]> code.delx.au - gnu-emacs/blobdiff - lisp/paren.el
* net/tramp-adb.el (tramp-adb-prompt): Extend regexp.
[gnu-emacs] / lisp / paren.el
index 2d6c42478e18453a7e182d0032b2c7f1aeada854..a9d3be606220c8f01adaa79b5b13d8cff9ce3926 100644 (file)
@@ -1,6 +1,6 @@
 ;;; paren.el --- highlight matching paren
 
-;; Copyright (C) 1993, 1996, 2001-201 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))