GNU bug report logs -
#78834
Feature request: make keymapp dereference symbol value slot
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Currently keymapp returns nil, when passed a symbol if a keymap
object is only in a symbol's value slot, but not fbound:
(keymapp emacs-lisp-mode-map) => t
(keymapp 'emacs-lisp-mode-map) => nil
(boundp 'emacs-lisp-mode-map) => t
(fboundp 'emacs-lisp-mode-map) => nil
Keymapp uses internally get_keymap to check if an object is a keymap,
and get_keymap does not check value slot of symbols. However, the
comment above says:
"Check that OBJECT is a keymap (after dereferencing through any
symbols). If it is, return it."
Now, I don't know why is it the case, why the value slot is not
derefenced. I guess it is by design; after all this time this function
is in existence, that must be known. I don't understand the reason
though, by just looking at it at the moment, so I do wonder why is it
so?
Anyway, that leaves me in a bit awkward situation where I can ask a
question: (keymapp some-symbol) and get two different answers:
(keymapp 'emacs-lisp-mode-map) => nil
(keymapp 'vc-mode-map) => t
because one is fbound and the other is not. The background for this is
that I want to collect all loaded keymaps in the system:
(defun collect-keymaps ()
(cl-loop for k being the symbol when (keymapp k) collect k))
But I don't get them all, since keymapp won't recognize those that are
not fbound. That makes the whole thing quite less effective, since I
have to additionally check if a symbol is bound and if its symbol value
is a keymap.
As a suggestion, the attached patch dereferences symbol value slots as
well. If it is not a wrong thing to do for some reason I am not aware
of, I would like to suggest it as a "fix" or a "feature request",
whichever is best describing the issue.
[Message part 2 (text/html, inline)]
[0001-Make-get_keymap-dereference-symbol-value-slot.patch (application/octet-stream, attachment)]
This bug report was last modified 12 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.