1
0

5 Ревизии 0fdaecbfff ... df76f0604a

Автор SHA1 Съобщение Дата
  Fred Gilham df76f0604a Work on synchronizing buffers преди 1 седмица
  Fred Gilham 0bb90b60f8 Working on having xrefs move Bible text not commentary text преди 1 седмица
  Fred Gilham f4dc70ff56 Clarify a TODO list item преди 1 седмица
  Fred Gilham 5bc1af2534 Update TODO list преди 1 седмица
  Fred Gilham 952ccdbd14 First cut at inserting commentary xrefs. Need to parse more. преди 1 седмица
променени са 2 файла, в които са добавени 217 реда и са изтрити 145 реда
  1. 12 3
      TODO
  2. 205 142
      bible.el

+ 12 - 3
TODO

@@ -1,12 +1,21 @@
 #+COMMENT: -*- Mode: org -*-
-#+COMMENT: Time-stamp: <2026-03-17 07:24:20 fred>
-* TODO Add commentaries as module options.
-* TODO Fix cross-references from books/commentaries.
+#+COMMENT: Time-stamp: <2026-03-23 15:42:28 fred>
+* TODO Fix parsing of cross-references from books/commentaries.
+  - Partly done
+* TODO Synchronize buffers
+  - Synchronize Commentary with Bible 
+  - Synchronize/de-synchronize different Bible buffers
+* TODO Split commentaries and Bibles (different names etc.)
+* TODO Cross-references in commentaries should point to Bible buffer, not Commentary buffer.
+  - That is, clicking on a cross-reference in a commentary should
+    cause an associated Bible buffer to go to the location of the cross-reference.
+    - Associate Bible buffer with commentary?
 * TODO Add customizations for font faces for different kinds of buffers (e.g. Greek, Hebrew, English etc.)
 * TODO Infer chapter counts from book data.
   - May not be easily possible
 * TODO Search should order references by OT books, then NT books, in alphabetical order
   - Search references currently works pretty well except for the above. Worth doing?
+* DONE Add commentaries as module options.
 * DONE Psalm 119 acrostic Hebrew letters doesn't work.
 * DONE It would be nice to be able to enter either I, II or III or 1, 2 or 3 when referencing books.
 * DONE XXX Using "bible-search-mode-follow-verse" function reverts to default (customized) module instead of current module.

+ 205 - 142
bible.el

@@ -40,7 +40,7 @@
 ;; The program also installs a Bible menu with keybindings and other
 ;; commands.
 
-;; You may customize `bible-module' to set a default browsing
+;; You may customize `bible-text' to set a default browsing
 ;; module, as well as `bible-word-study-enabled' to enable word
 ;; study by default.
 
@@ -78,11 +78,6 @@
 
 ;;;; Requirements
 
-;; REVIEW: CL-LIB is just used in this code for cl-search in two
-;; places. But since it is required by DOM and SHR, might as well take
-;; advantage of it. Maybe re-do some of the code below with CL-LIB
-;; constructs? (FMG 10-Mar-2026)
-;; Use cl-sort for backward compatibility. 21-Mar-2026
 (require 'cl-lib)
 (require 'dom)
 (require 'shr)
@@ -101,13 +96,23 @@
   :group 'tools
   :link '(url-link "https://gitbot.homedns.org/fred/bible-mode"))
 
-(defcustom bible-module
+(defcustom bible-text
   "KJV"
-  "Customize default book module for Diatheke to query.
+  "Customize default bible text module for Diatheke to query.
 \(For full list of installed modules, run `diatheke -b system -l bibliography'\)"
   :type '(choice (const :tag "None" nil)
-                 (string :tag "Module abbreviation (e.g. \"KJV\")"))
-  :local t
+                 (string :tag "Bible text (e.g. \"KJV\")"))
+  :local nil
+  :group 'bible)
+
+
+(defcustom bible-commentary
+  "Clarke"
+  "Customize default commentary module for Diatheke to query.
+\(For full list of installed modules, run `diatheke -b system -l bibliography'\)"
+  :type '(choice (const :tag "None" nil)
+                 (string :tag "Commentary (e.g. \"Clarke\")"))
+  :local nil
   :group 'bible)
 
 ;; TODO: Not implememted yet (FMG 5-Mar-2026)
@@ -205,6 +210,26 @@ See `bible--display-lemma-hebrew'."
 
 ;;;; Variable definitions
 
+(defvar bible--text-buffers nil
+  "List of Bible text buffers.")
+
+(defvar bible--commentary-buffers nil
+  "List of commentary buffers.")
+
+(defvar bible--synced-buffers nil
+  "List of buffers that are synchronized so that navigation in one applies 
+to all of them.")
+
+
+(defvar bible-mode-line-format
+  '("%e" mode-line-front-space
+    mode-line-frame-identification mode-line-buffer-identification "   "
+    bible--current-book-name " " (:eval (number-to-string bible--current-chapter))
+    "  "
+    "  " mode-line-modes mode-line-misc-info
+    mode-line-end-spaces)
+  "Mode line format for bible buffers.")
+
 (defconst bible--verse-regexp "\\(I \\|1 \\|II \\|2 \\|III \\|3 \\)??[a-zA-Z]+?[ \t\n][0-9]+[:][0-9]+")
 
 (defvar bible--texts (lazy-completion-table bible--texts bible--list-biblical-texts))
@@ -241,78 +266,86 @@ See `bible--display-lemma-hebrew'."
     ("3 John"           . 1))
   "A-list of name / chapter count for Bible books.")
 
-;; TODO: Add abbreviations found in other documents/commentaries? (FMG 5-Mar-2026)
+;; These abbreviations are used to follow cross-references in commentaries and lexicons.
+;; Abbreviations from NETnote module and Clarke module (commentaries).
+;; Abbreviations from some lexicons.
+;; Standard abbreviations come first.
 (defvar bible--book-name-abbreviations
   '(;; Old Testament
-    ("Ge" . "Genesis") ("Gen" . "Genesis")
-    ("Ex" . "Exodus") ("Exo" . "Exodus")
-    ("Le" . "Leviticus") ("Lev" . "Leviticus")
-    ("Nu" . "Numbers") ("Num" . "Numbers")
-    ("De" . "Deuteronomy") ("Deu" . "Deuteronomy")
-    ("Js" . "Joshua") ("Jos" . "Joshua")
-    ("Jg" . "Judges") ("Jdg" . "Judges") ("Judg" . "Judges")
+    ("Gen" . "Genesis") ("Ge" . "Genesis")
+    ("Exod" . "Exodus") ("Ex" . "Exodus") ("Exo" . "Exodus")
+    ("Lev" . "Leviticus") ("Le" . "Leviticus")
+    ("Num" . "Numbers") ("Nu" . "Numbers")
+    ("Deut" . "Deuteronomy") ("De" . "Deuteronomy") ("Deu" . "Deuteronomy")
+    ("Josh" . "Joshua") ("Js" . "Joshua") ("Jos" . "Joshua")
+    ("Judg" . "Judges") ("Jg" . "Judges") ("Jdg" . "Judges")
     ("Ru" . "Ruth") ("Rut" . "Ruth")
-    ("1 Samuel" . "I Samuel")  ("I Sa" . "I Samuel")   ("1 Sa" . "I Samuel")  ("1Sam" . "I Samuel")
-    ("2 Samuel" . "II Samuel") ("II Sa" . "II Samuel") ("2 Sa" . "II Samuel") ("2Sam" . "II Samuel")
-    ("1 Kings"  . "I Kings")   ("I Ki"  . "I Kings")   ("1 Ki" . "I Kings")
-    ("2 Kings"  . "II Kings")  ("II Ki" . "II Kings")  ("2 Ki" . "II Kings")
-    ("1 Chronicles" . "I Chronicles")  ("I Ch"  . "I Chronicles")  ("1 Ch" . "I Chronicles")
-    ("2 Chronicles" . "II Chronicles") ("II Ch" . "II Chronicles") ("2 Ch" . "II Chronicles")
+    ("1 Sam" . "I Samuel") ("1 Samuel" . "I Samuel")  ("I Sa" . "I Samuel")   ("1 Sa" . "I Samuel")  ("1Sam" . "I Samuel")
+    ("2 Sam" . "II Samuel") ("2 Samuel" . "II Samuel") ("II Sa" . "II Samuel") ("2 Sa" . "II Samuel") ("2Sam" . "II Samuel")
+    ("1 Kgs" . "I Kings") ("1 Kings"  . "I Kings") ("I Ki"  . "I Kings") ("1 Ki" . "I Kings") ("1Ki" . "I Kings")
+    ("2 Kgs" . "II Kings") ("2 Kings"  . "II Kings") ("II Ki" . "II Kings") ("2 Ki" . "II Kings") ("2Ki" . "II Kings")
+    ("1 Chr" . "I Chronicles") ("1 Chronicles" . "I Chronicles") ("I Ch"  . "I Chronicles") ("1 Ch" . "I Chronicles")
+    ("2 Chr" . "II Chronicles") ("2 Chronicles" . "II Chronicles") ("II Ch" . "II Chronicles") ("2 Ch" . "II Chronicles")
     ("Ezr" . "Ezra")
-    ("Ne"  . "Nehemiah") ("Neh"  . "Nehemiah")
-    ("Es"  . "Esther") ("Est"  . "Esther")
+    ("Neh"  . "Nehemiah") ("Ne"  . "Nehemiah")
+    ("Esth"  . "Esther") ("Es"  . "Esther") ("Est"  . "Esther")
     ("Jb"  . "Job")
     ("Ps"  . "Psalms") ("Psa" . "Psalms")
-    ("Pr"  . "Proverbs") ("Pro" . "Proverbs") 
-    ("Ec"  . "Ecclesiastes") ("Ecc"  . "Ecclesiastes")
-    ("So"  . "Song of Solomon") ("Sol"  . "Song of Solomon")
-    ("Is"  . "Isaiah") ("Isa" . "Isaiah")
-    ("Je"  . "Jeremiah") ("Jer" . "Jeremiah")
-    ("La"  . "Lamentations") ("Lam"  . "Lamentations")
-    ("Ez"  . "Ezekiel") ("Eze"  . "Ezekiel")
-    ("Da"  . "Daniel") ("Dan" . "Daniel")
-    ("Ho"  . "Hosea") ("Hos"  . "Hosea")
+    ("Prov" . "Proverbs") ("Pr"  . "Proverbs") ("Pro" . "Proverbs")
+    ("Eccl"  . "Ecclesiastes") ("Ec"  . "Ecclesiastes") ("Ecc"  . "Ecclesiastes")
+    ("Song"  . "Song of Solomon") ("So"  . "Song of Solomon") ("Sol"  . "Song of Solomon")
+    ("Isa" . "Isaiah") ("Is"  . "Isaiah")
+    ("Jer" . "Jeremiah") ("Je"  . "Jeremiah")
+    ("Lam"  . "Lamentations") ("La"  . "Lamentations")
+    ("Ezek" . "Ezekiel") ("Ez"  . "Ezekiel") ("Eze" . "Ezekiel")
+    ("Dan" . "Daniel") ("Da"  . "Daniel")
+    ("Hos"  . "Hosea") ("Ho"  . "Hosea")
     ("Joe" . "Joel")
     ("Am"  . "Amos") ("Amo"  . "Amos")
-    ("Ob"  . "Obadiah") ("Oba"  . "Obadiah")
+    ("Obad"  . "Obadiah") ("Ob"  . "Obadiah") ("Oba"  . "Obadiah")
     ("Jon" . "Jonah")
-    ("Mi"  . "Micah") ("Mic"  . "Micah")
-    ("Na"  . "Nahum") ("Nah"  . "Nahum")
-    ("Ha"  . "Habakkuk") ("Hab"  . "Habakkuk")
-    ("Zep" . "Zephaniah")
+    ("Mic"  . "Micah") ("Mi"  . "Micah")
+    ("Nah"  . "Nahum") ("Na"  . "Nahum")
+    ("Hab"  . "Habakkuk") ("Ha"  . "Habakkuk")
+    ("Zeph" . "Zephaniah") ("Zep" . "Zephaniah")
     ("Hag" . "Haggai")
-    ("Ze"  . "Zechariah") ("Zac"  . "Zechariah")
+    ("Zech"  . "Zechariah") ("Ze"  . "Zechariah") ("Zac"  . "Zechariah") ;; Is the last one correct??
     ("Mal" . "Malachi")
 
     ;; New Testament
-    ;; Added AbbottSmith lexicon abbreviations to allow proper following of cross references in lexicon buffers.
     ("Mt" . "Matthew") ("Mat" . "Matthew") ("Matt" . "Matthew")
     ("Mk" . "Mark") ("Mar" . "Mark")
     ("Lk" . "Luke") ("Luk" . "Luke")
-    ("Jo" . "John") ("Joh" . "John")
+    ("Jn" . "John") ("Jo" . "John") ("Joh" . "John") 
     ("Ac" . "Acts") ("Act" . "Acts")
-    ("Ro" . "Romans") ("Rom" . "Romans")
-    ("1 Corintihans" . "I Corinthians") ("I Co" . "I Corinthians") ("1 Co" . "I Corinthians") ("ICor" . "I Corinthians") ("1Cor" . "I Corinthians")
-    ("2 Corinthians" . "II Corinthians") ("II Co" . "II Corinthians") ("2 Co" . "II Corinthians") ("IICor" . "II Corinthians") ("2Cor" . "II Corinthians")
-    ("Ga" . "Galatians") ("Gal" . "Galatians")
+    ("Rom" . "Romans") ("Ro" . "Romans")
+    ("1 Cor" . "I Corinthians") ("1 Corintihans" . "I Corinthians") ("I Co" . "I Corinthians") ("1 Co" . "I Corinthians")
+    ("ICor" . "I Corinthians") ("1Cor" . "I Corinthians")
+    ("2 Cor" . "II Corinthians") ("2 Corinthians" . "II Corinthians") ("II Co" . "II Corinthians") ("2 Co" . "II Corinthians")
+    ("IICor" . "II Corinthians") ("2Cor" . "II Corinthians")
+    ("Gal" . "Galatians") ("Ga" . "Galatians")
     ("Eph" . "Ephesians")
-    ("Phl" . "Philippians") ("Phil" . "Philippians")
+    ("Phil" . "Philippians") ("Phl" . "Philippians")
     ("Col" . "Colossians")
-    ("1 Thessalonians" . "I Thessalonians")  ("I Th" . "I Thessalonians") ("1 Th" . "I Thessalonians") ("IThess" . "I Thessalonians") ("1Thes" . "I Thessalonians")
-    ("2 Thessalonians" . "II Thessalonians") ("II Th" . "II Thessalonians") ("2 Th" . "II Thessalonians") ("IIThess" . "II Thessalonians") ("2Thes" . "II Thessalonians")
-    ("1 Timothy" . "I Timothy")   ("I Ti"  . "I Timothy")  ("1 Ti" . "I Timothy")  ("ITim" . "I Timothy") ("1Tim" . "I Timothy")
-    ("2 Timothy" . "II Timothy")  ("II Ti" . "II Timothy") ("2 Ti" . "II Timothy") ("IITim" . "II Timothy") ("2Tim" . "II Timothy")
+    ("1 Thess" . "I Thessalonians") ("1 Thessalonians" . "I Thessalonians") ("I Th" . "I Thessalonians") ("1 Th" . "I Thessalonians")
+    ("IThess" . "I Thessalonians") ("1Thes" . "I Thessalonians") ("1Thess" . "I Thessalonians")
+    ("2 Thess" . "II Thessalonians") ("2 Thessalonians" . "II Thessalonians") ("II Th" . "II Thessalonians") ("2 Th" . "II Thessalonians")
+    ("IIThess" . "II Thessalonians") ("2Thes" . "II Thessalonians") ("2Thess" . "II Thessalonians")
+    ("1 Tim" . "I Timothy") ("1 Timothy" . "I Timothy")   ("I Ti"  . "I Timothy")  ("1 Ti" . "I Timothy")  ("ITim" . "I Timothy")
+    ("1Tim" . "I Timothy")
+    ("2 Tim" . "II Timothy") ("2 Timothy" . "II Timothy") ("II Ti" . "II Timothy") ("2 Ti" . "II Timothy") ("IITim" . "II Timothy")
+    ("2Tim" . "II Timothy")
     ("Tit" . "Titus")
-    ("Phm" . "Philemon") ("Phlm" . "Philemon") ("Plm" . "Philemon")
-    ("He" . "Hebrews") ("Heb" . "Hebrews")
-    ("Ja" . "James") ("Jas" . "James") ("Jam" . "James")
-    ("1 Peter" . "I Peter") ("I Pe" . "I Peter") ("1 Pe" . "I Peter") ("IPet" . "I Peter") ("1Pet" . "I Peter")
-    ("2 Peter" . "II Peter")  ("II Pe" . "II Peter") ("2 Pe" . "II Peter") ("IIPet" . "II Peter") ("2Pet" . "II Peter")
-    ("1 John" . "I John") ("I Jo" . "I John") ("1 Jo" . "I John") ("IJohn" . "I John") ("1Jn" . "I John")
-    ("2 John" . "II John") ("II Jo"  . "II John") ("2 Jo" . "II John") ("IIJohn" . "II John") ("2Jn" . "I John")
-    ("3 John" . "III John") ("III Jo" . "III John") ("3 Jo" . "III John") ("IIIJohn" . "III John") ("3Jn" . "I John")
+    ("Phlm" . "Philemon") ("Phm" . "Philemon") ("Plm" . "Philemon")
+    ("Heb" . "Hebrews") ("He" . "Hebrews")
+    ("Jas" . "James") ("Ja" . "James") ("Jam" . "James")
+    ("1 Pet" . "I Peter") ("1 Peter" . "I Peter") ("I Pe" . "I Peter") ("1 Pe" . "I Peter") ("IPet" . "I Peter") ("1Pet" . "I Peter")
+    ("2 Pet" . "II Peter") ("2 Peter" . "II Peter") ("II Pe" . "II Peter") ("2 Pe" . "II Peter") ("IIPet" . "II Peter") ("2Pet" . "II Peter")
+    ("1 Jn" . "I John") ("1 John" . "I John") ("I Jo" . "I John") ("1 Jo" . "I John") ("IJohn" . "I John") ("1Jn" . "I John")
+    ("2 Jn" . "I John") ("2 John" . "II John") ("II Jo"  . "II John") ("2 Jo" . "II John") ("IIJohn" . "II John") ("2Jn" . "I John")
+    ("3 Jn" . "I John") ("3 John" . "III John") ("III Jo" . "III John") ("3 Jo" . "III John") ("IIIJohn" . "III John") ("3Jn" . "I John")
     ("Ju" . "Jude") ("Jde" . "Jude")
-    ("Re" . "Revelation of John") ("Rev" . "Revelation of John"))
+    ("Rev" . "Revelation of John") ("Re" . "Revelation of John"))
   "A-list of abbreviations for Bible books.")
 
 ;;;;; Book / chapter
@@ -390,6 +423,8 @@ See `bible--display-lemma-hebrew'."
             [menu-bar bible split-display]
             '("Split Display" . bible-split-display))
 
+(define-key bible-map "S" 'bible-synchronize-display)
+
 ;;;;; Navigation
 
 (define-key bible-map "p" 'bible-previous-chapter)
@@ -443,7 +478,10 @@ See `bible--display-lemma-hebrew'."
 (define-key bible-search-mode-map "w" 'bible-toggle-word-study)
 (define-key bible-search-mode-map "n" 'bible-next-search-item)
 (define-key bible-search-mode-map "p" 'bible-previous-search-item)
-(define-key bible-search-mode-map (kbd "RET") 'bible-search-mode-follow-verse)
+;;(define-key bible-search-mode-map (kbd "RET") 'bible-search-mode-follow-verse)
+;;(define-key bible-search-mode-map [mouse-1] 'bible-search-mode-follow-verse)
+(define-key bible-search-mode-map (kbd "RET") 'bible-search-mode-follow-xref)
+(define-key bible-search-mode-map [mouse-1] 'bible-search-mode-follow-xref)
 
 ;;;;; Term display
 
@@ -608,7 +646,7 @@ This command is run by clicking on text, not directly by the user."
 \\{bible-term-greek-mode-map}")
 
 
-(define-derived-mode bible-module-select-mode special-mode "Select Module"
+(define-derived-mode bible-text-select-mode special-mode "Select Module"
   (buffer-disable-undo)
   (font-lock-mode t)
   (setq buffer-read-only t))
@@ -624,29 +662,49 @@ 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 (get-buffer-create (generate-new-buffer-name (concat "*bible*")))
+  (with-current-buffer (get-buffer-create (generate-new-buffer-name "*bible*"))
     (bible)
-    (when module
-      (setq-default bible-module module))
-    (setq-local bible-module (default-value 'bible-module))
+    (setq-local mode-line-format bible-mode-line-format)
+    (when module (setq-default bible-text module))
+    (setq-local bible-text (default-value 'bible-text))
     (bible--set-location
      (assoc (or book-name "Genesis") bible--books)
      (or chapter 1)
      verse)
+    (cl-pushnew (current-buffer) bible--text-buffers)
     (set-window-buffer (get-buffer-window (current-buffer)) (current-buffer))))
 
-(defun bible-next-chapter ()
-  "Page to the next chapter for the active `bible' buffer."
-  (interactive)
+(defun bible--navigate-to-next-chapter ()
   (let* ((book-chapters (cdr bible--current-book))
          (chapter (min book-chapters (1+ bible--current-chapter))))
     (bible--set-location bible--current-book chapter)))
 
-(defun bible-previous-chapter ()
+(defun bible-next-chapter ()
+  "Page to the next chapter for the active `bible' buffer."
+  (interactive)
+  (bible--navigate-to-next-chapter)
+  (when bible--synced-buffers
+    (save-excursion
+      (dolist (buffer bible--synced-buffers)
+	(unless (eq buffer (current-buffer))
+	  (with-current-buffer buffer (bible--navigate-to-next-chapter)))))))
+
+(defun bible--navigate-to-previous-chapter ()
   "Page to the previous chapter for the active `bible' buffer."
   (interactive)
   (bible--set-location bible--current-book (max 1 (1- bible--current-chapter))))
 
+(defun bible-previous-chapter ()
+  "Page to the previous chapter for the active `bible' buffer."
+  (interactive)
+  (bible--navigate-to-previous-chapter)
+  (when bible--synced-buffers
+    (save-excursion
+      (dolist (buffer bible--synced-buffers)
+	(unless (eq buffer (current-buffer))
+	  (with-current-buffer buffer 
+	    (bible--set-location bible--current-book (max 1 (1- bible--current-chapter)))))))))
+
 (defun bible-next-word ()
   "Move forward a word, taking into account the relevant text properties."
   (interactive)
@@ -704,18 +762,19 @@ specifies the module to use."
 (defun bible-select-text ()
   "Ask user for a new text module for the current `bible' buffer."
   (interactive)
-  (let ((module (completing-read "Text: " bible--texts)))
-    (unless (string= module "")
-      (setq-default bible-module module)
-      (bible--display module))))
+  (let ((text (completing-read "Text: " bible--texts)))
+    (unless (string= text "")
+      (setq-default bible-text text)
+      (setq-local bible-text text)
+      (bible--display))))
 
 (defun bible-select-commentary ()
   "Ask user for a new text module for the current `bible' buffer."
   (interactive)
-  (let ((module (completing-read "Commentary: " bible--commentaries)))
-    (unless (string= module "")
-      (setq-default bible-module module)
-      (bible--display module))))
+  (let ((commentary (completing-read "Commentary: " bible--commentaries)))
+    (unless (string= commentary "")
+      (setq-local bible-text commentary)
+      (bible--display))))
 
 (defun bible-toggle-word-study ()
   "Toggle the inclusion of word study for the active `bible' buffer."
@@ -735,7 +794,12 @@ specifies the module to use."
   (split-window-right)
   (balance-windows)
   (other-window 1)
-  (bible-open bible--current-book-name bible--current-chapter 1 bible-module))
+  (bible-open bible--current-book-name bible--current-chapter 1 bible-text))
+
+(defun bible-synchronize-display ()
+  "Copy the active `bible' buffer into a new buffer in another window."
+  (interactive)
+  (cl-pushnew (current-buffer) bible--synced-buffers))
 
 (defun bible-search (query)
   "Search for a QUERY: a word or phrase.
@@ -746,7 +810,7 @@ or `multiword'.  `lucene' is the default search.
   (interactive "sBible Search: ")
   (when (> (length query) 0)
     (let ((searchmode (completing-read "Search Mode: " '("lucene" "phrase" "regex" "multiword") nil t "lucene")))
-      (bible--open-search query searchmode (buffer-local-value 'bible-module (current-buffer))))))
+      (bible--open-search query searchmode (buffer-local-value 'bible-text (current-buffer))))))
 
 (defun bible-search-mode-follow-verse ()
   "Follow the hovered verse in a `bible-search-mode' buffer.
@@ -758,13 +822,14 @@ Create a new `bible' buffer positioned at the selected verse."
          verse)
     (string-match bible--verse-regexp text)
     (setq text (match-string 0 text))
+    (message "Text match is %s" text)
     (string-match "I?I?I? ?[A-Z]?[a-z]* " text)
     (setq book (match-string 0 text))
     (string-match "[0-9]?[0-9]?[0-9]?:" text)
     (setq chapter (substring (match-string 0 text) 0 (1- (length (match-string 0 text)))))
     (string-match ":[0-9]?[0-9]?[0-9]?" text)
     (setq verse (substring (match-string 0 text) 1))
-    (bible-open (string-trim book) (string-to-number chapter) (string-to-number verse)) bible-module))
+    (bible-open (string-trim book) (string-to-number chapter) (string-to-number verse)) bible-text))
 
 (defun bible-search-mode-follow-xref ()
   "Follow the hovered verse in a bible term buffer.
@@ -777,10 +842,7 @@ Handle abbreviations from lexicon module (AbbottSmith)."
   (let* ((xref (get-text-property (point) 'xref))
          (verse-ref (split-string xref))
          book-abbrev
-         chapter-verse
-         book
-         chapter
-         verse)
+         chapter-verse)
 ;;    (message "Trying to follow %s" xref)
     (cond ((= (length verse-ref) 2) ; Mat 5 or the like
            (setq book-abbrev (car verse-ref)
@@ -789,10 +851,10 @@ Handle abbreviations from lexicon module (AbbottSmith)."
            (setq book-abbrev (concat (car verse-ref) " " (cadr verse-ref))
                  chapter-verse (split-string (caddr verse-ref) ":"))))
     ;; Use book abbreviation if present or try whatever is in verse-ref.
-    (setq book (or (alist-get book-abbrev bible--book-name-abbreviations nil nil #'string-equal-ignore-case) (car verse-ref))
-          chapter (car chapter-verse)
-          verse (cadr chapter-verse))
-    (bible-open (string-trim book) (string-to-number chapter) (string-to-number verse) bible-module)))
+    (let ((book (or (alist-get book-abbrev bible--book-name-abbreviations nil nil #'string-equal-ignore-case) (car verse-ref)))
+	  (chapter (car chapter-verse))
+          (verse (cadr chapter-verse)))
+      (bible-open (string-trim book) (string-to-number chapter) (string-to-number verse) (default-value 'bible-text)))))
 
 ;; These can be called interactively if you know the Strong's number
 ;; you want to look up.
@@ -816,7 +878,7 @@ Handle abbreviations from lexicon module (AbbottSmith)."
          (chapter (when book-data (completing-read "Chapter: " (bible--list-number-range 1 (cdr book-data)) nil t "1" nil "1")))
          (verse (when chapter (read-from-minibuffer "Verse: ")))
          (query (concat (car book-data) " " chapter ":" verse))
-         (args (list bible-sword-query nil (current-buffer) t "-b" bible-module "-f" "plain" "-k" query)))
+         (args (list bible-sword-query nil (current-buffer) t "-b" bible-text "-f" "plain" "-k" query)))
     (apply #'call-process args)))
 
 ;; Choose a Bible text.
@@ -828,14 +890,14 @@ Handle abbreviations from lexicon module (AbbottSmith)."
 
 ;;;; Support (internal)
 
-(defconst bible-diatheke-filter-options " avlnmw")
+(defconst bible-diatheke-filter-options " afilmnsvw")
 
 (defun bible--exec-diatheke (query &optional filter format module)
   "Execute `diatheke' with specified QUERY options.
 FILTER is the Diatheke filter argument. FORMAT is either plain or
 the default of internal. MODULE is the text module to use. Returns
 string containing query result."
-  (let ((module (or module bible-module)))
+  (let ((module (or module bible-text)))
     (with-temp-buffer
       (let ((args (list bible-sword-query nil (current-buffer) t "-b" module)))
 	(if filter
@@ -853,7 +915,7 @@ string containing query result."
 Optional argument FORMAT is either plain or the default of internal.
 MODULE is the text module to use and defaults to the current module."
   (with-temp-buffer
-    (let ((args (list bible-sword-query nil (current-buffer) t "-b" (or module bible-module))))
+    (let ((args (list bible-sword-query nil (current-buffer) t "-b" (or module bible-text))))
       (setq args (append args (list "-s" (pcase searchtype
                                            ("lucene" "lucene")
                                            ("phrase" "phrase")
@@ -1178,7 +1240,7 @@ in buffer)."
                 ;;       articles with nouns. Deal with this.
                 ;;       (FMG 5-Mar-2026)
                 (let ((lexeme-list
-                       (if (string= bible-module "KJV")
+                       (if (string= bible-text "KJV")
                            (reverse lexemes) ; Use the last `strong:' entry.
 			 lexemes)))
 		  (catch 'loop
@@ -1194,7 +1256,7 @@ in buffer)."
                    (put-text-property refstart refend 'keymap bible-hebrew-keymap)))
             ;; Add help-echo, strongs reference for tooltips if match.
             (when matched
-              (setq bible-has-lexemes t)
+              (setq bible-has-lexemes " Lex")
               (put-text-property refstart refend 'help-echo 'bible--show-lex-morph)
               (put-text-property refstart refend 'strong matched))))
         ;; morphology
@@ -1208,7 +1270,7 @@ in buffer)."
                  (string-match "oshm:.*" morpheme)) ; OSHM Hebrew morphology
                 (setq matched (match-string 0 morpheme)))
             (when matched
-              (setq bible-has-morphemes t)
+              (setq bible-has-morphemes " Morph")
               (put-text-property refstart refend 'morph matched)
               (put-text-property refstart refend 'help-echo 'bible--show-lex-morph))))
         ;; Insert lemma into buffer. Lemma tag will be part of lemma/savelm item.
@@ -1261,6 +1323,20 @@ stored in `bible-chapter-title'."
           ((equal level "2")
 	   (newline)))))
 
+(defun bible--insert-xref (node)
+  (let* ((word (bible-dom-text node))
+	 (refs (split-string word ";" t)))
+    (message "refs %s" refs)
+    (dolist (ref refs)
+      (let ((start (point)))
+	(insert " " ref ";")
+	(let ((end (point)))
+	  (put-text-property start end 'xref ref)
+	  (put-text-property start end 'keymap bible-term-mode-map)
+	  (put-text-property start end 'help-echo (concat "Go to " ref))
+	  (add-face-text-property start end '(:foreground "blue")))))))
+
+
 (defun bible--insert-domnode-recursive (node &optional iproperties)
   "Recursively parse domnode NODE obtained from `libxml-parse-html-region'.
 Inserts resulting text into active buffer with properties specified in
@@ -1321,16 +1397,7 @@ In processing subnodes, each case will prepend a space if it needs it."
 		       (bible-new-line)))
                ;; For commentaries and the like.
                ;; TODO: Clicking on verse doesn't work yet. This will take work. (FMG 5-Mar-2026)
-               ((or 'scripref 'reference)
-                (let ((word (bible-dom-text subnode)))
-                  (let ((start (point)))
-                    (insert " " word)
-                    (let ((end (point)))
-;;		      (message "crossreferencing %s" (buffer-substring start end))
-                      (put-text-property start end 'xref word)
-                      (put-text-property start end 'keymap bible-term-mode-map)
-                      (put-text-property start end 'help-echo (concat "Go to " word " (incomplete feature)"))
-                      (add-face-text-property start end '(:foreground "blue"))))))
+               ((or 'scripref 'reference) (bible--insert-xref subnode))
                ;; Various text properties---ignore for now
                ((or 'b 'u) (bible--insert-domnode-recursive subnode iproperties))
                ;; Word inserted by translation, not in original, give visual indication.
@@ -1341,12 +1408,12 @@ In processing subnodes, each case will prepend a space if it needs it."
                       (add-face-text-property (- (point) (length word)) (point) '(:foreground "salmon"))
                     (add-face-text-property (- (point) (length word)) (point) '(:foreground "gray50")))))))))))
 
-(defun bible--display (&optional module verse)
+(defun bible--display (&optional _module verse)
   "Render a page (chapter) of a Bible module.
-Defaults to using `bible-module'.
+Defaults to using `bible-text'.
 If optional argument MODULE is supplied, use that module for display.
 If optional argument VERSE is supplied, set cursor at verse."
-  (when module (setq-local bible-module module))
+;;  (when module (setq-local bible-text module))
   (let ((buffer-read-only nil)
         (bible-has-lexemes nil)
         (bible-has-morphemes nil))
@@ -1359,7 +1426,7 @@ If optional argument VERSE is supplied, set cursor at verse."
         (erase-buffer)
 	(setq-local bible-chapter-title nil)
         ;; Looking for the "body" tag in the DOM node.
-	(bible--insert-domnode-recursive (dom-by-tag html-dom-tree 'body) nil)
+	(bible--insert-domnode-recursive (dom-by-tag html-dom-tree 'body))
         (goto-char (point-min))))
     (save-excursion
       (let ((search-string (concat " *" (car bible--current-book) " " (number-to-string bible--current-chapter) ":")))
@@ -1371,7 +1438,7 @@ If optional argument VERSE is supplied, set cursor at verse."
             (add-face-text-property (match-beginning 0) (match-end 0) '(:foreground "purple"))))))
     (save-excursion
       ;; Remove the module name from the buffer.
-      (while (re-search-forward (concat "^.*" bible-module ".*$") nil t)
+      (while (re-search-forward (concat "^.*" bible-text ".*$") nil t)
         (replace-match "" nil t)))
     (save-excursion
       ;; Fix divine name lossage.
@@ -1405,11 +1472,7 @@ If optional argument VERSE is supplied, set cursor at verse."
       (while (re-search-forward "  *" nil t) ; More than one space in a row
         (replace-match " ")))
     ;; Set the mode line of the biffer.
-    (setq mode-name (concat "Bible (" bible--current-book-name " " (number-to-string bible--current-chapter) ") "
-                            bible-module
-                            (when bible-has-lexemes " Lex")
-                            (when bible-has-morphemes " Morph")
-                            ")"))
+    (setq mode-name (concat bible-text (when bible-has-lexemes " Lex") (when bible-has-morphemes " Morph")))
     (force-mode-line-update))
     ;; If optional verse specification go to that verse.
     (when verse
@@ -1466,9 +1529,9 @@ If optional argument VERSE is supplied, set cursor at verse."
   (bible--get-biblical-modules) ; Make sure the lists are fresh.
   bible--commentaries)
 
-(defconst bible-module-map (make-keymap))
-(define-key bible-module-map [mouse-1] 'bible-pick-module)
-(define-key bible-module-map (kbd "RET") 'bible-pick-module)
+(defconst bible-text-map (make-keymap))
+(define-key bible-text-map [mouse-1] 'bible-pick-module)
+(define-key bible-text-map (kbd "RET") 'bible-pick-module)
 
 
 (defun bible-display-available-texts ()
@@ -1476,7 +1539,7 @@ If optional argument VERSE is supplied, set cursor at verse."
   (interactive)
   (bible--get-biblical-modules) ; Make sure lists are fresh.
   (with-current-buffer (get-buffer-create "Texts")
-    (bible-module-select-mode)
+    (bible-text-select-mode)
     (let ((buffer-read-only nil))
       (erase-buffer)
       (setq-local tab-stop-list '(25))
@@ -1488,7 +1551,7 @@ If optional argument VERSE is supplied, set cursor at verse."
                        'face 'bold
                        'module name
                        'help-echo (concat "Select " name)
-                       'keymap bible-module-map))
+                       'keymap bible-text-map))
           (move-to-tab-stop)
           (insert (format "%s\n" description)))))
     (goto-char (point-min))
@@ -1499,7 +1562,7 @@ If optional argument VERSE is supplied, set cursor at verse."
   (interactive)
   (bible--get-biblical-modules) ; Make sure lists are fresh.
   (with-current-buffer (get-buffer-create "Commentaries")
-    (bible-module-select-mode)
+    (bible-text-select-mode)
     (let ((buffer-read-only nil))
       (erase-buffer)
       (setq-local tab-stop-list '(25))
@@ -1511,7 +1574,7 @@ If optional argument VERSE is supplied, set cursor at verse."
                        'face 'bold
                        'module name
                        'help-echo (concat "Select " name)
-                       'keymap bible-module-map))
+                       'keymap bible-text-map))
           (move-to-tab-stop)
           (insert (format "%s\n" description)))))
     (goto-char (point-min))
@@ -1543,7 +1606,7 @@ If optional argument VERSE is supplied, set cursor at verse."
         (query-verses "")
         (buffer-read-only nil))
 ;;    (message "display-search %s" module)
-    (setq-default bible-module module)
+    (setq-default bible-text module)
     (erase-buffer)
     (while match
       (setq match (string-match ".+?:[0-9]?[0-9]?" results (+ match (length matchstr)))
@@ -1570,7 +1633,7 @@ If optional argument VERSE is supplied, set cursor at verse."
       (insert (bible--exec-diatheke query-verses nil nil module)))
     (let* ((html-dom-tree (libxml-parse-html-region (point-min) (point-max))))
       (erase-buffer)
-      (bible--insert-domnode-recursive (dom-by-tag html-dom-tree 'body) nil))
+      (bible--insert-domnode-recursive (dom-by-tag html-dom-tree 'body)))
     (goto-char (point-min))
     ;; Remove module name from buffer.
     (save-excursion
@@ -1588,24 +1651,24 @@ If optional argument VERSE is supplied, set cursor at verse."
 ;; ;; REVIEW: Do something here? (FMG 5-Mar-2026)
 ;;  )
 
-(defun bible--fixup-lexicon-display (termtype)
+(defun bible--fixup-lexicon-display (_termtype)
   "Fixup the display of a lexical entry whose language is given by TERMTYPE."
   (let ((buffer-read-only nil))
     (goto-char (point-min))
-    (save-excursion
-      ;; This enables clicking on Strong's numbers in some lexicon definitions.
-      (while (search-forward-regexp "[0-9]+" nil t)
-        (let ((match (match-string 0))
-              (start (match-beginning 0))
-              (end (match-end 0)))
-          (cond ((eq termtype 'hebrew)
-                 (put-text-property start end 'strong (concat "strong:H" match))
-                 (put-text-property start end 'keymap bible-hebrew-keymap)
-                 (add-face-text-property start end `(:foreground "blue")))
-                ((eq termtype 'greek)
-                 (put-text-property start end 'strong (concat "strong:G" match))
-                 (put-text-property start end 'keymap bible-greek-keymap)
-                 (add-face-text-property start end `(:foreground "blue")))))))
+    ;;; (save-excursion
+    ;;;   ;; This enables clicking on Strong's numbers in some lexicon definitions.
+    ;;;   (while (search-forward-regexp "[0-9]+" nil t)
+    ;;;     (let ((match (match-string 0))
+    ;;;           (start (match-beginning 0))
+    ;;;           (end (match-end 0)))
+    ;;;       (cond ((eq termtype 'hebrew)
+    ;;;              (put-text-property start end 'strong (concat "strong:H" match))
+    ;;;              (put-text-property start end 'keymap bible-hebrew-keymap)
+    ;;;              (add-face-text-property start end `(:foreground "blue")))
+    ;;;             ((eq termtype 'greek)
+    ;;;              (put-text-property start end 'strong (concat "strong:G" match))
+    ;;;              (put-text-property start end 'keymap bible-greek-keymap)
+    ;;;              (add-face-text-property start end `(:foreground "blue")))))))
     ;; This enables clicking on verse references.
     (save-excursion
       (while (search-forward-regexp bible--verse-regexp nil t)
@@ -1659,7 +1722,7 @@ This code is customized for the BDBGlosses_Strongs lexicon."
   (setq-local bible--current-book book)
   (setq-local bible--current-book-name (car book))
   (setq-local bible--current-chapter chapter)
-  (bible--display bible-module verse))
+  (bible--display bible-text verse))
 
 ;;;; Utilities