Ver código fonte

Clean up lex and morph mode line indicator logic.

Fred Gilham 1 semana atrás
pai
commit
b93bef7c6c
1 arquivos alterados com 6 adições e 14 exclusões
  1. 6 14
      bible.el

+ 6 - 14
bible.el

@@ -234,7 +234,7 @@ See `bible--display-lemma-hebrew'."
     " "  (:eval (number-to-string bible--current-chapter))
     "  " (:eval (if bible--synced-p "Sync" ""))
     (:eval (when bible-search-range (concat " <" bible-search-range ">")))
-    "  " mode-line-modes bible-lex bible-morph mode-line-misc-info
+    "  " mode-line-modes bible-has-lexemes bible-has-morphemes mode-line-misc-info
     mode-line-end-spaces)
   "Mode line format for bible buffers.")
 
@@ -664,9 +664,6 @@ to all of them.")
 
 ;;;;; Lexemes / morphemes
 
-(defvar-local bible-lex nil)
-(defvar-local bible-morph nil)
-
 (defvar-local bible-term-language nil
   "Displaying terms of this language.")
 
@@ -1458,7 +1455,7 @@ in buffer)."
                    (put-text-property start end 'keymap bible-hebrew-keymap)))
             ;; Add help-echo, strongs reference for tooltips if match.
             (when matched
-              (setq bible-has-lexemes " Lex")
+              (setq-local bible-has-lexemes " Lex")
               (put-text-property start end 'help-echo 'bible--show-lex-morph)
               (put-text-property start end 'strong matched))))
         ;; morphology
@@ -1469,7 +1466,7 @@ in buffer)."
                    (string-match "robinson:.*" morpheme) ; Robinson Greek morphology
                    (string-match "packard:.*" morpheme) ; Packard Greek morphology --- LXX seems to use this
                    (string-match "oshm:.*" morpheme)) ; OSHM Hebrew morphology
-              (setq bible-has-morphemes " Morph")
+              (setq-local bible-has-morphemes " Morph")
               (put-text-property start end 'morph  (match-string 0 morpheme))
               (put-text-property start end 'help-echo 'bible--show-lex-morph))))
         ;; Insert lemma into buffer. Lemma tag will be part of lemma/savelm item.
@@ -1692,9 +1689,7 @@ In processing subnodes, each case will prepend a space if it needs it."
   "Render a page (chapter) of a Bible module.
 Defaults to using `bible-text'.
 If optional argument VERSE is supplied, set cursor at verse."
-  (let ((buffer-read-only nil)
-        (bible-has-lexemes nil)
-        (bible-has-morphemes nil))
+  (let ((buffer-read-only nil))
     (erase-buffer)
     (insert (bible--exec-diatheke (concat bible--current-book-name ":" (number-to-string bible--current-chapter))))
     ;; Parse the xml in the buffer into a DOM tree.
@@ -1751,11 +1746,8 @@ If optional argument VERSE is supplied, set cursor at verse."
     (save-excursion
       (while (re-search-forward "  *" nil t) ; More than one space in a row
         (just-one-space)))
-    ;; Set the mode line of the biffer.
-    (setq-local bible-lex (when bible-has-lexemes " Lex"))
-    (setq-local bible-morph (when bible-has-morphemes " Morph"))
-    (force-mode-line-update))
-    ;; If optional verse specification go to that verse.
+    (force-mode-line-update)) ; Ensure mode line indicators are correct.
+  ;; If optional verse specification go to that verse.
   (when verse 
     (re-search-forward (concat " ?" (number-to-string verse)) nil t 1)))