From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#41740: 26.1; completion-at-point fails in the Pascal mode Date: Sun, 21 Jun 2020 21:19:16 +0200 Message-ID: <1DE58DD4-A8A5-45B4-B372-7504634BA86D@acm.org> References: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_B065B218-2955-4F57-9871-538145715BD2" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="5325"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41740@debbugs.gnu.org To: Shinichi Sakata Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 21 21:20:11 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 1jn5Vi-0001LJ-RM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Jun 2020 21:20:11 +0200 Original-Received: from localhost ([::1]:39704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jn5Vh-0006rZ-DZ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Jun 2020 15:20:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jn5Va-0006rQ-Fw for bug-gnu-emacs@gnu.org; Sun, 21 Jun 2020 15:20:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49369) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jn5Va-0007EX-79 for bug-gnu-emacs@gnu.org; Sun, 21 Jun 2020 15:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jn5Va-0004u7-07 for bug-gnu-emacs@gnu.org; Sun, 21 Jun 2020 15:20:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Jun 2020 19:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41740 X-GNU-PR-Package: emacs Original-Received: via spool by 41740-submit@debbugs.gnu.org id=B41740.159276716518800 (code B ref 41740); Sun, 21 Jun 2020 19:20:01 +0000 Original-Received: (at 41740) by debbugs.gnu.org; 21 Jun 2020 19:19:25 +0000 Original-Received: from localhost ([127.0.0.1]:60915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jn5Uz-0004tA-KU for submit@debbugs.gnu.org; Sun, 21 Jun 2020 15:19:25 -0400 Original-Received: from mail84c50.megamailservers.eu ([91.136.10.94]:44882 helo=mail18c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jn5Uv-0004sw-B0 for 41740@debbugs.gnu.org; Sun, 21 Jun 2020 15:19:23 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1592767159; bh=HDa2XXk28HWCrEfhzRZIVAULsiwaMoIIbbNA1fXN9sI=; h=From:Subject:Date:Cc:To:From; b=Pnvm9MaWHL/IAwcgOVayLVC8bnnm5DO2//YvNf2uZ9yPfa0LnrsYevzvcyIVi4EaE IfGI4WvxJLzf+e20iRgrjG8c4t7FmoWdTBRjhR97hmeTcV3Y/9YJ3Et8S60BoP6aae 2NmgEndDIFFIJqFr98Is0+1r4kfszRhcDdB3K54A= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se [85.230.74.78]) (authenticated bits=0) by mail18c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 05LJJGbM007673; Sun, 21 Jun 2020 19:19:18 +0000 X-Mailer: Apple Mail (2.3445.104.14) X-CTCH-RefID: str=0001.0A782F1D.5EEFB235.0015:SCFSTAT68638221, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: -4.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=K8Zc4BeI c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=M51BFTxLslgA:10 a=Lgqp5P2xYD7086wmjp4A:9 a=CjuIK1q_8ugA:10 a=TScF7K-tpFFgPFlCbK4A:9 a=B2y7HmGcmWMA:10 a=uFUDgC0RIDMrs8LWE_8A:9 a=tclcd6dtLQvEqt9_mmAA:9 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:182257 Archived-At: --Apple-Mail=_B065B218-2955-4F57-9871-538145715BD2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Thanks for the report! It looks like pascal-mode didn't obey the rules = for completion functions: they mustn't move point. Would you try these patches? The first should fix your bug, and the = second deals with an apparent bug in C-M-a in pascal-mode found when = fixing the first one. --Apple-Mail=_B065B218-2955-4F57-9871-538145715BD2 Content-Disposition: attachment; filename=0001-Preserve-point-in-pascal-mode-completion-bug-41740.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Preserve-point-in-pascal-mode-completion-bug-41740.patch" Content-Transfer-Encoding: quoted-printable =46rom=20a3e9f2c67c2feacbb6941d37966c251f03f99b87=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Sun,=2021=20Jun=202020=2021:04:30=20+0200=0A= Subject:=20[PATCH=201/2]=20Preserve=20point=20in=20pascal-mode=20= completion=20(bug#41740)=0A=0AFailure=20to=20do=20so=20caused=20errors=20= in=20several=20cases.=0AReported=20by=20Shinichi=20Sakata.=0A=0A*=20= lisp/progmodes/pascal.el=20(pascal-type-completion)=0A= (pascal-completion):=20Wrap=20code=20that=20may=20move=20point=20in=20= save-excursion.=0A*=20test/lisp/progmodes/pascal-tests.el:=20New=20file.=0A= ---=0A=20lisp/progmodes/pascal.el=20=20=20=20=20=20=20=20=20=20=20=20|=20= 51=20+++++++++++++-------------=0A=20test/lisp/progmodes/pascal-tests.el=20= |=2055=20+++++++++++++++++++++++++++++=0A=202=20files=20changed,=2082=20= insertions(+),=2024=20deletions(-)=0A=20create=20mode=20100644=20= test/lisp/progmodes/pascal-tests.el=0A=0Adiff=20--git=20= a/lisp/progmodes/pascal.el=20b/lisp/progmodes/pascal.el=0Aindex=20= 536a16dbb3..b0191c029b=20100644=0A---=20a/lisp/progmodes/pascal.el=0A+++=20= b/lisp/progmodes/pascal.el=0A@@=20-1170,26=20+1170,27=20@@=20= pascal-get-completion-decl=0A=20=0A=20(defun=20pascal-type-completion=20= (pascal-str)=0A=20=20=20"Calculate=20all=20possible=20completions=20for=20= types."=0A-=20=20(let=20((start=20(point))=0A-=20=20=20=20=20=20=20=20= (pascal-all=20())=0A-=09goon)=0A-=20=20=20=20;;=20Search=20for=20all=20= reachable=20type=20declarations=0A-=20=20=20=20(while=20(or=20= (pascal-beg-of-defun)=0A-=09=20=20=20=20=20=20=20(setq=20goon=20(not=20= goon)))=0A-=20=20=20=20=20=20(save-excursion=0A-=09(if=20(and=20(<=20= start=20(prog1=20(save-excursion=20(pascal-end-of-defun)=0A-=09=09=09=09=09= =09=20(point))=0A-=09=09=09=20=20=20=20(forward-char=201)))=0A-=09=09=20= (re-search-forward=0A-=09=09=20=20= "\\\\|\\<\\(begin\\|function\\|procedure\\)\\>"=0A-=09=09=20=20= start=20t)=0A-=09=09=20(not=20(match-end=201)))=0A-=09=20=20=20=20;;=20= Check=20current=20type=20declaration=0A-=20=20=20=20=20=20=20=20=20=20=20= =20(setq=20pascal-all=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(nconc=20(pascal-get-completion-decl=20pascal-str)=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= pascal-all)))))=0A+=20=20(save-excursion=0A+=20=20=20=20(let=20((start=20= (point))=0A+=20=20=20=20=20=20=20=20=20=20(pascal-all=20())=0A+=09=20=20= goon)=0A+=20=20=20=20=20=20;;=20Search=20for=20all=20reachable=20type=20= declarations=0A+=20=20=20=20=20=20(while=20(or=20(pascal-beg-of-defun)=0A= +=09=20=20=20=20=20=20=20=20=20(setq=20goon=20(not=20goon)))=0A+=20=20=20= =20=20=20=20=20(save-excursion=0A+=09=20=20(if=20(and=20(<=20start=20= (prog1=20(save-excursion=20(pascal-end-of-defun)=0A+=09=09=09=09=09=09=20= =20=20(point))=0A+=09=09=09=20=20=20=20=20=20(forward-char=201)))=0A+=09=09= =20=20=20(re-search-forward=0A+=09=09=20=20=20=20= "\\\\|\\<\\(begin\\|function\\|procedure\\)\\>"=0A+=09=09=20=20=20= =20start=20t)=0A+=09=09=20=20=20(not=20(match-end=201)))=0A+=09=20=20=20=20= =20=20;;=20Check=20current=20type=20declaration=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(setq=20pascal-all=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(nconc=20(pascal-get-completion-decl=20= pascal-str)=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=20pascal-all)))))=0A=20=0A-=20=20=20=20pascal-all))=0A= +=20=20=20=20=20=20pascal-all)))=0A=20=0A=20(defun=20= pascal-var-completion=20(prefix)=0A=20=20=20"Calculate=20all=20possible=20= completions=20for=20variables=20(or=20constants)."=0A@@=20-1263,11=20= +1264,13=20@@=20pascal-completion=0A=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(and=20(eq=20state=20'defun)=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= (save-excursion=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(re-search-backward=20")[=20\t]*:"=20= (point-at-bol)=20t))))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (if=20(or=20(eq=20state=20'paramlist)=20(eq=20state=20'defun))=0A-=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (pascal-beg-of-defun))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (nconc=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (pascal-type-completion=20pascal-str)=0A-=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(pascal-keyword-completion=20pascal-type-keywords=20= pascal-str)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (save-excursion=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (if=20(or=20(eq=20state=20'paramlist)=20(eq=20state=20'defun))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (pascal-beg-of-defun))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(nconc=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (pascal-type-completion=20pascal-str)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(pascal-keyword-completion=20= pascal-type-keywords=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=20=20=20=20=20=20=20= =20=20=20=20pascal-str))))=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=20=20=20=20= =20;--Starting=20a=20new=20statement=0A=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(and=20(not=20(eq=20state=20'contexp))=0A=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(save-excursion=0Adiff=20= --git=20a/test/lisp/progmodes/pascal-tests.el=20= b/test/lisp/progmodes/pascal-tests.el=0Anew=20file=20mode=20100644=0A= index=200000000000..10d6e0433d=0A---=20/dev/null=0A+++=20= b/test/lisp/progmodes/pascal-tests.el=0A@@=20-0,0=20+1,55=20@@=0A+;;;=20= pascal-tests.el=20---=20tests=20for=20pascal.el=20=20=20=20-*-=20= lexical-binding:=20t=20-*-=0A+=0A+;;=20Copyright=20(C)=202020=20Free=20= Software=20Foundation,=20Inc.=0A+=0A+;;=20This=20file=20is=20part=20of=20= GNU=20Emacs.=0A+=0A+;;=20GNU=20Emacs=20is=20free=20software:=20you=20can=20= redistribute=20it=20and/or=20modify=0A+;;=20it=20under=20the=20terms=20= of=20the=20GNU=20General=20Public=20License=20as=20published=20by=0A+;;=20= the=20Free=20Software=20Foundation,=20either=20version=203=20of=20the=20= License,=20or=0A+;;=20(at=20your=20option)=20any=20later=20version.=0A+=0A= +;;=20GNU=20Emacs=20is=20distributed=20in=20the=20hope=20that=20it=20= will=20be=20useful,=0A+;;=20but=20WITHOUT=20ANY=20WARRANTY;=20without=20= even=20the=20implied=20warranty=20of=0A+;;=20MERCHANTABILITY=20or=20= FITNESS=20FOR=20A=20PARTICULAR=20PURPOSE.=20=20See=20the=0A+;;=20GNU=20= General=20Public=20License=20for=20more=20details.=0A+=0A+;;=20You=20= should=20have=20received=20a=20copy=20of=20the=20GNU=20General=20Public=20= License=0A+;;=20along=20with=20GNU=20Emacs.=20=20If=20not,=20see=20= .=0A+=0A+(require=20'ert)=0A+(require=20= 'pascal)=0A+=0A+(ert-deftest=20pascal-completion=20()=0A+=20=20;;=20= Bug#41740:=20completion=20functions=20must=20preserve=20point.=0A+=20=20= (let=20((pascal-completion-cache=20nil))=0A+=20=20=20=20= (with-temp-buffer=0A+=20=20=20=20=20=20(pascal-mode)=0A+=20=20=20=20=20=20= (insert=20"program=20test;=20var")=0A+=20=20=20=20=20=20(let*=20= ((point-before=20(point))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= (completions=20(pascal-completion=20"var"=20nil=20'metadata))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20(point-after=20(point)))=0A+=20=20=20=20=20= =20=20=20(should=20(equal=20completions=20nil))=0A+=20=20=20=20=20=20=20=20= (should=20(equal=20point-before=20point-after)))))=0A+=0A+=20=20(let=20= ((pascal-completion-cache=20nil))=0A+=20=20=20=20(with-temp-buffer=0A+=20= =20=20=20=20=20(pascal-mode)=0A+=20=20=20=20=20=20(insert=20"program=20= test;=20function=20f(x=20:=20i")=0A+=20=20=20=20=20=20(let*=20= ((point-before=20(point))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= (completions=20(pascal-completion=20"i"=20nil=20'metadata))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20(point-after=20(point)))=0A+=20=20=20=20=20=20= =20=20(should=20(equal=20completions=20nil))=0A+=20=20=20=20=20=20=20=20= (should=20(equal=20point-before=20point-after)))))=0A+=0A+=20=20(let=20= ((pascal-completion-cache=20nil))=0A+=20=20=20=20(with-temp-buffer=0A+=20= =20=20=20=20=20(pascal-mode)=0A+=20=20=20=20=20=20(insert=20"program=20= test;=20function=20f(x=20:=20integer)=20:=20real")=0A+=20=20=20=20=20=20= (let*=20((point-before=20(point))=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20(completions=20(pascal-completion=20"real"=20nil=20'metadata))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20(point-after=20(point)))=0A+=20=20=20=20= =20=20=20=20(should=20(equal=20completions=20nil))=0A+=20=20=20=20=20=20=20= =20(should=20(equal=20point-before=20point-after))))))=0A+=0A+(provide=20= 'pascal-tests)=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_B065B218-2955-4F57-9871-538145715BD2 Content-Disposition: attachment; filename=0002-Fix-spurious-error-in-beginning-of-defun-in-pascal-m.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0002-Fix-spurious-error-in-beginning-of-defun-in-pascal-m.patch" Content-Transfer-Encoding: quoted-printable =46rom=206f20bd6baef7bcc490abd81fd177427d86cd0458=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Sun,=2021=20Jun=202020=2021:11:17=20+0200=0A= Subject:=20[PATCH=202/2]=20Fix=20spurious=20error=20in=20= beginning-of-defun=20in=20pascal-mode=0A=20(bug#41740)=0A=0A*=20= lisp/progmodes/pascal.el=20(pascal-beg-of-defun):=0AIgnore=20errors=20in=20= forward-sexp.=0A*=20test/lisp/progmodes/pascal-tests.el=20= (pascal-beg-of-defun):=20New=20test.=0A---=0A=20lisp/progmodes/pascal.el=20= =20=20=20=20=20=20=20=20=20=20=20|=202=20+-=0A=20= test/lisp/progmodes/pascal-tests.el=20|=208=20++++++++=0A=202=20files=20= changed,=209=20insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/pascal.el=20b/lisp/progmodes/pascal.el=0Aindex=20= b0191c029b..fce059bafc=20100644=0A---=20a/lisp/progmodes/pascal.el=0A+++=20= b/lisp/progmodes/pascal.el=0A@@=20-589,7=20+589,7=20@@=20= pascal-beg-of-defun=0A=20=20=20(interactive)=0A=20=20=20(catch=20'found=0A= =20=20=20=20=20(if=20(not=20(looking-at=20(concat=20"\\s=20\\|\\s)\\|"=20= pascal-defun-re)))=0A-=09(forward-sexp=201))=0A+=09(ignore-errors=20= (forward-sexp=201)))=0A=20=20=20=20=20(let=20((nest=200)=20(max=20-1)=20= (func=200)=0A=20=09=20=20(reg=20(concat=20pascal-beg-block-re=20"\\|"=0A=20= =09=09=20=20=20=20=20=20=20pascal-end-block-re=20"\\|"=0Adiff=20--git=20= a/test/lisp/progmodes/pascal-tests.el=20= b/test/lisp/progmodes/pascal-tests.el=0Aindex=2010d6e0433d..ed4c6fb03e=20= 100644=0A---=20a/test/lisp/progmodes/pascal-tests.el=0A+++=20= b/test/lisp/progmodes/pascal-tests.el=0A@@=20-52,4=20+52,12=20@@=20= pascal-completion=0A=20=20=20=20=20=20=20=20=20(should=20(equal=20= completions=20nil))=0A=20=20=20=20=20=20=20=20=20(should=20(equal=20= point-before=20point-after))))))=0A=20=0A+(ert-deftest=20= pascal-beg-of-defun=20()=0A+=20=20(with-temp-buffer=0A+=20=20=20=20= (pascal-mode)=0A+=20=20=20=20(insert=20"program=20test;=20procedure=20= p(")=0A+=20=20=20=20(forward-char=20-1)=0A+=20=20=20=20= (pascal-beg-of-defun)=0A+=20=20=20=20(should=20(equal=20(point)=2015))))=0A= +=0A=20(provide=20'pascal-tests)=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A= =0A= --Apple-Mail=_B065B218-2955-4F57-9871-538145715BD2 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_B065B218-2955-4F57-9871-538145715BD2--