[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Function for deleting a key binding in a sparse keymap
From: |
Stefan Monnier |
Subject: |
Re: Function for deleting a key binding in a sparse keymap |
Date: |
Mon, 05 Dec 2005 14:42:26 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> It would be good to have a function like this in Emacs:
> (defun delete-key-in-sparse-map(sparse-map key)
> "In the sparse keymap SPARSE-MAP remove KEY.
> In a sparse keymap if a key is bound to nil that means that
> invoking that key find no binding in that map. If instead there
> is no binding at all then the default value if any in that keymap
> is used. This function removes any binding of KEY in the sparse
> keymap SPARSE-MAP so that the default value will be used.
> If SPARSE-MAP is not a sparse keymap an error is raised."
> ...
> )
> However I do not know how to implement this for different formats for
> specifying the key.
There is no reason to limit this to sparse keymaps. AFAIK the problem that
a sparse keymap had all keys bound to nil has been solved. It seems that
I forgot to update the corresponding documentation. I've just installed the
patch below.
Stefan
--- keymaps.texi 22 aoû 2005 10:23:52 -0400 1.68
+++ keymaps.texi 05 déc 2005 14:38:12 -0500
@@ -158,17 +158,6 @@
bindings. A keymap with such a char-table is called a @dfn{full
keymap}. Other keymaps are called @dfn{sparse keymaps}.
-When a keymap contains a char-table vector, it always defines a
-binding for each character without modifiers. However, if the binding
-is @code{nil}, it doesn't constitute a definition. @code{nil} takes
-precedence over a default binding or a binding in the parent keymap.
-So in a full keymap, default bindings are not meaningful for
-characters without modifiers. They can still apply to characters with
-modifier bits and to non-character events. A binding of @code{nil}
-does @emph{not} override lower-precedence keymaps; thus, if the local
-map gives a binding of @code{nil}, Emacs uses the binding from the
-global map.
-
@item @var{string}
@cindex keymap prompt string
@cindex overall prompt string
@@ -178,6 +167,13 @@
use the keymap as a menu. @xref{Defining Menus}.
@end table
+When the binding is @code{nil}, it doesn't constitute a definition
+but it does take precedence over a default binding or a binding in the
+parent keymap. On the other hand, a binding of @code{nil} does
address@hidden override lower-precedence keymaps; thus, if the local map
+gives a binding of @code{nil}, Emacs uses the binding from the
+global map.
+
@cindex meta characters lookup
Keymaps do not directly record bindings for the meta characters.
Instead, meta characters are regarded for purposes of key lookup as
- Re: Function for deleting a key binding in a sparse keymap, (continued)
- Re: Function for deleting a key binding in a sparse keymap, Lennart Borgman, 2005/12/06
- Re: Function for deleting a key binding in a sparse keymap, Stefan Monnier, 2005/12/06
- Re: Function for deleting a key binding in a sparse keymap, Lennart Borgman, 2005/12/06
- Re: Function for deleting a key binding in a sparse keymap, Stefan Monnier, 2005/12/06
- Re: Function for deleting a key binding in a sparse keymap, Lennart Borgman, 2005/12/07
- Re: Function for deleting a key binding in a sparse keymap, Lennart Borgman, 2005/12/07
- Re: Function for deleting a key binding in a sparse keymap, Lennart Borgman, 2005/12/07
- Re: Function for deleting a key binding in a sparse keymap, Kim F. Storm, 2005/12/08
- Re: Function for deleting a key binding in a sparse keymap, Richard M. Stallman, 2005/12/07
- Re: Function for deleting a key binding in a sparse keymap, Lennart Borgman, 2005/12/07
Re: Function for deleting a key binding in a sparse keymap,
Stefan Monnier <=
Re: Function for deleting a key binding in a sparse keymap, LENNART BORGMAN, 2005/12/08
- Re: Function for deleting a key binding in a sparse keymap, Kim F. Storm, 2005/12/08
- Re: Function for deleting a key binding in a sparse keymap, Stefan Monnier, 2005/12/08
- Re: Function for deleting a key binding in a sparse keymap, Lennart Borgman, 2005/12/08
- Re: Function for deleting a key binding in a sparse keymap, Stefan Monnier, 2005/12/08
- Re: Function for deleting a key binding in a sparse keymap, Lennart Borgman, 2005/12/08
- Re: Function for deleting a key binding in a sparse keymap, Kim F. Storm, 2005/12/09
- Re: Function for deleting a key binding in a sparse keymap, Richard M. Stallman, 2005/12/09
- Re: Function for deleting a key binding in a sparse keymap, Lennart Borgman, 2005/12/09