From 2a6a8772399a3c41606d06fc6837d269f1734762 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 19 Feb 2020 09:34:21 -0500 Subject: [PATCH] Set up org-journal --- emacs/init.org | 124 +++++++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 55 deletions(-) diff --git a/emacs/init.org b/emacs/init.org index 9ab4f14..a5972e5 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -1480,9 +1480,6 @@ A function to add ids to every heading in an Org file: ("n" "Note" entry (file ,(agenda-files "notes.org")) "* %^{Description}\n%i%?") - ("j" "Journal entry" entry - (file ,(agenda-files "journal.org")) - "* %<%Y-%m-%d %H:%M:%S>%?") ("B" "Brain" plain (function org-brain-goto-end) "* %i%?" :empty-lines 1) ("l" "Log" entry @@ -2049,63 +2046,80 @@ Quickly find stuff in Org files: ("C-c n" org-roam-map)) #+END_SRC +* org-journal +[[https://github.com/bastibe/org-journal][org-journal]] is a package that provides some convenience functions +around keeping a daily Org-mode journal. I also set it up so it plays +nice with Org-roam: +#+BEGIN_SRC emacs-lisp + (use-package org-journal + :defer t + :init + (defun org-journal-file-header-func () + (let () + (format "#+TITLE: %s" + (format-time-string "%Y-%m-%d")))) + (defun org-journal-today () + (interactive) + (org-journal-new-entry t)) + (defun org-journal-capture-func () + (org-journal-new-entry t) + (goto-char (point-min)) + ;; Account for the #+TITLE + (forward-line)) + (add-to-list 'org-capture-templates + '("j" "Journal entry" entry (function org-journal-capture-func) + "* %(format-time-string org-journal-time-format)\n%?")) + (jdormit/define-prefix "oj" "org-journal") + (leader-def-key "ojn" #'org-journal-new-entry) + (leader-def-key "ojt" #'org-journal-today) + :custom + (org-journal-file-type 'daily) + (org-journal-dir (concat (get-dropbox-directory) "/org")) + (org-journal-file-format "%Y-%m-%d.org") + (org-journal-file-header 'org-journal-file-header-func) + (org-journal-carryover-items "") + :general + (org-roam-map "t" 'org-journal-today)) +#+END_SRC + * Projectile #+BEGIN_SRC emacs-lisp - (use-package projectile - :commands (projectile-find-file - projectile-grep - projectile-switch-project - projectile-project-root) - :init - (defhydra hydra-projectile (:color teal - :hint nil) - " - PROJECTILE: %(projectile-project-root) + (use-package projectile :commands (projectile-find-file + projectile-grep projectile-switch-project projectile-project-root) + :init (defhydra hydra-projectile (:color teal :hint nil) " + PROJECTILE: %(projectile-project-root) - Find File Search/Tags Buffers Cache + Find File Search/Tags Buffers Cache ------------------------------------------------------------------------------------------ - _s-f_: file _a_: ag _i_: Ibuffer _c_: cache clear - _ff_: file dwim _g_: update gtags _b_: switch to buffer _x_: remove known project - _fd_: file curr dir _o_: multi-occur _s-k_: Kill all buffers _X_: cleanup non-existing - _r_: recent file ^^^^_z_: cache current - _d_: dir + _s-f_: file _a_: ag _i_: Ibuffer _c_: cache clear _ff_: file dwim + _g_: update gtags _b_: switch to buffer _x_: remove known project + _fd_: file curr dir _o_: multi-occur _s-k_: Kill all buffers _X_: + cleanup non-existing _r_: recent file ^^^^_z_: cache current _d_: + dir - " - ("a" projectile-ag) - ("b" projectile-switch-to-buffer) - ("c" projectile-invalidate-cache) - ("d" projectile-find-dir) - ("s-f" projectile-find-file) - ("ff" projectile-find-file-dwim) - ("fd" projectile-find-file-in-directory) - ("g" ggtags-update-tags) - ("s-g" ggtags-update-tags) - ("i" projectile-ibuffer) - ("K" projectile-kill-buffers) - ("s-k" projectile-kill-buffers) - ("m" projectile-multi-occur) - ("o" projectile-multi-occur) - ("s-p" projectile-switch-project "switch project") - ("p" projectile-switch-project) - ("s" projectile-switch-project) - ("r" projectile-recentf) - ("x" projectile-remove-known-project) - ("X" projectile-cleanup-known-projects) - ("z" projectile-cache-current-file) - ("`" hydra-projectile-other-window/body "other window") - ("q" nil "cancel" :color blue)) - :config - (projectile-mode) - (jdormit/define-prefix "p" "projectile") - (leader-def-key "pf" #'projectile-find-file) - (leader-def-key "pg" #'projectile-grep) - (leader-def-key "pp" #'projectile-switch-project) - (leader-def-key "pc" #'projectile-compile-project) - (leader-def-key "ph" #'hydra-projectile/body) - (leader-def-key "ps" #'projectile-run-shell-command-in-root) - (leader-def-key "pa" #'projectile-run-async-shell-command-in-root) - (leader-def-key "p M-x" #'projectile-run-command-in-root)) -#+END_SRC + " ("a" projectile-ag) ("b" projectile-switch-to-buffer) ("c" + projectile-invalidate-cache) ("d" projectile-find-dir) ("s-f" + projectile-find-file) ("ff" projectile-find-file-dwim) ("fd" + projectile-find-file-in-directory) ("g" ggtags-update-tags) + ("s-g" ggtags-update-tags) ("i" projectile-ibuffer) ("K" + projectile-kill-buffers) ("s-k" projectile-kill-buffers) ("m" + projectile-multi-occur) ("o" projectile-multi-occur) ("s-p" + projectile-switch-project "switch project") ("p" + projectile-switch-project) ("s" projectile-switch-project) ("r" + projectile-recentf) ("x" projectile-remove-known-project) ("X" + projectile-cleanup-known-projects) ("z" + projectile-cache-current-file) ("`" + hydra-projectile-other-window/body "other window") ("q" nil + "cancel" :color blue)) :config (projectile-mode) + (jdormit/define-prefix "p" "projectile") (leader-def-key "pf" + #'projectile-find-file) (leader-def-key "pg" #'projectile-grep) + (leader-def-key "pp" #'projectile-switch-project) + (leader-def-key "pc" #'projectile-compile-project) + (leader-def-key "ph" #'hydra-projectile/body) (leader-def-key + "ps" #'projectile-run-shell-command-in-root) (leader-def-key + "pa" #'projectile-run-async-shell-command-in-root) + (leader-def-key "p M-x" #'projectile-run-command-in-root)) + #+END_SRC * Mode line * UI