GNU bug report logs - #19342
auto-fill scan-error in sh-mode

Previous Next

Package: emacs;

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 19342 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#19342: auto-fill scan-error in sh-mode
Date: Thu, 19 Aug 2021 15:29:10 +0200
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?

I've added Stefan to the CCs.

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




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.