parent
e1cf13c8d7
commit
9bd36f056f
2 changed files with 1 additions and 54 deletions
|
@ -5,6 +5,6 @@ end_of_line = lf
|
|||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.{el,nix,yml}]
|
||||
[*.{nix,yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
53
esv.el
53
esv.el
|
@ -1,53 +0,0 @@
|
|||
;;; esv.el --- read the Bible from Emacs -*- lexical-binding:t -*-
|
||||
|
||||
(defgroup esv nil
|
||||
"Read the Bible."
|
||||
:prefix "esv-"
|
||||
:group 'applications)
|
||||
|
||||
(defcustom esv-columns 72
|
||||
"Length of each line output by `esv'."
|
||||
:type 'natnum
|
||||
:group 'esv)
|
||||
(defcustom esv-mode-hook nil
|
||||
"Hook run after entering `esv-mode'."
|
||||
:type 'hook
|
||||
:group 'esv)
|
||||
(defcustom esv-process "esv"
|
||||
"Name of the process created by `esv'."
|
||||
:type 'string
|
||||
:group 'esv)
|
||||
(defcustom esv-program "esv"
|
||||
"Path to or name of the program started by `esv'."
|
||||
:type 'string
|
||||
:group 'esv)
|
||||
|
||||
(define-derived-mode esv-mode text-mode "ESV-Bible"
|
||||
"Major mode used for reading the Bible with `esv'."
|
||||
:group 'esv
|
||||
|
||||
(read-only-mode))
|
||||
|
||||
(defun esv (book verses)
|
||||
"Fetch the Bible passage identified by BOOK and VERSES.
|
||||
The result will be redirected to a buffer specified by `esv-buffer'."
|
||||
(interactive "MBook: \nMVerses: ")
|
||||
(let ((buffer (concat book " " verses)))
|
||||
(catch 'buffer-exists
|
||||
(when (get-buffer buffer)
|
||||
(message "Buffer `%s' already exists" buffer)
|
||||
(throw 'buffer-exists nil))
|
||||
;; execute esv
|
||||
(call-process esv-program nil buffer t
|
||||
;; arguments
|
||||
(format "-l%d" esv-columns) book verses)
|
||||
;; display buffer in another window
|
||||
(display-buffer buffer)
|
||||
;; move point to the beginning of the buffer
|
||||
(with-current-buffer buffer
|
||||
(esv-mode)
|
||||
(goto-char (point-min)))
|
||||
(set-window-start (get-buffer-window buffer) (point-min))
|
||||
t)))
|
||||
|
||||
(provide 'esv)
|
Loading…
Add table
Add a link
Reference in a new issue