mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-16 08:50:08 +00:00
Don't add a key binding when REMOVE is non-nil
* src/keymap.c (store_in_keymap): Don't add a nil keybinding if we've been asked to remove a non-existent binding. (Bug#62207)
This commit is contained in:
parent
a4a9ffdd80
commit
bb3e0ded9e
1 changed files with 16 additions and 15 deletions
31
src/keymap.c
31
src/keymap.c
|
@ -887,22 +887,23 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx,
|
||||||
keymap_end:
|
keymap_end:
|
||||||
/* We have scanned the entire keymap, and not found a binding for
|
/* We have scanned the entire keymap, and not found a binding for
|
||||||
IDX. Let's add one. */
|
IDX. Let's add one. */
|
||||||
{
|
if (!remove)
|
||||||
Lisp_Object elt;
|
{
|
||||||
|
Lisp_Object elt;
|
||||||
|
|
||||||
if (CONSP (idx) && CHARACTERP (XCAR (idx)))
|
if (CONSP (idx) && CHARACTERP (XCAR (idx)))
|
||||||
{
|
{
|
||||||
/* IDX specifies a range of characters, and not all of them
|
/* IDX specifies a range of characters, and not all of them
|
||||||
were handled yet, which means this keymap doesn't have a
|
were handled yet, which means this keymap doesn't have a
|
||||||
char-table. So, we insert a char-table now. */
|
char-table. So, we insert a char-table now. */
|
||||||
elt = Fmake_char_table (Qkeymap, Qnil);
|
elt = Fmake_char_table (Qkeymap, Qnil);
|
||||||
Fset_char_table_range (elt, idx, NILP (def) ? Qt : def);
|
Fset_char_table_range (elt, idx, NILP (def) ? Qt : def);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
elt = Fcons (idx, def);
|
elt = Fcons (idx, def);
|
||||||
CHECK_IMPURE (insertion_point, XCONS (insertion_point));
|
CHECK_IMPURE (insertion_point, XCONS (insertion_point));
|
||||||
XSETCDR (insertion_point, Fcons (elt, XCDR (insertion_point)));
|
XSETCDR (insertion_point, Fcons (elt, XCDR (insertion_point)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue