From f60fc1287d499e8c93857b1b96e8bd2467b22c8d Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 29 Mar 2025 13:50:21 +0100 Subject: 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'. --- lisp/emacs-lisp/map.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') 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. -- cgit v1.2.3