Function: show-paren-local-mode

show-paren-local-mode is an interactive and byte-compiled function defined in paren.el.gz.

Signature

(show-paren-local-mode &optional ARG)

Documentation

Toggle show-paren-mode(var)/show-paren-mode(fun) only in this buffer.

This is a minor mode. If called interactively, toggle the Show-Paren-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 (show-paren--enabled-p).

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

View in manual

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/paren.el.gz
;;;###autoload
(define-minor-mode show-paren-local-mode
  "Toggle `show-paren-mode' only in this buffer."
  :variable ((show-paren--enabled-p)
             .
             (lambda (val) (setq-local show-paren-mode val)))
  (cond
   ((eq show-paren-mode (default-value 'show-paren-mode))
    (unless show-paren-mode
      (show-paren--delete-overlays)
      (kill-local-variable 'show-paren-mode)))
   ((not (default-value 'show-paren-mode))
    ;; Locally enabled, but globally disabled.
    (show-paren-mode 1)                ; Setup the timer.
    (setq-default show-paren-mode nil) ; But keep it globally disabled.
    )
   (t ;; Locally disabled only.
    (show-paren--delete-overlays))))