emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

question on key bindings: minor-mode map vs minibuffer map


From: Drew Adams
Subject: question on key bindings: minor-mode map vs minibuffer map
Date: Tue, 9 Jan 2007 23:40:36 -0800

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 via email to

[Prev in Thread] Current Thread [Next in Thread]