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: Sat, 2 Jan 2021 18:20:52 +0100 Message-ID: <6AE36074-6531-42B0-83D7-A03774E2BF5C@acm.org> References: <83sg7oidp6.fsf@gnu.org> <87sg7oosmx.fsf@gnus.org> <97ADE294-0674-4CAC-96B1-DAD947BA3A32@acm.org> <87im8ioan4.fsf@gnus.org> <9029B6ED-5201-417A-AE37-44A564561BBA@acm.org> <87h7o1c4uv.fsf@gnus.org> <877dowc1of.fsf@gnus.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_840F17F8-1956-44C9-BF96-60157AD26FC3" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22684"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45536@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 02 18:21:10 2021 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 1kvkaU-0005m7-EH for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jan 2021 18:21:10 +0100 Original-Received: from localhost ([::1]:60178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kvkaT-0006Nd-8Y for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jan 2021 12:21:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kvkaM-0006NS-Fq for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2021 12:21:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49193) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kvkaM-0002s7-8z for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2021 12:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kvkaM-0004gy-5z for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2021 12:21: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: Sat, 02 Jan 2021 17:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45536 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45536-submit@debbugs.gnu.org id=B45536.160960806018009 (code B ref 45536); Sat, 02 Jan 2021 17:21:02 +0000 Original-Received: (at 45536) by debbugs.gnu.org; 2 Jan 2021 17:21:00 +0000 Original-Received: from localhost ([127.0.0.1]:60739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvkaK-0004gP-28 for submit@debbugs.gnu.org; Sat, 02 Jan 2021 12:21:00 -0500 Original-Received: from mail204c50.megamailservers.eu ([91.136.10.214]:34486 helo=mail193c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvkaH-0004gF-EJ for 45536@debbugs.gnu.org; Sat, 02 Jan 2021 12:20:58 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609608055; bh=by1qSfHfZVFbZ4RcoJR5DAxOXVeLDwi47yLmDcdRyZA=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=sr2mxMU+hizKouH4d+OFIrhnkIwDfl4DTxr3B8YTHR9RqY7/BNAywdaT/9KhOSkSM MY296FIXIGOjw1vUwRq58FHk/IXjolRDaqRCxXshNc6VBsuFvqumue6RnAAxp60mUm YH3gFE8/F9nSdPZEwNrhADFi6Hjq9NSrmlWXDKGo= 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 mail193c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 102HKrVj001743; Sat, 2 Jan 2021 17:20:54 +0000 In-Reply-To: <877dowc1of.fsf@gnus.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1C.5FF0AB77.0028, 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=TYHoSiYh c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=OocQHUDgAAAA:8 a=AamUQ6dlhBT3DfNBNTIA:9 a=CjuIK1q_8ugA:10 a=s08pby_Dw8iWvig-uyIA:9 a=B2y7HmGcmWMA:10 a=xUZTl98r3Qw_uB5NK3jt:22 X-Origin-Country: SE 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:197205 Archived-At: --Apple-Mail=_840F17F8-1956-44C9-BF96-60157AD26FC3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 1 jan. 2021 kl. 12.54 skrev Lars Ingebrigtsen : > Oh, right. Well, if the manual displays these keys as M- etc, = then > I withdraw all my objections based on possible confusion -- this = change > would make things less confusing. So I'm leaning towards applying the > change and then see whether this breaks anything for anybody. Good, here is the elaborated patch, complete with NEWS entry, a few doc = fixes, and tests. --Apple-Mail=_840F17F8-1956-44C9-BF96-60157AD26FC3 Content-Disposition: attachment; filename=0001-Pretty-print-keys-without-around-modifiers-bug-45536.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Pretty-print-keys-without-around-modifiers-bug-45536.patch" Content-Transfer-Encoding: quoted-printable =46rom=20a50b205b43471938b547e4aec4a517bae7ca162d=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=20(bug#45536)=0A=0ABe=20consistent=20when=20pretty-printing=20= keys:=20put=20modifiers=20outside=20<>,=0Athus=20the=20more=20logical=20= C-M-=20instead=20of=20.=0A=0A*=20src/keymap.c=20= (Fsingle_key_description):=0ASkip=20modifier=20prefix=20before=20adding=20= <>.=0A*=20doc/lispref/help.texi=20(Describing=20Characters):=20Update=20= example.=0A*=20doc/lispref/debugging.texi=20(Backtraces):=0A*=20= doc/lispref/minibuf.texi=20(Text=20from=20Minibuffer):=0AUse=20@kbd=20= instead=20of=20@key.=0A*=20etc/NEWS:=20Announce=20the=20change.=0A*=20= test/src/keymap-tests.el=20(keymap--key-description):=0A*=20= test/lisp/subr-tests.el=20(subr--kbd):=20New=20tests.=0A---=0A=20= doc/lispref/debugging.texi=20|=20=202=20+-=0A=20doc/lispref/help.texi=20=20= =20=20=20=20|=20=202=20+-=0A=20doc/lispref/minibuf.texi=20=20=20|=20=202=20= +-=0A=20etc/NEWS=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= |=20=207=20+++++++=0A=20src/keymap.c=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20|=2020=20+++++++++++++++-----=0A=20test/lisp/subr-tests.el=20=20=20= =20|=20=208=20++++++++=0A=20test/src/keymap-tests.el=20=20=20|=2012=20= ++++++++++++=0A=207=20files=20changed,=2045=20insertions(+),=208=20= deletions(-)=0A=0Adiff=20--git=20a/doc/lispref/debugging.texi=20= b/doc/lispref/debugging.texi=0Aindex=201e779ac705..8e4b0ebfe9=20100644=0A= ---=20a/doc/lispref/debugging.texi=0A+++=20b/doc/lispref/debugging.texi=0A= @@=20-424,7=20+424,7=20@@=20Backtraces=0A=20type=20@key{RET}=20while=20= point=20is=20on=20any=20name=20of=20a=20function=20or=20variable=0A=20= which=20is=20not=20underlined,=20to=20see=20help=20information=20for=20= that=20symbol=20in=20a=0A=20help=20buffer,=20if=20any=20exists.=20=20The=20= @code{xref-find-definitions}=20command,=0A-bound=20to=20@key{M-.},=20can=20= also=20be=20used=20on=20any=20identifier=20in=20a=20backtrace=0A+bound=20= to=20@kbd{M-.},=20can=20also=20be=20used=20on=20any=20identifier=20in=20= a=20backtrace=0A=20(@pxref{Looking=20Up=20Identifiers,,,emacs,=20The=20= GNU=20Emacs=20Manual}).=0A=20=0A=20In=20backtraces,=20the=20tails=20of=20= long=20lists=20and=20the=20ends=20of=20long=20strings,=0Adiff=20--git=20= a/doc/lispref/help.texi=20b/doc/lispref/help.texi=0Aindex=20= 2fd05b7391..298bec5230=20100644=0A---=20a/doc/lispref/help.texi=0A+++=20= b/doc/lispref/help.texi=0A@@=20-545,7=20+545,7=20@@=20Describing=20= Characters=0A=20@end=20group=0A=20@group=0A=20(single-key-description=20= 'C-mouse-1)=0A-=20=20=20=20=20@result{}=20""=0A+=20=20=20=20=20= @result{}=20"C-"=0A=20@end=20group=0A=20@group=0A=20= (single-key-description=20'C-mouse-1=20t)=0Adiff=20--git=20= a/doc/lispref/minibuf.texi=20b/doc/lispref/minibuf.texi=0Aindex=20= 81139b9e74..f0036f0ccf=20100644=0A---=20a/doc/lispref/minibuf.texi=0A+++=20= b/doc/lispref/minibuf.texi=0A@@=20-348,7=20+348,7=20@@=20Text=20from=20= Minibuffer=0A=20@item=20@key{RET}=0A=20@code{exit-minibuffer}=0A=20=0A= -@item=20@key{M-<}=0A+@item=20@kbd{M-<}=0A=20= @code{minibuffer-beginning-of-buffer}=0A=20=0A=20@item=20@kbd{C-g}=0A= diff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20b294ff1d23..671c6c2f56=20= 100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A@@=20-212,6=20+212,13=20= @@=20This=20makes=20debugging=20Emacs=20Lisp=20scripts=20run=20in=20= batch=20mode=20easier.=20=20To=0A=20get=20back=20the=20old=20behavior,=20= set=20the=20new=20variable=0A=20'backtrace-on-error-noninteractive'=20to=20= a=20nil=20value.=0A=20=0A++++=0A+**=20Modifiers=20now=20go=20outside=20= angle=20brackets=20in=20pretty-printed=20key=20bindings.=0A+For=20= example,=20=20with=20Control=20and=20Meta=20modifiers=20is=20now=20= shown=20as=0A+C-M-=20instead=20of=20.=20=20Either=20= variant=20can=20be=20used=20as=0A+input;=20functions=20such=20as=20'kbd'=20= and=20'read-kbd-macro'=20accept=20both=20styles=0A+as=20equivalent=20= (they=20have=20done=20so=20for=20a=20long=20time).=0A+=0A=20=0C=0A=20*=20= Editing=20Changes=20in=20Emacs=2028.1=0A=20=0Adiff=20--git=20= a/src/keymap.c=20b/src/keymap.c=0Aindex=201eeea81f62..a91f1456a6=20= 100644=0A---=20a/src/keymap.c=0A+++=20b/src/keymap.c=0A@@=20-2217,11=20= +2217,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}=0Adiff=20--git=20a/test/lisp/subr-tests.el=20= b/test/lisp/subr-tests.el=0Aindex=202f5b38d05d..8d19a26877=20100644=0A= ---=20a/test/lisp/subr-tests.el=0A+++=20b/test/lisp/subr-tests.el=0A@@=20= -630,5=20+630,13=20@@=20apropos-apropos-internal/predicate=0A=20=20=20= (should=20(>=3D=20(length=20(apropos-internal=20"^help"=20#'commandp))=20= 15))=0A=20=20=20(should-not=20(apropos-internal=20"^next-line$"=20= #'keymapp)))=0A=20=0A+(ert-deftest=20subr--kbd=20()=0A+=20=20;;=20Check=20= that=20kbd=20handles=20both=20new=20and=20old=20style=20key=20= descriptions=0A+=20=20;;=20(bug#45536).=0A+=20=20(should=20(equal=20(kbd=20= "s-")=20[s-return]))=0A+=20=20(should=20(equal=20(kbd=20= "")=20[s-return]))=0A+=20=20(should=20(equal=20(kbd=20= "C-M-")=20[C-M-return]))=0A+=20=20(should=20(equal=20(kbd=20= "")=20[C-M-return])))=0A+=0A=20(provide=20'subr-tests)=0A=20= ;;;=20subr-tests.el=20ends=20here=0Adiff=20--git=20= a/test/src/keymap-tests.el=20b/test/src/keymap-tests.el=0Aindex=20= 74fb3c892d..d4f5fc3f19=20100644=0A---=20a/test/src/keymap-tests.el=0A+++=20= b/test/src/keymap-tests.el=0A@@=20-248,6=20+248,18=20@@=20= help--describe-vector/bug-9293-same-command-does-not-shadow=0A=200=20..=20= 3=09=09foo=0A=20")))))=0A=20=0A+(ert-deftest=20keymap--key-description=20= ()=0A+=20=20(should=20(equal=20(key-description=20[right]=20[?\C-x])=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"C-x=20"))=0A+=20=20= (should=20(equal=20(key-description=20[M-H-right]=20[?\C-x])=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20"C-x=20M-H-"))=0A+=20=20= (should=20(equal=20(single-key-description=20'home)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20""))=0A+=20=20(should=20(equal=20= (single-key-description=20'home=20t)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20"home"))=0A+=20=20(should=20(equal=20= (single-key-description=20'C-s-home)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20"C-s-")))=0A+=0A=20(provide=20'keymap-tests)=0A=20= =0A=20;;;=20keymap-tests.el=20ends=20here=0A--=20=0A2.21.1=20(Apple=20= Git-122.3)=0A=0A= --Apple-Mail=_840F17F8-1956-44C9-BF96-60157AD26FC3--