unofficial mirror of bug-gnu-emacs@gnu.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: 17955@debbugs.gnu.org, Leo Liu <sdl.web@gmail.com>
Subject: bug#17955: 24.3.92; octave.el: indentation following ... or \
Date: Sat, 29 May 2021 10:44:10 -0400	[thread overview]
Message-ID: <jwvpmx9d2lz.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87a6oet9ge.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 29 May 2021 07:06:41 +0200")

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






  reply	other threads:[~2021-05-29 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-06  9:36 bug#17955: 24.3.92; octave.el: indentation following ... or \ Leo Liu
2014-07-07  1:49 ` Stefan Monnier
2021-05-29  5:06   ` Lars Ingebrigtsen
2021-05-29 14:44     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-05-30  4:26       ` Lars Ingebrigtsen

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=jwvpmx9d2lz.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=17955@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=sdl.web@gmail.com \
    /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).