aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2003-09-26 11:24:10 +0000
committerKenichi Handa2003-09-26 11:24:10 +0000
commitbd4a85b9ffa6c2f705101eaeb7df9d316198114b (patch)
tree52c27f7c3e5057414d0204667c98bb4d62dbff95
parent47cb11b343ce6cd48b96d85467c6db2e42e6a689 (diff)
downloademacs-bd4a85b9ffa6c2f705101eaeb7df9d316198114b.tar.gz
emacs-bd4a85b9ffa6c2f705101eaeb7df9d316198114b.zip
(auto-compose-region): New function.
-rw-r--r--lisp/composite.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/lisp/composite.el b/lisp/composite.el
index 3db2ff09644..ad1a37f69cb 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -456,6 +456,32 @@ With arg, enable it iff arg is positive."
456 (save-restriction 456 (save-restriction
457 (widen) 457 (widen)
458 (put-text-property (point-min) (point-max) 'auto-composed nil))))) 458 (put-text-property (point-min) (point-max) 'auto-composed nil)))))
459
460(defun auto-compose-region (from to)
461 "Force automatic character composition on the region FROM and TO."
462 (save-excursion
463 (if (get-text-property from 'auto-composed)
464 (setq from (next-single-property-change from 'auto-composed nil to)))
465 (goto-char from)
466 (let ((modified-p (buffer-modified-p))
467 (inhibit-read-only '(composition auto-composed))
468 (stop (next-single-property-change (point) 'auto-composed nil to)))
469 (while (< (point) to)
470 (if (= (point) stop)
471 (progn
472 (goto-char (next-single-property-change (point)
473 'auto-composed nil to))
474 (setq stop (next-single-property-change (point)
475 'auto-composed nil to)))
476 (let ((func (aref composition-function-table (following-char)))
477 (pos (point)))
478 (if (functionp func)
479 (goto-char (funcall func (point) nil)))
480 (if (<= (point) pos)
481 (forward-char 1)))))
482 (put-text-property from to 'auto-composed t)
483 (set-buffer-modified-p modified-p))))
484
459 485
460;;; The following codes are only for backward compatibility with Emacs 486;;; The following codes are only for backward compatibility with Emacs
461;;; 20.4 and earlier. 487;;; 20.4 and earlier.