From: Mark Wooding Date: Sun, 20 Mar 2016 19:42:15 +0000 (+0000) Subject: el/dot-emacs.el: Trim leading spaces from diary entry strings. X-Git-Url: https://git.distorted.org.uk/~mdw/profile/commitdiff_plain/9f58a8d25ff4410032f840c6a50d276a7d2b7836 el/dot-emacs.el: Trim leading spaces from diary entry strings. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 91283d9..e50d773 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -333,6 +333,14 @@ as output rather than a string." (nth 2 when)))))))) (eq w d))) +(defadvice diary-add-to-list (before mdw-trim-leading-space activate) + "Trim leading space from the diary entry string." + (save-match-data + (let ((str (ad-get-arg 1))) + (if (and str (string-match "^[ \t]+" str)) + (let ((new (replace-match "" nil nil str))) + (ad-set-arg 1 new)))))) + ;; Fighting with Org-mode's evil key maps. (defvar mdw-evil-keymap-keys