bin/org-capture: refactor & use -k switch

This commit is contained in:
Henrik Lissner 2019-03-29 23:49:47 -04:00
parent 99aefd6e02
commit 36919fedda
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -3,9 +3,9 @@
# Open an org-capture popup frame from the shell. This opens a temporary emacs # Open an org-capture popup frame from the shell. This opens a temporary emacs
# daemon if emacs isn't already running. # daemon if emacs isn't already running.
# #
# Usage: org-capture [key] [message...] # Usage: org-capture [-k KEY] [MESSAGE]
# Examples: # Examples:
# org-capture n "To the mind that is still, the whole universe surrenders." # org-capture -k n "To the mind that is still, the whole universe surrenders."
set -e set -e
@ -21,8 +21,8 @@ if ! emacsclient -e nil; then
fi fi
# org-capture key mapped to argument flags # org-capture key mapped to argument flags
keys=$(emacsclient -e "(+org-capture-available-keys)" | cut -d '"' -f2) # keys=$(emacsclient -e "(+org-capture-available-keys)" | cut -d '"' -f2)
while getopts $keys opt; do while getopts hk opt; do
key="\"$opt\"" key="\"$opt\""
break break
done done
@ -33,7 +33,7 @@ shift $((OPTIND-1))
if [[ $daemon ]]; then if [[ $daemon ]]; then
emacsclient -a "" \ emacsclient -a "" \
-c -F '((name . "org-capture") (width . 70) (height . 25) (transient . t))' \ -c -F '((name . "org-capture") (width . 70) (height . 25) (transient . t))' \
-e "(+org-capture/open-frame \"$str\" ${key:-nil} t)" -e "(+org-capture/open-frame \"$str\" ${key:-nil})"
else else
# Non-daemon servers flicker a lot if frames are created from terminal, so we # Non-daemon servers flicker a lot if frames are created from terminal, so we
# do it internally instead. # do it internally instead.