From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Function for deleting a key binding in a sparse keymap
Date: Mon, 05 Dec 2005 14:42:26 -0500 [thread overview]
Message-ID: <jwvslt7pcyy.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <439382B9.7020802@student.lu.se> (Lennart Borgman's message of "Mon, 05 Dec 2005 00:58:49 +0100")
> 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
+@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.
+
@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
next prev parent reply other threads:[~2005-12-05 19:42 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-04 23:58 Function for deleting a key binding in a sparse keymap Lennart Borgman
2005-12-05 16:38 ` Richard M. Stallman
2005-12-05 16:55 ` Lennart Borgman
2005-12-06 16:42 ` Richard M. Stallman
2005-12-06 17:04 ` Lennart Borgman
2005-12-06 21:26 ` Stefan Monnier
2005-12-06 22:18 ` Lennart Borgman
2005-12-06 22:28 ` Stefan Monnier
2005-12-06 23:01 ` Lennart Borgman
2005-12-07 1:56 ` Stefan Monnier
2005-12-07 9:56 ` Lennart Borgman
2005-12-07 10:13 ` Lennart Borgman
2005-12-07 14:33 ` Lennart Borgman
2005-12-08 9:10 ` Kim F. Storm
2005-12-07 17:06 ` Richard M. Stallman
2005-12-07 17:12 ` Lennart Borgman
2005-12-05 19:42 ` Stefan Monnier [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-12-08 9:32 LENNART BORGMAN
2005-12-08 14:24 ` Kim F. Storm
2005-12-08 15:03 ` Lennart Borgman
2005-12-08 16:53 ` Stefan Monnier
2005-12-08 18:36 ` Lennart Borgman
2005-12-08 18:56 ` Stefan Monnier
2005-12-08 23:59 ` Lennart Borgman
2005-12-09 11:24 ` Kim F. Storm
2005-12-09 15:03 ` Richard M. Stallman
2005-12-09 20:12 ` Lennart Borgman
2005-12-10 4:13 ` Richard M. Stallman
2005-12-10 23:45 ` Lennart Borgman
2005-12-11 1:12 ` Stefan Monnier
2005-12-11 2:16 ` Lennart Borgman
2005-12-11 8:14 ` Stefan Monnier
2005-12-11 16:49 ` Richard M. Stallman
2005-12-11 16:49 ` Richard M. Stallman
2005-12-12 1:41 ` Lennart Borgman
2005-12-12 15:52 ` Stefan Monnier
2005-12-12 17:02 ` Lennart Borgman
2005-12-13 15:52 ` Stefan Monnier
2005-12-12 16:18 ` Richard M. Stallman
2005-12-12 19:09 ` Lennart Borgman
2005-12-13 17:50 ` Richard M. Stallman
2005-12-14 0:50 ` Lennart Borgman
2005-12-14 20:02 ` Richard M. Stallman
2005-12-10 23:40 ` Kim F. Storm
2005-12-11 0:29 ` Lennart Borgman
2005-12-11 0:54 ` Lennart Borgman
2005-12-11 16:49 ` Richard M. Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvslt7pcyy.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).