[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/spell-fu 53bd2b24c6 81/86: Cleanup: add spell-fu--canonica
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/spell-fu 53bd2b24c6 81/86: Cleanup: add spell-fu--canonicalize-word utility function |
Date: |
Thu, 7 Jul 2022 12:03:45 -0400 (EDT) |
branch: elpa/spell-fu
commit 53bd2b24c6a72af90b7d4313b5403fa52e010287
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Cleanup: add spell-fu--canonicalize-word utility function
---
spell-fu.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/spell-fu.el b/spell-fu.el
index 334254fa4e..10208ba902 100644
--- a/spell-fu.el
+++ b/spell-fu.el
@@ -160,6 +160,10 @@ Notes:
;; ---------------------------------------------------------------------------
;; Dictionary Utility Functions
+(defsubst spell-fu--canonicalize-word (word)
+ "Return lowercase UTF-8 encoded WORD."
+ (encode-coding-string (downcase word) 'utf-8))
+
(defun spell-fu--default-dictionaries ()
"Construct the default value of `spell-fu-dictionaries'."
(nconc
@@ -209,7 +213,7 @@ already contain WORD."
(let
(
(adding (eq action 'add))
- (encoded-word (encode-coding-string (downcase word) 'utf-8)))
+ (encoded-word (spell-fu--canonicalize-word word)))
(delq
nil
(mapcar
@@ -373,7 +377,7 @@ save some time by not spending time reading it back."
(while (not (eobp))
(let ((l (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
;; Value of 't' is just for simplicity, it's no used except for
check the item exists.
- (puthash (encode-coding-string (downcase l) 'utf-8) t word-table)
+ (puthash (spell-fu--canonicalize-word l) t word-table)
(forward-line 1))))
;; Write write it to a file.
@@ -473,7 +477,7 @@ Marking the spelling as incorrect using
`spell-fu-incorrect-face' on failure.
Argument POS-BEG the beginning position of WORD.
Argument POS-END the end position of WORD."
;; Dictionary search.
- (unless (spell-fu--check-word-in-dict-list (encode-coding-string (downcase
word) 'utf-8))
+ (unless (spell-fu--check-word-in-dict-list (spell-fu--canonicalize-word
word))
;; Ignore all uppercase words.
(unless (equal word (upcase word))
;; Mark as incorrect otherwise.
@@ -962,7 +966,7 @@ Return t when the word has been added."
"Add to dictionary: ")))
(let ((word (spell-fu--word-at-point)))
(if dict
- (let ((encoded-word (encode-coding-string (downcase word) 'utf-8)))
+ (let ((encoded-word (spell-fu--canonicalize-word word)))
(funcall (get dict 'add-word) encoded-word)
(puthash encoded-word t (symbol-value dict))
t)
@@ -980,7 +984,7 @@ Return t when the word has been removed."
"Remove from dictionary: ")))
(let ((word (spell-fu--word-at-point)))
(if dict
- (let ((encoded-word (encode-coding-string (downcase
(spell-fu--word-at-point)) 'utf-8)))
+ (let ((encoded-word (spell-fu--canonicalize-word word)))
(funcall (get dict 'remove-word) encoded-word)
(remhash encoded-word (symbol-value dict))
t)
- [nongnu] elpa/spell-fu 676498f757 13/86: Support buffer local dictionaries, (continued)
- [nongnu] elpa/spell-fu 676498f757 13/86: Support buffer local dictionaries, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 073932be78 16/86: Cleanup: replace '(nth 5 ...' with file-attribute-modification-time, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 2c792330ac 18/86: Case insensitive sort lines as a list (not in the buffer), ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 03114080c8 20/86: Add requirements at the top of the file, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu fe557e3dff 21/86: Be explicit about using macro that sets values in-place, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 33a28e0df5 41/86: fix: encode word to utf-8 generating the cache, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 7770c005c4 47/86: Cleanup minor name change for spell-fu function name, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 866044304f 50/86: Check if faces can be used on property change, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 8f780a874c 66/86: Reduce idle overlay fragmentation, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 4fc84a9028 69/86: Fix spell-fu-directory's documentation, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 53bd2b24c6 81/86: Cleanup: add spell-fu--canonicalize-word utility function,
ELPA Syncer <=
- [nongnu] elpa/spell-fu a5a06e150a 02/86: Fix error comparing times of cache to word-list, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu bd00417a0e 09/86: Improve status messages when generating word-list & cache, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu afeb1fd46f 10/86: readme: add some TODO's, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu b7e5cf3d73 11/86: Fix missing checks that ispell variables are bound before use, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 30be3683b2 12/86: readme: update settings docs, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 18724c2e53 14/86: Avoid potentially accessing the same files time multiple times, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 8e8711f1fa 22/86: Add TODO's to the readme, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu 88d803e994 26/86: Cleanup: use updated auto-formatting results, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu db0eef27ab 33/86: Add: spell-fu-goto-next-error, spell-fu-goto-previous-error, ELPA Syncer, 2022/07/07
- [nongnu] elpa/spell-fu a7db587471 36/86: Remove redundant escaping, ELPA Syncer, 2022/07/07