yatex

changeset 170:269fb1992c2d dev

YaTeX-change-section: If new string equals to old one, do not change \ref{}-s. Face detection more desirably.
author yuuji@gentei.org
date Wed, 16 Feb 2011 21:39:22 +0900
parents 0cb6c6a78e9e
children 670549efa5c2
files yatexadd.el
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/yatexadd.el	Wed Feb 16 21:38:13 2011 +0900
     1.2 +++ b/yatexadd.el	Wed Feb 16 21:39:22 2011 +0900
     1.3 @@ -2,7 +2,7 @@
     1.4  ;;; YaTeX add-in functions.
     1.5  ;;; yatexadd.el rev.19
     1.6  ;;; (c)1991-2011 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Wed Feb 16 19:57:26 2011 on firestorm
     1.8 +;;; Last modified Wed Feb 16 21:35:40 2011 on firestorm
     1.9  ;;; $Id$
    1.10  
    1.11  ;;;
    1.12 @@ -1141,7 +1141,10 @@
    1.13  	    (ptn (concat
    1.14  		  "\\(" YaTeX-refcommand-ref-regexp "\\)"
    1.15  		  "\\s *{" oldptn "}"))
    1.16 -	    (useov (fboundp 'make-overlay)) ov
    1.17 +	    (repface (and (fboundp 'make-overlay)
    1.18 +			  (fboundp 'internal-find-face)
    1.19 +			  (if (internal-find-face 'isearch) 'isearch 'region)))
    1.20 +	    ov
    1.21  	    (qmsg "Replace to `%s'? [yn!rq]")
    1.22  	    continue ch)
    1.23  	(while bufs
    1.24 @@ -1158,11 +1161,11 @@
    1.25  			     e (match-end 0))
    1.26  		       (or continue
    1.27  			   (catch 'query
    1.28 -			     (if useov
    1.29 +			     (if repface
    1.30  				 (if ov (move-overlay ov b e)
    1.31  				   (overlay-put
    1.32  				    (setq ov (make-overlay b e))
    1.33 -				    'face 'isearch)))
    1.34 +				    'face repface)))
    1.35  			     (switch-to-buffer buf)
    1.36  			     (while t
    1.37  			       (message qmsg new)
    1.38 @@ -1212,7 +1215,9 @@
    1.39  		   " is stored into kill-ring.  Paste it by yank(%s).")))
    1.40  	    (kill-new refstr)
    1.41  	    (message (concat "`%s'" msg) refstr key)
    1.42 -	    (if chmode (YaTeX::label-rename-refs old label))))
    1.43 +	    (and chmode
    1.44 +		 (not (equal old label))
    1.45 +		 (YaTeX::label-rename-refs old label))))
    1.46        label))))
    1.47        
    1.48