[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/spell-fu 95e005969d 09/21: Cleanup: replace 'if' with 'con
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/spell-fu 95e005969d 09/21: Cleanup: replace 'if' with 'cond' |
Date: |
Sat, 7 Jan 2023 07:12:28 -0500 (EST) |
branch: elpa/spell-fu
commit 95e005969dc3b04137eb88ed415b3c9fe01cec17
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Cleanup: replace 'if' with 'cond'
---
spell-fu.el | 57 +++++++++++++++++++++++++++++++++------------------------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/spell-fu.el b/spell-fu.el
index 8e87df25a5..1abe16519a 100644
--- a/spell-fu.el
+++ b/spell-fu.el
@@ -268,9 +268,11 @@ already contain WORD."
;; Operation supported?
(get
dict
- (if adding
- 'add-word
- 'remove-word))
+ (cond
+ (adding
+ 'add-word)
+ (t
+ 'remove-word)))
;; Word is / is not in dictionary?
(eq adding (null (gethash encoded-word (symbol-value dict))))
;; Result.
@@ -280,13 +282,16 @@ already contain WORD."
(defun spell-fu--read-dictionary (candidate-dicts prompt)
"Ask the user to select one dictionary from CANDIDATE-DICTS.
PROMPT is shown to the users completing read."
- (if (<= (length candidate-dicts) 1)
- (car candidate-dicts) ; Return the single choice
- (let
- (
- (completion-extra-properties
- '(:annotation-function (lambda (candidate) (get (intern candidate)
'description)))))
- (intern (completing-read prompt (mapcar #'symbol-name
candidate-dicts))))))
+ (cond
+ ((<= (length candidate-dicts) 1)
+ ;; Return the single choice
+ (car candidate-dicts))
+ (t
+ (let
+ (
+ (completion-extra-properties
+ '(:annotation-function (lambda (candidate) (get (intern candidate)
'description)))))
+ (intern (completing-read prompt (mapcar #'symbol-name
candidate-dicts)))))))
;; ---------------------------------------------------------------------------
@@ -1024,13 +1029,15 @@ Return t when the word has been added."
(spell-fu--get-edit-candidate-dictionaries (spell-fu--word-at-point)
'add)
"Add to dictionary: ")))
(let ((word (spell-fu--word-at-point)))
- (if dict
- (let ((encoded-word (spell-fu--canonicalize-word word)))
- (funcall (get dict 'add-word) encoded-word)
- (puthash encoded-word t (symbol-value dict))
- t)
- (message "Cannot add %S to any active dictionary." word)
- nil)))
+ (cond
+ (dict
+ (let ((encoded-word (spell-fu--canonicalize-word word)))
+ (funcall (get dict 'add-word) encoded-word)
+ (puthash encoded-word t (symbol-value dict))
+ t))
+ (t
+ (message "Cannot add %S to any active dictionary." word)
+ nil))))
(defun spell-fu-word-remove (dict)
"Remove the current word from the dictionary DICT.
@@ -1042,13 +1049,15 @@ Return t when the word has been removed."
(spell-fu--get-edit-candidate-dictionaries (spell-fu--word-at-point)
'remove)
"Remove from dictionary: ")))
(let ((word (spell-fu--word-at-point)))
- (if dict
- (let ((encoded-word (spell-fu--canonicalize-word word)))
- (funcall (get dict 'remove-word) encoded-word)
- (remhash encoded-word (symbol-value dict))
- t)
- (message "Cannot remove %S from any active dictionary." word)
- nil)))
+ (cond
+ (dict
+ (let ((encoded-word (spell-fu--canonicalize-word word)))
+ (funcall (get dict 'remove-word) encoded-word)
+ (remhash encoded-word (symbol-value dict))
+ t))
+ (t
+ (message "Cannot remove %S from any active dictionary." word)
+ nil))))
(defun spell-fu-dictionary-add (dict)
"Add DICT to the list of active dictionaries."
- [nongnu] elpa/spell-fu f62b6d3770 12/21: Cleanup: doc-string length, (continued)
- [nongnu] elpa/spell-fu f62b6d3770 12/21: Cleanup: doc-string length, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu be719051a6 13/21: readme: note when reset may be needed, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu f0d49dcc5a 16/21: Cleanup: emacs native format, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu d0e67cdb25 06/21: When using jit-lock-stealth, ensure words out of the view are checked, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu 341575b1d0 10/21: Adding spell-fu-debug variable & spell-fu-reset command, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu bddea99f9c 17/21: Fix #36: byte compilation error with Emacs 28.2, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu 68d33508ef 04/21: Add support for buffer local word-lists, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu b89bfe035d 20/21: Cleanup: correct typo in description, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu 0dc0568186 11/21: Update doc-string and readme for spell-fu-faces-exclude, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu 8412ba02df 03/21: Cleanup: use `zerop`, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu 95e005969d 09/21: Cleanup: replace 'if' with 'cond',
ELPA Syncer <=
- [nongnu] elpa/spell-fu 635c5c2eed 19/21: Cleanup: sharp-quote function, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu 38f4a4a275 08/21: Fix #31: Failure to detect updated symlinked dictionaries, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu 89b014194a 18/21: Cleanup: emacs native format (update), ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu 39549871c7 15/21: Cleanup: format, ELPA Syncer, 2023/01/07
- [nongnu] elpa/spell-fu 3caf7047ea 21/21: Rename functions & variables that used a global- prefix, ELPA Syncer, 2023/01/07