mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-26 07:33:47 +00:00
Make sure 'M-x show-paren-local-mode' turns on right away
* lisp/paren.el (show-paren--enabled-p): Extract from 'show-paren-function'. (show-paren-local-mode): Use it in the :variable getter (bug#61098).
This commit is contained in:
parent
60089dcfe0
commit
793c24a6ac
@ -161,8 +161,9 @@ use `show-paren-local-mode'."
|
||||
;;;###autoload
|
||||
(define-minor-mode show-paren-local-mode
|
||||
"Toggle `show-paren-mode' only in this buffer."
|
||||
:variable ( show-paren-mode .
|
||||
(lambda (val) (setq-local show-paren-mode val)))
|
||||
: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
|
||||
@ -428,14 +429,17 @@ It is the default value of `show-paren-data-function'."
|
||||
;; `show-paren-delay'.
|
||||
(defvar-local show-paren--last-pos nil)
|
||||
|
||||
(defun show-paren--enabled-p ()
|
||||
(and show-paren-mode
|
||||
;; If we're using `show-paren-local-mode', then
|
||||
;; always heed the value.
|
||||
(or (local-variable-p 'show-paren-mode)
|
||||
;; If not, check that the predicate matches.
|
||||
(buffer-match-p show-paren-predicate (current-buffer)))))
|
||||
|
||||
(defun show-paren-function ()
|
||||
"Highlight the parentheses until the next input arrives."
|
||||
(let ((data (and show-paren-mode
|
||||
;; If we're using `show-paren-local-mode', then
|
||||
;; always heed the value.
|
||||
(or (local-variable-p 'show-paren-mode)
|
||||
;; If not, check that the predicate matches.
|
||||
(buffer-match-p show-paren-predicate (current-buffer)))
|
||||
(let ((data (and (show-paren--enabled-p)
|
||||
(funcall show-paren-data-function))))
|
||||
(if (not data)
|
||||
(progn
|
||||
|
Loading…
Reference in New Issue
Block a user