GNU bug report logs - #30726
[26.0.91 9] optimistic forward-sexp

Previous Next

Package: emacs;

Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>

Date: Tue, 6 Mar 2018 07:18:01 UTC

Severity: minor

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30726 in the body.
You can then email your comments to 30726 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#30726; Package emacs. (Tue, 06 Mar 2018 07:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Röhler <andreas.roehler <at> easy-emacs.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 06 Mar 2018 07:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: bug-gnu-emacs <at> gnu.org
Subject: [26.0.91 9] optimistic forward-sexp
Date: Tue, 6 Mar 2018 08:16:47 +0100
In GNU Emacs 26.0.91 (build 1, i686-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2018-01-27

From 
https://emacs.stackexchange.com/questions/39253/sh-mode-scan-error-containing-expression-ends-prematurely

Error occurs when forward-sexp is called from closing paren at last line 
of example code below

(echo '#!/bin/bash'
echo 'myfunc() {'
echo "cat <<'z'"
seq 135
echo zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
echo z
echo '}') >out

Bug-source is in but-last line of the def in lisp.el, where

    (goto-char (or (scan-sexps (point) arg) (buffer-end arg)))

scan-sexps sends the error.

Wrapping in into (ignore-errors...


(or (ignore-errors (scan-sexps (point) arg))

makes it gone.

Cheers,

Andreas





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30726; Package emacs. (Tue, 06 Mar 2018 07:48:02 GMT) Full text and rfc822 format available.

Message #8 received at 30726 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 30726 <at> debbugs.gnu.org
Subject: Re: bug#30726: [26.0.91 9] optimistic forward-sexp
Date: Tue, 06 Mar 2018 02:47:44 -0500
Andreas Röhler wrote:

> https://emacs.stackexchange.com/questions/39253/sh-mode-scan-error-containing-expression-ends-prematurely

Already reported as bug#30721.
(It would be great if people forwarding other people's stackexchange
issues would do basic checks first.)

> Error occurs when forward-sexp is called from closing paren at last
> line of example code below
>
> (echo '#!/bin/bash'
> echo 'myfunc() {'
> echo "cat <<'z'"
> seq 135
> echo zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
> echo z
> echo '}') >out

Note that the OP meant you to run that as shell code to generate a file,
"out", and then visit it.

You appear to have discovered that using forward-sexp inside eg

(

)

will print "containing expression ends prematurely" ?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30726; Package emacs. (Tue, 06 Mar 2018 10:44:01 GMT) Full text and rfc822 format available.

Message #11 received at 30726 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 30726 <at> debbugs.gnu.org
Subject: Re: bug#30726: [26.0.91 9] optimistic forward-sexp
Date: Tue, 6 Mar 2018 11:43:11 +0100
On 06.03.2018 08:47, Glenn Morris wrote:
> Andreas Röhler wrote:
> 
>> https://emacs.stackexchange.com/questions/39253/sh-mode-scan-error-containing-expression-ends-prematurely
> 
> Already reported as bug#30721.
> (It would be great if people forwarding other people's stackexchange
> issues would do basic checks first.)
> 
>> Error occurs when forward-sexp is called from closing paren at last
>> line of example code below
>>
>> (echo '#!/bin/bash'
>> echo 'myfunc() {'
>> echo "cat <<'z'"
>> seq 135
>> echo zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
>> echo z
>> echo '}') >out
> 
> Note that the OP meant you to run that as shell code to generate a file,
> "out", and then visit it.
> 
> You appear to have discovered that using forward-sexp inside eg
> 
> (
> 
> )
> 
> will print "containing expression ends prematurely" ?
> 


Right. Which it shouldn't IMO, but navigate sexp's until EOB is reached.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30726; Package emacs. (Tue, 06 Mar 2018 10:49:02 GMT) Full text and rfc822 format available.

Message #14 received at 30726 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 30726 <at> debbugs.gnu.org
Subject: Re: bug#30726: [26.0.91 9] optimistic forward-sexp
Date: Tue, 6 Mar 2018 11:47:45 +0100
On 06.03.2018 08:47, Glenn Morris wrote:
> Andreas Röhler wrote:
> 
>> https://emacs.stackexchange.com/questions/39253/sh-mode-scan-error-containing-expression-ends-prematurely
> 
> Already reported as bug#30721.
> (It would be great if people forwarding other people's stackexchange
> issues would do basic checks first.)
> 
>> Error occurs when forward-sexp is called from closing paren at last
>> line of example code below
>>
>> (echo '#!/bin/bash'
>> echo 'myfunc() {'
>> echo "cat <<'z'"
>> seq 135
>> echo zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
>> echo z
>> echo '}') >out
> 
> Note that the OP meant you to run that as shell code to generate a file,
> "out", and then visit it.
> 
> You appear to have discovered that using forward-sexp inside eg
> 
> (
> 
> )
> 
> will print "containing expression ends prematurely" ?
> 

When calling the way the OP intended

get the error as below from inside the singlequoted, which also is an 
old issue:

To avoid these wrote ar-forward-sexp

which see here: 
https://github.com/andreas-roehler/thingatpt-utils-core/blob/master/ar-subr.el



;;;;;


Debugger entered--Lisp error: (scan-error "Containing expression ends 
prematurely" 515 515)
  signal(scan-error ("Containing expression ends prematurely" 515 515))
  smie-forward-sexp-command(1)
  forward-sexp(1)
  funcall-interactively(forward-sexp 1)
  call-interactively(forward-sexp nil nil)
  command-execute(forward-sexp)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30726; Package emacs. (Thu, 12 Aug 2021 14:21:02 GMT) Full text and rfc822 format available.

Message #17 received at 30726 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: Glenn Morris <rgm <at> gnu.org>, 30726 <at> debbugs.gnu.org
Subject: Re: bug#30726: [26.0.91 9] optimistic forward-sexp
Date: Thu, 12 Aug 2021 16:20:16 +0200
Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:

>> Note that the OP meant you to run that as shell code to generate a
>> file,
>> "out", and then visit it.
>> You appear to have discovered that using forward-sexp inside eg
>> (
>> )
>> will print "containing expression ends prematurely" ?
>> 
>
> Right. Which it shouldn't IMO, but navigate sexp's until EOB is reached.

It has to -- we rely on it signalling an error for various commands to
work.  In these cases, the user may want to go up in the list and then
do a forward-sexp, though.

But I don't think there's any bug here, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 30726 <at> debbugs.gnu.org and Andreas Röhler <andreas.roehler <at> easy-emacs.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 12 Aug 2021 14:21:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 10 Sep 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 285 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.