-;; Copyright (C) 1993, 1996, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1996, 2001, 2002, 2003, 2004,
+;; 2005 Free Software Foundation, Inc.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
'((((class color) (background light))
:background "turquoise") ; looks OK on tty (becomes cyan)
(((class color) (background dark))
'((((class color) (background light))
:background "turquoise") ; looks OK on tty (becomes cyan)
(((class color) (background dark))
'((((class color)) (:foreground "white" :background "purple"))
(t (:inverse-video t)))
"Show Paren mode face used for a mismatching paren."
:group 'faces
:group 'paren-showing)
'((((class color)) (:foreground "white" :background "purple"))
(t (:inverse-video t)))
"Show Paren mode face used for a mismatching paren."
:group 'faces
:group 'paren-showing)
+;; backward-compatibility alias
+(put 'show-paren-mismatch-face 'face-alias 'show-paren-mismatch)
+
+(defvar show-paren-highlight-openparen t
+ "*Non-nil turns on openparen highlighting when matching forward.")
- (dir (cond ((eq (car (syntax-after (1- (point)))) 5) -1)
- ((eq (car (syntax-after (point))) 4) 1)))
+ (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1)
+ ((eq (syntax-class (syntax-after (point))) 4) 1)))
;; kind of paren to match the one we started at.
(when (integerp pos)
(let ((beg (min pos oldpos)) (end (max pos oldpos)))
;; kind of paren to match the one we started at.
(when (integerp pos)
(let ((beg (min pos oldpos)) (end (max pos oldpos)))
- (not (eq (char-before end)
- ;; This can give nil.
- (matching-paren (char-after beg)))))))))))
+ (not (or (eq (char-before end)
+ ;; This can give nil.
+ (cdr (syntax-after beg)))
+ (eq (char-after beg)
+ ;; This can give nil.
+ (cdr (syntax-after (1- end)))))))))))))
;;
;; If matching backwards, highlight the closeparen
;; before point as well as its matching open.
;; If matching forward, and the openparen is unbalanced,
;; highlight the paren at point to indicate misbalance.
;; Otherwise, turn off any such highlighting.
;;
;; If matching backwards, highlight the closeparen
;; before point as well as its matching open.
;; If matching forward, and the openparen is unbalanced,
;; highlight the paren at point to indicate misbalance.
;; Otherwise, turn off any such highlighting.
(when (and show-paren-overlay-1
(overlay-buffer show-paren-overlay-1))
(delete-overlay show-paren-overlay-1))
(when (and show-paren-overlay-1
(overlay-buffer show-paren-overlay-1))
(delete-overlay show-paren-overlay-1))