[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
show-paren-mode indicates mismatch for escaped parentheses
From: |
Ralf Angeli |
Subject: |
show-paren-mode indicates mismatch for escaped parentheses |
Date: |
Tue, 18 Oct 2005 11:41:05 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
In LaTeX escaped parentheses like \(a^2+b^2=c^2\) are used for marking
inline math. `show-paren-mode' indicates mismatches when moving point
over the opening or closing parentheses. In order to prevent this, I
think, it should not try to match an escaped paren in the first place.
The following patch achieves this by performing the search for a
matching paren only if an even number of escape chars or none is found
before the character in question:
*** Paren.el 10 Aug 2005 15:24:59 +0200 1.64
--- paren.el 18 Oct 2005 11:28:58 +0200
***************
*** 144,151 ****
(defun show-paren-function ()
(if show-paren-mode
(let ((oldpos (point))
! (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1)
! ((eq (syntax-class (syntax-after (point))) 4) 1)))
pos mismatch face)
;;
;; Find the other end of the sexp.
--- 144,158 ----
(defun show-paren-function ()
(if show-paren-mode
(let ((oldpos (point))
! (dir (cond ((and (eq (syntax-class (syntax-after (1- (point)))) 5)
! (zerop (mod (save-excursion
! (backward-char)
! (skip-syntax-backward "\\/")) 2)))
! -1)
! ((and (eq (syntax-class (syntax-after (point))) 4)
! (zerop (mod (save-excursion
! (skip-syntax-backward "\\/")) 2)))
! 1)))
pos mismatch face)
;;
;; Find the other end of the sexp.
In GNU Emacs 22.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.6.10)
of 2005-10-18 on neutrino
X server distributor `The X.Org Foundation', version 11.0.60802000
configured using `configure '--with-gtk''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US
locale-coding-system: iso-latin-1
default-enable-multibyte-characters: t
Major mode: LaTeX
Minor modes in effect:
reftex-mode: t
desktop-save-mode: t
display-time-mode: t
iswitchb-mode: t
recentf-mode: t
show-paren-mode: t
encoded-kbd-mode: t
mouse-wheel-mode: t
auto-compression-mode: t
menu-bar-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
C-x C-f s c <tab> v e r b <tab> 8 <tab> <return> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <left> <return> <return> a SPC \ ( b \ ) SPC
c <right> <left> <left> <left> <left> <up> <right>
C-x C-s C-x C-f C-a C-k / d a <tab> s h o <tab> <return>
C-n C-n C-M-x C-x b <return> C-f C-f C-f C-f C-f C-f
C-f C-f C-f SPC ( d ) SPC e C-b C-b C-b C-b C-b C-b
C-b C-b C-b C-b C-b C-b C-x C-s M-x r e p o r <tab>
<return>
Recent messages:
Starting new Ispell process...
Loading reftex...done
Loading reftex-auc...done
Loading reftex-dcr...done
Automatic display of crossref information was turned on
Loading skeleton...done
Wrote /home/angeli/scratch/verbatim-test8.tex
show-paren-function
Wrote /home/angeli/scratch/verbatim-test8.tex
Loading emacsbug...done
- show-paren-mode indicates mismatch for escaped parentheses,
Ralf Angeli <=