From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Glenn Morris <rgm@gnu.org>, 19342@debbugs.gnu.org
Subject: bug#19342: auto-fill scan-error in sh-mode
Date: Fri, 06 May 2022 08:34:57 -0400 [thread overview]
Message-ID: <jwvpmkqalhm.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87ilqiludd.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 06 May 2022 14:26:38 +0200")
Lars Ingebrigtsen [2022-05-06 14:26:38] wrote:
> Stefan Monnier <monnier@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)))))
next prev parent reply other threads:[~2022-05-06 12:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 21:51 bug#19342: auto-fill scan-error in sh-mode Glenn Morris
2018-12-09 10:35 ` Charles A. Roelli
2018-12-09 15:43 ` Charles A. Roelli
2020-08-12 16:44 ` Stefan Kangas
2021-08-19 13:29 ` Lars Ingebrigtsen
2021-08-29 12:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-29 18:42 ` Lars Ingebrigtsen
2021-08-30 0:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-30 0:44 ` Lars Ingebrigtsen
2021-08-30 12:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-30 15:03 ` Glenn Morris
2021-08-30 15:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-31 1:24 ` Lars Ingebrigtsen
2021-08-31 3:29 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-31 8:31 ` Lars Ingebrigtsen
2022-05-05 13:39 ` Lars Ingebrigtsen
2022-05-05 20:03 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-06 11:49 ` Lars Ingebrigtsen
2022-05-06 12:09 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-06 12:26 ` Lars Ingebrigtsen
2022-05-06 12:34 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-05-06 12:37 ` Lars Ingebrigtsen
2022-05-06 14:12 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-06 15:03 ` Lars Ingebrigtsen
2022-05-06 15:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvpmkqalhm.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=19342@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=monnier@iro.umontreal.ca \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).