yatex

changeset 181:ab7cd5129797 dev

Keep buffer-modified-p in YaTeX-jmode-hook().
author yuuji@gentei.org
date Fri, 07 Oct 2011 16:00:52 +0900
parents 8b8593e02dad
children 67b1e094e151 bdc00b25045d
files yatex.el
diffstat 1 files changed, 27 insertions(+), 25 deletions(-) [+]
line diff
     1.1 --- a/yatex.el	Mon May 16 15:50:05 2011 +0900
     1.2 +++ b/yatex.el	Fri Oct 07 16:00:52 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 Mon Mar 28 23:43:16 2011 on firestorm
     1.8 +;;; Last modified Fri Oct  7 15:58:31 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 @@ -1449,30 +1449,32 @@
    1.13      ;;	(setq endc (char-after (next-single-property-change new 'point-left))))
    1.14      ;;(message "n[%c]=%s o[%c]=%s end=[%c] jm=%s"
    1.15      ;;	     (char-after new) newp (char-after old) oldp endc jm)
    1.16 -    (cond
    1.17 -     ((eq lnew new) nil)		;Do nothing if continuous entry
    1.18 -     ((and (not (eq newp 'YaTeX-jmode-hook))
    1.19 -	   (eq oldp 'YaTeX-jmode-hook))
    1.20 -      ;; leave
    1.21 -      (remove-text-properties
    1.22 -       (1+ (or (previous-single-property-change old 'point-left)
    1.23 -	       (1- (point))))
    1.24 -       (1- (or (next-single-property-change old 'point-left)
    1.25 -	       (1+ (point))))
    1.26 -       (list 'last-new nil))
    1.27 -      (if (plist-get (text-properties-at old) 'jmode)
    1.28 -	  (YaTeX-jmode-on)))
    1.29 -     ((and (not (eq oldp 'YaTeX-jmode-hook))
    1.30 -	   (eq newp 'YaTeX-jmode-hook))
    1.31 -      ;; enter
    1.32 -      (add-text-properties
    1.33 -       (1+ (or (previous-single-property-change new 'point-left)
    1.34 -	       (1- (point))))
    1.35 -       (1- (or (next-single-property-change new 'point-left)
    1.36 -	       (1+ (point))))
    1.37 -       (list 'jmode jm 'last-new new))
    1.38 -      (set-buffer-modified-p bmp)
    1.39 -      (YaTeX-jmode-off)))))
    1.40 +    (unwind-protect
    1.41 +	(cond
    1.42 +	 ((eq lnew new) nil)		;Do nothing if continuous entry
    1.43 +	 ((and (not (eq newp 'YaTeX-jmode-hook))
    1.44 +	       (eq oldp 'YaTeX-jmode-hook))
    1.45 +	  ;; leave
    1.46 +	  (remove-text-properties
    1.47 +	   (1+ (or (previous-single-property-change old 'point-left)
    1.48 +		   (1- (point))))
    1.49 +	   (1- (or (next-single-property-change old 'point-left)
    1.50 +		   (1+ (point))))
    1.51 +	   (list 'last-new nil))
    1.52 +	  (if (plist-get (text-properties-at old) 'jmode)
    1.53 +	      (YaTeX-jmode-on)))
    1.54 +	 ((and (not (eq oldp 'YaTeX-jmode-hook))
    1.55 +	       (eq newp 'YaTeX-jmode-hook))
    1.56 +	  ;; enter
    1.57 +	  (add-text-properties
    1.58 +	   (1+ (or (previous-single-property-change new 'point-left)
    1.59 +		   (1- (point))))
    1.60 +	   (1- (or (next-single-property-change new 'point-left)
    1.61 +		   (1+ (point))))
    1.62 +	   (list 'jmode jm 'last-new new))
    1.63 +	  (YaTeX-jmode-off)))
    1.64 +      ;;unwind job
    1.65 +      (set-buffer-modified-p bmp))))
    1.66  
    1.67  (defun YaTeX-insert-dollar ()
    1.68    (interactive)