|
|
@@ -481,6 +481,10 @@ See `bible--display-lemma-hebrew'."
|
|
|
(defvar bible--commentary-buffers nil
|
|
|
"List of commentary buffers.")
|
|
|
|
|
|
+(defvar-local associated-buffer nil
|
|
|
+ "Buffer associated with a given commentary buffer---used for
|
|
|
+chasing cross-references.")
|
|
|
+
|
|
|
(defvar bible--synced-buffers nil
|
|
|
"List of buffers that are synchronized so that navigation in one applies
|
|
|
to all of them.")
|
|
|
@@ -702,6 +706,10 @@ Mostly in Psalms, like `Of David' or the like.")
|
|
|
(defvar-local bible-search-range-this-query nil)
|
|
|
(defvar-local bible-search-matches 0)
|
|
|
|
|
|
+;;;;; Variables used in constructing cross-references.
|
|
|
+(defvar-local bible-current-xref-book nil)
|
|
|
+(defvar-local bible-current-xref-chapter nil)
|
|
|
+
|
|
|
|
|
|
;;;; Functions
|
|
|
|
|
|
@@ -756,7 +764,7 @@ starting verse reference for the buffer. If no optional location
|
|
|
arguments are supplied, Genesis 1:1 is used. Optional argument MODULE
|
|
|
specifies the module to use."
|
|
|
(interactive)
|
|
|
- (with-current-buffer (or buffer (get-buffer-create (generate-new-buffer-name "*bible*")))
|
|
|
+ (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))
|
|
|
@@ -768,8 +776,7 @@ specifies the module to use."
|
|
|
(cl-pushnew (current-buffer) bible--text-buffers)
|
|
|
(set-window-buffer (get-buffer-window (current-buffer)) (current-buffer))))
|
|
|
|
|
|
-(defvar-local associated-buffer nil)
|
|
|
-(defun commentary-open (&optional module book-name chapter verse)
|
|
|
+(defun commentary-open (&optional buffer book-name chapter verse module)
|
|
|
"Create and open a `commentary' buffer.
|
|
|
Optional argument MODULE specifies the commentary module to use.
|
|
|
Optional arguments BOOK-NAME, CHAPTER and VERSE, when supplied, give the
|
|
|
@@ -777,7 +784,7 @@ starting verse reference for the buffer. If no optional location
|
|
|
arguments are supplied, Genesis 1:1 is used."
|
|
|
(interactive)
|
|
|
(let ((old-buffer (current-buffer)))
|
|
|
- (with-current-buffer (get-buffer-create (generate-new-buffer-name "*commentary*"))
|
|
|
+ (with-current-buffer (or buffer (get-buffer-create "*commentary*"))
|
|
|
(bible)
|
|
|
(when module (setq-default bible-commentary module))
|
|
|
(setq-local associated-buffer old-buffer)
|
|
|
@@ -871,11 +878,11 @@ for any synchronized buffers."
|
|
|
;;;;;; Select modules
|
|
|
|
|
|
;; Choose a module.
|
|
|
-(defun bible-pick-text ()
|
|
|
+(defun bible-pick-text (&optional module)
|
|
|
"Keymap action function---select text that the user chooses."
|
|
|
(interactive)
|
|
|
- (let ((item (get-text-property (point) 'module)))
|
|
|
- (bible-open nil bible--current-book-name bible--current-chapter 1 item)))
|
|
|
+ (let ((item (or module (get-text-property (point) 'module))))
|
|
|
+ (bible-open (current-buffer) bible--current-book-name bible--current-chapter 1 item)))
|
|
|
|
|
|
(defun bible-pick-commentary (&optional module)
|
|
|
"Keymap action function---select commentary that the user chooses.
|
|
|
@@ -883,7 +890,7 @@ Use optional argument MODULE as commentary if given."
|
|
|
(interactive)
|
|
|
(let ((item (or module (get-text-property (point) 'module))))
|
|
|
(setq-local bible-commentary item)
|
|
|
- (commentary-open item bible--current-book-name bible--current-chapter 1)))
|
|
|
+ (commentary-open nil 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."
|
|
|
@@ -892,7 +899,7 @@ Use optional argument MODULE as commentary if given."
|
|
|
(unless (string= text "")
|
|
|
(setq-default bible-text text)
|
|
|
(setq-local bible-text text)
|
|
|
- (bible--display))))
|
|
|
+ (bible-pick-text bible-text))))
|
|
|
|
|
|
(defun bible-select-commentary ()
|
|
|
"Ask user for a new commentary module for the current `bible' buffer."
|
|
|
@@ -935,7 +942,7 @@ Use optional argument MODULE as commentary if given."
|
|
|
(split-window-right)
|
|
|
(balance-windows)
|
|
|
(other-window 1)
|
|
|
- (bible-open nil bible--current-book-name bible--current-chapter 1 bible-text))
|
|
|
+ (bible-open (generate-new-buffer "*bible*") bible--current-book-name bible--current-chapter 1 bible-text))
|
|
|
|
|
|
;;;;;; Search helpers
|
|
|
|
|
|
@@ -1420,8 +1427,6 @@ stored in `bible-chapter-title'."
|
|
|
(newline)
|
|
|
(delete-blank-lines)))))
|
|
|
|
|
|
-(defvar-local bible-current-xref-book nil)
|
|
|
-(defvar-local bible-current-xref-chapter nil)
|
|
|
(defun bible--insert-xref (node)
|
|
|
"Insert a cross reference specified by NODE.
|
|
|
This format is used by the NETnote module."
|
|
|
@@ -1438,13 +1443,24 @@ This format is used by the NETnote module."
|
|
|
;; <verse> (or maybe <verse>-<verse>)
|
|
|
;; Books may look like this: <1 Cor> or <Gal> so we have to deal with the possible space.
|
|
|
;; We ignore verse ranges and hope for the best (it seems to do the right thing).
|
|
|
- (let ((set-chapter-p nil))
|
|
|
+ (let ((chapter-set-p nil))
|
|
|
+ ;; See if we've got a book name. Use greedy regexp to make
|
|
|
+ ;; sure we get the whole name. If the name is not found,
|
|
|
+ ;; there will be a default (for this xref) name in
|
|
|
+ ;; bible-current-xref-book. (We hope. This depends on the module.)
|
|
|
(when (string-match ".* " b-ref)
|
|
|
(setq-local bible-current-xref-book (match-string 0 b-ref)))
|
|
|
+ ;; See if we've got a chapter. Note this regexp will skip
|
|
|
+ ;; the book name if present.
|
|
|
(when (string-match "[0-9]*:" b-ref)
|
|
|
- (setq-local bible-current-xref-chapter (string-trim (substring (match-string 0 b-ref) 0 (1- (length (match-string 0 b-ref))))))
|
|
|
- (setq set-chapter-p t))
|
|
|
- (let* ((match (string-match "[0-9]*" b-ref (if set-chapter-p (match-end 0) 0)))
|
|
|
+ (setq-local bible-current-xref-chapter
|
|
|
+ (string-trim
|
|
|
+ (substring
|
|
|
+ (match-string 0 b-ref)
|
|
|
+ 0
|
|
|
+ (1- (length (match-string 0 b-ref))))))
|
|
|
+ (setq chapter-set-p t))
|
|
|
+ (let* ((match (string-match "[0-9]*" b-ref (if chapter-set-p (match-end 0) 0)))
|
|
|
(verse (string-trim (substring b-ref match (match-end 0)))))
|
|
|
(just-one-space)
|
|
|
(let ((start (point))
|
|
|
@@ -1532,9 +1548,9 @@ In processing subnodes, each case will prepend a space if it needs it."
|
|
|
;; Some modules use this for line breaks and such.
|
|
|
('milestone
|
|
|
(pcase (dom-attr subnode 'type)
|
|
|
- ("line" (bible-new-line))
|
|
|
-;; ("x-PN" (bible-new-line)) ; REVIEW: Don't yet understand this one. (FMG 26-Mar-2026)
|
|
|
- ("x-p" (insert (dom-attr subnode 'marker) " "))))
|
|
|
+ ("line" (bible-new-line))
|
|
|
+;; ("x-PN" (bible-new-line)) ; REVIEW: Don't yet understand this one. (FMG 26-Mar-2026)
|
|
|
+ ("x-p" (insert (dom-attr subnode 'marker) " "))))
|
|
|
('br (bible-new-line))
|
|
|
('lb (when (equal (dom-attr subnode 'type) "x-begin-paragraph") (bible-new-line)))
|
|
|
('div (when (or (equal (dom-attr subnode 'type) "paragraph")
|
|
|
@@ -1741,7 +1757,7 @@ If optional argument VERSE is supplied, set cursor at verse."
|
|
|
"No results found."
|
|
|
(when (equal searchmode "lucene")
|
|
|
" Verify index has been build with mkfastmod.")))
|
|
|
- (with-current-buffer (get-buffer-create (generate-new-buffer-name (concat "*bible-search*")))
|
|
|
+ (with-current-buffer (generate-new-buffer-name "*bible-search*")
|
|
|
(bible-search-mode)
|
|
|
(bible--display-search results module)
|
|
|
(setq-local bible-search-word-this-query query
|
|
|
@@ -1856,7 +1872,7 @@ This command is run by clicking on text, not directly by the user."
|
|
|
|
|
|
(defun bible--open-term-hebrew (term)
|
|
|
"Open a buffer of the Strong's Hebrew TERM's definition."
|
|
|
- (with-current-buffer (get-buffer-create (generate-new-buffer-name "*bible-term*"))
|
|
|
+ (with-current-buffer (generate-new-buffer "*bible-term*")
|
|
|
(bible-term-hebrew-mode)
|
|
|
(setq-local bidi-paragraph-direction 'left-to-right)
|
|
|
(setq-local mode-name (concat (bible--get-lemma 'hebrew term) " Term (Hebrew)"))
|
|
|
@@ -1875,7 +1891,7 @@ This code is customized for the BDBGlosses_Strongs lexicon."
|
|
|
|
|
|
(defun bible--open-term-greek (term)
|
|
|
"Open a buffer of the Strong's Greek TERM definition."
|
|
|
- (with-current-buffer (get-buffer-create (generate-new-buffer-name "*bible-term*"))
|
|
|
+ (with-current-buffer (generate-new-buffer "*bible-term*")
|
|
|
(bible-term-greek-mode)
|
|
|
(setq-local mode-name (concat (bible--get-lemma 'greek term) " Term (Greek)"))
|
|
|
(bible--display-lemma-greek term)
|