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:
committed by
Philip Kaludercic
parent
fbb7eb5686
commit
3dacd8b41a
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user