X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/226c3633fdc0a259aa73aa9e6555cd42dd9f168c..bfc58a84b276919f675b0c65e84ea97238833033:/lisp/paren.el diff --git a/lisp/paren.el b/lisp/paren.el index 2d6c42478e..a9d3be6062 100644 --- a/lisp/paren.el +++ b/lisp/paren.el @@ -1,6 +1,6 @@ ;;; paren.el --- highlight matching paren -;; Copyright (C) 1993, 1996, 2001-2012 Free Software Foundation, Inc. +;; Copyright (C) 1993, 1996, 2001-2013 Free Software Foundation, Inc. ;; Author: rms@gnu.org ;; Maintainer: FSF @@ -52,8 +52,17 @@ otherwise)." :group 'paren-showing) (defcustom show-paren-delay 0.125 - "Time in seconds to delay before showing a matching paren." + "Time in seconds to delay before showing a matching paren. +If you change this without using customize while `show-paren-mode' is +active, you must toggle the mode off and on again for this to take effect." :type '(number :tag "seconds") + :initialize 'custom-initialize-default + :set (lambda (sym val) + (if (not show-paren-mode) + (set sym val) + (show-paren-mode -1) + (set sym val) + (show-paren-mode 1))) :group 'paren-showing) (defcustom show-paren-priority 1000 @@ -234,27 +243,26 @@ matching parenthesis is highlighted in `show-paren-style' after ;; ;; Turn on highlighting for the matching paren, if found. ;; If it's an unmatched paren, turn off any such highlighting. - (unless (integerp pos) - (delete-overlay show-paren-overlay)) - (let ((to (if (or (eq show-paren-style 'expression) - (and (eq show-paren-style 'mixed) - (not (pos-visible-in-window-p pos)))) - (point) - pos)) - (from (if (or (eq show-paren-style 'expression) + (if (not (integerp pos)) + (when show-paren-overlay (delete-overlay show-paren-overlay)) + (let ((to (if (or (eq show-paren-style 'expression) (and (eq show-paren-style 'mixed) (not (pos-visible-in-window-p pos)))) - pos - (save-excursion - (goto-char pos) - (- (point) dir))))) - (if show-paren-overlay - (move-overlay show-paren-overlay from to (current-buffer)) - (setq show-paren-overlay (make-overlay from to nil t)))) - ;; - ;; Always set the overlay face, since it varies. - (overlay-put show-paren-overlay 'priority show-paren-priority) - (overlay-put show-paren-overlay 'face face))) + (point) + pos)) + (from (if (or (eq show-paren-style 'expression) + (and (eq show-paren-style 'mixed) + (not (pos-visible-in-window-p pos)))) + pos + (save-excursion + (goto-char pos) + (- (point) dir))))) + (if show-paren-overlay + (move-overlay show-paren-overlay from to (current-buffer)) + (setq show-paren-overlay (make-overlay from to nil t)))) + ;; Always set the overlay face, since it varies. + (overlay-put show-paren-overlay 'priority show-paren-priority) + (overlay-put show-paren-overlay 'face face)))) ;; show-paren-mode is nil in this buffer. (and show-paren-overlay (delete-overlay show-paren-overlay))