unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30726: [26.0.91 9] optimistic forward-sexp
@ 2018-03-06  7:16 Andreas Röhler
  2018-03-06  7:47 ` Glenn Morris
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Röhler @ 2018-03-06  7:16 UTC (permalink / raw)
  To: 30726

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






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30726: [26.0.91 9] optimistic forward-sexp
  2018-03-06  7:16 bug#30726: [26.0.91 9] optimistic forward-sexp Andreas Röhler
@ 2018-03-06  7:47 ` Glenn Morris
  2018-03-06 10:43   ` Andreas Röhler
  2018-03-06 10:47   ` Andreas Röhler
  0 siblings, 2 replies; 5+ messages in thread
From: Glenn Morris @ 2018-03-06  7:47 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: 30726

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" ?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30726: [26.0.91 9] optimistic forward-sexp
  2018-03-06  7:47 ` Glenn Morris
@ 2018-03-06 10:43   ` Andreas Röhler
  2021-08-12 14:20     ` Lars Ingebrigtsen
  2018-03-06 10:47   ` Andreas Röhler
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Röhler @ 2018-03-06 10:43 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 30726

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30726: [26.0.91 9] optimistic forward-sexp
  2018-03-06  7:47 ` Glenn Morris
  2018-03-06 10:43   ` Andreas Röhler
@ 2018-03-06 10:47   ` Andreas Röhler
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Röhler @ 2018-03-06 10:47 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 30726

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)






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#30726: [26.0.91 9] optimistic forward-sexp
  2018-03-06 10:43   ` Andreas Röhler
@ 2021-08-12 14:20     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-12 14:20 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: Glenn Morris, 30726

Andreas Röhler <andreas.roehler@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-12 14:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-06  7:16 bug#30726: [26.0.91 9] optimistic forward-sexp Andreas Röhler
2018-03-06  7:47 ` Glenn Morris
2018-03-06 10:43   ` Andreas Röhler
2021-08-12 14:20     ` Lars Ingebrigtsen
2018-03-06 10:47   ` Andreas Röhler

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).