bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19342: auto-fill scan-error in sh-mode


From: Lars Ingebrigtsen
Subject: bug#19342: auto-fill scan-error in sh-mode
Date: Thu, 19 Aug 2021 15:29:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Glenn Morris <rgm@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?

I've added Stefan to the CCs.

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]