summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-08-04 12:45:14 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-08-05 11:38:04 -0700
commit8848adb7cfb08b939f1dda56a7d7a4c82e40d9ba (patch)
tree6f3e27dc47e06ea3cae2e20785aa6262c78c9e71
parent5594a8c95f50b1af70698f3539fa41dea45d66df (diff)
downloaddotfiles-8848adb7cfb08b939f1dda56a7d7a4c82e40d9ba.tar.gz
incrementally replace #+TITLE: with #+title: in old notes
-rw-r--r--.emacs.d/init.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index cff1a4d1..c0a24fad 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -4348,6 +4348,19 @@ We don't use the FILES parameter in the entry for \"d\" in
(spw/feature-add-hook howm-mode-set-buffer-name
howm (howm after-save-hook))
+;; Incrementally replace #+TITLE in old notes.
+(defun spw/howm-replace-title-option ()
+ (when howm-mode
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (let (case-fold-search)
+ (when (re-search-forward "^#\\+TITLE: " nil t)
+ (replace-match "#+title: " t)))))))
+(spw/when-library-available howm
+ (add-hook 'before-save-hook #'spw/howm-replace-title-option))
+
(defun spw/howm-directory-howm-mode ()
(when-let ((file (buffer-file-name)))
(when (file-in-directory-p file howm-directory)