diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-03-09 10:51:03 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-03-10 18:33:29 -0700 |
commit | c9f78d0182e0f17e6e6691966dbe0e52b3e919fb (patch) | |
tree | 0ee578e31e0eff354a507a99e06ae9df1c53e358 /archive | |
parent | 3e867509a40430b4991cabab65d4496dcd1540bb (diff) | |
download | dotfiles-c9f78d0182e0f17e6e6691966dbe0e52b3e919fb.tar.gz |
doccheckin: save all files under ~/doc/ rather than all Org buffers
Also check that LOGNAME is actually set, to avoid nonsensical calls to pgrep.
Diffstat (limited to 'archive')
-rwxr-xr-x | archive/bin/save-org-buffers | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/archive/bin/save-org-buffers b/archive/bin/save-org-buffers new file mode 100755 index 00000000..d0dabfef --- /dev/null +++ b/archive/bin/save-org-buffers @@ -0,0 +1,17 @@ +#!/bin/sh + +. $HOME/.shenv + +# If emacs is running, try to save all Org-mode buffers + +if pgrep -u "$LOGNAME" emacs >/dev/null; then + output="$(emacsclient -e '(org-save-all-org-buffers)' 2>/dev/null)" + # TODO wait for 5 seconds for above; if doesn't finish, tell user + # that it might mean that Emacs is waiting on a y/n prompt + # TODO check output for failure if Org not yet loaded; if so, exit + # zero + if [ $? != 0 ]; then + echo "failed to save all Org buffers" + exit 1 + fi +fi |