comparison lisp/composite.el @ 107617:c5f9e4613394

Merge from mainline.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 16 Jan 2010 06:57:09 -0500
parents 0d5d2e53a07c
children 823c35a2846d 80012eb6c2a3
comparison
equal deleted inserted replaced
107616:fa5ad3eee9f5 107617:c5f9e4613394
1 ;;; composite.el --- support character composition 1 ;;; composite.el --- support character composition
2 2
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 ;; 2008, 2009 4 ;; 2008, 2009, 2010
5 ;; National Institute of Advanced Industrial Science and Technology (AIST) 5 ;; National Institute of Advanced Industrial Science and Technology (AIST)
6 ;; Registration Number H14PRO021 6 ;; Registration Number H14PRO021
7 7
8 ;; Author: Kenichi HANDA <handa@etl.go.jp> 8 ;; Author: Kenichi HANDA <handa@etl.go.jp>
9 ;; (according to ack.texi) 9 ;; (according to ack.texi)
742 gstring 742 gstring
743 (or (fontp font-object 'font-object) 743 (or (fontp font-object 'font-object)
744 (setq func 'compose-gstring-for-terminal)) 744 (setq func 'compose-gstring-for-terminal))
745 (funcall func gstring)))) 745 (funcall func gstring))))
746 746
747 (make-variable-buffer-local 'auto-composition-mode)
748 (put 'auto-composition-mode 'permanent-local t)
749
747 (make-variable-buffer-local 'auto-composition-function) 750 (make-variable-buffer-local 'auto-composition-function)
751 (setq-default auto-composition-function 'auto-compose-chars)
748 752
749 ;;;###autoload 753 ;;;###autoload
750 (define-minor-mode auto-composition-mode 754 (defun auto-composition-mode (&optional arg)
751 "Toggle Auto Composition mode. 755 "Toggle Auto Composition mode.
752 With ARG, turn Auto Composition mode off if and only if ARG is a non-positive 756 With ARG, turn Auto Composition mode off if and only if ARG is a non-positive
753 number; if ARG is nil, toggle Auto Composition mode; anything else turns Auto 757 number; if ARG is nil, toggle Auto Composition mode; anything else turns Auto
754 Composition on. 758 Composition on.
755 759
756 When Auto Composition is enabled, text characters are automatically composed 760 When Auto Composition is enabled, text characters are automatically composed
757 by functions registered in `composition-function-table' (which see). 761 by functions registered in `composition-function-table' (which see).
758 762
759 You can use `global-auto-composition-mode' to turn on 763 You can use `global-auto-composition-mode' to turn on
760 Auto Composition mode in all buffers (this is the default)." 764 Auto Composition mode in all buffers (this is the default)."
761 nil nil nil 765 (interactive "P")
762 (if noninteractive 766 (setq auto-composition-mode
763 (setq auto-composition-mode nil)) 767 (if arg
764 (cond (auto-composition-mode 768 (or (not (integerp arg)) (> arg 0))
765 (setq auto-composition-function 'auto-compose-chars)) 769 (not auto-composition-mode))))
766 (t
767 (setq auto-composition-function nil))))
768
769 (defun turn-on-auto-composition-if-enabled ()
770 (if enable-multibyte-characters
771 (auto-composition-mode 1)))
772 770
773 ;;;###autoload 771 ;;;###autoload
774 (define-global-minor-mode global-auto-composition-mode 772 (defun global-auto-composition-mode (&optional arg)
775 auto-composition-mode turn-on-auto-composition-if-enabled 773 "Toggle Auto-Composition mode in every possible buffer.
776 ;; This :extra-args' appears to be the result of a naive copy&paste 774 With prefix arg, turn Global-Auto-Composition mode on if and only if arg
777 ;; from global-font-lock-mode. 775 is positive.
778 ;; :extra-args (dummy) 776 See `auto-composition-mode' for more information on Auto-Composition mode."
779 :initialize 'custom-initialize-delay 777 (interactive "P")
780 :init-value (not noninteractive) 778 (setq-default auto-composition-mode
781 :group 'auto-composition 779 (if arg
782 :version "23.1") 780 (or (not (integerp arg)) (> arg 0))
783 781 (not (default-value 'auto-composition-mode)))))
784 (defalias 'toggle-auto-composition 'auto-composition-mode) 782 (defalias 'toggle-auto-composition 'auto-composition-mode)
785 783
786 784
787 ;; The following codes are only for backward compatibility with Emacs 785 ;; The following codes are only for backward compatibility with Emacs
788 ;; 20.4 and earlier. 786 ;; 20.4 and earlier.