help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Disabling automatic reindentation of the current line after a newlin


From: Stefan Monnier
Subject: Re: Disabling automatic reindentation of the current line after a newline
Date: Mon, 24 Oct 2022 13:58:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> line when I press RET. What I'd like is for Emacs to auto-insert the
> number of spaces it deems necessary for the new, still blank line
> whenever I press RET, without also reindenting the previous line,

Set `electric-indent-inhibit` to t.

Tho if it's only for the cases where Emacs's choice of indentation is
wrong, I think a better course of action might be:

- Use `C-q C-j` instead of RET the rare times it's necessary.
- If it's not rare (or if it's an indentation bug rather than
  a question of style), submit a bug report to the major
  mode's maintainers.

For modes using SMIE you can also add a comment with the word
"fixindent" in it to tell the auto-indentation that it shouldn't touch
this line (this is also obeyed by `indent-region`, etc...).
It's not a very elegant solution, admittedly.


        Stefan




reply via email to

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