diff options
-rw-r--r-- | .emacs.d/init.el | 8 | ||||
-rwxr-xr-x | archive/bin/save-org-buffers (renamed from bin/save-org-buffers) | 0 | ||||
-rwxr-xr-x | bin/doccheckin | 9 |
3 files changed, 12 insertions, 5 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 39dfb6e1..de498199 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -3165,6 +3165,14 @@ before uploading to NEW again." \n \n "/\n"))) (insert "* References")) +(defun spw/save-my-doc-buffers () + "Save all buffers visiting files under ~/doc/. +Called by doccheckin script." + (let ((root (expand-file-name "~/doc/"))) + (dolist (buffer (buffer-list)) + (when (string-prefix-p root (buffer-file-name buffer)) + (with-current-buffer buffer (basic-save-buffer)))))) + ;;;; Diary diff --git a/bin/save-org-buffers b/archive/bin/save-org-buffers index d0dabfef..d0dabfef 100755 --- a/bin/save-org-buffers +++ b/archive/bin/save-org-buffers diff --git a/bin/doccheckin b/bin/doccheckin index c3ec710f..291520e7 100755 --- a/bin/doccheckin +++ b/bin/doccheckin @@ -1,13 +1,12 @@ #!/bin/sh set -e - -# TODO should also save *.md files in ~/doc .. maybe just save all -# files under ~/doc? -save-org-buffers - cd ~/doc/ +# If emacs is running, try to save all ~/doc/ buffers. +[ -n "$LOGNAME" ] && pgrep -u "$LOGNAME" emacs >/dev/null \ + && emacsclient -e '(spw/save-my-doc-buffers)' + # don't do anything if waiting on a manual merge; don't want just # blanket commit that merge [ -z "$(git ls-files --unmerged)" ] || exit 0 |