Variable: electric-pair-mode-hook

electric-pair-mode-hook is a customizable variable defined in elec-pair.el.gz.

Value

(emacs-lisp-set-electric-text-pairs)

Documentation

Hook run after entering or leaving electric-pair-mode(var)/electric-pair-mode(fun).

No problems result if this variable is not bound. add-hook automatically binds it. (This is true for all hook variables.)

Source Code

;; Defined in /usr/src/emacs/lisp/elec-pair.el.gz
;;;###autoload
(define-minor-mode electric-pair-mode
  "Toggle automatic parens pairing (Electric Pair mode).

Electric Pair mode is a global minor mode.  When enabled, typing
an open parenthesis automatically inserts the corresponding
closing parenthesis, and vice versa.  (Likewise for brackets, etc.).
If the region is active, the parentheses (brackets, etc.) are
inserted around the region instead.

To toggle the mode in a single buffer, use `electric-pair-local-mode'."
  :global t :group 'electricity
  (if electric-pair-mode
      (progn
	(add-hook 'post-self-insert-hook
		  #'electric-pair-post-self-insert-function
                  ;; Prioritize this to kick in after
                  ;; `electric-layout-post-self-insert-function': that
                  ;; considerably simplifies interoperation when
                  ;; `electric-pair-mode', `electric-layout-mode' and
                  ;; `electric-indent-mode' are used together.
                  ;; Use `vc-region-history' on these lines for more info.
                  50)
        (add-hook 'post-self-insert-hook
		  #'electric-pair-open-newline-between-pairs-psif
                  50)
	(add-hook 'self-insert-uses-region-functions
		  #'electric-pair-will-use-region))
    (remove-hook 'post-self-insert-hook
                 #'electric-pair-post-self-insert-function)
    (remove-hook 'post-self-insert-hook
                 #'electric-pair-open-newline-between-pairs-psif)
    (remove-hook 'self-insert-uses-region-functions
                 #'electric-pair-will-use-region)))