emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Bug] M-S Ret keybinding translated to M-Ret
@ 2018-02-06 20:54 Matt Lundin
  2018-02-07 21:46 ` Matt Lundin
  0 siblings, 1 reply; 7+ messages in thread
From: Matt Lundin @ 2018-02-06 20:54 UTC (permalink / raw)
  To: Org Mode

I discovered that when trying to insert a new item with a checkbox using
M-S Return (org-insert-todo-heading), the keybinding is "translated" to
M-Return (org-meta-return). As a result, all I get is simple list item
without a checkbox.

M-x describe-key [Ret] M-S Ret

...shows the following...

--8<---------------cut here---------------start------------->8---
M-RET (translated from <M-S-return>) runs the command org-meta-return
(found in org-mode-map), which is an interactive compiled Lisp
function in ‘org.el’.

It is bound to M-RET, C-c C-x RET.
 
(org-meta-return &optional ARG)
--8<---------------cut here---------------end--------------->8---

A git bisect traced the source of this problem to the following commit:

--8<---------------cut here---------------start------------->8---
6965098a5357b09575a1119074545eb708cf5944 is the first bad commit
commit 6965098a5357b09575a1119074545eb708cf5944
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date:   Mon Jan 15 16:13:37 2018 +0100

    Use a single keybinding representation

    * lisp/org.el (org-replace-disputed-keys): Fix docstring.

    Use `kbd' macro everywhere.  Also add missing "ESC" equivalents for
    "M-" bindings.
--8<---------------cut here---------------end--------------->8---

Thanks,
Matt

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

* Re: [Bug] M-S Ret keybinding translated to M-Ret
  2018-02-06 20:54 [Bug] M-S Ret keybinding translated to M-Ret Matt Lundin
@ 2018-02-07 21:46 ` Matt Lundin
  2018-02-08  5:06   ` Allen Li
  0 siblings, 1 reply; 7+ messages in thread
From: Matt Lundin @ 2018-02-07 21:46 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 325 bytes --]

Matt Lundin <mdl@imapmail.org> writes:

> I discovered that when trying to insert a new item with a checkbox using
> M-S Return (org-insert-todo-heading), the keybinding is "translated" to
> M-Return (org-meta-return). As a result, all I get is simple list item
> without a checkbox.
>

The attached patch fixes this issue.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-return-bindings.patch --]
[-- Type: text/x-patch, Size: 1333 bytes --]

From 240caa630ef053a27536fe9c4725d0480dc4c570 Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
Date: Wed, 7 Feb 2018 15:45:45 -0600
Subject: [PATCH] Fix return bindings

---
 lisp/org.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 688e48bcc..133bf038a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18859,11 +18859,11 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
 (define-key org-mode-map (kbd "<backtab>") #'org-shifttab)
 
 ;;;; RET key with modifiers
-(org-defkey org-mode-map (kbd "S-RET") #'org-table-copy-down)
-(org-defkey org-mode-map (kbd "M-S-RET") #'org-insert-todo-heading)
-(org-defkey org-mode-map (kbd "ESC S-RET") #'org-insert-todo-heading)
-(org-defkey org-mode-map (kbd "M-RET") #'org-meta-return)
-(org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return)
+(org-defkey org-mode-map (kbd "S-<return>") #'org-table-copy-down)
+(org-defkey org-mode-map (kbd "M-S-<return>") #'org-insert-todo-heading)
+(org-defkey org-mode-map (kbd "ESC S-<return>") #'org-insert-todo-heading)
+(org-defkey org-mode-map (kbd "M-<return>") #'org-meta-return)
+(org-defkey org-mode-map (kbd "ESC <return>") #'org-meta-return)
 
 ;;;; Cursor keys with modifiers
 (org-defkey org-mode-map (kbd "M-<left>") #'org-metaleft)
-- 
2.16.1


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

* Re: [Bug] M-S Ret keybinding translated to M-Ret
  2018-02-07 21:46 ` Matt Lundin
@ 2018-02-08  5:06   ` Allen Li
  2018-02-08 23:51     ` Matt Lundin
  2018-02-09 15:02     ` Matt Lundin
  0 siblings, 2 replies; 7+ messages in thread
From: Allen Li @ 2018-02-08  5:06 UTC (permalink / raw)
  To: Org Mode List

On Wed, Feb 7, 2018 at 1:47 PM Matt Lundin <mdl@imapmail.org> wrote:

> Matt Lundin <mdl@imapmail.org> writes:

> > I discovered that when trying to insert a new item with a checkbox using
> > M-S Return (org-insert-todo-heading), the keybinding is "translated" to
> > M-Return (org-meta-return). As a result, all I get is simple list item
> > without a checkbox.
> >

> The attached patch fixes this issue.

I'm pretty sure your patch would break those binding in terminal Emacs
completely, since <return>
cannot be typed in the terminal and Emacs does not remap these bindings.

Furthermore, I cannot reproduce your issue on Org mode version 9.1.6
(9.1.6-33-g5b4a71-elpaplus)

C-h C-k M-S-<return>

<M-S-return> runs the command org-insert-todo-heading (found in
org-mode-map), which is an interactive compiled Lisp function in
‘org.el’.

It is bound to <M-S-return>.

(org-insert-todo-heading ARG &optional FORCE-HEADING)

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

* Re: [Bug] M-S Ret keybinding translated to M-Ret
  2018-02-08  5:06   ` Allen Li
@ 2018-02-08 23:51     ` Matt Lundin
  2018-02-09 15:02     ` Matt Lundin
  1 sibling, 0 replies; 7+ messages in thread
From: Matt Lundin @ 2018-02-08 23:51 UTC (permalink / raw)
  To: Allen Li; +Cc: Org Mode List

Allen Li <vianchielfaura@gmail.com> writes:

> On Wed, Feb 7, 2018 at 1:47 PM Matt Lundin <mdl@imapmail.org> wrote:
>
>> Matt Lundin <mdl@imapmail.org> writes:
>
>> > I discovered that when trying to insert a new item with a checkbox using
>> > M-S Return (org-insert-todo-heading), the keybinding is "translated" to
>> > M-Return (org-meta-return). As a result, all I get is simple list item
>> > without a checkbox.
>> >
>
>> The attached patch fixes this issue.
>
> I'm pretty sure your patch would break those binding in terminal Emacs
> completely, since <return>
> cannot be typed in the terminal and Emacs does not remap these
> bindings.

Thanks for pointing this out. I hope someone who knows emacs keybindings
better can take the lead here. I was just following the example of the
following commit, which uses "<return>".

,----
| commit c3fffcd8d21f248f946e2d39d4bde3ce80dcf6d4
| Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
| Date:   Mon Jan 15 22:59:40 2018 +0100
| 
|     Fix C-<return> binding
`----

> Furthermore, I cannot reproduce your issue on Org mode version 9.1.6
> (9.1.6-33-g5b4a71-elpaplus)

That is because the version in elpa not have the problematic commit yet.
The elpa version you are using still uses old way of defining these
keys:

(org-defkey org-mode-map [(meta shift return)] 'org-insert-todo-heading)

The problematic commit (6965098a5357b09575a1119074545eb708cf5944)
changed that line to the following (along with several related changes):

(org-defkey org-mode-map (kbd "M-S-RET") #'org-insert-todo-heading)

Could you evaluate this latter line and see if you can reproduce the
problem.

Thanks,
Matt

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

* Re: [Bug] M-S Ret keybinding translated to M-Ret
  2018-02-08  5:06   ` Allen Li
  2018-02-08 23:51     ` Matt Lundin
@ 2018-02-09 15:02     ` Matt Lundin
  2018-02-09 22:56       ` Allen Li
  2018-02-10 12:53       ` Nicolas Goaziou
  1 sibling, 2 replies; 7+ messages in thread
From: Matt Lundin @ 2018-02-09 15:02 UTC (permalink / raw)
  To: Allen Li; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

Allen Li <vianchielfaura@gmail.com> writes:

> On Wed, Feb 7, 2018 at 1:47 PM Matt Lundin <mdl@imapmail.org> wrote:
>
>> Matt Lundin <mdl@imapmail.org> writes:
>
>> > I discovered that when trying to insert a new item with a checkbox using
>> > M-S Return (org-insert-todo-heading), the keybinding is "translated" to
>> > M-Return (org-meta-return). As a result, all I get is simple list item
>> > without a checkbox.
>> >
>
>> The attached patch fixes this issue.
>
> I'm pretty sure your patch would break those binding in terminal Emacs
> completely, since <return> cannot be typed in the terminal and Emacs
> does not remap these bindings.

Attached please find a more limited patch that fixes the issue in the
GUI without affecting TTY use. I have only changed bindings for the
M-S-RET or S-RET combinations. These combinations cannot be used in the
TTY anyway and Org Mode already defines alternative TTY bindings for
these combinations.

Best,
Matt


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-S-return-and-M-S-return-keybindings-for-GUI.patch --]
[-- Type: text/x-patch, Size: 1279 bytes --]

From 3ec2e2b82ff64d708286cc9f3962acad56771dfb Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
Date: Fri, 9 Feb 2018 08:52:41 -0600
Subject: [PATCH] Fix S-<return> and M-S-<return> keybindings for GUI

This prevents these key combinations from being translated to M-RET in
window systems. These bindings already have extra keys defined for
TTY.
---
 lisp/org.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 688e48bcc..e47a7e0ac 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18859,9 +18859,9 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
 (define-key org-mode-map (kbd "<backtab>") #'org-shifttab)
 
 ;;;; RET key with modifiers
-(org-defkey org-mode-map (kbd "S-RET") #'org-table-copy-down)
-(org-defkey org-mode-map (kbd "M-S-RET") #'org-insert-todo-heading)
-(org-defkey org-mode-map (kbd "ESC S-RET") #'org-insert-todo-heading)
+(org-defkey org-mode-map (kbd "S-<return>") #'org-table-copy-down)
+(org-defkey org-mode-map (kbd "M-S-<return>") #'org-insert-todo-heading)
+(org-defkey org-mode-map (kbd "ESC S-<return>") #'org-insert-todo-heading)
 (org-defkey org-mode-map (kbd "M-RET") #'org-meta-return)
 (org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return)
 
-- 
2.16.1


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

* Re: [Bug] M-S Ret keybinding translated to M-Ret
  2018-02-09 15:02     ` Matt Lundin
@ 2018-02-09 22:56       ` Allen Li
  2018-02-10 12:53       ` Nicolas Goaziou
  1 sibling, 0 replies; 7+ messages in thread
From: Allen Li @ 2018-02-09 22:56 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

Thanks, your new patch looks acceptable to me.


On Fri, Feb 9, 2018 at 7:02 AM Matt Lundin <mdl@imapmail.org> wrote:

> Allen Li <vianchielfaura@gmail.com> writes:
>
> > On Wed, Feb 7, 2018 at 1:47 PM Matt Lundin <mdl@imapmail.org> wrote:
> >
> >> Matt Lundin <mdl@imapmail.org> writes:
> >
> >> > I discovered that when trying to insert a new item with a checkbox
> using
> >> > M-S Return (org-insert-todo-heading), the keybinding is "translated"
> to
> >> > M-Return (org-meta-return). As a result, all I get is simple list item
> >> > without a checkbox.
> >> >
> >
> >> The attached patch fixes this issue.
> >
> > I'm pretty sure your patch would break those binding in terminal Emacs
> > completely, since <return> cannot be typed in the terminal and Emacs
> > does not remap these bindings.
>
> Attached please find a more limited patch that fixes the issue in the
> GUI without affecting TTY use. I have only changed bindings for the
> M-S-RET or S-RET combinations. These combinations cannot be used in the
> TTY anyway and Org Mode already defines alternative TTY bindings for
> these combinations.
>
> Best,
> Matt
>
>

[-- Attachment #2: Type: text/html, Size: 1741 bytes --]

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

* Re: [Bug] M-S Ret keybinding translated to M-Ret
  2018-02-09 15:02     ` Matt Lundin
  2018-02-09 22:56       ` Allen Li
@ 2018-02-10 12:53       ` Nicolas Goaziou
  1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2018-02-10 12:53 UTC (permalink / raw)
  To: Allen Li; +Cc: Org Mode List

Hello,

Matt Lundin <mdl@imapmail.org> writes:

> Attached please find a more limited patch that fixes the issue in the
> GUI without affecting TTY use. I have only changed bindings for the
> M-S-RET or S-RET combinations. These combinations cannot be used in the
> TTY anyway and Org Mode already defines alternative TTY bindings for
> these combinations.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2018-02-10 12:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 20:54 [Bug] M-S Ret keybinding translated to M-Ret Matt Lundin
2018-02-07 21:46 ` Matt Lundin
2018-02-08  5:06   ` Allen Li
2018-02-08 23:51     ` Matt Lundin
2018-02-09 15:02     ` Matt Lundin
2018-02-09 22:56       ` Allen Li
2018-02-10 12:53       ` Nicolas Goaziou

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).