From 3dacd8b41a0ffc8a56c4beff29b7dfc39bee27f7 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 28 Oct 2025 20:15:23 +0100 Subject: [PATCH] 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) --- lisp/emacs-lisp/map.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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'." (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.