-;;; paren.el --- highlight matching paren.
+;;; paren.el --- highlight matching paren
-;; Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1996, 2001 Free Software Foundation, Inc.
;; Author: rms@gnu.org
;; Maintainer: FSF
;;; Commentary:
-;; Load this and it will display highlighting on whatever
-;; paren matches the one before or after point.
+;; Put this into your ~/.emacs:
+
+;; (show-paren-mode t)
+
+;; It will display highlighting on whatever paren matches the one
+;; before or after point.
;;; Code:
:version "20.3")
(defface show-paren-match-face
- '((((class color)) (:background "turquoise"))
- (t (:background "gray")))
+ '((((class color) (background light))
+ :background "turquoise") ; looks OK on tty (becomes cyan)
+ (((class color) (background dark))
+ :background "steelblue3") ; looks OK on tty (becomes blue)
+ (((background dark))
+ :background "grey50")
+ (t
+ :background "gray"))
"Show Paren mode face used for a matching paren."
:group 'faces
:group 'paren-showing)
When Show Paren mode is enabled, any matching parenthesis is highlighted
in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time."
- nil nil nil :global t :group 'paren-showing
+ :global t :group 'paren-showing
;; Turn off the usual paren-matching method
;; when this one is turned on.
(if (local-variable-p 'show-paren-mode)
(condition-case ()
(setq pos (scan-sexps (point) dir))
(error (setq pos t mismatch t)))
+ ;; Move back the other way and verify we get back to the
+ ;; starting point. If not, these two parens don't really match.
+ ;; Maybe the one at point is escaped and doesn't really count.
+ (when (integerp pos)
+ (unless (condition-case ()
+ (eq (point) (scan-sexps pos (- dir)))
+ (error nil))
+ (setq pos nil)))
;; If found a "matching" paren, see if it is the right
;; kind of paren to match the one we started at.
(when (integerp pos)