comparison lisp/international/mule-cmds.el @ 23049:82a27d5b4582

(activate-input-method): Handle the case that the arg INPUT-METHOD is nil correctly. (read-multilingual-string): Activate the specified input method before calling read-string. Afterward, activate the original input method.
author Kenichi Handa <handa@m17n.org>
date Tue, 18 Aug 1998 00:44:20 +0000
parents 6a8e5ce6cfc1
children 4ae12d3c8c30
comparison
equal deleted inserted replaced
23048:fd2d1a752d93 23049:82a27d5b4582
784 784
785 (defun activate-input-method (input-method) 785 (defun activate-input-method (input-method)
786 "Switch to input method INPUT-METHOD for the current buffer. 786 "Switch to input method INPUT-METHOD for the current buffer.
787 If some other input method is already active, turn it off first. 787 If some other input method is already active, turn it off first.
788 If INPUT-METHOD is nil, deactivate any current input method." 788 If INPUT-METHOD is nil, deactivate any current input method."
789 (if (symbolp input-method) 789 (if (and input-method (symbolp input-method))
790 (setq input-method (symbol-name input-method))) 790 (setq input-method (symbol-name input-method)))
791 (if (and current-input-method 791 (if (and current-input-method
792 (not (string= current-input-method input-method))) 792 (not (string= current-input-method input-method)))
793 (inactivate-input-method)) 793 (inactivate-input-method))
794 (unless (or current-input-method (null input-method)) 794 (unless (or current-input-method (null input-method))
795 (let ((slot (assoc input-method input-method-alist))) 795 (let ((slot (assoc input-method input-method-alist)))
796 (if (null slot) 796 (if (null slot)
797 (error "Can't activate input method `%s'" input-method)) 797 (error "Can't activate input method `%s'" input-method))
798 (let ((func (nth 2 slot))) 798 (let ((func (nth 2 slot)))
905 current-input-method 905 current-input-method
906 default-input-method 906 default-input-method
907 (read-input-method-name "Input method: " nil t))) 907 (read-input-method-name "Input method: " nil t)))
908 (if (and input-method (symbolp input-method)) 908 (if (and input-method (symbolp input-method))
909 (setq input-method (symbol-name input-method))) 909 (setq input-method (symbol-name input-method)))
910 (let ((current-input-method input-method)) 910 (let ((prev-input-method current-input-method))
911 (read-string prompt initial-input nil nil t))) 911 (unwind-protect
912 (progn
913 (activate-input-method input-method)
914 (read-string prompt initial-input nil nil t))
915 (activate-input-method prev-input-method))))
912 916
913 ;; Variables to control behavior of input methods. All input methods 917 ;; Variables to control behavior of input methods. All input methods
914 ;; should react to these variables. 918 ;; should react to these variables.
915 919
916 (defcustom input-method-verbose-flag 'default 920 (defcustom input-method-verbose-flag 'default