changeset 89528:c75e3c6b608a

(auto-compose-region): New function.
author Kenichi Handa <handa@m17n.org>
date Fri, 26 Sep 2003 11:24:10 +0000
parents 7ca60ab7a039
children 1f7ce29b19bd
files lisp/composite.el
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/composite.el	Fri Sep 26 11:21:21 2003 +0000
+++ b/lisp/composite.el	Fri Sep 26 11:24:10 2003 +0000
@@ -456,6 +456,32 @@
       (save-restriction
 	(widen)
 	(put-text-property (point-min) (point-max) 'auto-composed nil)))))
+
+(defun auto-compose-region (from to)
+  "Force automatic character composition on the region FROM and TO."
+  (save-excursion
+    (if (get-text-property from 'auto-composed)
+	(setq from (next-single-property-change from 'auto-composed nil to)))
+    (goto-char from)
+    (let ((modified-p (buffer-modified-p))
+	  (inhibit-read-only '(composition auto-composed))
+	  (stop (next-single-property-change (point) 'auto-composed nil to)))
+      (while (< (point) to)
+	(if (= (point) stop)
+	    (progn
+	      (goto-char (next-single-property-change (point)
+						      'auto-composed nil to))
+	      (setq stop (next-single-property-change (point)
+						      'auto-composed nil to)))
+	  (let ((func (aref composition-function-table (following-char)))
+		(pos (point)))
+	    (if (functionp func)
+		(goto-char (funcall func (point) nil)))
+	    (if (<= (point) pos)
+		(forward-char 1)))))
+      (put-text-property from to 'auto-composed t)
+      (set-buffer-modified-p modified-p))))
+
 
 ;;; The following codes are only for backward compatibility with Emacs
 ;;; 20.4 and earlier.