Prechádzať zdrojové kódy

Fix various cross-ref issues, unused lexical variable warnings

Fred Gilham 2 týždňov pred
rodič
commit
aebd479b35
1 zmenil súbory, kde vykonal 63 pridanie a 36 odobranie
  1. 63 36
      bible-mode.el

+ 63 - 36
bible-mode.el

@@ -178,44 +178,69 @@ which are of the form
   '(;; Old Testament
   '(;; Old Testament
     ("Genesis"		. 50)	("Exodus"		. 40)	("Leviticus"		. 27)	("Numbers"		. 36)
     ("Genesis"		. 50)	("Exodus"		. 40)	("Leviticus"		. 27)	("Numbers"		. 36)
     ("Deuteronomy"	. 34)	("Joshua"		. 24)	("Judges"		. 21)	("Ruth"			. 4)
     ("Deuteronomy"	. 34)	("Joshua"		. 24)	("Judges"		. 21)	("Ruth"			. 4)
-    ("I Samuel"		. 31)	("II Samuel"		. 24)	("I Kings"		. 22)	("II Kings"		. 25)
+    ("I Samuel"		. 31)	("II Samuel"		. 24)	("I Kings"		. 22)	("II Kings"		. 25)   
     ("I Chronicles"	. 29)	("II Chronicles"	. 36)	("Ezra"			. 10)	("Nehemiah"		. 13)
     ("I Chronicles"	. 29)	("II Chronicles"	. 36)	("Ezra"			. 10)	("Nehemiah"		. 13)
     ("Esther" 		. 10)	("Job"			. 42)	("Psalms"		. 150)	("Proverbs"		. 31)
     ("Esther" 		. 10)	("Job"			. 42)	("Psalms"		. 150)	("Proverbs"		. 31)
     ("Ecclesiastes"	. 12)	("Song of Solomon"	. 8)	("Isaiah"		. 66)	("Jeremiah"		. 52)
     ("Ecclesiastes"	. 12)	("Song of Solomon"	. 8)	("Isaiah"		. 66)	("Jeremiah"		. 52)
     ("Lamentations"	. 5)	("Ezekiel"		. 48)	("Daniel"		. 12)	("Hosea"		. 14)
     ("Lamentations"	. 5)	("Ezekiel"		. 48)	("Daniel"		. 12)	("Hosea"		. 14)
-    ("Joel"		. 3)	("Amos"			. 9)	("Obadiah"		. 1)	("Jonah"		. 4)
+    ("Joel"		. 3)	("Amos"			. 9)    ("Obadiah"		. 1)	("Jonah"		. 4)
     ("Micah"		. 7)	("Nahum"		. 3)	("Habakkuk"		. 3)	("Zephaniah"		. 3)
     ("Micah"		. 7)	("Nahum"		. 3)	("Habakkuk"		. 3)	("Zephaniah"		. 3)
     ("Haggai"		. 2)	("Zechariah"		. 14)	("Malachi"		. 4)
     ("Haggai"		. 2)	("Zechariah"		. 14)	("Malachi"		. 4)
     ;; New Testament
     ;; New Testament
     ("Matthew"		. 28)	("Mark"			. 16)	("Luke"			. 24)	("John"			. 21)
     ("Matthew"		. 28)	("Mark"			. 16)	("Luke"			. 24)	("John"			. 21)
     ("Acts"		. 28)	("Romans"		. 16)	("I Corinthians"	. 16)	("II Corinthians" 	. 13)
     ("Acts"		. 28)	("Romans"		. 16)	("I Corinthians"	. 16)	("II Corinthians" 	. 13)
-    ("Galatians"	. 6)	("Ephesians"		. 6)	("Philippians"		. 4)	("Colossians"		. 4)
-    ("I Thessalonians"	. 5)	("II Thessalonians"	. 3)	("I Timothy"		. 6)	("II Timothy"		. 4)
+    ("Galatians"	. 6)	("Ephesians"		. 6)	("Philippians"		. 4)	("Colossians"		. 4) 
+    ("I Thessalonians"	. 5)    ("II Thessalonians"	. 3)    ("I Timothy"		. 6)    ("II Timothy"		. 4)
     ("Titus"		. 3)	("Philemon"		. 1)	("Hebrews"		. 13)	("James"		. 5)
     ("Titus"		. 3)	("Philemon"		. 1)	("Hebrews"		. 13)	("James"		. 5)
-    ("I Peter"		. 5)	("II Peter"		. 3)	("I John"		. 5)	("II John"		. 1)
+    ("I Peter"		. 5)    ("II Peter"		. 3)    ("I John"		. 5)    ("II John"		. 1)
     ("III John"		. 1)    ("Jude"			. 1)	("Revelation of John"	. 22))
     ("III John"		. 1)    ("Jude"			. 1)	("Revelation of John"	. 22))
   "A-list of name / chapter count for Bible books.")
   "A-list of name / chapter count for Bible books.")
 
 
-(defvar bible-mode-book-name-abbreviations-alist
+
+(defvar bible-mode-book-name-abbreviations-alist ;; XXX not currently used.
   '(;; Old Testament
   '(;; Old Testament
     ("Ge"     . "Genesis")         ("Ex"    . "Exodus")           ("Le"   . "Leviticus")     ("Nu"    . "Numbers")
     ("Ge"     . "Genesis")         ("Ex"    . "Exodus")           ("Le"   . "Leviticus")     ("Nu"    . "Numbers")
-    ("De"     . "Deuteronomy")     ("Js"    . "Joshua")           ("Jg"   . "Judges")        ("Ru"    . "Ruth")
-    ("I Sa"   . "I Samuel")	   ("II Sa" . "II Samuel")        ("I Ki" . "I Kings")       ("II Ki" . "II Kings") 
-    ("I Ch"   . "I Chronicles")    ("II Ch" . "II Chronicles")    ("Ezr"  . "Ezra")          ("Ne"    . "Nehemiah")
+    ("De"     . "Deuteronomy")     ("Js"    . "Joshua")           ("Jg"   . "Judges")	     ("Judg"   . "Judges")
+    ("Ru"    . "Ruth")		   ("1 Samuel"     . "I Samuel")  ("I Sa"  . "I Samuel")     ("1 Sa" . "I Samuel")    
+    ("2 Samuel"     . "II Samuel") ("II Sa" . "II Samuel")	  ("2 Sa" . "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")
+    ("Ezr"  . "Ezra")          ("Ne"    . "Nehemiah")
     ("Es"     . "Esther")          ("Jb"    . "Job")              ("Ps"   . "Psalms")        ("Pr"    . "Proverbs")
     ("Es"     . "Esther")          ("Jb"    . "Job")              ("Ps"   . "Psalms")        ("Pr"    . "Proverbs")
     ("Ec"     . "Ecclesiastes")    ("So"    . "Song of Solomon")  ("Is"   . "Isaiah")        ("Je"    . "Jeremiah")
     ("Ec"     . "Ecclesiastes")    ("So"    . "Song of Solomon")  ("Is"   . "Isaiah")        ("Je"    . "Jeremiah")
     ("La"     . "Lamentations")    ("Ez"    . "Ezekiel")          ("Da"   . "Daniel")        ("Ho"    . "Hosea") 
     ("La"     . "Lamentations")    ("Ez"    . "Ezekiel")          ("Da"   . "Daniel")        ("Ho"    . "Hosea") 
     ("Joe"    . "Joel")	           ("Am"    . "Amos")             ("Ob"   . "Obadiah")       ("Jon"   . "Jonah")
     ("Joe"    . "Joel")	           ("Am"    . "Amos")             ("Ob"   . "Obadiah")       ("Jon"   . "Jonah")
     ("Mi"     . "Micah")           ("Na"    . "Nahum")            ("Ha"   . "Habakkuk")      ("Zep"   . "Zephaniah")     
     ("Mi"     . "Micah")           ("Na"    . "Nahum")            ("Ha"   . "Habakkuk")      ("Zep"   . "Zephaniah")     
     ("Hag"    . "Haggai")          ("Ze"    . "Zechariah")        ("Mal"  . "Malachi")
     ("Hag"    . "Haggai")          ("Ze"    . "Zechariah")        ("Mal"  . "Malachi")
+
     ;; New Testament
     ;; New Testament
-    ("Mt"     . "Matthew")         ("Mk"    . "Mark")             ("Lk"   . "Luke")          ("Jo"    . "John")
-    ("Ac"     . "Acts")            ("Ro"    . "Romans")           ("I Co" . "I Corinthians") ("II Co" . "II Corinthians")
-    ("Ga"     . "Galatians")       ("Eph"   . "Ephesians")	  ("Phl"  . "Philippians")   ("Col"   . "Colossians")
-    ("I Th"   . "I Thessalonians") ("II Th" . "II Thessalonians") ("I Ti" . "I Timothy")     ("II Ti" . "II Timothy")
-    ("Tit"    . "Titus")           ("Phm"   . "Philemon")	  ("He"   . "Hebrews")       ("Ja"    . "James")
-    ("I Pe"   . "I Peter")         ("II Pe" . "II Peter")	  ("I Jo" . "I John")        ("II Jo" . "II John")
-    ("III Jo" . "III John")        ("Ju"    . "Jude")             ("Re"   . "Revelation of John"))
+    ;; Added AbbottSmith lexicon abbreviations to allow proper following of cross references in lexicon buffers.
+    ("Mt" . "Matthew") ("Matt" . "Matthew")
+    ("Mk" . "Mark") ("Lk" . "Luke") ("Jo" . "John") ("Ac" . "Acts")
+    ("Ro" . "Romans") ("Rom" . "Romans")
+    ("1 Corintihans" . "I Corinthians") ("I Co" . "I Corinthians") ("1 Co" . "I Corinthians") ("ICor" . "I Corinthians")
+    ("2 Corinthians" . "II Corinthians") ("II Co" . "II Corinthians") ("2 Co" . "II Corinthians") ("IICor" . "II Corinthians")
+    ("Ga" . "Galatians") ("Gal" . "Galatians")
+    ("Eph" . "Ephesians")
+    ("Phl" . "Philippians") ("Phil" . "Philippians")
+    ("Col" . "Colossians")
+    ("1 Thessalonians" . "I Thessalonians")  ("I Th" . "I Thessalonians") ("1 Th" . "I Thessalonians") ("IThess" . "I Thessalonians") 
+    ("2 Thessalonians" . "II Thessalonians") ("II Th" . "II Thessalonians") ("2 Th" . "II Thessalonians") ("IIThess" . "II Thessalonians")
+    ("1 Timothy" . "I Timothy")   ("I Ti"  . "I Timothy")  ("1 Ti" . "I Timothy")  ("ITim" . "I Timothy")
+    ("2 Timothy" . "II Timothy")  ("II Ti" . "II Timothy") ("2 Ti" . "II Timothy") ("IITim" . "II Timothy")
+    ("Tit" . "Titus")           
+    ("Phm" . "Philemon") ("Phlm" . "Philemon")
+    ("He"   . "Hebrews") ("Heb"   . "Hebrews")
+    ("Ja"    . "James") ("Jas"    . "James")
+    ("1 Peter" . "I Peter")   ("I Pe"   . "I Peter")  ("1 Pe" . "I Peter")         
+    ("2 Peter" . "II Peter")  ("II Pe"  . "II Peter") ("2 Pe" . "II Peter") ("IIPet" . "II Peter")
+    ("1 John"  . "I John")    ("I Jo"   . "I John")   ("1 Jo" . "I John") ("IJohn" . "I John")
+    ("2 John"  . "II John")   ("II Jo"  . "II John")  ("2 Jo" . "II John")   ("IIJohn" . "II John")
+    ("3 John"  . "III John")  ("III Jo" . "III John") ("3 Jo" . "III John") ("IIIJohn" . "III John")
+    ("Ju"    . "Jude")             
+    ("Re"   . "Revelation of John") ("Rev"   . "Revelation of John"))
+  
   "A-list of abbreviations for Bible books.")
   "A-list of abbreviations for Bible books.")
 
 
 ;;;; Book / chapter
 ;;;; Book / chapter
@@ -378,6 +403,9 @@ which are of the form
 (defvar-local bible-mode-debugme nil
 (defvar-local bible-mode-debugme nil
   "Make text show up as XML when set.")
   "Make text show up as XML when set.")
 
 
+(defvar-local bible-mode-search-query nil
+  "Query used in toggles (word study and red letter).")
+
 (defvar use-tooltips t)
 (defvar use-tooltips t)
 
 
 (defun bible-mode-toggle-tooltips ()
 (defun bible-mode-toggle-tooltips ()
@@ -649,7 +677,8 @@ Create a new `bible-mode' buffer positioned at the selected verse."
   "Follow the hovered verse in a bible term buffer.
   "Follow the hovered verse in a bible term buffer.
 Create a new `bible-mode' buffer positioned at the specified verse.
 Create a new `bible-mode' buffer positioned at the specified verse.
 XXX We use the current module to avoid opening cans of worms regarding
 XXX We use the current module to avoid opening cans of worms regarding
-OT/NT etc. If that module doesn't have that verse...???"
+OT/NT etc. If that module doesn't have that verse...???
+Handle abbreviations from lexicon module (AbbottSmith)."
   (interactive)
   (interactive)
   (let* ((xref (get-text-property (point) 'xref))
   (let* ((xref (get-text-property (point) 'xref))
 	 (verse-ref (string-split xref))
 	 (verse-ref (string-split xref))
@@ -658,17 +687,18 @@ OT/NT etc. If that module doesn't have that verse...???"
 	 chapter-verse
 	 chapter-verse
 	 chapter
 	 chapter
 	 verse)
 	 verse)
+
     (if (= (length verse-ref) 3) ; II Cor 3:17 or the like
     (if (= (length verse-ref) 3) ; II Cor 3:17 or the like
-	(progn
-	  (setq book-abbrev (concat (car verse-ref) " " (cadr verse-ref)))
-	  (setq chapter-verse (split-string (caddr verse-ref) ":")))
-      (progn  ; Mat 5 or the like
-	(setq book-abbrev (car verse-ref))
-	(setq chapter-verse (split-string (cadr verse-ref) ":"))))
-
-    (setq book (car verse-ref))
+	(setq book-abbrev (concat (car verse-ref) (cadr verse-ref))
+	      chapter-verse (split-string (caddr verse-ref) ":"))
+      ;; Mat 5 or the like
+      (setq book-abbrev (car verse-ref)
+	    chapter-verse (split-string (cadr verse-ref) ":")))
+
+    (setq book (cdr (assoc book-abbrev bible-mode-book-name-abbreviations-alist)))
+    (unless book (setq book (car verse-ref))) ; Didn't find abbreviation
     (setq chapter (car chapter-verse)
     (setq chapter (car chapter-verse)
-	  verse (cadr chapter-verse))
+	  verse   (cadr chapter-verse))
     (bible-open (string-trim book) (string-to-number chapter) (string-to-number verse))))
     (bible-open (string-trim book) (string-to-number chapter) (string-to-number verse))))
 
 
 ;;;###autoload
 ;;;###autoload
@@ -880,21 +910,19 @@ lexical definition is set for a particular lexicon."
 		 (bible-mode--lookup-greek-def key))
 		 (bible-mode--lookup-greek-def key))
 	       greek-hash)))
 	       greek-hash)))
 
 
-(defun bible-mode--lookup-strongs-greek (window object pos)
+(defun bible-mode--lookup-strongs-greek (_window object pos)
   "Look up Greek lexical entry of OBJECT clicked on in WINDOW at POS.
   "Look up Greek lexical entry of OBJECT clicked on in WINDOW at POS.
 If not found in hash table, get it from sword database. stash in hash
 If not found in hash table, get it from sword database. stash in hash
-table, and return string.
-Note: compiler warns about unused `WINDOW' argument."
+table, and return string."
   (let ((query (get-text-property pos 'strong object)))  ; Get Strong's number from text property
   (let ((query (get-text-property pos 'strong object)))  ; Get Strong's number from text property
     (when (string-match "[0-9]+" query)
     (when (string-match "[0-9]+" query)
       (bible-mode--lookup-lex-greek (match-string 0 query)))))
       (bible-mode--lookup-lex-greek (match-string 0 query)))))
 
 
 
 
-(defun bible-mode--lookup-strongs-greek-short (window object pos)
+(defun bible-mode--lookup-strongs-greek-short (_window object pos)
   "Look up shorter Greek lexical entry of OBJECT clicked on in WINDOW at POS.
   "Look up shorter Greek lexical entry of OBJECT clicked on in WINDOW at POS.
 If not found in hash table, get it from sword database, stash in hash table, 
 If not found in hash table, get it from sword database, stash in hash table, 
-and return string.
-Note: compiler warns about unused `window' argument."
+and return string."
   (let ((query (get-text-property pos 'strong object)))  ; Get Strong's number from text property
   (let ((query (get-text-property pos 'strong object)))  ; Get Strong's number from text property
     (when (string-match "[0-9]+" query)
     (when (string-match "[0-9]+" query)
       (let ((lookup-key (match-string 0 query)))
       (let ((lookup-key (match-string 0 query)))
@@ -903,11 +931,10 @@ Note: compiler warns about unused `window' argument."
 	      (puthash lookup-key raw-text greek-hash-short)))))))
 	      (puthash lookup-key raw-text greek-hash-short)))))))
 
 
 
 
-(defun bible-mode--lookup-strongs-hebrew (window object pos)
+(defun bible-mode--lookup-strongs-hebrew (_window object pos)
   "Look up Hebrew lexical string for object at point. 
   "Look up Hebrew lexical string for object at point. 
 If not found in hash table, get it from sword database, 
 If not found in hash table, get it from sword database, 
-stash in hash table, and return string.
-Note: compiler warns about unused `window' argument."
+stash in hash table, and return string."
   (let ((query (get-text-property pos 'strong object)))
   (let ((query (get-text-property pos 'strong object)))
     (when (string-match "[0-9]+" query)
     (when (string-match "[0-9]+" query)
       (let ((lookup-key (concat "H" (match-string 0 query))))
       (let ((lookup-key (concat "H" (match-string 0 query))))
@@ -915,7 +942,7 @@ Note: compiler warns about unused `window' argument."
 	    (let ((raw-text (bible-mode--lex-query lookup-key bible-mode-hebrew-lexicon)))
 	    (let ((raw-text (bible-mode--lex-query lookup-key bible-mode-hebrew-lexicon)))
 	      (puthash lookup-key raw-text hebrew-hash)))))))
 	      (puthash lookup-key raw-text hebrew-hash)))))))
 
 
-(defun bible-mode--lookup-strongs-hebrew-short (window object pos)
+(defun bible-mode--lookup-strongs-hebrew-short (_window object pos)
   "Look up Hebrew lexical string from short Hebrew lexicon for object
   "Look up Hebrew lexical string from short Hebrew lexicon for object
 at point. If not found in hash table, get it from sword database, 
 at point. If not found in hash table, get it from sword database, 
 stash in hash table, and return string.
 stash in hash table, and return string.