* org-mode-map binds [tab]
[not found] ` <3209a500-8654-2508-3b1a-34a73edc0053@daniel-mendler.de>
@ 2021-06-27 15:34 ` Daniel Mendler
2021-07-01 10:17 ` Nicolas Goaziou
2021-07-09 1:39 ` Barton, Mark
2021-06-27 15:37 ` Bug: org-mode-map binds tab [9.4.6 (9.4.6-gab9f2a @ /home/user/.config/emacs/elpa/org-9.4.6/)] Daniel Mendler
1 sibling, 2 replies; 5+ messages in thread
From: Daniel Mendler @ 2021-06-27 15:34 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Stefan Monnier
`org-mode-map` binds `[tab]` which is unnecessary and harmful, since it
takes precendence over bindings of TAB even in keymaps with higher
precedence.
Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.5, cairo version 1.16.0)
of 2021-02-09, modified by Debian
Package: Org mode version 9.4.6 (9.4.6-gab9f2a @
/home/user/.config/emacs/elpa/org-9.4.6/)
----
I've observed this problem with my GNU ELPA package Corfu, which
installs a keymap with higher precedence than org-mode. In order to
override Org, it also has to bind [tab], which is undesired.
On 6/27/21 11:11 AM, Daniel Mendler wrote:
> On 6/26/21 4:02 PM, Stefan Monnier wrote:
>>> + (define-key map [tab] #'corfu-complete)
>>
>> Please avoid binding `tab`: the `tab` event (only generated under GUIs)
>> is supposed to be remapped to the TAB char-event (aka `C-i`) and this is
>> what you should bind to if you want your binding to work both under ttys
>> and GUIs.
>>
>> More importantly, if you bind to `tab` than this binding will take
>> precedence over all other bindings to TAB, even those in keymaps that
>> have higher precedence.
>>
>> The same holds for `return` vs RET, and `escape` vs ESC.
>
> Hello Stefan,
>
> I am aware of the unfortunate implications of these bindings.
> Originally I avoided these bindings for the exact reasons you mention
> and I hoped I could do without those (only binding RET/TAB and
> remappings). However I have to use these keys since Org-mode seems to
> override these keys too. Otherwise my keymap will not take precedence
> over the Org-mode keymap.
>
> Daniel
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Bug: org-mode-map binds tab [9.4.6 (9.4.6-gab9f2a @ /home/user/.config/emacs/elpa/org-9.4.6/)]
[not found] ` <3209a500-8654-2508-3b1a-34a73edc0053@daniel-mendler.de>
2021-06-27 15:34 ` org-mode-map binds [tab] Daniel Mendler
@ 2021-06-27 15:37 ` Daniel Mendler
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Mendler @ 2021-06-27 15:37 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Stefan Monnier
`org-mode-map` binds `[tab]` which is unnecessary and harmful, since it
takes precendence over bindings of TAB even in keymaps with higher
precedence.
Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.5, cairo version 1.16.0)
of 2021-02-09, modified by Debian
Package: Org mode version 9.4.6 (9.4.6-gab9f2a @
/home/user/.config/emacs/elpa/org-9.4.6/)
----
I've observed this problem with my GNU ELPA package Corfu, which
installs a keymap with higher precedence than org-mode. In order to
override Org, it also has to bind [tab], which is undesired.
On 6/27/21 11:11 AM, Daniel Mendler wrote:
> On 6/26/21 4:02 PM, Stefan Monnier wrote:
>>> + (define-key map [tab] #'corfu-complete)
>>
>> Please avoid binding `tab`: the `tab` event (only generated under GUIs)
>> is supposed to be remapped to the TAB char-event (aka `C-i`) and this is
>> what you should bind to if you want your binding to work both under ttys
>> and GUIs.
>>
>> More importantly, if you bind to `tab` than this binding will take
>> precedence over all other bindings to TAB, even those in keymaps that
>> have higher precedence.
>>
>> The same holds for `return` vs RET, and `escape` vs ESC.
>
> Hello Stefan,
>
> I am aware of the unfortunate implications of these bindings.
> Originally I avoided these bindings for the exact reasons you mention
> and I hoped I could do without those (only binding RET/TAB and
> remappings). However I have to use these keys since Org-mode seems to
> override these keys too. Otherwise my keymap will not take precedence
> over the Org-mode keymap.
>
> Daniel
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-mode-map binds [tab]
2021-06-27 15:34 ` org-mode-map binds [tab] Daniel Mendler
@ 2021-07-01 10:17 ` Nicolas Goaziou
2021-07-09 1:39 ` Barton, Mark
1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2021-07-01 10:17 UTC (permalink / raw)
To: Daniel Mendler; +Cc: emacs-orgmode, Stefan Monnier
Hello,
Daniel Mendler <mail@daniel-mendler.de> writes:
> `org-mode-map` binds `[tab]` which is unnecessary and harmful, since it
> takes precendence over bindings of TAB even in keymaps with higher
> precedence.
Thou shalt not have precedence over Org mode!
Fixed.
Thank you!
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-mode-map binds [tab]
2021-06-27 15:34 ` org-mode-map binds [tab] Daniel Mendler
2021-07-01 10:17 ` Nicolas Goaziou
@ 2021-07-09 1:39 ` Barton, Mark
2021-07-09 3:01 ` Stefan Monnier
1 sibling, 1 reply; 5+ messages in thread
From: Barton, Mark @ 2021-07-09 1:39 UTC (permalink / raw)
To: Daniel Mendler; +Cc: emacs-orgmode@gnu.org, Stefan Monnier
With Emacs compiled from master, after Nicolas Goaziou's fix to remove the <tab> binding, my tab key was no longer bound to org-cycle, but instead to outline-cycle from outline.el
If I comment out line 185 in outline.el then TAB will bind to org-cycle.
Does outline.el need to be fixed too?
——snippet from outline.el
(defvar outline-mode-cycle-map
(let ((map (make-sparse-keymap)))
(let ((tab-binding `(menu-item
"" outline-cycle
;; Only takes effect if point is on a heading.
:filter ,(lambda (cmd)
(when (outline-on-heading-p) cmd)))))
(define-key map [tab] tab-binding)
(define-key map (kbd "TAB") tab-binding)
(define-key map (kbd "<backtab>") #'outline-cycle-buffer))
map)
"Keymap used by `outline-mode-map' and `outline-minor-mode-cycle'.")
I don’t see outline as a minor mode listed when I use C-h m while in an org file expecting org-cycle.
Mark
> On Jun 27, 2021, at 8:34 AM, Daniel Mendler <mail@daniel-mendler.de> wrote:
>
> `org-mode-map` binds `[tab]` which is unnecessary and harmful, since it
> takes precendence over bindings of TAB even in keymaps with higher
> precedence.
>
> Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.5, cairo version 1.16.0)
> of 2021-02-09, modified by Debian
> Package: Org mode version 9.4.6 (9.4.6-gab9f2a @
> /home/user/.config/emacs/elpa/org-9.4.6/)
>
> ----
>
> I've observed this problem with my GNU ELPA package Corfu, which
> installs a keymap with higher precedence than org-mode. In order to
> override Org, it also has to bind [tab], which is undesired.
>
> On 6/27/21 11:11 AM, Daniel Mendler wrote:
>> On 6/26/21 4:02 PM, Stefan Monnier wrote:
>>>> + (define-key map [tab] #'corfu-complete)
>>>
>>> Please avoid binding `tab`: the `tab` event (only generated under GUIs)
>>> is supposed to be remapped to the TAB char-event (aka `C-i`) and this is
>>> what you should bind to if you want your binding to work both under ttys
>>> and GUIs.
>>>
>>> More importantly, if you bind to `tab` than this binding will take
>>> precedence over all other bindings to TAB, even those in keymaps that
>>> have higher precedence.
>>>
>>> The same holds for `return` vs RET, and `escape` vs ESC.
>>
>> Hello Stefan,
>>
>> I am aware of the unfortunate implications of these bindings.
>> Originally I avoided these bindings for the exact reasons you mention
>> and I hoped I could do without those (only binding RET/TAB and
>> remappings). However I have to use these keys since Org-mode seems to
>> override these keys too. Otherwise my keymap will not take precedence
>> over the Org-mode keymap.
>>
>> Daniel
>>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-mode-map binds [tab]
2021-07-09 1:39 ` Barton, Mark
@ 2021-07-09 3:01 ` Stefan Monnier
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2021-07-09 3:01 UTC (permalink / raw)
To: Barton, Mark; +Cc: Juri Linkov, Daniel Mendler, emacs-orgmode@gnu.org
> Does outline.el need to be fixed too?
[...]
> ——snippet from outline.el
> (defvar outline-mode-cycle-map
> (let ((map (make-sparse-keymap)))
> (let ((tab-binding `(menu-item
> "" outline-cycle
> ;; Only takes effect if point is on a heading.
> :filter ,(lambda (cmd)
> (when (outline-on-heading-p) cmd)))))
> (define-key map [tab] tab-binding)
> (define-key map (kbd "TAB") tab-binding)
> (define-key map (kbd "<backtab>") #'outline-cycle-buffer))
> map)
> "Keymap used by `outline-mode-map' and `outline-minor-mode-cycle'.")
Very much so, indeed, thanks.
I just pushed that change to `master`.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-11 12:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210626095705.11804.96621@vcs0.savannah.gnu.org>
[not found] ` <20210626095707.B514720D0A@vcs0.savannah.gnu.org>
[not found] ` <jwvo8bspw03.fsf-monnier+emacs@gnu.org>
[not found] ` <3209a500-8654-2508-3b1a-34a73edc0053@daniel-mendler.de>
2021-06-27 15:34 ` org-mode-map binds [tab] Daniel Mendler
2021-07-01 10:17 ` Nicolas Goaziou
2021-07-09 1:39 ` Barton, Mark
2021-07-09 3:01 ` Stefan Monnier
2021-06-27 15:37 ` Bug: org-mode-map binds tab [9.4.6 (9.4.6-gab9f2a @ /home/user/.config/emacs/elpa/org-9.4.6/)] Daniel Mendler
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.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).