all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
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: Sun, 29 Aug 2021 08:56:14 -0400	[thread overview]
Message-ID: <jwvfsusifkc.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87tujl7ec9.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 19 Aug 2021 15:29:10 +0200")

Lars Ingebrigtsen [2021-08-19 15:29:10] wrote:

> 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?

The behavior I see in the example above is that a newline
is inserted right before the last "aaaaaaaaaa", and an error message is
displayed in the echo area.

I'm not completely sure what behavior we'd like to see here instead.
Just a less scary error message?

We could also emit no error message at all, but since this is using
smie-auto-fill (i.e. syntax-aware auto-fill), it seems important to
point out that we couldn't use syntax-aware auto-filling because of
a problem in the syntax, which is what the error message is trying
to say.


        Stefan






  reply	other threads:[~2021-08-29 12:56 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 [this message]
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
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvfsusifkc.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.