changeset 89559:44b83fad0b9b

(auto-composition-chunk-size): Variable deleted. (auto-compose-chars): Always stop after processing a newline.
author Kenichi Handa <handa@m17n.org>
date Tue, 30 Sep 2003 11:09:29 +0000
parents 5addd0693c9d
children 3b8f43ceb4b9
files lisp/composite.el
diffstat 1 files changed, 28 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/composite.el	Tue Sep 30 11:07:55 2003 +0000
+++ b/lisp/composite.el	Tue Sep 30 11:09:29 2003 +0000
@@ -398,9 +398,6 @@
   ;;(def-edebug-spec save-buffer-state let)
   )
 
-(defvar auto-composition-chunk-size 500
-  "*Automatic composition uses chunks of this many characters, or smaller.")
-
 (defun auto-compose-chars (pos string)
   "Compose characters after the buffer position POS.
 If STRING is non-nil, it is a string, and POS is an index into the string.
@@ -411,28 +408,34 @@
     (save-excursion
       (save-restriction
 	(save-match-data
-	  (let* ((start pos)
-		 (end (if string (length string) (point-max)))
-		 (limit (next-single-property-change pos 'auto-composed string
-						     end))
-		 (lines 0)
-		 ch func newpos)
-	    (if (> (- limit start) auto-composition-chunk-size)
-		(setq limit (+ start auto-composition-chunk-size)))
-	    (while (and (< pos end)
-			(setq ch (if string (aref string pos)
-				   (char-after pos)))
-			(or (< pos limit)
-			    (/= ch ?\n)))
-	      (setq func (aref composition-function-table ch))
-	      (if (functionp func)
-		  (setq newpos (funcall func pos string)
-			pos (if (and (integerp newpos) (> newpos pos))
-				newpos
-			      (1+ pos)))
-		(setq pos (1+ pos))))
-	    (if (< pos limit)
-		(setq pos (1+ pos)))
+	  (let ((start pos)
+		(limit (next-single-property-change pos 'auto-composed string))
+		ch func newpos)
+	    (if limit
+		(setq limit (1+ limit))
+	      (setq limit (if string (length string) (point-max))))
+	    (catch 'tag
+	      (if string
+		  (while (< pos limit)
+		    (setq ch (aref string pos)
+			  pos (1+ pos))
+		    (if (= ch ?\n)
+			(throw 'tag nil))
+		    (setq func (aref composition-function-table ch))
+		    (if (and (functionp func)
+			     (setq newpos (funcall func (1- pos) string))
+			     (> newpos pos))
+			(setq pos newpos)))
+		(while (< pos limit)
+		  (setq ch (char-after pos)
+			pos (1+ pos))
+		  (if (= ch ?\n)
+		      (throw 'tag nil))
+		  (setq func (aref composition-function-table ch))
+		  (if (and (functionp func)
+			   (setq newpos (funcall func (1- pos) string))
+			   (> newpos pos))
+		      (setq pos newpos)))))
 	    (put-text-property start pos 'auto-composed t string)))))))
 
 (setq auto-composition-function 'auto-compose-chars)