summaryrefslogtreecommitdiff
path: root/src/keymap.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-06-18 14:06:00 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-06-18 14:06:30 +0200
commit0dc75daf1189d2327c6efa4d747fa98fcba03ea3 (patch)
treeff53b16faa9c8fef8530590abca8f8e99ba44ccb /src/keymap.c
parentd7265d58f8dbab8049be4be0fa3f474e7fef7be6 (diff)
downloademacs-0dc75daf1189d2327c6efa4d747fa98fcba03ea3.tar.gz
Filter out NS non-key events from `where-is-internal'
* doc/lispref/keymaps.texi (Scanning Keymaps): Document it. * lisp/keymap.el (make-non-key-event): New function. * lisp/term/common-win.el (x-setup-function-keys): Mark ns events as not being keys (bug#55940). * src/keymap.c (Fwhere_is_internal): Filter out key sequences that are marked as being non-keys.
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/keymap.c b/src/keymap.c
index c8b01eed6fd..2b77a7fc444 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2596,7 +2596,10 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
- If DEFINITION is remapped to OTHER-COMMAND, normally return the
bindings for OTHER-COMMAND. But if NO-REMAP is non-nil, return the
- bindings for DEFINITION instead, ignoring its remapping. */)
+ bindings for DEFINITION instead, ignoring its remapping.
+
+Keys that are represented as events that have a `non-key-event' non-nil
+symbol property are ignored. */)
(Lisp_Object definition, Lisp_Object keymap, Lisp_Object firstonly, Lisp_Object noindirect, Lisp_Object no_remap)
{
/* The keymaps in which to search. */
@@ -2720,7 +2723,12 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
/* It is a true unshadowed match. Record it, unless it's already
been seen (as could happen when inheriting keymaps). */
- if (NILP (Fmember (sequence, found)))
+ if (NILP (Fmember (sequence, found))
+ /* Filter out non key events. */
+ && !(VECTORP (sequence)
+ && ASIZE (sequence) == 1
+ && SYMBOLP (AREF (sequence, 0))
+ && !NILP (Fget (AREF (sequence, 0), Qnon_key_event))))
found = Fcons (sequence, found);
/* If firstonly is Qnon_ascii, then we can return the first
@@ -3461,4 +3469,6 @@ that describe key bindings. That is why the default is nil. */);
DEFSYM (Qkey_parse, "key-parse");
DEFSYM (Qkey_valid_p, "key-valid-p");
+
+ DEFSYM (Qnon_key_event, "non-key-event");
}