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 wrap: on
line diff
--- a/yatex.el	Mon May 16 15:50:05 2011 +0900
+++ b/yatex.el	Fri Oct 07 16:00:52 2011 +0900
@@ -2,7 +2,7 @@
 ;;; Yet Another tex-mode for emacs - //–ì’¹//
 ;;; yatex.el rev. 1.74.4
 ;;; (c)1991-2011 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Mon Mar 28 23:43:16 2011 on firestorm
+;;; Last modified Fri Oct  7 15:58:31 2011 on firestorm
 ;;; $Id$
 ;;; The latest version of this software is always available at;
 ;;; http://www.yatex.org/
@@ -1449,30 +1449,32 @@
     ;;	(setq endc (char-after (next-single-property-change new 'point-left))))
     ;;(message "n[%c]=%s o[%c]=%s end=[%c] jm=%s"
     ;;	     (char-after new) newp (char-after old) oldp endc jm)
-    (cond
-     ((eq lnew new) nil)		;Do nothing if continuous entry
-     ((and (not (eq newp 'YaTeX-jmode-hook))
-	   (eq oldp 'YaTeX-jmode-hook))
-      ;; leave
-      (remove-text-properties
-       (1+ (or (previous-single-property-change old 'point-left)
-	       (1- (point))))
-       (1- (or (next-single-property-change old 'point-left)
-	       (1+ (point))))
-       (list 'last-new nil))
-      (if (plist-get (text-properties-at old) 'jmode)
-	  (YaTeX-jmode-on)))
-     ((and (not (eq oldp 'YaTeX-jmode-hook))
-	   (eq newp 'YaTeX-jmode-hook))
-      ;; enter
-      (add-text-properties
-       (1+ (or (previous-single-property-change new 'point-left)
-	       (1- (point))))
-       (1- (or (next-single-property-change new 'point-left)
-	       (1+ (point))))
-       (list 'jmode jm 'last-new new))
-      (set-buffer-modified-p bmp)
-      (YaTeX-jmode-off)))))
+    (unwind-protect
+	(cond
+	 ((eq lnew new) nil)		;Do nothing if continuous entry
+	 ((and (not (eq newp 'YaTeX-jmode-hook))
+	       (eq oldp 'YaTeX-jmode-hook))
+	  ;; leave
+	  (remove-text-properties
+	   (1+ (or (previous-single-property-change old 'point-left)
+		   (1- (point))))
+	   (1- (or (next-single-property-change old 'point-left)
+		   (1+ (point))))
+	   (list 'last-new nil))
+	  (if (plist-get (text-properties-at old) 'jmode)
+	      (YaTeX-jmode-on)))
+	 ((and (not (eq oldp 'YaTeX-jmode-hook))
+	       (eq newp 'YaTeX-jmode-hook))
+	  ;; enter
+	  (add-text-properties
+	   (1+ (or (previous-single-property-change new 'point-left)
+		   (1- (point))))
+	   (1- (or (next-single-property-change new 'point-left)
+		   (1+ (point))))
+	   (list 'jmode jm 'last-new new))
+	  (YaTeX-jmode-off)))
+      ;;unwind job
+      (set-buffer-modified-p bmp))))
 
 (defun YaTeX-insert-dollar ()
   (interactive)

yatex.org