diff options
Diffstat (limited to '.emacs.d/init.el')
-rw-r--r-- | .emacs.d/init.el | 98 |
1 files changed, 52 insertions, 46 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 964da5f2..b6456b21 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -252,6 +252,10 @@ windows side-by-side in the frame." '(holiday-bahai-holidays nil) '(holiday-hebrew-holidays nil) '(holiday-islamic-holidays nil) + '(howm-directory "~/doc/howm/") + '(howm-file-name-format "%Y/%Y-%m-%d-%H%M.org") + '(howm-keyword-file "~/doc/howm/.howm-keys") + '(howm-view-use-grep t) '(imenu-auto-rescan t) '(kill-read-only-ok t) '(magit-define-global-key-bindings nil) @@ -303,7 +307,7 @@ windows side-by-side in the frame." '(org-agenda-timegrid-use-ampm t) '(org-agenda-todo-ignore-scheduled 'future) '(org-agenda-window-setup 'current-window) - '(org-archive-location "~/doc/org/archive/archive.org::* From %s") + '(org-archive-location "~/doc/archive/howm/archive.org::* From %s") '(org-archive-save-context-info '(time file olpath)) '(org-archive-subtree-save-file-p t) '(org-blank-before-new-entry '((heading . t) (plain-list-item . auto))) @@ -311,8 +315,8 @@ windows side-by-side in the frame." '(org-catch-invisible-edits 'show) '(org-cycle-separator-lines 0) '(org-deadline-warning-days 60) - '(org-default-notes-file "~/doc/org/refile.org") - '(org-directory "~/doc/org/") + '(org-default-notes-file "~/doc/howm/refile.org") + '(org-directory "~/doc/howm/") '(org-enforce-todo-checkbox-dependencies t) '(org-enforce-todo-dependencies t) '(org-footnote-section "Notes") @@ -567,8 +571,8 @@ that's something we can determine.") ;; These use `pop-to-buffer-same-window', so obey `display-buffer-alist'. ;; -;; Unlike ~/doc/org/refile.org and ~/doc/notes/days/, *notes* does not require -;; ~/doc/ checked out. And we get one per machine, which can be convenient. +;; Unlike ~/doc/howm/refile.org and C-c c c, *notes* does not require ~/doc/ +;; checked out. And we get one per machine, which can be convenient. (global-set-key "\C-xg" #'remember-notes) (global-set-key "\C-xl" #'scratch-buffer) @@ -3349,44 +3353,6 @@ mutt's review view, after exiting EDITOR." (dolist (hook '(cperl-mode-hook c-mode-hook)) (add-hook hook #'ggtags-mode))) -(setq org-roam-v2-ack t) - -(spw/when-library-available org-roam - (dolist (fn '(org-roam-dailies-goto-next-note - org-roam-dailies-goto-previous-note)) - (autoload fn "org-roam-dailies")) - - (setq org-roam-directory (expand-file-name "~/doc/notes") - org-roam-dailies-directory "days/" - org-roam-capture-templates - '(("c" "concept" plain "%?" :if-new - (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n") - :unnarrowed t :immediate-finish t) - ("l" "literature" plain "- topics ::\n- source :: %?" :if-new - (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}\n") - :unnarrowed t))) - - (global-set-key "\C-cof" #'org-roam-node-find) - - ;; An alternative would be to bind C-c o <left>/<right> to - ;; org-roam-dailies-goto-yesterday and -tomorrow, but that would mean the - ;; keys have different meanings in and out of Org-mode buffers. - (transient-cycles-define-commands () - (([?\C-c ?o left] . org-roam-dailies-goto-previous-note) - ("\C-cod" . org-roam-dailies-goto-today) - ([?\C-c ?o right] . org-roam-dailies-goto-next-note)) - (lambda (_ignore) #'org-roam-dailies-goto-next-note)) - - ;; don't bother starting it up until we open something in Org-mode - (with-eval-after-load 'org - (when (and (file-directory-p org-roam-directory) - ;; Avoid messages when `eval-buffer' init.el. - (not org-roam-db-autosync-mode)) - (org-roam-db-autosync-enable)))) - -(spw/feature-define-keys ((org-roam org-mode-map)) - "\C-cir" org-roam-node-insert "\C-cor" org-roam-buffer-toggle) - (spw/when-library-available rainbow-mode (dolist (hook '(html-mode-hook css-mode-hook)) (add-hook hook 'rainbow-mode))) @@ -3767,10 +3733,10 @@ before uploading to NEW again." \n \n ;; than this "* TODO [[gnus:%:group#%:message-id][%^{Title|\"%(replace-regexp-in-string \"\\\\\\[\\\\\\|\\\\\\]\" \"\" \"%:subject\")\" from %:fromname}]]\n%?") - ;; ("a" "Appointment" entry (file+datetree "~/doc/org/diary.org") + ;; ("a" "Appointment" entry (file+datetree "~/doc/howm/diary.org") ;; "* %^{Time} %^{Title & location} ;; %^t" :immediate-finish t) - ;; ("A" "Appointment (untimed)" entry (file+datetree "~/doc/org/diary.org") + ;; ("A" "Appointment (untimed)" entry (file+datetree "~/doc/howm/diary.org") ;; "* %^{Title & location} ;; %^t" :immediate-finish t) @@ -4237,7 +4203,7 @@ different occasions." ;; Don't bind `diary' globally as for viewing purposes we use Org agenda ;; bindings, and for editing purposes just C-x b suffices. -(global-set-key "\C-cc" #'calendar) +(global-set-key "\C-cC" #'calendar) (when (file-readable-p "~/doc/emacs-diary") (require 'org-agenda) ; for `org-class' @@ -4326,6 +4292,46 @@ We don't use the FILES parameter in the entry for \"d\" in (run-at-time t 14400 #'spw/export-diary-web-view))) +;;;; Howm + +(setq howm-prefix "\C-cc" + + ;; Use Org-mode style because our notes are in `org-mode'. + howm-date-format "%Y-%m-%d %a" + howm-dtime-body-format "%Y-%m-%d %a %H:%M" + howm-dtime-format "[%Y-%m-%d %a %H:%M]" + howm-view-title-header "#+title:" + + howm-template + '(;; If it is to have a title, add it after writing some content. + "%date %file\n\n%cursor" + ;; Literature note -- write a title right away. + ;; + ;; We make the title a come-from link such that the literature note + ;; appears early in the list of results if we follow a goto link with + ;; the same title as the literature note. + "#+title: <<< %title%cursor\n%date %file\n\n")) + +;; Default sorting for certain views. +(defun spw/howm-list-all (&rest ignore) + (howm-view-sort-by-reverse-date)) +(advice-add 'howm-list-recent :after #'howm-view-sort-by-mtime) +(advice-add 'howm-list-all :after #'spw/howm-list-all) + +(spw/reclaim-keys-from howm-menu howm-menu-mode-map "\C-h") +(spw/reclaim-keys-from riffle riffle-summary-mode-map "\C-h") +(spw/reclaim-keys-from howm-view howm-view-contents-mode-map "\C-h") + +;; Alternatively we might rename the file and buffer based on the title, for +;; notes that have one. But not clear that achieves anything, and it +;; introduces complexity because we would probably want to transform titles. +(spw/feature-add-hook howm-mode-set-buffer-name + howm (howm after-save-hook)) + +;; Have the global bindings set up right away if we've Howm. +(when (file-directory-p "~/doc/howm/") (require 'howm nil t)) + + ;;;; C and friends ;; following setting also part of Linux kernel style, but it's from |