all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* question on key bindings: minor-mode map vs minibuffer map
@ 2007-01-10  7:40 Drew Adams
  2007-01-10 15:34 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2007-01-10  7:40 UTC (permalink / 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: question on key bindings: minor-mode map vs minibuffer map
  2007-01-10  7:40 question on key bindings: minor-mode map vs minibuffer map Drew Adams
@ 2007-01-10 15:34 ` Stefan Monnier
  2007-01-10 16:39   ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2007-01-10 15:34 UTC (permalink / raw)
  Cc: Emacs-Devel

> In the case of `S-tab', the `minibuffer-local-completion-map' binding of
> `S-tab' is manifested.

That is *very* strange.

> In the case of `C-y', the minor-mode binding of `C-y'
> is manifested.

That's normal.

> 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?

The minibuffer map is the keymap used as local map in the minibuffer, so
just like any other local map in any other buffer it does not take
precedence over a minor mode map.


        Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: question on key bindings: minor-mode map vs minibuffer map
  2007-01-10 15:34 ` Stefan Monnier
@ 2007-01-10 16:39   ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2007-01-10 16:39 UTC (permalink / raw)


> > In the case of `S-tab', the `minibuffer-local-completion-map' binding of
> > `S-tab' is manifested.
> 
> That is *very* strange. 
...
> The minibuffer map is the keymap used as local map in the minibuffer, so
> just like any other local map in any other buffer it does not take
> precedence over a minor mode map.

Thx.  (Followed up with Stefan and the code off list.)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-10 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-10  7:40 question on key bindings: minor-mode map vs minibuffer map Drew Adams
2007-01-10 15:34 ` Stefan Monnier
2007-01-10 16:39   ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.