[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging SMIE for sh-script.el

From: Kévin Le Gouguec
Subject: Re: Debugging SMIE for sh-script.el
Date: Thu, 02 Sep 2021 23:37:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier via Users list for the GNU Emacs text editor
<> writes:

> Indeed, the problem seems to be in `sh-smie-sh-forward-token` where it
> should skip over the whole of "${foo}/bar".

Mmm, I see that with point on "--baz", (smie-backward-sexp) stops at
"/bar" instead of going all the way back to bol.

I'm tracking this down to sh-smie--default-backward-token, which makes
sense: this is where I tentatively added "()" in the call to
(skip-syntax-backward ".w_'") in 6392bc37a.

bug#50320 showed that this causes all paired delimiters (parentheses and
braces) to turn into tokens that smie-backward-sexp can jump to, so this
got misindented:

#+begin_src sh
foo ()
bar     # derp

If I understand correctly, the progn form in

1. skips over chars matching syntax classes ".w_'",
2. skips over backslashes.

I guess TRT would be to add a third step to check whether (char-before
(point)) is a closing delimiter, and if so, skip back to its matching
opener?  With (forward-sexp -1)?  And then assert whether we've hit a $

No idea whether this makes sense.  I don't mind implementing that and
seeing how it goes, but I'd like to make sure I'm not completely off the

reply via email to

[Prev in Thread] Current Thread [Next in Thread]