Subject: bug#2205: closed (Re: bug#2205: electric-perl-terminator leaves point at beginning of line on error)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 05 Oct 2011 05:31:02 +0000

Your bug report

#2205: electric-perl-terminator leaves point at beginning of line on error

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
2205: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=2205
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#2205: electric-perl-terminator leaves point at beginning of line on error
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Wed, 05 Oct 2011 01:30:31 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

Subject: electric-perl-terminator leaves point at beginning of line on error
From: "Keith Ponting" <[email-masked]>
To: <[email-masked]>
Date: Thu, 5 Feb 2009 06:11:20 -0500

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 [email-masked] 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) = @_;
	my $line="";
	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. 

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=/usr'
'--infodir=/usr/share/info' '--mandir=/usr/share/man'
'--localstatedir=/var' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--with-x=no' '--with-sound=no'
'--build=x86_64-suse-linux-gnu' 'build_alias=x86_64-suse-linux-gnu'
'CC=gcc' 'CFLAGS=-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -g
-D_GNU_SOURCE -std=gnu89 -pipe -fno-strict-aliasing -Wno-pointer-sign
-Wno-unused-variable -Wno-unused-label -Wno-unprototyped-calls
-DSYSTEM_PURESIZE_EXTRA=25000 	 -DSITELOAD_PURESIZE_EXTRA=10000 '
'LDFLAGS=''

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