Function: electric-newline-and-maybe-indent

electric-newline-and-maybe-indent is an interactive and byte-compiled function defined in electric.el.gz.

Signature

(electric-newline-and-maybe-indent)

Documentation

Insert a newline.

If electric-indent-mode(var)/electric-indent-mode(fun) is enabled, that's that, but if it is *disabled* then additionally indent according to major mode. Indentation is done using the value of indent-line-function. In programming language modes, this is the same as TAB. In some text modes, where TAB inserts a tab, this command indents to the column specified by the function current-left-margin.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/electric.el.gz
;;;###autoload
(defun electric-newline-and-maybe-indent ()
  "Insert a newline.
If `electric-indent-mode' is enabled, that's that, but if it
is *disabled* then additionally indent according to major mode.
Indentation is done using the value of `indent-line-function'.
In programming language modes, this is the same as TAB.
In some text modes, where TAB inserts a tab, this command indents to the
column specified by the function `current-left-margin'."
  (interactive "*")
  (if electric-indent-mode
      (electric-indent-just-newline nil)
    (newline-and-indent)))