1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

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'.
This commit is contained in:
Stefan Kangas 2025-03-29 13:50:21 +01:00
parent dd0dd87e3a
commit f60fc1287d
7 changed files with 16 additions and 22 deletions

View file

@ -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.