Variable: electric-pair-preserve-balance

electric-pair-preserve-balance is a customizable variable defined in elec-pair.el.gz.

Value

t

Documentation

Whether to keep matching delimiters balanced.

When non-nil, typing a delimiter inserts only this character if there is a unpaired matching delimiter later (if the latter is a closing delimiter) or earlier (if the latter is a opening delimiter) in the buffer. When nil, inserting a delimiter disregards unpaired matching delimiters.

Whether this variable takes effect depends on the variables electric-pair-inhibit-predicate and electric-pair-skip-self, which check the value of this variable before delegating to other predicates responsible for making decisions on whether to pair/skip some characters based on the actual state of the buffer's delimiters. In addition, this variable has no effect if there is an active region.

This variable was added, or its default value changed, in Emacs 24.4.

View in manual

Probably introduced at or before Emacs version 24.4.

Source Code

;; Defined in /usr/src/emacs/lisp/elec-pair.el.gz
(defcustom electric-pair-preserve-balance t
  "Whether to keep matching delimiters balanced.
When non-nil, typing a delimiter inserts only this character if there is
a unpaired matching delimiter later (if the latter is a closing
delimiter) or earlier (if the latter is a opening delimiter) in the
buffer.  When nil, inserting a delimiter disregards unpaired matching
delimiters.

Whether this variable takes effect depends on the variables
`electric-pair-inhibit-predicate' and `electric-pair-skip-self', which
check the value of this variable before delegating to other predicates
responsible for making decisions on whether to pair/skip some characters
based on the actual state of the buffer's delimiters.  In addition, this
variable has no effect if there is an active region."
  :version "24.4"
  :group 'electricity
  :type 'boolean)