Function: electric-pair-local-mode

electric-pair-local-mode is an autoloaded, interactive and byte-compiled function defined in elec-pair.el.gz.

Signature

(electric-pair-local-mode &optional ARG)

Documentation

Toggle electric-pair-mode(var)/electric-pair-mode(fun) only in this buffer.

This is a minor mode. If called interactively, toggle the Electric-Pair-Local mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (buffer-local-value \=electric-pair-mode
(current-buffer))'.

The mode's hook is called both when the mode is enabled and when it is disabled.

Probably introduced at or before Emacs version 25.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/elec-pair.el.gz
;;;###autoload
(define-minor-mode electric-pair-local-mode
  "Toggle `electric-pair-mode' only in this buffer."
  :variable (buffer-local-value 'electric-pair-mode (current-buffer))
  (cond
   ((eq electric-pair-mode (default-value 'electric-pair-mode))
    (kill-local-variable 'electric-pair-mode))
   ((not (default-value 'electric-pair-mode))
    ;; Locally enabled, but globally disabled.
    (electric-pair-mode 1)		  ; Setup the hooks.
    (setq-default electric-pair-mode nil) ; But keep it globally disabled.
    )))