esv.el: improve documentation

This commit is contained in:
Jeremy Baxter 2024-07-18 20:06:51 +12:00
parent 892af96051
commit 7bd2e3db37

9
esv.el
View file

@ -64,20 +64,19 @@
(defun esv (book verses) (defun esv (book verses)
"Fetch the Bible passage identified by BOOK and VERSES. "Fetch the Bible passage identified by BOOK and VERSES.
The result will be redirected to a buffer specified by `esv-buffer'." The result will be redirected to a buffer specified by `esv-buffer'.
Requires the esv command line tool to be in the system's PATH.
esv can be acquired at <https://sr.ht/~jeremy/esv>."
(interactive "MBook: \nMVerses: ") (interactive "MBook: \nMVerses: ")
(let ((buffer (concat book " " verses))) (let ((buffer (concat book " " verses)))
(catch 'buffer-exists (catch 'buffer-exists
(when (get-buffer buffer) (when (get-buffer buffer)
(message "Buffer `%s' already exists" buffer) (message "Buffer `%s' already exists" buffer)
(throw 'buffer-exists nil)) (throw 'buffer-exists nil))
;; execute esv
(call-process esv-program nil buffer t (call-process esv-program nil buffer t
;; arguments
(format "-l%d" esv-columns) book verses) (format "-l%d" esv-columns) book verses)
;; display buffer in another window
(display-buffer buffer) (display-buffer buffer)
;; move point to the beginning of the buffer
(with-current-buffer buffer (with-current-buffer buffer
(esv-mode) (esv-mode)
(goto-char (point-min))) (goto-char (point-min)))