[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17955: 24.3.92; octave.el: indentation following ... or \
From: |
Stefan Monnier |
Subject: |
bug#17955: 24.3.92; octave.el: indentation following ... or \ |
Date: |
Sat, 29 May 2021 10:44:10 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Lars Ingebrigtsen [2021-05-29 07:06:41] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> So you should be able to control indentation of "b" above by tweaking
>> the (:after . "=") or (:before . "=") rule.
>
> I've never played around with the SMIE indentation before, but looking
> at other examples, I came up with this:
>
> diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
> index a1a5192ee1..5d877fc6ba 100644
> --- a/lisp/progmodes/octave.el
> +++ b/lisp/progmodes/octave.el
> @@ -460,7 +460,8 @@ octave-smie-rules
> (smie-rule-parent octave-block-offset)
> ;; For (invalid) code between switch and case.
> ;; (if (smie-rule-parent-p "switch") 4)
> - nil))))
> + nil))
> + ('(:after . "=") octave-block-offset)))
>
> (defun octave-indent-comment ()
> "A function for `smie-indent-functions' (which see)."
>
> And the results look OK to me:
>
> a = \
> b
> foo = \
> dasd
>
> So I've pushed this to Emacs 28; feel free to tweak further.
I suspect this behavior, is still not quite what users would want:
why break the line if the continuation starts where you broke?
Maybe
('(:after . "=") (smie-rule-parent octave-block-offset))))
would work better?
And we should add tests for these changes, since regressions are all too
easy to introduce when it comes to indentation rules.
Stefan