GNU bug report logs - #38551
27.0.50; [ELPA][PATCH] debbugs: bind to RET rather than return

Previous Next

Package: emacs;

Reported by: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>

Date: Mon, 9 Dec 2019 19:29:02 UTC

Severity: normal

Tags: patch

Found in version 27.0.50

Fixed in version 27.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38551 in the body.
You can then email your comments to 38551 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38551; Package emacs. (Mon, 09 Dec 2019 19:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kévin Le Gouguec <kevin.legouguec <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 09 Dec 2019 19:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; [ELPA][PATCH] debbugs: bind to RET rather than return
Date: Mon, 09 Dec 2019 20:27:59 +0100
[Message part 1 (text/plain, inline)]
Hello,

debbugs-gnu.el binds debbugs-gnu-select-report and
debbugs-gnu-select-usertag to [return].  Unless I'm mistaken, this
designates only the function key, and terminals do not tell applications
that function keys were pressed.  In the case of [return], they only
send RET, i.e. the C-m character.

Concretely, this means that on a TTY, the return key is not bound to
those functions, as RET is bound to newline.  Pressing return thus leads
to the following error message:

> command-execute: Buffer is read-only: #<buffer *Emacs Bugs*>

(Also, weirdos like me who actually use control+m instead of the return
key are screwed on graphical sessions too.)

On the other hand, if one binds those functions to (kbd "RET") ≡ "\C-m"
≡ "\r", Emacs automatically translates [return] to RET, and everything
Just Works™.

Suggested patch:

[debbugs-RET.patch (text/x-patch, inline)]
diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el
index 5789d80db..b9d9083e3 100644
--- a/packages/debbugs/debbugs-gnu.el
+++ b/packages/debbugs/debbugs-gnu.el
@@ -987,7 +987,7 @@ Used instead of `tabulated-list-print-entry'."
   (let ((map (make-sparse-keymap))
 	(menu-map (make-sparse-keymap)))
     (set-keymap-parent map tabulated-list-mode-map)
-    (define-key map [return] #'debbugs-gnu-select-report)
+    (define-key map "\C-m" #'debbugs-gnu-select-report)
     (define-key map [mouse-2] #'debbugs-gnu-select-report)
     (define-key map "A" #'debbugs-gnu-select-current-bugs)
     (define-key map "g" #'debbugs-gnu-rescan)
@@ -2163,7 +2163,7 @@ successfully sent."
 (defvar debbugs-gnu-usertags-mode-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map tabulated-list-mode-map)
-    (define-key map [return] #'debbugs-gnu-select-usertag)
+    (define-key map "\C-m" #'debbugs-gnu-select-usertag)
     (define-key map [mouse-2] #'debbugs-gnu-select-usertag)
     map))
 
[Message part 3 (text/plain, inline)]
(I picked "\C-m" out of all possible spellings because AFAICT it's the
one that comes up most often in the Emacs source tree, but maybe it's
not the best possible one.)

Thank you for your time.


References:

- (emacs) Keymaps

> Most modern  keyboards have function  keys as well  as character
> keys.  Function  keys send input  events just as  character keys
> do, and keymaps can have bindings for them.
>
> …
>
> On  text terminals,  typing a  function key  actually sends  the
> computer a  sequence of characters;  the precise details  of the
> sequence depends on the function key and on the terminal type.

- (emacs) Named ASCII Chars

> Emacs can distinguish  these two kinds of input  if the keyboard
> does.  It treats the special  keys as function keys named ‘tab’,
> ‘return’,  ‘backspace’,  ‘linefeed’,   ‘escape’,  and  ‘delete’.
> These   function   keys   translate   automatically   into   the
> corresponding  ASCII characters  _if_ they  have no  bindings of
> their own.
>
> If you  do not want  to distinguish between (for  example) <TAB>
> and  ‘C-i’,  make just  one  binding,  for the  ASCII  character
> <TAB> (octal code 011).  If you do want to distinguish, make one
> binding for this  ASCII character, and another  for the function
> key ‘tab’.
>
> With an ordinary ASCII terminal,  there is no way to distinguish
> between <TAB>  and ‘C-i’  (and likewise  for other  such pairs),
> because the terminal sends the same character in both cases.

- a *scratch* buffer:

> (kbd "RET")         ; "^M"
> (kbd "\r")          ; "^M"
> (kbd "C-m")         ; "^M"
> (kbd "<return>")    ; [return]

- on X:

> C-h c ⏎ ; RET (translated from <return>) runs the command newline

- on a TTY:

> C-h c ⏎ ; RET runs the command newline


In GNU Emacs 27.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.12, cairo version 1.16.0)
 of 2019-12-09 built on my-little-tumbleweed
Repository revision: 51176ee81e8e773d8b6ac06dd153846abee0c0f4
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12006000
System Description: openSUSE Tumbleweed

Configured using:
 'configure --with-xwidgets --with-cairo'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS JSON
PDUMPER LCMS2 GMP

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38551; Package emacs. (Mon, 09 Dec 2019 20:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 38551 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Cc: 38551 <at> debbugs.gnu.org
Subject: Re: bug#38551: 27.0.50; [ELPA][PATCH] debbugs: bind to RET rather
 than return
Date: Mon, 09 Dec 2019 21:36:18 +0100
Kévin Le Gouguec <kevin.legouguec <at> gmail.com> writes:

> Hello,

Hi Kévin,

> debbugs-gnu.el binds debbugs-gnu-select-report and
> debbugs-gnu-select-usertag to [return].  Unless I'm mistaken, this
> designates only the function key, and terminals do not tell applications
> that function keys were pressed.  In the case of [return], they only
> send RET, i.e. the C-m character.

Oops, my bad. It was bound to "\r" previous to debbugs 0.21. I wanted to
change it for better readability, and I've overlooked this trap.

> On the other hand, if one binds those functions to (kbd "RET") ≡ "\C-m"
> ≡ "\r", Emacs automatically translates [return] to RET, and everything
> Just Works™.

I've decided for (kbd "RET"). Committed locally (the remote ELPA git is
down just now).

I will release debbugs 0.22, including this patch, when I have finished
my work on bug#37168, adding threading to debbugs for better performance.

> Thank you for your time.

Best regards, Michael.




bug Marked as fixed in versions 27.1. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Mon, 09 Dec 2019 20:38:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38551; Package emacs. (Tue, 10 Dec 2019 06:15:02 GMT) Full text and rfc822 format available.

Message #13 received at 38551 <at> debbugs.gnu.org (full text, mbox):

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 38551 <at> debbugs.gnu.org
Subject: Re: bug#38551: 27.0.50; [ELPA][PATCH] debbugs: bind to RET rather
 than return
Date: Tue, 10 Dec 2019 07:14:31 +0100
Michael Albinus <michael.albinus <at> gmx.de> writes:

> I've decided for (kbd "RET"). Committed locally (the remote ELPA git is
> down just now).

Great!  Looking forward to this :)

> I will release debbugs 0.22, including this patch, when I have finished
> my work on bug#37168, adding threading to debbugs for better performance.

And that as well 🙌

Thank you for working on this.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Tue, 11 Feb 2020 12:13:02 GMT) Full text and rfc822 format available.

Notification sent to Kévin Le Gouguec <kevin.legouguec <at> gmail.com>:
bug acknowledged by developer. (Tue, 11 Feb 2020 12:13:02 GMT) Full text and rfc822 format available.

Message #18 received at 38551-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
Cc: 38551-done <at> debbugs.gnu.org
Subject: Re: bug#38551: 27.0.50; [ELPA][PATCH] debbugs: bind to RET rather
 than return
Date: Tue, 11 Feb 2020 13:11:54 +0100
Kévin Le Gouguec <kevin.legouguec <at> gmail.com> writes:

Hi Kévin,

>> I will release debbugs 0.22, including this patch, when I have finished
>> my work on bug#37168, adding threading to debbugs for better performance.
>
> And that as well 🙌

Debbugs 0.22 is out, although I didn't find the time yet for
implementing threading. So I close this bug report.

> Thank you for working on this.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 11 Mar 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 40 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.