Просмотр исходного кода

Fix bible--insert-xref default book name.

Fred Gilham 4 дней назад
Родитель
Сommit
ebc15b200d
1 измененных файлов с 17 добавлено и 1 удалено
  1. 17 1
      bible.el

+ 17 - 1
bible.el

@@ -1490,6 +1490,22 @@ This format is used by the NETnote module."
   ;; HACK: What a mess! There are still some broken edge cases! (FMG 29-Mar-2026)
   (let* ((refs-text (bible-dom-text node))
          (refs (split-string refs-text "," t " ")))
+    ;; Fix: each reference will have a book name. There are three
+    ;; different kinds of reference entries:
+    ;;
+    ;; 1. The reference entry will have a single book with possibly
+    ;; multiple references to that book. Make sure the book is carried
+    ;; along to all the other references until another book name
+    ;; appears. E.g. Mark 2:3 4 8:17 all refer to the book of Mark.
+    ;;
+    ;; 2. The reference entry has multiple book names. Mark 2:3 8 Luke
+    ;; 8:17 is three references, two to Mark and one to Luke. Make
+    ;; sure the book names are updated appropriately.
+    ;;
+    ;; 3. If the reference entry has no book at all, use the current
+    ;; module's book name. We set it here as a default; it will get
+    ;; replaced if a book name appears in the reference entry.
+    (setq-local bible-current-xref-book (concat bible--current-book-name " "))
     (dolist (ref refs)
       (let ((a-ref (split-string ref ";" t " ")))
         (dolist (b-ref a-ref)
@@ -1504,7 +1520,7 @@ This format is used by the NETnote module."
             ;; 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.)
+            ;; bible-current-xref-book.
             (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