diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2025-03-29 13:50:21 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2025-03-29 14:59:44 +0100 |
commit | f60fc1287d499e8c93857b1b96e8bd2467b22c8d (patch) | |
tree | 972126c3db11b14f93b352d698fd450fdddc2953 /lisp/emacs-lisp | |
parent | dd0dd87e3aaf3116c400fba858cbe35ced15f04e (diff) | |
download | emacs-f60fc1287d499e8c93857b1b96e8bd2467b22c8d.tar.gz emacs-f60fc1287d499e8c93857b1b96e8bd2467b22c8d.tar.bz2 emacs-f60fc1287d499e8c93857b1b96e8bd2467b22c8d.zip |
Use 'hash-table-contains-p' in a few places
This replaces open coded versions of the common idiom
(not (eq (gethash key table 'missing) 'missing))
with
(hash-table-contains-p key table)
in files where we can rely on features in Emacs 31.
* lisp/emacs-lisp/map.el (map-contains-key):
* lisp/external-completion.el (external-completion-table):
* lisp/mh-e/mh-utils.el (mh-sub-folders)
(mh-remove-from-sub-folders-cache):
* lisp/net/ange-ftp.el (ange-ftp-hash-entry-exists-p):
* lisp/password-cache.el (password-in-cache-p, password-cache-add):
* lisp/pcmpl-x.el (pcmpl-x-tlmgr-action-options):
* lisp/xdg.el (xdg-mime-apps): Use 'hash-table-contains-p'.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/map.el | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index 72ff5e2221d..deeeec132cf 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -403,8 +403,7 @@ If MAP is a plist, TESTFN defaults to `eq'." (cl-defmethod map-contains-key ((map hash-table) key &optional _testfn) "Return non-nil if MAP contains KEY, ignoring TESTFN." - (let ((v '(nil))) - (not (eq v (gethash key map v))))) + (hash-table-contains-p key map)) (cl-defgeneric map-some (pred map) "Return the first non-nil value from applying PRED to elements of MAP. |