|
|
@@ -82,7 +82,7 @@
|
|
|
(global-eldoc-mode -1)
|
|
|
|
|
|
;;;; Requirements
|
|
|
-(require 'cl-lib)
|
|
|
+(require 'cl-lib) ; Required by `dom' and `shr', might as well use it.
|
|
|
(require 'dom)
|
|
|
(require 'shr)
|
|
|
(require 'menu+ nil t) ; If you have it, it looks nice.
|
|
|
@@ -187,7 +187,6 @@ See `bible--display-lemma-hebrew'."
|
|
|
|
|
|
(defcustom bible-hebrew-lexicon-short
|
|
|
"StrongsRealHebrew"
|
|
|
-;; "StrongsHebrew"
|
|
|
"Lexicon used for displaying definitions of Hebrew words in tooltips."
|
|
|
:type '(string :tag "Lexicon module (e.g. \"StrongsRealHebrew\")")
|
|
|
:local nil
|
|
|
@@ -334,8 +333,8 @@ See `bible--display-lemma-hebrew'."
|
|
|
|
|
|
;;;;; Misc key bindings
|
|
|
|
|
|
-(define-key bible-map "T" 'bible-select-text)
|
|
|
-(define-key bible-map "C" 'bible-select-commentary)
|
|
|
+(define-key bible-map "T" 'bible-select-text-module)
|
|
|
+(define-key bible-map "C" 'bible-select-commentary-module)
|
|
|
(define-key bible-map "w" 'bible-toggle-word-study)
|
|
|
(define-key bible-map "l" 'bible-toggle-red-letter)
|
|
|
|
|
|
@@ -457,12 +456,12 @@ See `bible--display-lemma-hebrew'."
|
|
|
|
|
|
;;;;; Module choice keymaps.
|
|
|
(defconst bible-text-map (make-keymap))
|
|
|
-(define-key bible-text-map [mouse-1] 'bible-pick-text)
|
|
|
-(define-key bible-text-map (kbd "RET") 'bible-pick-text)
|
|
|
+(define-key bible-text-map [mouse-1] 'bible-pick-text-module)
|
|
|
+(define-key bible-text-map (kbd "RET") 'bible-pick-text-module)
|
|
|
|
|
|
(defconst bible-commentary-map (make-keymap))
|
|
|
-(define-key bible-commentary-map [mouse-1] 'bible-pick-commentary)
|
|
|
-(define-key bible-commentary-map (kbd "RET") 'bible-pick-commentary)
|
|
|
+(define-key bible-commentary-map [mouse-1] 'bible-pick-commentary-module)
|
|
|
+(define-key bible-commentary-map (kbd "RET") 'bible-pick-commentary-module)
|
|
|
|
|
|
|
|
|
;;;; Variable definitions
|
|
|
@@ -635,7 +634,7 @@ to all of them.")
|
|
|
|
|
|
;;;;; Book / chapter
|
|
|
|
|
|
-(defvar-local bible--current-book (assoc "Genesis" bible--books)
|
|
|
+(defvar-local bible--current-book-entry (assoc "Genesis" bible--books)
|
|
|
"Current book data (name . chapter).")
|
|
|
|
|
|
(defvar-local bible--current-book-name "Genesis"
|
|
|
@@ -786,23 +785,28 @@ Mostly in Psalms, like `Of David' or the like.")
|
|
|
|
|
|
;;;;; Commands (interactive)
|
|
|
|
|
|
-(defun bible-open (&optional module book-name chapter verse buffer)
|
|
|
+;;;###autoload
|
|
|
+(defun bible-open (&optional book-name chapter verse module buffer)
|
|
|
"Create and open a `bible' buffer.
|
|
|
Optional arguments BOOK-NAME, CHAPTER and VERSE, when supplied, give the
|
|
|
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."
|
|
|
+specifies the module to use. Optional argument BUFFER will use that
|
|
|
+buffer instead of creating a new one."
|
|
|
(interactive)
|
|
|
(with-current-buffer (or buffer (get-buffer-create "*bible*"))
|
|
|
(bible)
|
|
|
(when module (setq-local bible-text module))
|
|
|
(setq-local bible-buffer-type 'text
|
|
|
mode-name (concat "Text " bible-text))
|
|
|
+ (bible--set-location
|
|
|
+ (assoc (or book-name "Genesis") bible--books)
|
|
|
+ (or chapter 1)
|
|
|
+ (or verse 1))
|
|
|
(cl-pushnew (current-buffer) bible--text-buffers)
|
|
|
- (bible--set-location (assoc (or book-name "Genesis") bible--books) (or chapter 1) (or verse 1))
|
|
|
(set-window-buffer (get-buffer-window (current-buffer)) (current-buffer))))
|
|
|
|
|
|
-(defun commentary-open (&optional module book-name chapter verse buffer)
|
|
|
+(defun commentary-open (&optional book-name chapter verse module buffer)
|
|
|
"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
|
|
|
@@ -814,11 +818,13 @@ Optional argument BUFFER gives a buffer into which to render the text."
|
|
|
(unless old-buffer (error "No current buffer! How did this happen!"))
|
|
|
(with-current-buffer (or buffer (get-buffer-create "*comm*"))
|
|
|
(bible)
|
|
|
- (when module (setq-default bible-commentary module))
|
|
|
+ (when module
|
|
|
+ (setq-local bible-commentary module))
|
|
|
(setq-local bible-buffer-type 'commentary
|
|
|
- bible-associated-buffer (cl-first bible--text-buffers)
|
|
|
- bible-text (default-value 'bible-commentary)
|
|
|
- mode-name (concat "Commentary " bible-text))
|
|
|
+ bible-text bible-commentary
|
|
|
+ mode-name (concat "Commentary " bible-text)
|
|
|
+ ;; This is used for chasing cross-references.
|
|
|
+ bible-associated-buffer (cl-first bible--text-buffers))
|
|
|
(bible--set-location
|
|
|
(assoc (or book-name "Genesis") bible--books)
|
|
|
(or chapter 1)
|
|
|
@@ -834,10 +840,12 @@ Optional argument BUFFER gives a buffer into which to render the text."
|
|
|
(bible--display (or verse 1)))
|
|
|
|
|
|
(defun bible--set-location (book chapter &optional verse)
|
|
|
- "Set the BOOK, CHAPTER and optionally VERSE of the active `bible' buffer."
|
|
|
+ "Set the BOOK, CHAPTER and optionally VERSE of the active `bible' buffer.
|
|
|
+If there are synchronized buffers, set their locations as well."
|
|
|
(let ((buffer (current-buffer)))
|
|
|
- (setq-local bible--current-book book)
|
|
|
+ (setq-local bible--current-book-entry book)
|
|
|
(bible--do-set-location (car book) chapter (or verse 1))
|
|
|
+ ;; Handle synchronized buffers.
|
|
|
(when (cl-find buffer bible--synced-buffers)
|
|
|
(dolist (buf bible--synced-buffers)
|
|
|
(unless (eq buf buffer)
|
|
|
@@ -848,32 +856,30 @@ Optional argument BUFFER gives a buffer into which to render the text."
|
|
|
"Page to the next chapter for the active `bible' buffer and
|
|
|
for any synchronized buffers."
|
|
|
(interactive)
|
|
|
- (let* ((book-chapters (cdr bible--current-book))
|
|
|
+ (let* ((book-chapters (cdr bible--current-book-entry))
|
|
|
(chapter (min book-chapters (1+ bible--current-chapter))))
|
|
|
- (bible--set-location bible--current-book chapter)))
|
|
|
+ (bible--set-location bible--current-book-entry chapter)))
|
|
|
|
|
|
(defun bible-previous-chapter ()
|
|
|
"Page to the previous chapter for the active `bible' buffer and
|
|
|
for any synchronized buffers."
|
|
|
(interactive)
|
|
|
(let ((chapter (max 1 (1- bible--current-chapter))))
|
|
|
- (bible--set-location bible--current-book chapter)))
|
|
|
-
|
|
|
-(defun bible-next-word ()
|
|
|
- "Move forward a word, taking into account the relevant text properties."
|
|
|
- (interactive)
|
|
|
- (unless (eobp)
|
|
|
- (let ((next-change (text-property-search-forward 'strong nil nil t)))
|
|
|
- (when next-change
|
|
|
- (goto-char (1- (prop-match-end next-change)))))))
|
|
|
-
|
|
|
-(defun bible-previous-word ()
|
|
|
- "Move back a word, taking into account the relevant text properties."
|
|
|
- (interactive)
|
|
|
- (unless (bobp)
|
|
|
- (let ((previous-change (text-property-search-backward 'strong)))
|
|
|
- (when previous-change
|
|
|
- (goto-char (prop-match-beginning previous-change))))))
|
|
|
+ (bible--set-location bible--current-book-entry chapter)))
|
|
|
+
|
|
|
+(defun bible-next-word (next-word)
|
|
|
+ "Move forward a word, taking into account the relevant text properties.
|
|
|
+Note that we stay on the word so that clicking or hitting return will
|
|
|
+bring up the term dispplay for that word."
|
|
|
+ (interactive (list (unless (eobp) (text-property-search-forward 'strong nil nil t))))
|
|
|
+ (when next-word (goto-char (1- (prop-match-end next-word)))))
|
|
|
+
|
|
|
+(defun bible-previous-word (previous-word)
|
|
|
+ "Move back a word, taking into account the relevant text properties.
|
|
|
+Note that we stay on the word so that clicking or hitting return will
|
|
|
+bring up the term dispplay for that word."
|
|
|
+ (interactive (list (unless (bobp) (text-property-search-backward 'strong))))
|
|
|
+ (when previous-word (goto-char (prop-match-beginning previous-word))))
|
|
|
|
|
|
;;;;;; Select Location
|
|
|
|
|
|
@@ -893,41 +899,42 @@ for any synchronized buffers."
|
|
|
(?3 (setq book-data (cons (concat "III" (substring book-data-string 1)) (cdr book-data)))))
|
|
|
(bible--set-location book-data chapter)))
|
|
|
|
|
|
+
|
|
|
(defun bible-select-chapter ()
|
|
|
"Ask user for a new chapter for the current `bible' buffer."
|
|
|
(interactive)
|
|
|
- (let* ((book-chapters (cdr bible--current-book))
|
|
|
+ (let* ((book-chapters (cdr bible--current-book-entry))
|
|
|
(chapter (string-to-number
|
|
|
(completing-read
|
|
|
"Chapter [1]: "
|
|
|
(bible--list-number-range 1 book-chapters) nil t nil nil "1"))))
|
|
|
(when chapter
|
|
|
- (bible--set-location bible--current-book chapter))))
|
|
|
+ (bible--set-location bible--current-book-entry chapter))))
|
|
|
|
|
|
;;;;;; Choose modules, either by keystroke or by choosing from a list.
|
|
|
|
|
|
-(defun bible-pick-text ()
|
|
|
+(defun bible-pick-text-module ()
|
|
|
"Select a text from a list. Re-use the buffer listing the texts. Called
|
|
|
by the menu item `Select Text'."
|
|
|
(interactive)
|
|
|
(let ((item (get-text-property (point) 'module)))
|
|
|
(rename-buffer "*bible*" t)
|
|
|
- (bible-open item
|
|
|
- bible--current-book-name
|
|
|
+ (bible-open bible--current-book-name
|
|
|
bible--current-chapter
|
|
|
- 1
|
|
|
+ 1
|
|
|
+ item
|
|
|
(current-buffer))))
|
|
|
|
|
|
-(defun bible-pick-commentary ()
|
|
|
+(defun bible-pick-commentary-module ()
|
|
|
"Select a commentary from a list. Re-use the buffer listing the commentaries.
|
|
|
Called by the menu item `Select Commentary'."
|
|
|
(interactive)
|
|
|
(let ((item (get-text-property (point) 'module)))
|
|
|
(rename-buffer "*comm*" t)
|
|
|
- (commentary-open item
|
|
|
- bible--current-book-name
|
|
|
- bible--current-chapter
|
|
|
+ (commentary-open bible--current-book-name
|
|
|
+ bible--current-chapter
|
|
|
1
|
|
|
+ item
|
|
|
(current-buffer))))
|
|
|
|
|
|
(defun bible--new-window (name)
|
|
|
@@ -938,7 +945,7 @@ Returns the new buffer."
|
|
|
(other-window 1)
|
|
|
(generate-new-buffer name))
|
|
|
|
|
|
-(defun bible-select-text (text)
|
|
|
+(defun bible-select-text-module (text)
|
|
|
"Prompt for a new text module for the current `bible' buffer.
|
|
|
Replace current text in buffer. With prefix argument or if called from a
|
|
|
commentary window, use new buffer and new window."
|
|
|
@@ -948,13 +955,13 @@ commentary window, use new buffer and new window."
|
|
|
(bible--new-window "*bible*")
|
|
|
(current-buffer))
|
|
|
(setq-local bible-text text)
|
|
|
- (bible-open text
|
|
|
- bible--current-book-name
|
|
|
- bible--current-chapter
|
|
|
- 1
|
|
|
+ (bible-open bible--current-book-name
|
|
|
+ bible--current-chapter
|
|
|
+ 1
|
|
|
+ text
|
|
|
(current-buffer)))))
|
|
|
|
|
|
-(defun bible-select-commentary (commentary)
|
|
|
+(defun bible-select-commentary-module (commentary)
|
|
|
"Promp for a new commentary module for the current `commentary' buffer.
|
|
|
Replace current text in buffer. With prefix argument or if called from a
|
|
|
text window, split window and put commentary in a new buffer in a new
|
|
|
@@ -965,10 +972,10 @@ window."
|
|
|
(bible--new-window "*comm*")
|
|
|
(current-buffer))
|
|
|
(setq-local bible-commentary commentary)
|
|
|
- (commentary-open commentary
|
|
|
- bible--current-book-name
|
|
|
- bible--current-chapter
|
|
|
- 1
|
|
|
+ (commentary-open bible--current-book-name
|
|
|
+ bible--current-chapter
|
|
|
+ 1
|
|
|
+ commentary
|
|
|
(current-buffer)))))
|
|
|
|
|
|
;;;;;; Toggles
|
|
|
@@ -1013,10 +1020,10 @@ window."
|
|
|
(defun bible-split-display ()
|
|
|
"Copy the active `bible' buffer into a new buffer in another window."
|
|
|
(interactive)
|
|
|
- (bible-open bible-text
|
|
|
- bible--current-book-name
|
|
|
+ (bible-open bible--current-book-name
|
|
|
bible--current-chapter
|
|
|
1
|
|
|
+ bible-text
|
|
|
(bible--new-window "*bible*")))
|
|
|
|
|
|
;;;;;; Search helpers
|
|
|
@@ -1030,10 +1037,13 @@ window."
|
|
|
(setq bible-search-range range))))
|
|
|
|
|
|
(defun bible-search (query searchmode)
|
|
|
- "Search for a QUERY: a word or phrase.
|
|
|
-Asks the user for type of search: either `lucene', `phrase', `regex'
|
|
|
-or `multiword'. `lucene' is the default search.
|
|
|
-`lucene' mode requires an index to be built using the `mkfastmod' program."
|
|
|
+ "Search for a QUERY with search mode SEARCHMODE.
|
|
|
+Searches are done using the diatheke search modes. See diatheke for
|
|
|
+more information.
|
|
|
+First ask for the query and then ask the user for search mode: either
|
|
|
+`lucene', `phrase', `regex' or `multiword'. `lucene' is the default search.
|
|
|
+`lucene' mode requires an index to be built for the module being searched
|
|
|
+using the `mkfastmod' program."
|
|
|
(interactive (let ((query (read-string "Query: ")))
|
|
|
(if (> (length query) 0)
|
|
|
(list query (completing-read "Search Mode: " '("lucene" "phrase" "regex" "multiword") nil t "lucene"))
|
|
|
@@ -1043,59 +1053,54 @@ or `multiword'. `lucene' is the default search.
|
|
|
(bible--open-search query searchmode (buffer-local-value 'bible-text (current-buffer)))))
|
|
|
|
|
|
|
|
|
-(defun bible--lookup-abbrev (name)
|
|
|
- "Find the canonican book entry for NAME in bible--books."
|
|
|
- (or (cl-find name bible--books :key #'car :test #'string-equal-ignore-case)
|
|
|
+(defun bible--lookup-name (name)
|
|
|
+ "Find the canonical book entry for NAME in bible--books. First check in
|
|
|
+the bible--books list to see if NAME is the canonical name. If not,
|
|
|
+check if NAME is an abbreviation. If so, look up the abbreviation and
|
|
|
+get the canonical name from there. Once we have the canonical name, use
|
|
|
+that to look up the book entry."
|
|
|
+ (or (cl-find name
|
|
|
+ bible--books :key #'car :test #'string-equal-ignore-case)
|
|
|
(cl-find (alist-get name bible--book-name-abbreviations nil nil #'string-equal-ignore-case)
|
|
|
- bible--books
|
|
|
- :key #'car
|
|
|
- :test #'string-equal-ignore-case)))
|
|
|
+ bible--books :key #'car :test #'string-equal-ignore-case)))
|
|
|
|
|
|
-(defun bible-follow-verse ()
|
|
|
- "Follow the hovered verse in a bible search mode buffer.
|
|
|
+(defun bible-follow-verse (verse-ref)
|
|
|
+ "Follow VERSE-REF obtained from a bible search mode buffer.
|
|
|
Create a new `bible' buffer positioned at the selected verse."
|
|
|
- (interactive)
|
|
|
- (let ((verse-ref (thing-at-point 'line t)))
|
|
|
- (when (string-match bible--verse-regexp verse-ref)
|
|
|
- (let* ((verse-ref-string (match-string 0 verse-ref))
|
|
|
- (book (when (string-match "I?I?I? ?[A-Z]?[a-z]* " verse-ref-string)
|
|
|
- (string-trim (match-string 0 verse-ref-string))))
|
|
|
- (chapter (when (string-match "[0-9]?[0-9]?[0-9]?:" verse-ref-string)
|
|
|
- (string-to-number
|
|
|
- (substring verse-ref-string (match-beginning 0) (1- (match-end 0))))))
|
|
|
- (verse (when (string-match ":[0-9]?[0-9]?[0-9]?" verse-ref-string)
|
|
|
- (string-to-number (substring (match-string 0 verse-ref-string) 1)))))
|
|
|
- (pop-to-buffer bible-reference-buffer)
|
|
|
- (bible--set-location (assoc book bible--books) chapter verse)))))
|
|
|
-
|
|
|
-(defun bible-follow-xref ()
|
|
|
- "Follow the hovered verse in a bible term or commentary buffer.
|
|
|
+ (interactive (list (thing-at-point 'line t)))
|
|
|
+ (when (string-match bible--verse-regexp verse-ref)
|
|
|
+ (let* ((ref-string (match-string 0 verse-ref))
|
|
|
+ (book (when (string-match "I?I?I? ?[A-Z]?[a-z]* " ref-string)
|
|
|
+ (string-trim (match-string 0 ref-string))))
|
|
|
+ (chapter (when (string-match "[0-9]?[0-9]?[0-9]?:" ref-string)
|
|
|
+ (string-to-number
|
|
|
+ (substring ref-string (match-beginning 0) (1- (match-end 0))))))
|
|
|
+ (verse (when (string-match ":[0-9]?[0-9]?[0-9]?" ref-string)
|
|
|
+ (string-to-number (substring (match-string 0 ref-string) 1)))))
|
|
|
+ (pop-to-buffer bible-reference-buffer)
|
|
|
+ (bible--set-location (assoc book bible--books) chapter verse))))
|
|
|
+
|
|
|
+(defun bible-follow-xref (verse-ref)
|
|
|
+ "Follow VERSE-REF in a bible term or commentary buffer.
|
|
|
Create a new `bible' buffer positioned at the specified verse.
|
|
|
Handle abbreviations."
|
|
|
- (interactive)
|
|
|
- (let ((xref (get-text-property (point) 'xref)))
|
|
|
- (when xref
|
|
|
- (let ((verse-ref (split-string xref))
|
|
|
- book-abbrev
|
|
|
- chapter-verse)
|
|
|
- (cond ((= (length verse-ref) 2) ; Mat 5 or the like
|
|
|
- (setq book-abbrev (car verse-ref)
|
|
|
- chapter-verse (split-string (cadr verse-ref) ":")))
|
|
|
- ((= (length verse-ref) 3) ; II Cor 3:17 or the like
|
|
|
- (setq book-abbrev (concat (car verse-ref) " " (cadr verse-ref))
|
|
|
- chapter-verse (split-string (caddr verse-ref) ":")))
|
|
|
- (t (error "Invalid verse ref %s" verse-ref)))
|
|
|
- ;; Use book abbreviation if present or try whatever is in verse-ref.
|
|
|
- (let ((book (or (alist-get book-abbrev
|
|
|
- bible--book-name-abbreviations
|
|
|
- nil
|
|
|
- nil
|
|
|
- #'string-equal-ignore-case)
|
|
|
- (car verse-ref)))
|
|
|
- (chapter (string-to-number (car chapter-verse)))
|
|
|
- (verse (string-to-number (cadr chapter-verse))))
|
|
|
- (pop-to-buffer (or bible-associated-buffer (cl-first bible--text-buffers)))
|
|
|
- (bible--set-location (assoc book bible--books) chapter verse))))))
|
|
|
+ (interactive (list (split-string (get-text-property (point) 'xref))))
|
|
|
+ (when verse-ref
|
|
|
+ (let* (book-abbrev
|
|
|
+ chapter-verse)
|
|
|
+ (cond ((= (length verse-ref) 2) ; Mat 5 or the like
|
|
|
+ (setq book-abbrev (cl-first verse-ref)
|
|
|
+ chapter-verse (split-string (cadr verse-ref) ":")))
|
|
|
+ ((= (length verse-ref) 3) ; II Cor 3:17 or the like
|
|
|
+ (setq book-abbrev (concat (cl-first verse-ref) " " (cl-second verse-ref))
|
|
|
+ chapter-verse (split-string (cl-third verse-ref) ":")))
|
|
|
+ (t (error "Invalid verse ref %s" verse-ref)))
|
|
|
+ ;; Use book abbreviation if present or try whatever is in verse-ref.
|
|
|
+ (let* ((book-entry (bible--lookup-name book-abbrev))
|
|
|
+ (chapter (string-to-number (cl-first chapter-verse)))
|
|
|
+ (verse (string-to-number (cl-second chapter-verse))))
|
|
|
+ (pop-to-buffer (or bible-associated-buffer (cl-first bible--text-buffers)))
|
|
|
+ (bible--set-location book-entry chapter verse)))))
|
|
|
|
|
|
|
|
|
;;;;;; User visible actions.
|
|
|
@@ -1103,17 +1108,20 @@ Handle abbreviations."
|
|
|
;; These can be called interactively if you know the Strong's number
|
|
|
;; you want to look up.
|
|
|
|
|
|
+;;;###autoload
|
|
|
(defun bible-term-hebrew (term)
|
|
|
"Query user for a Strong's Hebrew Lexicon TERM."
|
|
|
(interactive "sTerm: ")
|
|
|
(bible--open-term-hebrew term))
|
|
|
|
|
|
+;;;###autoload
|
|
|
(defun bible-term-greek (term)
|
|
|
"Query user for a Strong's Greek Lexicon TERM."
|
|
|
(interactive "sTerm: ")
|
|
|
(bible--open-term-greek term))
|
|
|
|
|
|
;; Interactively insert a verse into an arbitrary current buffer.
|
|
|
+;;;###autoload
|
|
|
(defun bible-insert ()
|
|
|
"Query user to select a verse for insertion into the current buffer."
|
|
|
(interactive)
|
|
|
@@ -1307,12 +1315,15 @@ Massage output so various cross references are usable. Returns string."
|
|
|
Returns a string that is intended to be displayed in a tooltip.
|
|
|
Uses short lexicon (e.g. StrongsRealHebrew or StrongsRealGreek)."
|
|
|
(when (string-match "[0-9]+" lemma)
|
|
|
- (bible--remove-module-name
|
|
|
- lexicon
|
|
|
- ;; Get rid of unnecessary strongs codes at the beginning.
|
|
|
- (replace-regexp-in-string
|
|
|
- ".*[0-9]+ [0-9]+ " ""
|
|
|
- (bible--lex-query (concat (match-string 0 lemma)) lexicon)))))
|
|
|
+ (let ((string
|
|
|
+ (bible--remove-module-name
|
|
|
+ lexicon
|
|
|
+ ;; Get rid of unnecessary strongs codes at the beginning. This
|
|
|
+ ;; differs between lexicon versions.
|
|
|
+ (replace-regexp-in-string
|
|
|
+ ".*[0-9]+: [0-9]+. " ""
|
|
|
+ (bible--lex-query (concat (match-string 0 lemma)) lexicon)))))
|
|
|
+ string)))
|
|
|
|
|
|
(defun bible--lookup-lex (lex)
|
|
|
"Look up lexical item LEX. This is used for tooltips.
|
|
|
@@ -1691,7 +1702,7 @@ If optional argument VERSE is supplied, set cursor at verse."
|
|
|
(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) ":")))
|
|
|
+ (let ((search-string (concat " *" (car bible--current-book-entry) " " (number-to-string bible--current-chapter) ":")))
|
|
|
;; Delete <Book Ch:> at beginning of verse, just leave verse number.
|
|
|
(while (re-search-forward search-string nil t)
|
|
|
(replace-match "")
|
|
|
@@ -1808,42 +1819,42 @@ If optional argument VERSE is supplied, set cursor at verse."
|
|
|
(erase-buffer)
|
|
|
(setq-local tab-stop-list '(25))
|
|
|
(dolist (text bible--texts)
|
|
|
- (let ((name (string-trim (car text)))
|
|
|
- (description (string-trim-left (cadr text))))
|
|
|
- (insert
|
|
|
- (propertize (string-trim name)
|
|
|
- 'face 'bold
|
|
|
- 'module name
|
|
|
- 'help-echo (concat "Select " name)
|
|
|
- 'keymap bible-text-map))
|
|
|
- (move-to-tab-stop)
|
|
|
+ (let ((name (string-trim (cl-first text)))
|
|
|
+ (description (string-trim-left (cl-second text))))
|
|
|
+ (insert (propertize (string-trim name)
|
|
|
+ 'face 'bold
|
|
|
+ 'module name
|
|
|
+ 'help-echo (concat "Select " name)
|
|
|
+ 'keymap bible-text-map))
|
|
|
+ (insert (propertize " " 'display '(space :align-to 20)))
|
|
|
(insert (format "%s\n" description)))))
|
|
|
(goto-char (point-min))
|
|
|
(pop-to-buffer (current-buffer) nil t)))
|
|
|
|
|
|
+
|
|
|
(defun bible-display-available-commentaries ()
|
|
|
"Display available modules, allow user to select."
|
|
|
(interactive)
|
|
|
- (bible--get-biblical-modules) ; Make sure lists are fresh.
|
|
|
+ (bible--get-biblical-modules) ; Make sure lists are fresh.
|
|
|
(with-current-buffer (get-buffer-create " Commentaries")
|
|
|
(bible-text-select-mode)
|
|
|
(let ((buffer-read-only nil))
|
|
|
(erase-buffer)
|
|
|
- (setq-local tab-stop-list '(25))
|
|
|
(dolist (commentary bible--commentaries)
|
|
|
- (let ((name (string-trim (car commentary)))
|
|
|
- (description (string-trim-left (cadr commentary))))
|
|
|
- (insert
|
|
|
- (propertize (string-trim name)
|
|
|
- 'face 'bold
|
|
|
- 'module name
|
|
|
- 'help-echo (concat "Select " name)
|
|
|
- 'keymap bible-commentary-map))
|
|
|
- (move-to-tab-stop)
|
|
|
+ (let ((name (string-trim (cl-first commentary)))
|
|
|
+ (description (string-trim-left (cl-second commentary))))
|
|
|
+ (insert (propertize (string-trim name)
|
|
|
+ 'face 'bold
|
|
|
+ 'module name
|
|
|
+ 'help-echo (concat "Select " name)
|
|
|
+ 'keymap bible-commentary-map))
|
|
|
+ (insert (propertize " " 'display '(space :align-to 22)))
|
|
|
(insert (format "%s\n" description)))))
|
|
|
(goto-char (point-min))
|
|
|
(pop-to-buffer (current-buffer) nil t)))
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
;;;; Bible Searching
|
|
|
|
|
|
@@ -1916,39 +1927,39 @@ If optional argument VERSE is supplied, set cursor at verse."
|
|
|
|
|
|
;;;; Terms (lemmas, morphemes)
|
|
|
(defun bible--get-lemma (language strongs)
|
|
|
- "Get the lemma from lexicon for LANGUAGE for strong's term STRONGS.
|
|
|
-Used to display lemmas in mode lines. Assumes that StrongsHebrew
|
|
|
-and StrongsGreek lexicons have been installed."
|
|
|
+ "Get the lemma from shorter lexicon for LANGUAGE for term STRONGS.
|
|
|
+Used to display lemmas in mode lines. Assumes that StrongsHebrew and
|
|
|
+StrongsGreek lexicons, or lexicons with compatible output, have been
|
|
|
+installed."
|
|
|
(let ((lemma-entry
|
|
|
(pcase language
|
|
|
('hebrew
|
|
|
- ;; Use Strong's Hebrew lexicon to look up Hebrew lemma.
|
|
|
- (bible--lex-query strongs "StrongsHebrew" ))
|
|
|
+ ;; Use shorter Hebrew lexicon to look up Hebrew lemma.
|
|
|
+ (bible--lex-query strongs bible-hebrew-lexicon-short))
|
|
|
('greek
|
|
|
- ;; Use Strong's Greek lexicon to look up Greek lemma.
|
|
|
- (bible--lex-query strongs "StrongsGreek")))))
|
|
|
+ ;; Use shorter Greek lexicon to look up Greek lemma.
|
|
|
+ (bible--lex-query strongs bible-greek-lexicon-short)))))
|
|
|
(unless (equal lemma-entry "")
|
|
|
- ;; Entry will look like <num>: <num>. <lemma> <definition>. Get
|
|
|
- ;; rid of everything before and after <lemma>.
|
|
|
- (let* ((lemma-line (split-string lemma-entry))
|
|
|
- (lemma (caddr lemma-line)))
|
|
|
- lemma))))
|
|
|
-
|
|
|
-(defun bible--display-greek ()
|
|
|
- "Display Greek term.
|
|
|
+ ;; Entry will look something like
|
|
|
+ ;; <num>: <num>. <lemma> <definition>.
|
|
|
+ ;; Get rid of everything before and after <lemma>.
|
|
|
+ (let* ((lemma-line (split-string lemma-entry)))
|
|
|
+ (cl-third lemma-line)))))
|
|
|
+
|
|
|
+
|
|
|
+(defun bible--display-greek (term)
|
|
|
+ "Display Greek TERM..
|
|
|
This command is run by clicking on text, not directly by the user."
|
|
|
- (interactive)
|
|
|
- (let ((item (car (split-string (get-text-property (point) 'strong)))))
|
|
|
- ;; Remove "strong:G" prefix
|
|
|
- (bible--open-term-greek (replace-regexp-in-string "strong:G" "" item))))
|
|
|
+ (interactive (list (car (split-string (get-text-property (point) 'strong)))))
|
|
|
+ ;; Remove "strong:G" prefix
|
|
|
+ (bible--open-term-greek (replace-regexp-in-string "strong:G" "" term)))
|
|
|
|
|
|
-(defun bible--display-hebrew ()
|
|
|
- "Display Hebrew term.
|
|
|
+(defun bible--display-hebrew (term)
|
|
|
+ "Display Hebrew TERM.
|
|
|
This command is run by clicking on text, not directly by the user."
|
|
|
- (interactive)
|
|
|
- (let ((item (car (split-string (get-text-property (point) 'strong)))))
|
|
|
- ;; Remove "strong:H" prefix and any alphabetic suffixes.
|
|
|
- (bible--open-term-hebrew (replace-regexp-in-string "strong:H" "" item))))
|
|
|
+ (interactive (list (car (split-string (get-text-property (point) 'strong)))))
|
|
|
+ ;; Remove "strong:H" prefix and any alphabetic suffixes.
|
|
|
+ (bible--open-term-hebrew (replace-regexp-in-string "strong:H" "" term)))
|
|
|
|
|
|
;;(defun bible-display-morphology (morph)
|
|
|
;; ;; REVIEW: Do something here? (FMG 5-Mar-2026)
|