yatex

changeset 169:0cb6c6a78e9e dev

YaTeX-change-section: If new string equals to old one, do not change text.
author yuuji@gentei.org
date Wed, 16 Feb 2011 21:38:13 +0900
parents 191cffccc912
children 269fb1992c2d
files yatex.el
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/yatex.el	Wed Feb 16 20:08:05 2011 +0900
     1.2 +++ b/yatex.el	Wed Feb 16 21:38:13 2011 +0900
     1.3 @@ -2,7 +2,7 @@
     1.4  ;;; Yet Another tex-mode for emacs - //–ì’¹//
     1.5  ;;; yatex.el rev. 1.74.4
     1.6  ;;; (c)1991-2011 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Wed Feb 16 17:23:52 2011 on firestorm
     1.8 +;;; Last modified Wed Feb 16 21:20:13 2011 on firestorm
     1.9  ;;; $Id$
    1.10  ;;; The latest version of this software is always available at;
    1.11  ;;; http://www.yatex.org/
    1.12 @@ -2309,7 +2309,8 @@
    1.13  	      (set-marker end (match-end 1))
    1.14  	      (goto-char beg)		;beginning of the command
    1.15  	      (setq new (YaTeX-read-section
    1.16 -			 (format "Change `%s' to: " cmd) nil)))
    1.17 +			 (format "Change `%s' to: " cmd) nil)
    1.18 +		    old cmd))
    1.19  
    1.20  	     ((= where -1);;if point is on a optional parameter
    1.21  	      (set-marker beg (match-beginning 2))
    1.22 @@ -2320,9 +2321,10 @@
    1.23  		    (if (fboundp (intern-soft (concat YaTeX-addin-prefix cmd)))
    1.24  			(YaTeX-addin cmd)
    1.25  		      (concat "["
    1.26 -			      (read-string (format "Change `%s' to: "
    1.27 -						   (YaTeX-buffer-substring
    1.28 -						    (1+ beg) (1- end))))
    1.29 +			      (read-string
    1.30 +			       (format "Change `%s' to: "
    1.31 +				       (setq old (YaTeX-buffer-substring
    1.32 +						  (1+ beg) (1- end)))))
    1.33  			      "]"))))
    1.34  
    1.35  	     ((> where 0);;if point is in arguments' braces
    1.36 @@ -2342,9 +2344,11 @@
    1.37  			(funcall (intern-soft (concat "YaTeX::" cmd)) where)
    1.38  		      (read-string (format "Change `%s' to: " old)))))
    1.39  	     )				;cond
    1.40 -	    (delete-region beg end)
    1.41 -	    (goto-char beg)
    1.42 -	    (insert-before-markers new))
    1.43 +	    (if (string= old new)
    1.44 +		nil			;do not replace
    1.45 +	      (delete-region beg end)
    1.46 +	      (goto-char beg)
    1.47 +	      (insert-before-markers new)))
    1.48  	(set-marker beg nil)
    1.49  	(set-marker end nil))
    1.50        ;;(goto-char (marker-position p))