Variable: electric-layout-rules

electric-layout-rules is a variable defined in electric.el.gz.

Value

nil

Documentation

List of rules saying where to automatically insert newlines.

Each rule has the form (CHAR . WHERE), the rule matching if the character just inserted was CHAR. WHERE specifies where to insert newlines, and can be:

* one of the symbols before, after, around, after-stay,
  or nil.

* a list of the preceding symbols, processed in order of
  appearance to insert multiple newlines;

* a function of no arguments that returns one of the previous
  values.

Each symbol specifies where, in relation to the position POS of the character inserted, the newline character(s) should be inserted. after-stay means insert a newline after POS but stay in the same place.

Instead of the (CHAR . WHERE) form, a rule can also be just a function of a single argument, the character just inserted. It is called at that position, and should return a value compatible with WHERE if the rule matches, or nil if it doesn't match.

If multiple rules match, only first one is executed.

Probably introduced at or before Emacs version 24.1.

Source Code

;; Defined in /usr/src/emacs/lisp/electric.el.gz
;;; Electric newlines after/before/around some chars.

(defvar electric-layout-rules nil
  "List of rules saying where to automatically insert newlines.

Each rule has the form (CHAR . WHERE), the rule matching if the
character just inserted was CHAR.  WHERE specifies where to
insert newlines, and can be:

* one of the symbols `before', `after', `around', `after-stay',
  or nil.

* a list of the preceding symbols, processed in order of
  appearance to insert multiple newlines;

* a function of no arguments that returns one of the previous
  values.

Each symbol specifies where, in relation to the position POS of
the character inserted, the newline character(s) should be
inserted.  `after-stay' means insert a newline after POS but stay
in the same place.

Instead of the (CHAR . WHERE) form, a rule can also be just a
function of a single argument, the character just inserted.  It
is called at that position, and should return a value compatible with
WHERE if the rule matches, or nil if it doesn't match.

If multiple rules match, only first one is executed.")