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

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

Disabling automatic reindentation of the current line after a newline


From: Jean Abou Samra
Subject: Disabling automatic reindentation of the current line after a newline
Date: Sat, 22 Oct 2022 17:18:45 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1

Hi,

Suppose I am in Lisp mode and I write this:

(defun f (x)
    (g x))

Note the extra spaces compared to standard indentation. If, after
writing the last parenthesis, I press RET, Emacs automatically
reindents the second line, changing the code to this:

(defun f (x)
  (g x))


The same happens with other major modes.

I am aware that I can turn this off with M-x electric-indent-mode.
However, that also disables any automatic indentation for the next
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, where I might have changed the indentation if Emacs made
a mistake (e.g., if the major mode I am using is not 100% accurate,
or if I have a slightly different style for which no option exists
in that mode).

Is this possible?

Thanks,
Jean






reply via email to

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