summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-03-09 10:51:03 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-03-10 18:33:29 -0700
commitc9f78d0182e0f17e6e6691966dbe0e52b3e919fb (patch)
tree0ee578e31e0eff354a507a99e06ae9df1c53e358 /bin
parent3e867509a40430b4991cabab65d4496dcd1540bb (diff)
downloaddotfiles-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 'bin')
-rwxr-xr-xbin/doccheckin9
-rwxr-xr-xbin/save-org-buffers17
2 files changed, 4 insertions, 22 deletions
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
diff --git a/bin/save-org-buffers b/bin/save-org-buffers
deleted file mode 100755
index d0dabfef..00000000
--- a/bin/save-org-buffers
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/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