[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Debugging SMIE for sh-script.el
From: |
Stefan Monnier |
Subject: |
Re: Debugging SMIE for sh-script.el |
Date: |
Sun, 05 Sep 2021 12:27:09 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> The proper solution IMHO should be changing sh-smie--indent-continuation to
> not rely on other functions to calculate indent. Something along the lines
> of going (smie-backward-sexp) until you get (smie-rule-bolp), this would get
> you to the start of the parent line and then you can base your indentation
> decisions on it.
I'm not sure which "other functions" you're thinking of (obviously
`smie-backward-sexp` and `smie-rule-bolp` aren't included in those
"other functions" that shouldn't be used ;-).
Note that if you start with the loop you describe (which corresponds to
the algorithm used by `smie-indent-exps`) you'll sooner or later
hit cases where the code needs to be refined a bit, as at some point
I think you'll realize that you're reimplementing the whole indentation
code and that you're probably better off calling `smie-indent-calculate`
recursively and call it a day ;-)
> Also note, that sh-mode separates default-backward\forward-token functions
> from the actual backward\forward-token functions, with the latter handling
> whatever special cases there are and the default functions just doing
> straight buffer reading.
The default-backward\forward-token functions are only meant as examples
to help get started (they're often good enough during the first
half-hour of fiddling with a new grammar to get a feel for what might
work). The actual backward\forward-token functions don't need to
use them or to look like them.
Stefan
- Re: Debugging SMIE for sh-script.el, (continued)
- Re: Debugging SMIE for sh-script.el, Nikolay Kudryavtsev, 2021/09/05
- Re: Debugging SMIE for sh-script.el,
Stefan Monnier <=
- Re: Debugging SMIE for sh-script.el, Nikolay Kudryavtsev, 2021/09/05
- Re: Debugging SMIE for sh-script.el, Stefan Monnier, 2021/09/05
- Re: Debugging SMIE for sh-script.el, Nikolay Kudryavtsev, 2021/09/05
- Re: Debugging SMIE for sh-script.el, Stefan Monnier, 2021/09/05
- Re: Debugging SMIE for sh-script.el, Nikolay Kudryavtsev, 2021/09/06
- Re: Debugging SMIE for sh-script.el, Stefan Monnier, 2021/09/06
- Re: Debugging SMIE for sh-script.el, Nikolay Kudryavtsev, 2021/09/06
- Re: Debugging SMIE for sh-script.el, Stefan Monnier, 2021/09/06
- Re: Debugging SMIE for sh-script.el, Kévin Le Gouguec, 2021/09/12
Re: Debugging SMIE for sh-script.el, Stefan Monnier, 2021/09/02