GNU bug report logs -
#19342
auto-fill scan-error in sh-mode
Previous Next
Reported by: Glenn Morris <rgm <at> gnu.org>
Date: Wed, 10 Dec 2014 21:52:02 UTC
Severity: normal
Tags: confirmed
Found in versions 24.4, 28.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Lars Ingebrigtsen [2021-08-19 15:29:10] wrote:
> Glenn Morris <rgm <at> gnu.org> writes:
>
>> Type a long string with spaces, past fill-column; eg:
>>
>> foo="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaa aaaaaaaaaa
>>
>> Auto-fill results in:
>>
>> Error: (scan-error "Containing expression ends prematurely" 75 75)
>
> This problem is still present in Emacs 28. This is the backtrace:
>
> Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 95 95)
> signal(scan-error ("Containing expression ends prematurely" 95 95))
> (if (and (car res) (= pos (point)) (not (if forw (eobp) (bobp)))) (
> (let ((pos (point)) (res (if forw (smie-forward-sexp 'halfsexp) (sm
> (while (/= n 0) (setq n (- n (if forw 1 -1))) (let ((pos (point)) (
> (let ((forw (> n 0)) (forward-sexp-function nil)) (while (/= n 0) (
> smie-forward-sexp-command(1)
> forward-sexp(1)
> (cond ((< 0 (length tok)) (assoc tok smie-grammar)) ((looking-at "\
> (let ((tok (funcall smie-forward-token-function))) (cond ((< 0 (len
> smie-indent-forward-token()
> smie-indent-keyword()
> smie--funcall(smie-indent-keyword)
> run-hook-wrapped(smie--funcall smie-indent-keyword)
> smie-indent-calculate()
> smie-auto-fill(#f(compiled-function (&rest args) #<bytecode -0x1d0b7391ba5340b6>))
>
> The code that errors out is:
>
> (defun smie-indent-forward-token ()
> [...]
> ((looking-at "\\s\"\\|\\s|")
> (forward-sexp 1)
>
> That is, if we're auto-filling an unterminated string, it'll always bug
> out, apparently?
The behavior I see in the example above is that a newline
is inserted right before the last "aaaaaaaaaa", and an error message is
displayed in the echo area.
I'm not completely sure what behavior we'd like to see here instead.
Just a less scary error message?
We could also emit no error message at all, but since this is using
smie-auto-fill (i.e. syntax-aware auto-fill), it seems important to
point out that we couldn't use syntax-aware auto-filling because of
a problem in the syntax, which is what the error message is trying
to say.
Stefan
This bug report was last modified 3 years and 73 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.