From c54083d67713066b187430990ff8376db55f9e02 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 3 Aug 2022 13:27:39 -0700 Subject: add initial Howm setup, archive Org-roam config to git history --- .emacs.d/init.el | 98 +++++++++++++++++---------------- .mrconfig.in | 6 +- archive/bin/capture-mail | 4 +- archive/bin/reading.py | 2 +- archive/bin/sysmaint | 2 +- bin/doccheckin | 3 +- bin/locmaint | 2 +- scripts/web/goodreads_library_export.pl | 3 +- 8 files changed, 63 insertions(+), 57 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 / 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' @@ -4325,6 +4291,46 @@ We don't use the FILES parameter in the entry for \"d\" in (defvar spw/export-diary-web-view-timer (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 diff --git a/.mrconfig.in b/.mrconfig.in index 608ce2ee..c7f5e899 100644 --- a/.mrconfig.in +++ b/.mrconfig.in @@ -770,9 +770,9 @@ checkout = git clone demeterp:doc doc update = git pull --no-edit "$@" skip = ! mine -# set file modification times to last commit for deft.el -# (commented out because no longer using deft) -#fixups = git-utime +# Set mtimes to last commit, for Howm; doing so only in post_checkout, and not +# fixups, should be sufficient for summary buffer ordering purposes. +post_checkout = git utime # before pulling, automatically commit in the same way that my cron job does pre_update = win32 || doccheckin diff --git a/archive/bin/capture-mail b/archive/bin/capture-mail index a34b894e..6347d172 100755 --- a/archive/bin/capture-mail +++ b/archive/bin/capture-mail @@ -8,6 +8,6 @@ subject=$(echo $msg | grep -m 1 -i "^Subject:" | sed "s/^Subject: //") save-org-buffers -echo "* TODO E-mail \"$subject\" from $from" >>$HOME/doc/org/refile.org -echo "# Message-Id: $id" >>$HOME/doc/org/refile.org +echo "* TODO E-mail \"$subject\" from $from" >>$HOME/doc/howm/refile.org +echo "# Message-Id: $id" >>$HOME/doc/howm/refile.org #emacsclient -t -e '(spw/end-of-refile)' diff --git a/archive/bin/reading.py b/archive/bin/reading.py index c4fc6361..01830fd8 100755 --- a/archive/bin/reading.py +++ b/archive/bin/reading.py @@ -14,7 +14,7 @@ import tempfile import shutil READINGDIR = "/home/swhitton/local/reading" -READINGORG = "/home/swhitton/doc/org/reading.org" +READINGORG = "/home/swhitton/doc/howm/2014/reading.org" def main(): """Run the script""" diff --git a/archive/bin/sysmaint b/archive/bin/sysmaint index 936c4c86..5cd85827 100755 --- a/archive/bin/sysmaint +++ b/archive/bin/sysmaint @@ -247,7 +247,7 @@ if ( defined $loc ) { # I used to use github-backup for this but the GitHub API rate # limiting seemed to mean that it was never able to complete the # backup, even after logging in with OAUTH. See old propellor - # config for that in ~/doc/org/old_propellor_config.org + # config for that in ~/doc/howm/2017/old_propellor_config.org if ( eval "use Net::GitHub; 1" ) { my $gh = Net::GitHub->new(version => 3); diff --git a/bin/doccheckin b/bin/doccheckin index a2fcd2f3..29046f8b 100755 --- a/bin/doccheckin +++ b/bin/doccheckin @@ -15,13 +15,12 @@ cd ~/doc/ [ -z "$(git ls-files --unmerged)" ] || exit 0 # this command should never fail and stop mr -git add org/*.org \ +git add howm/*.org howm/*/*.org \ papers/*.org papers/*.md papers/*.bib \ newpapers/*/*.org \ dissert/*.md pres/*.md letters/*.tex \ emacs-abbrevs emacs-bookmarks News/* \ emacs-diary archive/emacs-diary-* \ - notes/days/*.org notes/*.org \ || true # this command should never fail and stop mr diff --git a/bin/locmaint b/bin/locmaint index 668440a8..f551e9a1 100755 --- a/bin/locmaint +++ b/bin/locmaint @@ -350,7 +350,7 @@ sub do_coldbkup { # I used to use github-backup for this but the GitHub API rate # limiting seemed to mean that it was never able to complete the # backup, even after logging in with OAUTH. See old propellor - # config for that in ~/doc/org/old_propellor_config.org + # config for that in ~/doc/howm/2017/old_propellor_config.org my $gh = Net::GitHub->new(version => 3); my $starred = $gh->query('/users/spwhitton/starred'); foreach my $repo (@$starred) { diff --git a/scripts/web/goodreads_library_export.pl b/scripts/web/goodreads_library_export.pl index fd1a4f5a..dab510e4 100755 --- a/scripts/web/goodreads_library_export.pl +++ b/scripts/web/goodreads_library_export.pl @@ -4,7 +4,8 @@ use warnings; use Text::CSV_XS qw(csv); -open my $fh, ">:encoding(utf8)", "$ENV{HOME}/doc/org/goodreads_library_export.org"; +open my $fh, + ">:encoding(utf8)", "$ENV{HOME}/doc/howm/2019/goodreads_library_export.org"; my $grle = csv( in => "$ENV{HOME}/tmp/goodreads_library_export.csv", headers => 'auto', -- cgit v1.2.3