emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/jinx fe82400abb: jinx--word-valid-p: Allow capitalized


From: ELPA Syncer
Subject: [elpa] externals/jinx fe82400abb: jinx--word-valid-p: Allow capitalized words (See #96)
Date: Fri, 28 Jul 2023 12:58:03 -0400 (EDT)

branch: externals/jinx
commit fe82400abbd324ceb6e3c4c2df1a619588021e8e
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    jinx--word-valid-p: Allow capitalized words (See #96)
---
 CHANGELOG.org | 5 +++++
 jinx.el       | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index 3eb4bd425b..a62c978471 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -2,6 +2,11 @@
 #+author: Daniel Mendler
 #+language: en
 
+* Development
+
+- Allow capitalized form of a word if non-capitalized word is stored in the
+  session word list.
+
 * Version 0.9 (2023-07-02)
 
 - 🪄 Make sure that Emojis are not marked as misspelled 🧙🏼‍♀️.
diff --git a/jinx.el b/jinx.el
index c526bd71e6..44bfd79a72 100644
--- a/jinx.el
+++ b/jinx.el
@@ -352,8 +352,15 @@ Predicate may return a position to skip forward.")
 
 (defun jinx--word-valid-p (start)
   "Return non-nil if word at START is valid."
-  (let ((word (buffer-substring-no-properties start (point))))
+  (let ((word (buffer-substring-no-properties start (point)))
+        case-fold-search)
     (or (member word jinx--session-words)
+        ;; Allow capitalized words
+        (and (string-match-p "\\`[[:upper:]]" word)
+             (cl-loop
+              for w in jinx--session-words
+              thereis (and (eq t (compare-strings word 0 1   w 0 1   t))
+                           (eq t (compare-strings word 1 nil w 1 nil nil)))))
         (cl-loop for dict in jinx--dicts
                  thereis (jinx--mod-check dict word)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]