[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Key-binding without minor mode!
From: |
Phillip Lord |
Subject: |
Re: Key-binding without minor mode! |
Date: |
Fri, 12 Sep 2014 10:50:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> But if the major-mode defines binds to [tab] then it will override the
>> minor mode.
>
> Indeed. It might be a bug in the major-mode, tho (which manifests
> for example under ttys where the TAB key sends a \t rather than a `tab').
Oh, dear, yes. So binding to [tab] in my minor mode is a mistake. I need
to bind to both \t and [tab]. If I bind to just \t then a major mode can
override this by binding [tab]. If I bind, though, to just [tab] then I
have no binding in tty.
>
>> I think I have no choice but to handle tab explicitly. Is [tab] the only
>> key that works like this?
>
> No. What you're trying to do is inherently tricky/fiddly/unreliable
> because Emacs's key-binding infrastructure is not designed for that.
>
Yep. I've ended up with this. I've had to do something similar for
return which does the same thing.
(defun pabbrev-get-previous-binding ()
"Show the binding of tab if pabbrev were not active.
The command `pabbrev-show-previous-binding' prints this out."
(let ((pabbrev-mode nil))
(let ((tckv
(if pabbrev-xemacs-p
(this-command-keys)
(this-command-keys-vector))))
(cond
((or (equal tckv [tab])
(equal tckv [9]))
(or (key-binding [tab]) (key-binding "\t")))
((or (equal tckv [return])
(equal tckv [32]))
(or (key-binding [return]) (key-binding "\n")))
(t
(key-binding tckv))))))
> You might want to report a bug asking for some feature that lets you do
> what you want (which I suspect is something like "let my command
> delegate to the next command bound to this key").
Will do!
Phil
- Key-binding without minor mode!, Phillip Lord, 2014/09/11
- Re: Key-binding without minor mode!, Stefan Monnier, 2014/09/11
- Re: Key-binding without minor mode!, Phillip Lord, 2014/09/11
- Re: Key-binding without minor mode!, Stefan Monnier, 2014/09/11
- Re: Key-binding without minor mode!, Phillip Lord, 2014/09/11
- Re: Key-binding without minor mode!, Stefan Monnier, 2014/09/11
- Re: Key-binding without minor mode!,
Phillip Lord <=
- Re: Key-binding without minor mode!, Stefan Monnier, 2014/09/12
- Re: Key-binding without minor mode!, Phillip Lord, 2014/09/12
- Re: Key-binding without minor mode!, Stefan Monnier, 2014/09/12
- Re: Key-binding without minor mode!, Phillip Lord, 2014/09/15
- Re: Key-binding without minor mode!, Stefan Monnier, 2014/09/15
- Re: Key-binding without minor mode!, Phillip Lord, 2014/09/15