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

Check if 'hash-table-contains-p' is available in map.el

* lisp/emacs-lisp/map.el (map-contains-key): Hide old
implementation prior to f60fc128 behind a `fboundp', as the
package is distributed on ELPA and should be backwards
compatible to Emacs 26.  (Bug#79711)
This commit is contained in:
Philip Kaludercic 2025-10-28 20:15:23 +01:00 committed by Philip Kaludercic
parent fbb7eb5686
commit 3dacd8b41a
No known key found for this signature in database

View file

@ -405,7 +405,11 @@ 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."
(hash-table-contains-p key map))
;; FIXME: use `hash-table-contains-p' from Compat when available.
(if (fboundp 'hash-table-contains-p)
(hash-table-contains-p key map)
(let ((v '(nil)))
(not (eq v (gethash key map v))))))
(cl-defgeneric map-some (pred map)
"Return the first non-nil value from applying PRED to elements of MAP.