mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Add bin/org-capture script
This commit is contained in:
28
bin/org-capture
Executable file
28
bin/org-capture
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Open an org-capture popup frame from the shell. This opens a temporary emacs
|
||||||
|
# daemon if emacs isn't already running.
|
||||||
|
#
|
||||||
|
# Usage: org-capture [key] [message...]
|
||||||
|
# Examples:
|
||||||
|
# org-capture n "To the mind that is still, the whole universe surrenders."
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
key="${1:-n}"
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
emacsclient --eval '(kill-emacs)'
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! pgrep emacs >/dev/null; then
|
||||||
|
emacs --daemon
|
||||||
|
trap cleanup EXIT INT TERM
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO Allow piping from stdin
|
||||||
|
|
||||||
|
emacsclient -c \
|
||||||
|
-F '((name . "org-capture") (width . 70) (height . 25))' \
|
||||||
|
--eval "(+org-capture \"$key\" \"$2\")"
|
||||||
|
|
@ -1,3 +1,11 @@
|
|||||||
;;; lang/org/autoload/capture.el
|
;;; lang/org/autoload/capture.el
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +org-capture (&optional key string)
|
||||||
|
"Initializes the current frame as a pop-up `org-capture' frame."
|
||||||
|
(interactive)
|
||||||
|
(let ((key (or key "n"))
|
||||||
|
(string (unless (string-empty-p string) string)))
|
||||||
|
(if string
|
||||||
|
(org-capture-string string key)
|
||||||
|
(org-capture nil key))))
|
||||||
|
Reference in New Issue
Block a user