[Top][All Lists]

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

Re: newline-and-indent vs. electric-indent-mode

From: Dmitry Gutov
Subject: Re: newline-and-indent vs. electric-indent-mode
Date: Sat, 23 Jan 2021 02:45:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 23.01.2021 01:16, Stefan Monnier wrote:
That would disable the effects of electric-indent-functions, and in
particular, of ruby--electric-indent-p.
I don't see why.  AFAIK it should only inhibit the "reindent original
line when inserting \n".  It should affect indentation of the line after
the inserted \n nor should it affect indentation when inserting
other chars.
It also affect "reindent original line when inserting something other than
\n", which is what ruby--electric-indent-p is all about (e.g. I type 'd'
finishing the token 'end', and the line is reindented).

Hmm... indeed I now see that the code also inhibits reindentation in
that case.  Weird!
Could you open a bug report for this?

I'm not sure how it is a bug. It's "reindentation" in both cases, right?

And electric-indent-inhibit's docstring refers to reindentation.

It's just that in my mental model \n doesn't belong to the current line,
only to the next one. So it shouldn't reindent the original line.

It's often useful for me, as in typing

     foo RET else RET blabla

where the else benefits from being reindented upon the second RET.

I see. Well, ruby--electric-indent-p covers this scenario already.

Perhaps your approach is simpler, but always reindenting the original line gets annoying if the indentation function sometimes produces suboptimal results. Or, you know, just results that disagree with the style guide used in a project. Then I have to go back and change the indentation manually again, or undo the change and go with C-o C-n TAB.

reply via email to

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