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
Message #67 received at 19342 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen [2022-05-06 14:26:38] wrote:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>>> Sure, sounds simpler... uhm... but what would a good point-max be
>>> here? Just the `fc' point?
>>
>> I'd think `point-max` does the trick.
>
> Tried that, and it leads to breakages in other parts of the loop:
>
> Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 74 74)
> signal(scan-error ("Containing expression ends prematurely" 74 74))
> smie-forward-sexp-command(1)
> forward-sexp(1)
> smie-indent-forward-token()
> smie-auto-fill(#f(compiled-function (&rest args) #<bytecode -0x1ddee5fc6c36b776>))
> apply(smie-auto-fill #f(compiled-function (&rest args) #<bytecode -0x1ddee5fc6c36b776>) nil)
> #f(advice smie-auto-fill :around #f(compiled-function (&rest args)
> #<bytecode -0x1ddee5fc6c36b776>))()
> internal-auto-fill()
I can't begin to imagine why we'd get that.
But how 'bout the patch below?
Stefan
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 2bab1319132..0da403c7053 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1862,8 +1862,10 @@ smie-auto-fill
;; here may not be accurate, but in practice it seems
;; to work well enough.
(skip-chars-forward " \t")
- (let* ((newcol (smie-indent-calculate))
- (newgain (- (current-column) newcol)))
+ (let* ((newgain (condition-case nil
+ (- (current-column)
+ (smie-indent-calculate))
+ (scan-error -1)))
(when (> newgain gain)
(setq gain newgain)
(setq bsf (point)))))
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.