unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: question on key bindings: minor-mode map vs minibuffer map
Date: Tue, 9 Jan 2007 23:40:36 -0800	[thread overview]
Message-ID: <BDEIJAFNGDOAGCJIPKPBCEOGCBAA.drew.adams@oracle.com> (raw)

I'd appreciate any help understanding this.

I think I treat the bindings of `S-tab' and `C-y' the same in my code, but
the behavior is not the same. In both cases, I have a minor-mode binding and
a `minibuffer-local-completion-map' binding. The minor mode is a global
minor mode.

During minibuffer completion:

In the case of `S-tab', the `minibuffer-local-completion-map' binding of
`S-tab' is manifested. In the case of `C-y', the minor-mode binding of `C-y'
is manifested. I don't understand why there is this difference, or how to
control this.

I do this:

(define-key my-minor-mode-map
            [(control ?y)] 'c-y-minor)
(define-key my-minor-mode-map
            [S-tab]        's-tab-minor)

(define-key minibuffer-local-completion-map
            [(control ?y)] 'c-y-minibuf)
(define-key minibuffer-local-completion-map
            [S-tab]        's-tab-minibuf)

The bindings appear as I would expect in the keymaps:

my-minor-mode-map:
(keymap
 (S-tab . s-tab-minor)
 (25 . c-y-minor)
 ...)

minibuffer-local-completion-map:
(keymap
 ...
 (S-tab . s-tab-minibuf)
 ...
 (25 . c-y-minibuf)
 ...)

The relative order of the two bindings is the same in each map.

I'm confused at this point. I would expect the same behavior for both
`S-tab' and `C-y' - why are they different?

If they were the same, it's not clear to me which behavior would be
expected, that of `C-y', where the minor-mode binding overrides in the
minibuffer or that of `S-tab', where the minibuffer binding overrides in the
minibuffer.

The doc speaks about which maps take precedence over which other maps, but
it doesn't speak of minibuffer maps in that context. In the place where
minibuffer maps are discussed, they are referred to as "local" keymaps, so
presumably what is said in the keymap section about local keymaps would
pertain to them. IIUC, the doc says that minor-mode maps override local
maps, if there is no `overriding-local-map'. My `overriding-*map's are nil.

So, a first question I have is what is supposed to happen when both
minor-mode and minibuffer bindings exist for the same key - which is
supposed to be manifested during completion?

My main question is how to get the minibuffer binding to override in the
minibuffer - that is, how to get the `C-y' bindings to behave like the
`S-tab' bindings. Any help would be appreciated.

             reply	other threads:[~2007-01-10  7:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-10  7:40 Drew Adams [this message]
2007-01-10 15:34 ` question on key bindings: minor-mode map vs minibuffer map Stefan Monnier
2007-01-10 16:39   ` 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=BDEIJAFNGDOAGCJIPKPBCEOGCBAA.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).