From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#38551: 27.0.50; [ELPA][PATCH] debbugs: bind to RET rather than return Date: Mon, 09 Dec 2019 20:27:59 +0100 Message-ID: <87wob5l2o0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="195897"; mail-complaints-to="usenet@blaine.gmane.org" To: 38551@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 09 20:29:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ieOiX-000opw-Vp for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Dec 2019 20:29:14 +0100 Original-Received: from localhost ([::1]:45508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieOiW-00035u-Kp for geb-bug-gnu-emacs@m.gmane.org; Mon, 09 Dec 2019 14:29:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33383) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieOiP-00032n-8j for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 14:29:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ieOiN-0003q2-T3 for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 14:29:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48460) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ieOiM-0003ok-Du for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 14:29:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ieOiM-0007Pb-BQ for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 14:29:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 Dec 2019 19:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38551 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.157591968828275 (code B ref -1); Mon, 09 Dec 2019 19:29:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Dec 2019 19:28:08 +0000 Original-Received: from localhost ([127.0.0.1]:54433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ieOhU-0007Lx-BE for submit@debbugs.gnu.org; Mon, 09 Dec 2019 14:28:08 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:55619) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ieOhS-0007Lk-Ox for submit@debbugs.gnu.org; Mon, 09 Dec 2019 14:28:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33033) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieOhR-0002f3-6C for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 14:28:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ieOhP-0002XM-R8 for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 14:28:05 -0500 Original-Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:35979) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ieOhP-0002WN-H2 for bug-gnu-emacs@gnu.org; Mon, 09 Dec 2019 14:28:03 -0500 Original-Received: by mail-wr1-x42c.google.com with SMTP id z3so17517266wru.3 for ; Mon, 09 Dec 2019 11:28:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=BwZ3EZjxgUCK4/6xWGsWt+RaAyK3Tn5IEEe1sdjknSA=; b=IZWgchHqFBAH1BIDoRNr7L8bIP7/6RreiEaBImuU20/kg6GcNVHT6Qxv9PxjZQ0B+X RvBWUVXv7/+aG5oLO8WN/z5bcOL8wmgFYBcTQ874vghK2fubFwQnAKdyHPHp/yaPJwji ZTt9WcNCayKyvB9UXMxCjJy7CFQtw8hQGtcxZcbvFlWImy4xlGb8GdpyXfA1ymlSmceh tWglkhhJM6NeSHuT3vMxxbcL/R7Y3oWSwl/fnm+SN62r+d61Jce2RNi1POHekYX8Djpk ijd/WF14L6hYfFz2NLAT1MiiZCh/AZAmE7Am27FU0NuCGT9RV8/OBYVuD96dOFIELfzT oM7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=BwZ3EZjxgUCK4/6xWGsWt+RaAyK3Tn5IEEe1sdjknSA=; b=mNXqeBN0doXmBJCgZlK/MjfSOQXoY3vGfKfkwFXOwUZZ1wq+k32nUPZk7/nH1Yjchp aQatAJAHOCq1W9y4J6obY273haSpUL7/ONDsmowaYMS7JEd3nvV0yPKaWAUrBlqHmL23 l34JAuoU+hKjqq4+e6q+49RG8r9G2S1TFiP33XkcqRIL9hVKkSntVfkfXioxcyYlL+QD QhL1JqU6tEFkLllOint32TqKD26yzy61EC5LqzsoAidvIAA68/HcWAreRsosVctFjY5N cwpMXTiVMAPGexzc+aShcSfoSSZt9LhG/F4rd7GkKJZFg+gbghNcFeywaXbDI3n4xNWS uwqQ== X-Gm-Message-State: APjAAAVYxtnEclFJVuqPJaIfqVMjhk/XdhoM/YBp9s26QdvCOTKRIji6 TJxa6NSX16C5Y+sqjxeKeB4JL6Dd X-Google-Smtp-Source: APXvYqyL1wKdS2pkun+pQ3dbwBPFawMxfBdXuF507Ux+9H2DyWUi2Tz3Ym4tRdLgisNbxcVsKbFSqw== X-Received: by 2002:adf:cf12:: with SMTP id o18mr3945043wrj.361.1575919681628; Mon, 09 Dec 2019 11:28:01 -0800 (PST) Original-Received: from my-little-tumbleweed (200.143.13.109.rev.sfr.net. [109.13.143.200]) by smtp.gmail.com with ESMTPSA id m7sm346471wma.39.2019.12.09.11.28.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 11:28:00 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:173118 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: # (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") =E2=89=A1 "\= C-m" =E2=89=A1 "\r", Emacs automatically translates [return] to RET, and everyth= ing Just Works=E2=84=A2. Suggested patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=debbugs-RET.patch 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)) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable (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. > > =E2=80=A6 > > 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 =E2=80=98tab=E2= =80=99, > =E2=80=98return=E2=80=99, =E2=80=98backspace=E2=80=99, =E2=80=98linefee= d=E2=80=99, =E2=80=98escape=E2=80=99, and =E2=80=98delete=E2=80=99. > 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) > and =E2=80=98C-i=E2=80=99, make just one binding, for the ASCII ch= aracter > (octal code 011). If you do want to distinguish, make one > binding for this ASCII character, and another for the function > key =E2=80=98tab=E2=80=99. > > With an ordinary ASCII terminal, there is no way to distinguish > between and =E2=80=98C-i=E2=80=99 (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] - on X: > C-h c =E2=8F=8E ; RET (translated from ) runs the command newline - on a TTY: > C-h c =E2=8F=8E ; RET runs the command newline In GNU Emacs 27.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.12, c= airo 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=3Dlocal locale-coding-system: utf-8-unix --=-=-=--