diff options
| author | Philip Kaludercic | 2025-10-28 20:15:23 +0100 |
|---|---|---|
| committer | Philip Kaludercic | 2025-11-01 20:52:05 +0100 |
| commit | 3dacd8b41a0ffc8a56c4beff29b7dfc39bee27f7 (patch) | |
| tree | 4b3a46a30475d58b61a591244786fb7161b4ca28 | |
| parent | fbb7eb5686b699cdaa78e31236c0d750631edde3 (diff) | |
| download | emacs-3dacd8b41a0ffc8a56c4beff29b7dfc39bee27f7.tar.gz emacs-3dacd8b41a0ffc8a56c4beff29b7dfc39bee27f7.zip | |
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)
| -rw-r--r-- | lisp/emacs-lisp/map.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index 1e88630959d..fb43f53d5b1 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el | |||
| @@ -405,7 +405,11 @@ If MAP is a plist, TESTFN defaults to `eq'." | |||
| 405 | 405 | ||
| 406 | (cl-defmethod map-contains-key ((map hash-table) key &optional _testfn) | 406 | (cl-defmethod map-contains-key ((map hash-table) key &optional _testfn) |
| 407 | "Return non-nil if MAP contains KEY, ignoring TESTFN." | 407 | "Return non-nil if MAP contains KEY, ignoring TESTFN." |
| 408 | (hash-table-contains-p key map)) | 408 | ;; FIXME: use `hash-table-contains-p' from Compat when available. |
| 409 | (if (fboundp 'hash-table-contains-p) | ||
| 410 | (hash-table-contains-p key map) | ||
| 411 | (let ((v '(nil))) | ||
| 412 | (not (eq v (gethash key map v)))))) | ||
| 409 | 413 | ||
| 410 | (cl-defgeneric map-some (pred map) | 414 | (cl-defgeneric map-some (pred map) |
| 411 | "Return the first non-nil value from applying PRED to elements of MAP. | 415 | "Return the first non-nil value from applying PRED to elements of MAP. |