comparison lisp/composite.el @ 90315:7ddbac913d1a

(auto-composition-after-change): Use save-buffer-state. (turn-on-auto-composition-if-enabled): Don't turn on auto-composition-mode in a unibyte buffer.
author Kenichi Handa <handa@m17n.org>
date Fri, 24 Feb 2006 06:32:07 +0000
parents a2899387f787
children 4a80a8a200ba
comparison
equal deleted inserted replaced
90314:d1c5430c5bff 90315:7ddbac913d1a
498 (widen) 498 (widen)
499 (remove-text-properties (point-min) (point-max) '(auto-composed nil)) 499 (remove-text-properties (point-min) (point-max) '(auto-composed nil))
500 (decompose-region (point-min) (point-max))))) 500 (decompose-region (point-min) (point-max)))))
501 501
502 (defun auto-composition-after-change (start end old-len) 502 (defun auto-composition-after-change (start end old-len)
503 (when (and auto-composition-mode (not memory-full)) 503 (save-buffer-state nil
504 (let (func1 func2) 504 (if (< start (point-min))
505 (when (and (> start (point-min)) 505 (setq start (point-min)))
506 (setq func2 (aref composition-function-table 506 (if (> end (point-max))
507 (char-after (1- start)))) 507 (setq end (point-max)))
508 (or (= start (point-max)) 508 (when (and auto-composition-mode (not memory-full))
509 (not (setq func1 (aref composition-function-table 509 (let (func1 func2)
510 (char-after start)))) 510 (when (and (> start (point-min))
511 (eq func1 func2))) 511 (setq func2 (aref composition-function-table
512 (setq start (1- start) 512 (char-after (1- start))))
513 func1 func2) 513 (or (= start (point-max))
514 (while (eq func1 func2) 514 (not (setq func1 (aref composition-function-table
515 (if (> start (point-min)) 515 (char-after start))))
516 (setq start (1- start) 516 (eq func1 func2)))
517 func2 (aref composition-function-table 517 (setq start (1- start)
518 (char-after start))) 518 func1 func2)
519 (setq func2 nil)))) 519 (while (eq func1 func2)
520 (when (and (< end (point-max)) 520 (if (> start (point-min))
521 (setq func2 (aref composition-function-table 521 (setq start (1- start)
522 (char-after end))) 522 func2 (aref composition-function-table
523 (or (= end (point-min)) 523 (char-after start)))
524 (not (setq func1 (aref composition-function-table 524 (setq func2 nil))))
525 (char-after (1- end))))) 525 (when (and (< end (point-max))
526 (eq func1 func2))) 526 (setq func2 (aref composition-function-table
527 (setq end (1+ end) 527 (char-after end)))
528 func1 func2) 528 (or (= end (point-min))
529 (while (eq func1 func2) 529 (not (setq func1 (aref composition-function-table
530 (if (< end (point-max)) 530 (char-after (1- end)))))
531 (setq func2 (aref composition-function-table 531 (eq func1 func2)))
532 (char-after end)) 532 (setq end (1+ end)
533 end (1+ end)) 533 func1 func2)
534 (setq func2 nil)))) 534 (while (eq func1 func2)
535 (if (< start end) 535 (if (< end (point-max))
536 (put-text-property start end 'auto-composed nil))))) 536 (setq func2 (aref composition-function-table
537 (char-after end))
538 end (1+ end))
539 (setq func2 nil))))
540 (if (< start end)
541 (put-text-property start end 'auto-composed nil))))))
537 542
538 (defun turn-on-auto-composition-if-enabled () 543 (defun turn-on-auto-composition-if-enabled ()
539 (auto-composition-mode 1)) 544 (if enable-multibyte-characters
545 (auto-composition-mode 1)))
540 546
541 ;;;###autoload 547 ;;;###autoload
542 (define-global-minor-mode global-auto-composition-mode 548 (define-global-minor-mode global-auto-composition-mode
543 auto-composition-mode turn-on-auto-composition-if-enabled 549 auto-composition-mode turn-on-auto-composition-if-enabled
544 :extra-args (dummy) 550 :extra-args (dummy)