Mercurial > emacs
comparison lisp/paren.el @ 17009:3db0adbc5367
(show-paren-function): Handle multibyte characters.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 20 Feb 1997 05:48:19 +0000 |
parents | 11dadc34fd9a |
children | e3a032578eb3 |
comparison
equal
deleted
inserted
replaced
17008:3a99b530ad9a | 17009:3db0adbc5367 |
---|---|
102 ;; kind of paren to match the one we started at. | 102 ;; kind of paren to match the one we started at. |
103 (if (integerp pos) | 103 (if (integerp pos) |
104 (let ((beg (min pos oldpos)) (end (max pos oldpos))) | 104 (let ((beg (min pos oldpos)) (end (max pos oldpos))) |
105 (and (/= (char-syntax (char-after beg)) ?\$) | 105 (and (/= (char-syntax (char-after beg)) ?\$) |
106 (setq mismatch | 106 (setq mismatch |
107 (not (eq (char-after (1- end)) | 107 (not (eq (char-before end) |
108 ;; This can give nil. | 108 ;; This can give nil. |
109 (matching-paren (char-after beg)))))))) | 109 (matching-paren (char-after beg)))))))) |
110 ;; If they don't properly match, use a different face, | 110 ;; If they don't properly match, use a different face, |
111 ;; or print a message. | 111 ;; or print a message. |
112 (if mismatch | 112 (if mismatch |
135 ;; before point as well as its matching open. | 135 ;; before point as well as its matching open. |
136 ;; If matching forward, and the openparen is unbalanced, | 136 ;; If matching forward, and the openparen is unbalanced, |
137 ;; highlight the paren at point to indicate misbalance. | 137 ;; highlight the paren at point to indicate misbalance. |
138 (let ((from (if (= dir 1) | 138 (let ((from (if (= dir 1) |
139 (point) | 139 (point) |
140 (1- (point)))) | 140 (forward-point -1))) |
141 (to (if (= dir 1) | 141 (to (if (= dir 1) |
142 (1+ (point)) | 142 (forward-point 1) |
143 (point)))) | 143 (point)))) |
144 (if show-paren-overlay-1 | 144 (if show-paren-overlay-1 |
145 (move-overlay show-paren-overlay-1 | 145 (move-overlay show-paren-overlay-1 |
146 from to | 146 from to |
147 (current-buffer)) | 147 (current-buffer)) |
155 (delete-overlay show-paren-overlay-1))) | 155 (delete-overlay show-paren-overlay-1))) |
156 ;; Turn on highlighting for the matching paren, if found. | 156 ;; Turn on highlighting for the matching paren, if found. |
157 ;; If it's an unmatched paren, turn off any such highlighting. | 157 ;; If it's an unmatched paren, turn off any such highlighting. |
158 (or (and (not (integerp pos)) | 158 (or (and (not (integerp pos)) |
159 (delete-overlay show-paren-overlay)) | 159 (delete-overlay show-paren-overlay)) |
160 (if show-paren-overlay | 160 (save-excursion |
161 (move-overlay show-paren-overlay (- pos dir) pos | 161 (goto-char pos) |
162 (current-buffer)) | 162 (if show-paren-overlay |
163 (setq show-paren-overlay | 163 (move-overlay show-paren-overlay |
164 (make-overlay (- pos dir) pos)))) | 164 (forward-point (- dir)) |
165 pos | |
166 (current-buffer)) | |
167 (setq show-paren-overlay | |
168 (make-overlay (forward-point (- dir)) pos))))) | |
165 ;; Always set the overlay face, since it varies. | 169 ;; Always set the overlay face, since it varies. |
166 (overlay-put show-paren-overlay 'face face)) | 170 (overlay-put show-paren-overlay 'face face)) |
167 (t | 171 (t |
168 ;; If not at a paren that has a match, | 172 ;; If not at a paren that has a match, |
169 ;; turn off any previous paren highlighting. | 173 ;; turn off any previous paren highlighting. |