From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#45536: [PATCH] Pretty-print keys without <> around modifiers Date: Tue, 29 Dec 2020 17:21:03 +0100 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_AE5A45EA-7EC7-448F-B446-8730928325AE" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17143"; mail-complaints-to="usenet@ciao.gmane.io" To: 45536@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 29 17:42:41 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuI53-0004Lx-Ow for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Dec 2020 17:42:41 +0100 Original-Received: from localhost ([::1]:38512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuI51-0008Dp-0i for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Dec 2020 11:42:39 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuI4Q-0008DV-Tq for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2020 11:42:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kuI4Q-0002xD-Mo for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2020 11:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kuI4Q-0001Ob-Ks for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2020 11:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2020 16:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45536 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.16092601065329 (code B ref -1); Tue, 29 Dec 2020 16:42:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Dec 2020 16:41:46 +0000 Original-Received: from localhost ([127.0.0.1]:40026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuI49-0001Nr-Mf for submit@debbugs.gnu.org; Tue, 29 Dec 2020 11:41:45 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:60584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuI47-0001Ng-Ka for submit@debbugs.gnu.org; Tue, 29 Dec 2020 11:41:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuI47-00080D-2l for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2020 11:41:43 -0500 Original-Received: from mail1472c50.megamailservers.eu ([91.136.14.72]:41736 helo=mail102c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuI44-0002lA-NK for bug-gnu-emacs@gnu.org; Tue, 29 Dec 2020 11:41:42 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609258873; bh=H7263/BWsM/8PztobsU78DpCUwiHBfo4doyXtrm4GtE=; h=From:Subject:Date:To:From; b=J5RAZ4P2+vuzT0v00BDbcjYJ+DXz+tKlEMFXKVmkt/1wsWEkfPJVi83k1fHKoSQxg 2B9LbJzEXSmATFj0Jkrjiaa5u7RCjx9EJ6T2lQ4vslhoNWvGgiS72q/ILYCsg+zdw3 GD8hObnMCUqGHrB7tSRlI6LKkG8qtyK1pOZZoibM= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail102c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BTGL42j022109 for ; Tue, 29 Dec 2020 16:21:12 +0000 X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F17.5FEB5778.0061, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=d6CLNirE c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=70yG_HCnfgZFqohj0l4A:9 a=CjuIK1q_8ugA:10 a=oeYR-KG3CumxoNrnDWwA:9 a=B2y7HmGcmWMA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.14.72; envelope-from=mattiase@acm.org; helo=mail102c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:196950 Archived-At: --Apple-Mail=_AE5A45EA-7EC7-448F-B446-8730928325AE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii It is a bit inconsistent that keys are described as C-x and but = . It would be more logical to write C-. The key parser = will happily accept either, but descriptions without modifiers in <> = brackets are more legible, and the result is easier to understand and = explain. Attached is a patch which adapts the code that pretty-prints keys. This = is a change for human consumption only; it seems unlikely to affect = compatibility. With the patch, is now printed as = C-M-. I'd be happy to update the manuals accordingly, and add a NEWS entry if = required. --Apple-Mail=_AE5A45EA-7EC7-448F-B446-8730928325AE Content-Disposition: attachment; filename=0001-Pretty-print-keys-without-around-modifiers.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Pretty-print-keys-without-around-modifiers.patch" Content-Transfer-Encoding: quoted-printable =46rom=2018c9fc433f75a286abcd459abb77b2667d650021=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Tue,=2029=20Dec=202020=2016:55:06=20+0100=0A= Subject:=20[PATCH]=20Pretty-print=20keys=20without=20<>=20around=20= modifiers=0A=0ABe=20consistent=20when=20pretty-printing=20keys:=20put=20= modifiers=20outside=20<>,=0Athus=20the=20more=20logical=20C-M-=20= instead=20of=20.=0A=0A*=20src/keymap.c=20= (Fsingle_key_description):=0ASkip=20modifier=20prefix=20before=20adding=20= <>.=0A---=0A=20src/keymap.c=20|=2020=20+++++++++++++++-----=0A=201=20= file=20changed,=2015=20insertions(+),=205=20deletions(-)=0A=0Adiff=20= --git=20a/src/keymap.c=20b/src/keymap.c=0Aindex=20ca2d33dba4..d3cde8e7ab=20= 100644=0A---=20a/src/keymap.c=0A+++=20b/src/keymap.c=0A@@=20-2260,11=20= +2260,21=20@@=20DEFUN=20("single-key-description",=20= Fsingle_key_description,=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20if=20= (NILP=20(no_angles))=0A=20=09{=0A-=09=20=20Lisp_Object=20result;=0A-=09=20= =20char=20*buffer=20=3D=20SAFE_ALLOCA=20(sizeof=20"<>"=0A-=09=09=09=09=20= =20=20=20=20=20+=20SBYTES=20(SYMBOL_NAME=20(key)));=0A-=09=20=20esprintf=20= (buffer,=20"<%s>",=20SDATA=20(SYMBOL_NAME=20(key)));=0A-=09=20=20result=20= =3D=20build_string=20(buffer);=0A+=09=20=20Lisp_Object=20namestr=20=3D=20= SYMBOL_NAME=20(key);=0A+=09=20=20const=20char=20*sym=20=3D=20SSDATA=20= (namestr);=0A+=09=20=20ptrdiff_t=20len=20=3D=20SBYTES=20(namestr);=0A+=09= =20=20/*=20Find=20the=20extent=20of=20the=20modifier=20prefix,=20like=20= "C-M-".=20*/=0A+=09=20=20int=20i=20=3D=200;=0A+=09=20=20while=20(i=20<=20= len=20-=203=20&&=20sym[i=20+=201]=20=3D=3D=20'-'=20&&=20strchr=20= ("CMSsHA",=20sym[i]))=0A+=09=20=20=20=20i=20+=3D=202;=0A+=09=20=20/*=20= First=20I=20bytes=20of=20SYM=20are=20modifiers;=20put=20<>=20around=20= the=20rest.=20*/=0A+=09=20=20char=20*buffer=20=3D=20SAFE_ALLOCA=20(len=20= +=203);=0A+=09=20=20memcpy=20(buffer,=20sym,=20i);=0A+=09=20=20buffer[i]=20= =3D=20'<';=0A+=09=20=20memcpy=20(buffer=20+=20i=20+=201,=20sym=20+=20i,=20= len=20-=20i);=0A+=09=20=20buffer=20[len=20+=201]=20=3D=20'>';=0A+=09=20=20= buffer=20[len=20+=202]=20=3D=20'\0';=0A+=09=20=20Lisp_Object=20result=20= =3D=20build_string=20(buffer);=0A=20=09=20=20SAFE_FREE=20();=0A=20=09=20=20= return=20result;=0A=20=09}=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_AE5A45EA-7EC7-448F-B446-8730928325AE--