From unknown Mon Aug 18 02:05:29 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#2205 <2205@debbugs.gnu.org> To: bug#2205 <2205@debbugs.gnu.org> Subject: Status: electric-perl-terminator leaves point at beginning of line on error Reply-To: bug#2205 <2205@debbugs.gnu.org> Date: Mon, 18 Aug 2025 09:05:29 +0000 retitle 2205 electric-perl-terminator leaves point at beginning of line on = error reassign 2205 emacs submitter 2205 "Keith Ponting" severity 2205 normal thanks From k.ponting@aurix.com Thu Feb 5 04:01:45 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 5 Feb 2009 12:01:45 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n15C1f5n006600 for ; Thu, 5 Feb 2009 04:01:43 -0800 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LV2vN-0004Xp-8a for bug-gnu-emacs@gnu.org; Thu, 05 Feb 2009 07:01:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LV2vK-0004Vd-5I for bug-gnu-emacs@gnu.org; Thu, 05 Feb 2009 07:01:40 -0500 Received: from [199.232.76.173] (port=33902 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LV2vJ-0004VQ-TK for bug-gnu-emacs@gnu.org; Thu, 05 Feb 2009 07:01:37 -0500 Received: from server107t.exghost.com ([69.20.26.51]:3725 helo=server107.appriver.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LV2vJ-0003Sd-CV for bug-gnu-emacs@gnu.org; Thu, 05 Feb 2009 07:01:37 -0500 Received: by server107.appriver.com (CommuniGate Pro PIPE 5.2.0) with PIPE id 78311954; Thu, 05 Feb 2009 06:11:27 -0500 Received: from [207.97.230.107] (HELO fe09.exg3.exghost.com) by server107.appriver.com (CommuniGate Pro SMTP 5.2.0) with ESMTP id 78311948 for bug-gnu-emacs@gnu.org; Thu, 05 Feb 2009 06:11:24 -0500 Received: from BE02.exg3.exghost.com ([207.97.230.117]) by fe09.exg3.exghost.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Feb 2009 06:09:13 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: electric-perl-terminator leaves point at beginning of line on error Date: Thu, 5 Feb 2009 06:11:20 -0500 Message-ID: <0368DB7855FE094FBFF313BE6BC5A810D485A1@BE02.exg3.exghost.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: electric-perl-terminator leaves point at beginning of line on error thread-index: AcmHgnlkwKA62ImDQCKcr4luRl3vYg== From: "Keith Ponting" To: X-OriginalArrivalTime: 05 Feb 2009 11:09:13.0832 (UTC) FILETIME=[2DA90680:01C98782] X-Policy: GLOBAL - aurix.com X-Primary: k.ponting@aurix.com X-Note: This Email was scanned by AppRiver SecureTide X-ALLOW: k.ponting@aurix.com ALLOWED X-Virus-Scan: V- X-Note: Spam Tests Failed: X-Country-Path: UNITED STATES->UNITED STATES->UNITED STATES X-Note-Sending-IP: 207.97.230.107 X-Note-Reverse-DNS: fe09.exg3.exghost.com X-Note-WHTLIST: k.ponting@aurix.com X-Note: User Rule Hits: X-Note: Global Rule Hits: 94 95 96 97 101 102 170 X-Note: Mail Class: ALLOWEDSENDER X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-Greylist: delayed 2403 seconds by postgrey-1.27 at monty-python; Thu, 05 Feb 2009 07:01:36 EST Please write in English if possible, because the Emacs maintainers usually do not have translators to read other languages for them. Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list, and to the gnu.emacs.bug news group. Please describe exactly what actions triggered the bug and the precise symptoms of the bug: In perl mode, entering the line-end { at the point shown in the following closure: { sub tran { # start of transition my($e,%attrs) =3D @_; my $line=3D""; if ( "TURN" eq $attrs{level} ){ # typing the { at the end of the following line gives scan error # and leaves point at the beginning of line, which is a pain! # fixed by changing progn to save-excursion in electric-perl-terminator if ( exists($attrs{ } else if ($wantlevel eq $attrs{level}){ } } } causes the electric-perl-terminator function to stop with an error: forward-sexp: Scan error: "Unbalanced parentheses", 16, 410 but it leaves me at the _beginning_ of the line. This means that I cannot easily type in the line I want, which is: if ( exists($attrs{tag}) ){ instead when I type that sequence of characters without pausing I end up with: tag}) ){ if ( exists($attrs{ This also happens under emacs 21.3.1 on Linux and on a (modified) 22.3.1 on Windows.=20 It does not appear to happen in a number of simpler variants I tried of the above source, so I do not quite understand what is going on. A fix appears to be to replace the "progn" in electric-perl-terminator with "save-excursion", so that when perl-indent-line reports an error, the point remains where I want it. If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. If you would like to further debug the crash, please read the file /usr/share/emacs/22.3/etc/DEBUG for instructions. In GNU Emacs 22.3.1 (x86_64-suse-linux-gnu) of 2008-12-03 on build23 configured using `configure '--with-gcc' '--with-pop' '--without-hesiod' '--with-kerberos' '--with-kerberos5' '--with-leim' '--with-xim' '--with-system-malloc' '--prefix=3D/usr' '--infodir=3D/usr/share/info' '--mandir=3D/usr/share/man' '--localstatedir=3D/var' '--sharedstatedir=3D/var/lib' '--libexecdir=3D/usr/lib' '--with-x=3Dno' '--with-sound=3Dno' '--build=3Dx86_64-suse-linux-gnu' 'build_alias=3Dx86_64-suse-linux-gnu' 'CC=3Dgcc' 'CFLAGS=3D-fmessage-length=3D0 -O2 -Wall = -D_FORTIFY_SOURCE=3D2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -D_GNU_SOURCE -std=3Dgnu89 -pipe -fno-strict-aliasing -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label -Wno-unprototyped-calls -DSYSTEM_PURESIZE_EXTRA=3D25000 -DSITELOAD_PURESIZE_EXTRA=3D10000 ' 'LDFLAGS=3D'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8 default-enable-multibyte-characters: t Major mode: Perl Minor modes in effect: mouse-wheel-mode: t show-paren-mode: t encoded-kbd-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: ESC x r e p o r t - e m a c s - b u g RET Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. test.pl has auto save data; consider M-x recover-this-file Loading perl-mode...done Loading vc-cvs...done Loading mwheel...done Loading emacsbug... Loading regexp-opt...done Loading emacsbug...done Keith Ponting Aurix Ltd, Malvern WR14 3SZ UK From k.ponting@aurix.com Thu Feb 5 05:12:37 2009 Received: (at 2205) by emacsbugs.donarmstrong.com; 5 Feb 2009 13:12:37 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: * X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=1.0 required=4.0 tests=MULTALT autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from server107.appriver.com (server107k.exghost.com [69.20.106.170]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n15DCY42024712 for <2205@emacsbugs.donarmstrong.com>; Thu, 5 Feb 2009 05:12:35 -0800 Received: by server107.appriver.com (CommuniGate Pro PIPE 5.2.0) with PIPE id 155570510; Thu, 05 Feb 2009 08:12:33 -0500 Received: from [207.97.230.107] (HELO fe09.exg3.exghost.com) by server107.appriver.com (CommuniGate Pro SMTP 5.2.0) with ESMTP id 155570508 for 2205@emacsbugs.donarmstrong.com; Thu, 05 Feb 2009 08:12:30 -0500 Received: from BE02.exg3.exghost.com ([207.97.230.117]) by fe09.exg3.exghost.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 5 Feb 2009 08:10:20 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C98793.18C8942C" Subject: My fix does not quite work Date: Thu, 5 Feb 2009 08:12:29 -0500 Message-ID: <0368DB7855FE094FBFF313BE6BC5A810D485BA@BE02.exg3.exghost.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: My fix does not quite work thread-index: AcmHk2W0DHcNxtNSTgqLyrzAZXeG9Q== From: "Keith Ponting" To: <2205@debbugs.gnu.org> X-OriginalArrivalTime: 05 Feb 2009 13:10:20.0177 (UTC) FILETIME=[18BD4810:01C98793] X-Policy: GLOBAL - aurix.com X-Primary: k.ponting@aurix.com X-Note: This Email was scanned by AppRiver SecureTide X-ALLOW: k.ponting@aurix.com ALLOWED X-Virus-Scan: V- X-Note: Spam Tests Failed: X-Country-Path: UNITED STATES->UNITED STATES->UNITED STATES X-Note-Sending-IP: 207.97.230.107 X-Note-Reverse-DNS: fe09.exg3.exghost.com X-Note-WHTLIST: k.ponting@aurix.com X-Note: User Rule Hits: X-Note: Global Rule Hits: 94 95 96 97 101 102 170 X-Note: Mail Class: ALLOWEDSENDER This is a multi-part message in MIME format. ------_=_NextPart_001_01C98793.18C8942C Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable A small postscript - the save-excursion fix I suggested does not quite work as it leaves point _before_ the inserted terminator not after it. The following rearrangement works around that: =20 (defun perl-electric-terminator (arg) "Insert character and adjust indentation. If at end-of-line, and not in a comment or a quote, correct the's indentation." (interactive "P") (let ((insertpos (point))) (and (not arg) ; decide whether to indent (eolp) (save-excursion (beginning-of-line) (and (not ; eliminate comments quickly (and comment-start-skip (re-search-forward comment-start-skip insertpos t)) ) (or (/=3D last-command-char ?:) ;; Colon is special only after a label .... (looking-at "\\s-*\\(\\w\\|\\s_\\)+$")) (let ((pps (parse-partial-sexp =20 (perl-beginning-of-function) insertpos))) (not (or (nth 3 pps) (nth 4 pps) (nth 5 pps)))))) (progn ; must insert, indent, delete (insert-char last-command-char 1) (save-excursion (perl-indent-line)) (delete-char -1)))) (self-insert-command (prefix-numeric-value arg))) =20 =20 =20 Keith Ponting Aurix Ltd, Malvern WR14 3SZ UK =20 ------_=_NextPart_001_01C98793.18C8942C Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

A small postscript - the save-excursion  fix I suggested does not quite work as it leaves point _before_ the = inserted terminator not after it.

The following rearrangement works around = that:

 

(defun perl-electric-terminator = (arg)

  "Insert character and adjust = indentation.

If at end-of-line, and not in a comment or a quote, = correct the's indentation."

  (interactive "P")

  (let ((insertpos (point)))

    (and (not = arg)           &nb= sp;           &nbs= p;            = ;            ; decide whether to indent

         &= nbsp;       (eolp)

         &= nbsp;       (save-excursion

         &= nbsp;         (beginning-of-line)

         &= nbsp;         (and = (not           &nb= sp;           &nbs= p;            = ;      ; eliminate comments quickly

         &= nbsp;           &n= bsp;           (and comment-start-skip

         &= nbsp;           &n= bsp;          =       (re-search-forward comment-start-skip insertpos t)) )

         &= nbsp;           &n= bsp;          (or (/=3D last-command-char ?:)

         &= nbsp;           &n= bsp;          =     ;; Colon is special only after a label ....

         &= nbsp;           &n= bsp;          =     (looking-at "\\s-*\\(\\w\\|\\s_\\)+$"))

         &= nbsp;           &n= bsp;          (let ((pps (parse-partial-sexp

         &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p;      (perl-beginning-of-function) insertpos)))

         &= nbsp;           &n= bsp;            (not (or (nth 3 pps) (nth 4 pps) (nth 5 pps))))))

         &= nbsp;       (progn =                    &= nbsp;            = ; must insert, indent, delete

         &= nbsp;         (insert-char last-command-char 1)

         &= nbsp;         (save-excursion (perl-indent-line))

         &= nbsp;         (delete-char -1))))

  (self-insert-command (prefix-numeric-value = arg)))

 

 

 

Keith Ponting

Aurix Ltd, Malvern WR14 3SZ  UK

 

------_=_NextPart_001_01C98793.18C8942C-- From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 05 01:30:36 2011 Received: (at 2205-done) by debbugs.gnu.org; 5 Oct 2011 05:30:36 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RBK3v-0006Pt-OX for submit@debbugs.gnu.org; Wed, 05 Oct 2011 01:30:36 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RBK3s-0006Pl-RO for 2205-done@debbugs.gnu.org; Wed, 05 Oct 2011 01:30:33 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RBK3r-00024I-B5; Wed, 05 Oct 2011 01:30:31 -0400 From: Glenn Morris To: 2205-done@debbugs.gnu.org Subject: Re: bug#2205: electric-perl-terminator leaves point at beginning of line on error References: <0368DB7855FE094FBFF313BE6BC5A810D485BA@BE02.exg3.exghost.com> X-Spook: Capricorn Perl-RSA dictionary Centro Janet Reno benelux X-Ran: BYbrI$M`%%Pm$!4~HyF-('tXMl["o2(ZiZC~v}lf680O<%qr5k5"pxXx4^KDo*)?JsukvG X-Hue: black X-Attribution: GM Date: Wed, 05 Oct 2011 01:30:31 -0400 In-Reply-To: <0368DB7855FE094FBFF313BE6BC5A810D485BA@BE02.exg3.exghost.com> (Keith Ponting's message of "Thu, 5 Feb 2009 08:12:29 -0500") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 2205-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) Version: 24.0.91 I am sorry for the long delay. Hopefully this is now fixed, by stopping perl-calculate-indent from throwing the error that was upsetting perl-electric-terminator. From unknown Mon Aug 18 02:05:29 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 02 Nov 2011 11:24:02 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator