From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#33205: 26.1; unibyte/multibyte missing in rx.el Date: Sat, 29 Dec 2018 11:43:56 +0100 Message-ID: References: <83pnvrjqec.fsf@gnu.org> <160755c702f9b4dfc80be8b5664eb3919804bb84.camel@acm.org> <83wopyi00z.fsf@gnu.org> <83pnvjcvwc.fsf@gnu.org> <834lcsd7qu.fsf@gnu.org> <5203F729-8090-4453-80CC-1249DB064631@acm.org> <83efa0660p.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_C2FBE732-6E11-4218-8B9C-651851EED46A" X-Trace: blaine.gmane.org 1546080810 20189 195.159.176.226 (29 Dec 2018 10:53:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 29 Dec 2018 10:53:30 +0000 (UTC) Cc: 33205@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 29 11:53:26 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gdCF9-00055Q-3n for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Dec 2018 11:53:23 +0100 Original-Received: from localhost ([127.0.0.1]:35778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gdCHF-00043w-Ur for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Dec 2018 05:55:34 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gdCH4-0003m9-At for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2018 05:55:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gdC74-0007X7-I3 for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2018 05:45:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44866) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gdC74-0007Wj-EI for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2018 05:45:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gdC74-0001Df-7u for bug-gnu-emacs@gnu.org; Sat, 29 Dec 2018 05:45: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, 29 Dec 2018 10:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33205 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33205-submit@debbugs.gnu.org id=B33205.15460802434594 (code B ref 33205); Sat, 29 Dec 2018 10:45:02 +0000 Original-Received: (at 33205) by debbugs.gnu.org; 29 Dec 2018 10:44:03 +0000 Original-Received: from localhost ([127.0.0.1]:40863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gdC66-0001C2-NV for submit@debbugs.gnu.org; Sat, 29 Dec 2018 05:44:02 -0500 Original-Received: from mail239c50.megamailservers.eu ([91.136.10.249]:41468 helo=mail56c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gdC64-0001BT-Ew for 33205@debbugs.gnu.org; Sat, 29 Dec 2018 05:44:01 -0500 X-Authenticated-User: mattiase@bredband.net Original-Received: from [192.168.1.64] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail56c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id wBTAhvXN028493; Sat, 29 Dec 2018 10:43:59 +0000 In-Reply-To: <83efa0660p.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.9.1) X-CTCH-RefID: str=0001.0A0B0203.5C274FEF.0021, 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-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Oo5hNR3t c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=mDV3o1hIAAAA:8 a=Ibbcr7HH99-x3-a_jkIA:9 a=CjuIK1q_8ugA:10 a=Tx-RiSymivJQPsAUKsEA:9 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22 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: 208.118.235.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:153986 Archived-At: --Apple-Mail=_C2FBE732-6E11-4218-8B9C-651851EED46A Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii 29 dec. 2018 kl. 10.23 skrev Eli Zaretskii : > > First, please provide a ChangeLog-style commit log message describing > the changes. See CONTRIBUTE for more details. Done. > The first line of a doc string should be a single full sentence, and > it should mention the arguments of the function. Also, the first > sentence confused me: what do you mean by this part: > > "... and, representing ranges, dotted pairs of characters" > > Finally, please use the US English convention of leaving 2 spaces > between sentences in the documentation. All done. > This seems to have dropped the validity check which signaled an error > in the original code? Any reason for that? Just an oversight; check reinstated. Thank you; new patch attached. --Apple-Mail=_C2FBE732-6E11-4218-8B9C-651851EED46A Content-Disposition: attachment; filename=0001-Handle-raw-bytes-and-LF-in-ranges-in-rx-any-argument.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Handle-raw-bytes-and-LF-in-ranges-in-rx-any-argument.patch" Content-Transfer-Encoding: quoted-printable =46rom=20f96258853db47aee2935e5e07876bb97fbed2640=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Sat,=2029=20Dec=202018=2011:09:27=20+0100=0A= Subject:=20[PATCH]=20Handle=20raw=20bytes,=20and=20LF=20in=20ranges,=20= in=20rx=20`any'=20argument=0A=20strings=0A=0A*=20lisp/emacs-lisp/rx.el=20= (rx-check-any-string):=20Rewrite=20to=20handle=20raw=20bytes=0Ain=20= unibyte=20strings=20and=20accept=20LF=20as=20range=20endpoints=20= (Bug#33205).=0A*=20test/lisp/emacs-lisp/rx-tests.el:=20Add=20tests=20for=20= the=20above.=0A---=0A=20lisp/emacs-lisp/rx.el=20=20=20=20=20=20=20=20=20=20= =20=20|=2051=20++++++++++++++++++--------------=0A=20= test/lisp/emacs-lisp/rx-tests.el=20|=2022=20++++++++++++++=0A=202=20= files=20changed,=2051=20insertions(+),=2022=20deletions(-)=0A=0Adiff=20= --git=20a/lisp/emacs-lisp/rx.el=20b/lisp/emacs-lisp/rx.el=0Aindex=20= 1230df4f15..1cae22f870=20100644=0A---=20a/lisp/emacs-lisp/rx.el=0A+++=20= b/lisp/emacs-lisp/rx.el=0A@@=20-449,28=20+449,35=20@@=20Only=20both=20= edges=20of=20each=20range=20is=20checked."=0A=20=0A=20=0A=20(defun=20= rx-check-any-string=20(str)=0A-=20=20"Check=20string=20argument=20STR=20= for=20Rx=20`any'."=0A-=20=20(let=20((i=200)=0A-=09c1=20c2=20l)=0A-=20=20=20= =20(if=20(=3D=200=20(length=20str))=0A-=09(error=20"String=20arg=20for=20= Rx=20`any'=20must=20not=20be=20empty"))=0A-=20=20=20=20(while=20= (string-match=20".-."=20str=20i)=0A-=20=20=20=20=20=20;;=20string=20= before=20range:=20convert=20it=20to=20characters=0A-=20=20=20=20=20=20= (if=20(<=20i=20(match-beginning=200))=0A-=09=20=20(setq=20l=20(nconc=0A-=09= =09=20=20=20l=0A-=09=09=20=20=20(append=20(substring=20str=20i=20= (match-beginning=200))=20nil))))=0A-=20=20=20=20=20=20;;=20range=0A-=20=20= =20=20=20=20(setq=20i=20(match-end=200)=0A-=09=20=20=20=20c1=20(aref=20= str=20(match-beginning=200))=0A-=09=20=20=20=20c2=20(aref=20str=20(1-=20= i)))=0A-=20=20=20=20=20=20(cond=0A-=20=20=20=20=20=20=20((<=20c1=20c2)=20= (setq=20l=20(nconc=20l=20(list=20(cons=20c1=20c2)))))=0A-=20=20=20=20=20=20= =20((=3D=20c1=20c2)=20(setq=20l=20(nconc=20l=20(list=20c1))))))=0A-=20=20= =20=20;;=20rest?=0A-=20=20=20=20(if=20(<=20i=20(length=20str))=0A-=09= (setq=20l=20(nconc=20l=20(append=20(substring=20str=20i)=20nil))))=0A-=20= =20=20=20l))=0A+=20=20"Turn=20the=20`any'=20argument=20string=20STR=20= into=20a=20list=20of=20characters.=0A+The=20original=20order=20is=20not=20= preserved.=20=20Ranges,=20\"A-Z\",=20become=20pairs,=20(?A=20.=20?Z)."=0A= +=20=20(let=20((decode-char=0A+=20=20=20=20=20=20=20=20=20;;=20Make=20= sure=20raw=20bytes=20are=20decoded=20as=20such,=20to=20avoid=20confusion=20= with=0A+=20=20=20=20=20=20=20=20=20;;=20U+0080..U+00FF.=0A+=20=20=20=20=20= =20=20=20=20(if=20(multibyte-string-p=20str)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20#'identity=0A+=20=20=20=20=20=20=20=20=20=20=20(lambda=20(c)=20= (if=20(<=3D=20#x80=20c=20#xff)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(+=20c=20#x3fff00)=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20c))))=0A= +=20=20=20=20=20=20=20=20(len=20(length=20str))=0A+=20=20=20=20=20=20=20=20= (i=200)=0A+=20=20=20=20=20=20=20=20(ret=20nil))=0A+=20=20=20=20(if=20(=3D=20= 0=20len)=0A+=20=20=20=20=20=20=20=20(error=20"String=20arg=20for=20Rx=20= `any'=20must=20not=20be=20empty"))=0A+=20=20=20=20(while=20(<=20i=20len)=0A= +=20=20=20=20=20=20(cond=20((and=20(<=20i=20(-=20len=202))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(=3D=20(aref=20str=20(+=20i=20= 1))=20?-))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Range.=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20(let=20((start=20(funcall=20decode-char=20= (aref=20str=20i)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(end=20=20=20(funcall=20decode-char=20(aref=20str=20(+=20i=20= 2)))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cond=20((<=20= start=20end)=20(push=20(cons=20start=20end)=20ret))=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20((=3D=20start=20end)=20= (push=20start=20ret)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (setq=20i=20(+=20i=203))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20(t=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20;;=20Single=20character.=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20(push=20(funcall=20decode-char=20(aref=20= str=20i))=20ret)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20i=20= (+=20i=201)))))=0A+=20=20=20=20ret))=0A=20=0A=20=0A=20(defun=20= rx-check-any=20(arg)=0Adiff=20--git=20a/test/lisp/emacs-lisp/rx-tests.el=20= b/test/lisp/emacs-lisp/rx-tests.el=0Aindex=20d15e3d7719..8b3ce6cb01=20= 100644=0A---=20a/test/lisp/emacs-lisp/rx-tests.el=0A+++=20= b/test/lisp/emacs-lisp/rx-tests.el=0A@@=20-33,6=20+33,28=20@@=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(number-sequence=20?<=20?\])=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(number-sequence=20?-=20?:))))))=0A=20=0A+(ert-deftest=20= rx-char-any-range-nl=20()=0A+=20=20"Test=20character=20alternatives=20= with=20LF=20as=20a=20range=20endpoint."=0A+=20=20(should=20(equal=20(rx=20= (any=20"\n-\r"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "[\n-\r]"))=0A+=20=20(should=20(equal=20(rx=20(any=20"\a-\n"))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20"[\a-\n]")))=0A+=0A= +(ert-deftest=20rx-char-any-raw-byte=20()=0A+=20=20"Test=20raw=20bytes=20= in=20character=20alternatives."=0A+=20=20;;=20Separate=20raw=20= characters.=0A+=20=20(should=20(equal=20(string-match-p=20(rx=20(any=20= "\326A\333B"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20"X\326\333")=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=201))=0A+=20=20;;=20Range=20of=20raw=20= characters,=20unibyte.=0A+=20=20(should=20(equal=20(string-match-p=20(rx=20= (any=20"\200-\377"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"=C3=BFA\310B")=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=202))=0A+=20=20;;=20Range=20= of=20raw=20characters,=20multibyte.=0A+=20=20(should=20(equal=20= (string-match-p=20(rx=20(any=20"=C3=85\211\326-\377\177"))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20"XY\355\177\327")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=202)))=0A+=0A=20(ert-deftest=20rx-pcase=20()=0A=20=20=20(should=20= (equal=20(pcase=20"a=201=202=203=201=201=20b"=0A=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20((rx=20(let=20u=20(+=20digit))=20space=0A= --=20=0A2.17.2=20(Apple=20Git-113)=0A=0A= --Apple-Mail=_C2FBE732-6E11-4218-8B9C-651851EED46A--