|
|
@@ -255,8 +255,7 @@ See `bible--display-lemma-hebrew'."
|
|
|
(buffer-disable-undo)
|
|
|
(font-lock-mode t)
|
|
|
(use-local-map bible-map)
|
|
|
- (setq-local mode-line-format bible-mode-line-format
|
|
|
- bible-buffer-type 'text)
|
|
|
+ (setq-local mode-line-format bible-mode-line-format)
|
|
|
(setq buffer-read-only t)
|
|
|
(visual-line-mode t))
|
|
|
|
|
|
@@ -792,9 +791,9 @@ specifies the module to use."
|
|
|
(interactive)
|
|
|
(with-current-buffer (or buffer (get-buffer-create "*bible*"))
|
|
|
(bible)
|
|
|
- (when module (setq-default bible-text module))
|
|
|
- (setq-local bible-text (default-value 'bible-text))
|
|
|
- (setq-local mode-name (concat "Text " bible-text))
|
|
|
+ (when module (setq-local bible-text module))
|
|
|
+ (setq-local bible-buffer-type 'text
|
|
|
+ mode-name (concat "Text " bible-text))
|
|
|
(bible--set-location
|
|
|
(assoc (or book-name "Genesis") bible--books)
|
|
|
(or chapter 1)
|
|
|
@@ -813,12 +812,11 @@ arguments are supplied, Genesis 1:1 is used."
|
|
|
(unless old-buffer (error "No current buffer! How did this happen!"))
|
|
|
(with-current-buffer (or buffer (get-buffer-create "*comm*"))
|
|
|
(bible)
|
|
|
- (setq-local bible-buffer-type 'commentary)
|
|
|
(when module (setq-default bible-commentary module))
|
|
|
- ;; Should we open a new text buffer here?
|
|
|
- (setq-local bible-associated-buffer (cl-first bible--text-buffers))
|
|
|
- (setq-local bible-text (default-value 'bible-commentary))
|
|
|
- (setq-local mode-name (concat "Commentary " bible-text))
|
|
|
+ (setq-local bible-buffer-type 'commentary
|
|
|
+ bible-associated-buffer (cl-first bible--text-buffers)
|
|
|
+ bible-text (default-value 'bible-commentary)
|
|
|
+ mode-name (concat "Commentary " bible-text))
|
|
|
(bible--set-location
|
|
|
(assoc (or book-name "Genesis") bible--books)
|
|
|
(or chapter 1)
|
|
|
@@ -904,93 +902,72 @@ for any synchronized buffers."
|
|
|
(when chapter
|
|
|
(bible--set-location bible--current-book chapter))))
|
|
|
|
|
|
-;;;;;; Select modules
|
|
|
-
|
|
|
-;; REVIEW: Need to re-visit which of the following is called in which
|
|
|
-;; mode. `bible-select-<xxxx>' should be called in <xxxx> mode
|
|
|
-;; (i.e. text or commentary). It should be used for replacing
|
|
|
-;; the current text/commentary and should not create a new
|
|
|
-;; buffer. `bible-select-<xxxx>' uses the interface for
|
|
|
-;; choosing texts or commentaries and should be available in
|
|
|
-;; either mode. It will create a new buffer with the chosen
|
|
|
-;; module in it. Commentaries have an `associated buffer'
|
|
|
-;; against which its cross-references work and so I guess
|
|
|
-;; there will have to be an identified current bible text
|
|
|
-;; buffer to set this association. (FMG 31-Mar-2026)
|
|
|
-
|
|
|
-;; Choose a module.
|
|
|
-(defun bible-pick-text (&optional module buffer)
|
|
|
- "Keymap action function---select text that the user chooses.
|
|
|
-If optional argument MODULE is supplied, use that as the module;
|
|
|
-otherwise use module text property. Will open a new buffer unless
|
|
|
-optional argument BUFFER is given."
|
|
|
+;;;;;; Choose modules, either by keystroke or by choosing from a list.
|
|
|
+
|
|
|
+(defun bible-pick-text ()
|
|
|
+ "Select a text from a list. Re-use the buffer listing the texts. Called
|
|
|
+by the menu item `Select Text'."
|
|
|
(interactive)
|
|
|
- (let ((item (or module (get-text-property (point) 'module))))
|
|
|
- (bible-open
|
|
|
- (or buffer (generate-new-buffer "*bible*"))
|
|
|
- bible--current-book-name
|
|
|
- bible--current-chapter
|
|
|
- 1
|
|
|
- item)))
|
|
|
-
|
|
|
-(defun bible-pick-commentary (&optional module buffer)
|
|
|
- "Keymap action function---select commentary that the user chooses.
|
|
|
-If optional argument MODULE is supplied, use that as the module;
|
|
|
-otherwise use module text property. Will open a new buffer unless
|
|
|
-optional argument BUFFER is given."
|
|
|
+ (let ((item (get-text-property (point) 'module)))
|
|
|
+ (rename-buffer "*bible*" t)
|
|
|
+ (bible-open (current-buffer)
|
|
|
+ bible--current-book-name
|
|
|
+ bible--current-chapter
|
|
|
+ 1
|
|
|
+ item)))
|
|
|
+
|
|
|
+(defun bible-pick-commentary ()
|
|
|
+ "Select a commentary from a list. Re-use the buffer listing the commentaries.
|
|
|
+Called by the menu item `Select Commentary'."
|
|
|
(interactive)
|
|
|
- (when (eq bible-buffer-type 'text)
|
|
|
- (split-window-right)
|
|
|
- (balance-windows)
|
|
|
- (other-window 1))
|
|
|
- (with-current-buffer (or buffer (current-buffer))
|
|
|
+ (let ((item (get-text-property (point) 'module)))
|
|
|
(rename-buffer "*comm*" t)
|
|
|
- (let ((item (or module (get-text-property (point) 'module))))
|
|
|
- (setq-local bible-commentary item)
|
|
|
- (setq-local bible-buffer-type 'commentary)
|
|
|
- (commentary-open
|
|
|
- (or buffer (current-buffer))
|
|
|
- bible--current-book-name
|
|
|
- bible--current-chapter
|
|
|
- 1
|
|
|
- item))))
|
|
|
-
|
|
|
-(defun bible-select-text ()
|
|
|
- "Ask user for a new text module for the current `bible' buffer.
|
|
|
-Replaces current text in buffer."
|
|
|
- (interactive)
|
|
|
- (let ((text (completing-read "Text: " bible--texts)))
|
|
|
- (unless (string= text "")
|
|
|
- (setq-default bible-text text)
|
|
|
+ (commentary-open (current-buffer)
|
|
|
+ bible--current-book-name
|
|
|
+ bible--current-chapter
|
|
|
+ 1
|
|
|
+ item)))
|
|
|
+
|
|
|
+(defun bible--new-window (name)
|
|
|
+ "Open a new window and generate a new buffer with NAME.
|
|
|
+Returns the new buffer."
|
|
|
+ (split-window-right)
|
|
|
+ (balance-windows)
|
|
|
+ (other-window 1)
|
|
|
+ (generate-new-buffer name))
|
|
|
+
|
|
|
+(defun bible-select-text (text)
|
|
|
+ "Prompt for a new text module for the current `bible' buffer.
|
|
|
+Replace current text in buffer. With prefix argument or if called from a
|
|
|
+commentary window, use new buffer and new window."
|
|
|
+ (interactive (list (completing-read "Text: " bible--texts)))
|
|
|
+ (unless (string= text "")
|
|
|
+ (with-current-buffer (if (or current-prefix-arg (eq bible-buffer-type 'commentary))
|
|
|
+ (bible--new-window "*bible*")
|
|
|
+ (current-buffer))
|
|
|
(setq-local bible-text text)
|
|
|
- (bible-pick-text
|
|
|
- bible-text
|
|
|
- (when (eq bible-buffer-type 'text)
|
|
|
- (current-buffer))))))
|
|
|
-
|
|
|
-;;;(defun bible-select-commentary ()
|
|
|
-;;; "Ask user for a new commentary module for the current `bible' buffer."
|
|
|
-;;; (interactive)
|
|
|
-;;; (let ((commentary (completing-read "Commentary: " bible--commentaries)))
|
|
|
-;;; (unless (string= commentary "")
|
|
|
-;;; (setq-local bible-commentary commentary)
|
|
|
-;;; (bible-pick-commentary
|
|
|
-;;; bible-commentary
|
|
|
-;;; (if (eq bible-buffer-type 'commentary)
|
|
|
-;;; (current-buffer)
|
|
|
-;;; (generate-new-buffer "*comm*"))))))
|
|
|
-
|
|
|
-(defun bible-select-commentary ()
|
|
|
- "Ask user for a new commentary module for the current `bible' buffer."
|
|
|
- (interactive)
|
|
|
- (let ((commentary (completing-read "Commentary: " bible--commentaries)))
|
|
|
- (unless (string= commentary "")
|
|
|
+ (bible-open (current-buffer)
|
|
|
+ bible--current-book-name
|
|
|
+ bible--current-chapter
|
|
|
+ 1
|
|
|
+ text))))
|
|
|
+
|
|
|
+(defun bible-select-commentary (commentary)
|
|
|
+ "Promp for a new commentary module for the current `commentary' buffer.
|
|
|
+Replace current text in buffer. With prefix argument or if called from a
|
|
|
+text window, split window and put commentary in a new buffer in a new
|
|
|
+window."
|
|
|
+ (interactive (list (completing-read "Commentary: " bible--commentaries)))
|
|
|
+ (unless (string= commentary "")
|
|
|
+ (with-current-buffer (if (or current-prefix-arg (eq bible-buffer-type 'text))
|
|
|
+ (bible--new-window "*comm*")
|
|
|
+ (current-buffer))
|
|
|
(setq-local bible-commentary commentary)
|
|
|
- (bible-pick-commentary
|
|
|
- bible-commentary
|
|
|
- (if (eq bible-buffer-type 'commentary)
|
|
|
- (current-buffer)
|
|
|
- (generate-new-buffer "*comm*"))))))
|
|
|
+ (commentary-open (current-buffer)
|
|
|
+ bible--current-book-name
|
|
|
+ bible--current-chapter
|
|
|
+ 1
|
|
|
+ commentary))))
|
|
|
|
|
|
;;;;;; Toggles
|
|
|
|
|
|
@@ -1813,7 +1790,7 @@ If optional argument VERSE is supplied, set cursor at verse."
|
|
|
"Display available modules, allow user to select."
|
|
|
(interactive)
|
|
|
(bible--get-biblical-modules) ; Make sure lists are fresh.
|
|
|
- (with-current-buffer (get-buffer-create "Texts")
|
|
|
+ (with-current-buffer (get-buffer-create " Texts")
|
|
|
(bible-text-select-mode)
|
|
|
(let ((buffer-read-only nil))
|
|
|
(erase-buffer)
|
|
|
@@ -1836,7 +1813,7 @@ If optional argument VERSE is supplied, set cursor at verse."
|
|
|
"Display available modules, allow user to select."
|
|
|
(interactive)
|
|
|
(bible--get-biblical-modules) ; Make sure lists are fresh.
|
|
|
- (with-current-buffer (get-buffer-create "Commentaries")
|
|
|
+ (with-current-buffer (get-buffer-create " Commentaries")
|
|
|
(bible-text-select-mode)
|
|
|
(let ((buffer-read-only nil))
|
|
|
(erase-buffer)
|