From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: ffap bindings suggestion
Date: Sun, 12 Feb 2006 07:51:25 -0800 [thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICIEIMDCAA.drew.adams@oracle.com> (raw)
In-Reply-To: <87lkwgd7bx.fsf-monnier+emacs@gnu.org>
In one of my libraries, I use a minor mode, and restore the
original bindings when the mode is exited. I find that
clean. However, the library currently just restores the vanilla
Emacs (-q) bindings; it would of course be better to save the
bindings at the time of entry into the mode, and restore those
(original user bindings) when the mode is exited. I'm not
referring here to a keymap that is local to the mode; in my
case, the minor mode changes minibuffer key bindings. (Using a
local keymap is obviously the way to go when appropriate.)
Is there no recommended way (or recommended ways) to handle
this? It's not uncommon for a library to let users adopt the
library's suggested (multiple, often global) bindings in some
easy way. Perhaps we should come up with a recommended way for
libraries to do that. That way should, in the best case, let
users get back their original bindings when they no longer want
to use the features of the library.
No ideas/opinions on this?
Too general for me to answer. I'm not really sure what you're
talking about. Make it more concrete.
When minor mode is turned on:
(substitute-key-definition 'scroll-up 'foobar-cmd
minibuffer-local-completion-map
global-map)
When it is turned off:
(substitute-key-definition 'scroll-up nil
minibuffer-local-completion-map
global-map)
That's what I do: bind keys that are bound globally to `scroll-up' to
`foobar-cmd' in minibuffer-local-completion-map. Then restore those
keys to their original bindings in minibuffer-local-completion-map.
I'm asking for a recommended way to accomplish this.
I think you've already seen here some example code that modifies a
keymap and then restores the original one, using inheritance (so the
"save" and the "restore" of changed key-bindings are done in one
step each).
Could you please point to that information (discussion). I searched
for "inherit" + "map", but I didn't notice it.
Again, the need is to modify an existing keymap (such as
minibuffer-local-completion-map), not to use another keymap. Existing
code expects to use the existing map.
next prev parent reply other threads:[~2006-02-12 15:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-08 18:46 ffap bindings suggestion Drew Adams
2006-02-09 17:33 ` Juri Linkov
2006-02-09 18:13 ` Drew Adams
2006-02-12 1:56 ` Drew Adams
2006-02-12 13:43 ` Stefan Monnier
2006-02-12 15:51 ` Drew Adams [this message]
2006-02-12 17:15 ` Stefan Monnier
2006-02-12 17:34 ` Drew Adams
2006-02-12 20:48 ` Stefan Monnier
2006-02-12 21:19 ` Drew Adams
2006-02-13 5:06 ` Stefan Monnier
2006-02-13 15:29 ` Drew Adams
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=DNEMKBNJBGPAOPIJOOICIEIMDCAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
/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).