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

From: Stefan Monnier <[email-masked]>
Date: Fri, 06 May 2022 10:12:21 -0400

Lars Ingebrigtsen [2021-08-31 03:24:35] wrote:
> Stefan Monnier <[email-masked]> writes:
>> It's not issuing an error.  It's emitting a message, the purpose
>> of which is to warn the user that the behavior was affected by
>> that problem.
>
> I get your point, and as you say, it works fine -- it auto-fills as it's
> supposed to.
>
> But it's literally signalling an error.  (And this is one of those rare
> instances where "literally" isn't a general intensifier.)  Changing it
> to a message would solve the issue, I think?

BTW, AFAICT it does not *literally* signal an error: the error is caught
inside `smie-auto-fill` and turned into a message (by
`with-demoted-errors`).

So if we want to silence the message, all it takes is to use
`ignore-error` instead as in the patch below, no?

        Stefan

diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 2bab1319132..2be1ca3218b 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1846,7 +1846,7 @@ smie-auto-fill
                            (move-to-column fc)
                            (syntax-ppss))))
         (while
-            (and (with-demoted-errors "SMIE Error: %S"
+            (and (ignore-error scan-error
                    (save-excursion
                      (let ((end (point))
                            (bsf nil)    ;Best-so-far.