aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/composite.el
diff options
context:
space:
mode:
authorKenichi Handa <[email protected]>2003-09-26 11:24:10 +0000
committerKenichi Handa <[email protected]>2003-09-26 11:24:10 +0000
commitbd4a85b9ffa6c2f705101eaeb7df9d316198114b (patch)
tree52c27f7c3e5057414d0204667c98bb4d62dbff95 /lisp/composite.el
parent47cb11b343ce6cd48b96d85467c6db2e42e6a689 (diff)
(auto-compose-region): New function.
Diffstat (limited to 'lisp/composite.el')
-rw-r--r--lisp/composite.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/lisp/composite.el b/lisp/composite.el
index 3db2ff0964..ad1a37f69c 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -456,6 +456,32 @@ With arg, enable it iff arg is positive."
(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.