1 |
;;; paren.el --- highlight matching paren |
;;; paren.el --- highlight matching paren |
2 |
|
|
3 |
;; Copyright (C) 1993, 1996, 2001, 2004 Free Software Foundation, Inc. |
;; Copyright (C) 1993, 1996, 2001, 2004, 2005 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: rms@gnu.org |
;; Author: rms@gnu.org |
6 |
;; Maintainer: FSF |
;; Maintainer: FSF |
139 |
(defun show-paren-function () |
(defun show-paren-function () |
140 |
(if show-paren-mode |
(if show-paren-mode |
141 |
(let ((oldpos (point)) |
(let ((oldpos (point)) |
142 |
(dir (cond ((eq (car (syntax-after (1- (point)))) 5) -1) |
(dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1) |
143 |
((eq (car (syntax-after (point))) 4) 1))) |
((eq (syntax-class (syntax-after (point))) 4) 1))) |
144 |
pos mismatch face) |
pos mismatch face) |
145 |
;; |
;; |
146 |
;; Find the other end of the sexp. |
;; Find the other end of the sexp. |
169 |
;; kind of paren to match the one we started at. |
;; kind of paren to match the one we started at. |
170 |
(when (integerp pos) |
(when (integerp pos) |
171 |
(let ((beg (min pos oldpos)) (end (max pos oldpos))) |
(let ((beg (min pos oldpos)) (end (max pos oldpos))) |
172 |
(unless (eq (car (syntax-after beg)) 8) ;Not syntax `$'. |
(unless (eq (syntax-class (syntax-after beg)) 8) |
173 |
(setq mismatch |
(setq mismatch |
174 |
(not (or (eq (char-before end) |
(not (or (eq (char-before end) |
175 |
;; This can give nil. |
;; This can give nil. |