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 wrap: on
line diff
--- a/yatexadd.el	Wed Feb 16 21:38:13 2011 +0900
+++ b/yatexadd.el	Wed Feb 16 21:39:22 2011 +0900
@@ -2,7 +2,7 @@
 ;;; YaTeX add-in functions.
 ;;; yatexadd.el rev.19
 ;;; (c)1991-2011 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Wed Feb 16 19:57:26 2011 on firestorm
+;;; Last modified Wed Feb 16 21:35:40 2011 on firestorm
 ;;; $Id$
 
 ;;;
@@ -1141,7 +1141,10 @@
 	    (ptn (concat
 		  "\\(" YaTeX-refcommand-ref-regexp "\\)"
 		  "\\s *{" oldptn "}"))
-	    (useov (fboundp 'make-overlay)) ov
+	    (repface (and (fboundp 'make-overlay)
+			  (fboundp 'internal-find-face)
+			  (if (internal-find-face 'isearch) 'isearch 'region)))
+	    ov
 	    (qmsg "Replace to `%s'? [yn!rq]")
 	    continue ch)
 	(while bufs
@@ -1158,11 +1161,11 @@
 			     e (match-end 0))
 		       (or continue
 			   (catch 'query
-			     (if useov
+			     (if repface
 				 (if ov (move-overlay ov b e)
 				   (overlay-put
 				    (setq ov (make-overlay b e))
-				    'face 'isearch)))
+				    'face repface)))
 			     (switch-to-buffer buf)
 			     (while t
 			       (message qmsg new)
@@ -1212,7 +1215,9 @@
 		   " is stored into kill-ring.  Paste it by yank(%s).")))
 	    (kill-new refstr)
 	    (message (concat "`%s'" msg) refstr key)
-	    (if chmode (YaTeX::label-rename-refs old label))))
+	    (and chmode
+		 (not (equal old label))
+		 (YaTeX::label-rename-refs old label))))
       label))))
       
 

yatex.org