diff --git a/.gitignore b/.gitignore index a22e7c2..1785087 100644 --- a/.gitignore +++ b/.gitignore @@ -12,9 +12,10 @@ nohup.out network-security.data nov-places org-persist/* +persist/* places *recentf request/* tramp transient/* -url/* \ No newline at end of file +url/* diff --git a/custom/capture.el b/custom/capture.el new file mode 100644 index 0000000..8f7999c --- /dev/null +++ b/custom/capture.el @@ -0,0 +1,92 @@ +(unless (string-equal system-type "android") + (unless (string-equal user-login-name "3055822") + + (require 'org-capture) + + (defun findread () + "Find or create heading for read books" + (goto-char (point-min)) + (if (not (search-forward "** read" nil t)) + (if (not (search-forward "* books" nil t)) + (progn + (goto-char (point-max)) + (insert "* books\n** read")) + (insert "\n** read")))) + + (defun findacquired () + "Find or create heading for acquired books" + (goto-char (point-min)) + (if (not (search-forward "** acquired" nil t)) + (if (not (search-forward "* books" nil t)) + (progn + (goto-char (point-max)) + (insert "* books\n** acquired")) + (insert "\n** acquired")))) + + (defun findwatched () + "Find or create heading for watched films" + (goto-char (point-min)) + (if (not (search-forward "** watched" nil t)) + (if (not (search-forward "* films" nil t)) + (progn + (goto-char (point-max)) + (insert "* films\n** watched")) + (insert "\n** watched")))) + + (defun findvisited () + "Find or create heading for visited places" + (goto-char (point-min)) + (if (not (search-forward "** visited" nil t)) + (if (not (search-forward "* places" nil t)) + (progn + (goto-char (point-max)) + (insert "* places\n** visited")) + (insert "\n** visited")))) + + (defun therating () + "Rate some media" + (setq therating nil) + (setq ratingreturn "") + (setq therating (completing-read "Rating: " '("1" "2" "3" "4" "5"))) + (when (equal therating "1") + (setq ratingreturn " and rated ★")) + (when (equal therating "2") + (setq ratingreturn " and rated ★★")) + (when (equal therating "3") + (setq ratingreturn " and rated ★★★")) + (when (equal therating "4") + (setq ratingreturn " and rated ★★★★")) + (when (equal therating "5") + (setq ratingreturn " and rated ★★★★★")) + ratingreturn) + + (defun thevisitdate () + "Add dates for a visit" + (setq visitreturn "") + (setq visitstart (read-string "Start date (YYYY-MM-DD): " )) + (unless (equal visitstart "") + (setq visitend (read-string "End date (YYYY-MM-DD): " )) + (setq visitreturn (concat " <" visitstart ">--<" visitend ">"))) + visitreturn) + + (setq org-default-notes-file (concat "~/Documents/drive/org/journal/" (format-time-string "%Y/%m/%Y-%m-%d") ".org")) + + (setq org-capture-templates + '(("a" "Acquired book" entry + (file+function "" findacquired) + "* %^{Author} /%^{Title}/" + :jump-to-captured t) + ("b" "Read book" entry + (file+function "" findread) + "* %^{Author} /%^{Title}/%(therating)" + :jump-to-captured t) + ("f" "Watched film" entry + (file+function "" findwatched) + "* %^{Title} (%^{Year})%(therating)" + :jump-to-captured t) + ("p" "Visited place" entry + (file+function "" findvisited) + "* %^{Place}%(thevisitdate)" + :jump-to-captured t))) + + (global-set-key (kbd "C-c c") #'org-capture))) diff --git a/custom/refile.el b/custom/refile.el index e7aad3e..7ff0267 100644 --- a/custom/refile.el +++ b/custom/refile.el @@ -1,5 +1,5 @@ (defun filejournal () - "Refile heading to specific file based on heading" + "Refile heading to specific file based on heading (journal edition)" (interactive) (setq orgheading (org-get-heading)) (setq orgyear (substring orgheading 0 4)) @@ -9,6 +9,17 @@ (let ((org-refile-targets '((orgfilepath :maxlevel . 1)))) (org-refile))) +(defun filediscord () + "Refile heading to specific file based on heading (discord edition)" + (interactive) + (setq orgheading (org-get-heading)) + (setq orgyear (substring orgheading 0 4)) + (setq orgmonth (substring orgheading 5 7)) + (setq orgfilepath (concat "~/Documents/drive/org/journal/" orgyear "/" orgmonth "/" orgheading ".org")) + (org-edit-headline "discord") + (let ((org-refile-targets '((orgfilepath :maxlevel . 1)))) + (org-refile))) + (defun filedate () "Insert timestamp if required based on file name" (interactive)