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: Mon, 24 Oct 2022 11:16:29 +0200

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]