Explorar o código

Use correct mode for term xref lookups.

Fred Gilham hai 1 semana
pai
achega
4027f5d4ba
Modificáronse 1 ficheiros con 12 adicións e 12 borrados
  1. 12 12
      bible.el

+ 12 - 12
bible.el

@@ -425,14 +425,14 @@ 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 [mouse-1] 'bible-search-mode-follow-verse)
+(define-key bible-search-mode-map (kbd "RET") 'bible-follow-verse)
+(define-key bible-search-mode-map [mouse-1] 'bible-follow-verse)
 
 ;;;;; Term mode keymaps
 
 (defconst bible-term-mode-map (make-sparse-keymap))
 (define-key bible-term-mode-map "z" 'text-scale-adjust)
-(define-key bible-term-mode-map [mouse-1] 'bible-search-mode-follow-xref)
+(define-key bible-term-mode-map [mouse-1] 'bible-follow-xref)
 
 (defconst bible-greek-keymap (make-sparse-keymap))
 (define-key bible-greek-keymap (kbd "RET") 'bible--display-greek)
@@ -922,8 +922,8 @@ or `multiword'.  `lucene' is the default search.
     (let ((searchmode (completing-read "Search Mode: " '("lucene" "phrase" "regex" "multiword") nil t "lucene")))
       (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.
+(defun bible-follow-verse ()
+  "Follow the hovered verse in a bible search mode buffer.
 Create a new `bible' buffer positioned at the selected verse."
   (interactive)
   (let* ((text (thing-at-point 'line t))
@@ -940,18 +940,19 @@ Create a new `bible' buffer positioned at the selected verse."
       (setq verse (substring (match-string 0 text) 1))
       (bible-open (string-trim book) (string-to-number chapter) (string-to-number verse)) bible-text)))
 
-(defun bible-search-mode-follow-xref ()
+(defun bible-follow-xref ()
   "Follow the hovered verse in a bible term buffer.
 Create a new `bible' buffer positioned at the specified verse.
 Handle abbreviations."
   (interactive)
+;;  (message "Following xref.")
   (let ((xref (get-text-property (point) 'xref)))
     (when xref
       (let ((verse-ref (split-string xref))
             book-abbrev
             chapter-verse)
-        (message "xref: %s" xref)
-        (message "Verse-ref: %s" verse-ref)
+;;        (message "xref: %s" xref)
+;;        (message "Verse-ref: %s" verse-ref)
         (cond ((= (length verse-ref) 2) ; Mat 5 or the like
                (setq book-abbrev (car verse-ref)
                      chapter-verse (split-string (cadr verse-ref) ":")))
@@ -1395,12 +1396,11 @@ stored in `bible-chapter-title'."
           ;; <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-book-p nil)
-                (set-chapter-p nil))
+          (let ((set-chapter-p nil))
             (when (string-match ".* " b-ref)
               (setq-local bible-current-xref-book (match-string 0 b-ref))
 ;;              (message "Setting book to |%s|" bible-current-xref-book)
-              (setq set-book-p t))
+              )
             (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))))))
 ;;              (message "Setting chapter to |%s|" bible-current-xref-chapter)
@@ -1788,7 +1788,7 @@ This command is run by clicking on text, not directly by the user."
               (start (match-beginning 0))
               (end (match-end 0)))
           (put-text-property start end 'xref match)
-          (put-text-property start end 'keymap bible-search-mode-map)
+          (put-text-property start end 'keymap bible-term-mode-map)
           (put-text-property start end 'help-echo (concat "Go to " (substring-no-properties match)))
           (add-face-text-property start end '(:foreground "blue")))))
     (save-excursion