Variable: electric-indent-actions
electric-indent-actions is a customizable variable defined in
electric.el.gz.
Value
nil
Documentation
List of actions to indent.
The valid elements of this list can be:
- yank: Indent the yanked text only if point is not in a string or
comment and yanked region is longer than 1 line.
- before-save: Indent the whole buffer before saving it.
The indentation will not happen when the major mode is unable to reindent code reliably, such as in buffers where indentation is significant.
This variable was added, or its default value changed, in Emacs 31.1.
Probably introduced at or before Emacs version 31.1.
Source Code
;; Defined in /usr/src/emacs/lisp/electric.el.gz
;;; Electric indentation.
(defcustom electric-indent-actions nil
"List of actions to indent.
The valid elements of this list can be:
- `yank': Indent the yanked text only if point is not in a string or
comment and yanked region is longer than 1 line.
- `before-save': Indent the whole buffer before saving it.
The indentation will not happen when the major mode is unable to
reindent code reliably, such as in buffers where indentation is
significant."
:type '(repeat (choice (const :tag "After yanking" yank)
(const :tag "Before saving" before-save)))
:set (lambda (var val)
(set-default var val)
(when (bound-and-true-p electric-indent-mode)
(electric-indent--activate-indent-actions t)))
:safe (lambda (v)
(and (proper-list-p v)
(null (seq-filter (lambda (e) (not (symbolp e)) ) v))))
:version "31.1")