changeset 19328:a616b45ffa31

(read-input-method-name): Replace INITIAL-INPUT arg with DEFAULT arg. Substitute it into to the prompt, if it is non-nil. (select-input-method): Call read-input-method-name the new way. (toggle-input-method): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Wed, 13 Aug 1997 00:29:02 +0000
parents 70e5d1211d98
children 249631cebee0
files lisp/international/mule-cmds.el
diffstat 1 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule-cmds.el	Wed Aug 13 00:26:42 1997 +0000
+++ b/lisp/international/mule-cmds.el	Wed Aug 13 00:29:02 1997 +0000
@@ -442,15 +442,16 @@
       (setq slot (cons input-method info))
       (setq input-method-alist (cons slot input-method-alist)))))
 
-(defun read-input-method-name (prompt &optional initial-input inhibit-null)
+(defun read-input-method-name (prompt &optional default inhibit-null)
   "Read a name of input method from a minibuffer prompting with PROMPT.
-If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
-  If it is (STRING . POSITION), the initial input
-  is STRING, but point is placed POSITION characters into the string.
+If DEFAULT is non-nil, use that as the default,
+  and substitute it into PROMPT at the first `%s'.
 If INHIBIT-NULL is non-nil, null input signals an error."
+  (if default
+      (setq prompt (format prompt default)))
   (let* ((completion-ignore-case t)
 	 (input-method (completing-read prompt input-method-alist
-					nil t initial-input)))
+					nil t nil nil default)))
     (if (> (length input-method) 0)
 	input-method
       (if inhibit-null
@@ -486,11 +487,10 @@
 to the input method you specify.
 See also the function `register-input-method'."
   (interactive
-   (let* ((default (or previous-input-method default-input-method))
-	  (initial (if default (cons default 0))))
+   (let* ((default (or previous-input-method default-input-method)))
      (if (not enable-multibyte-characters)
-	 (error "Can't activate any input method while enable-multibyte-characters is nil"))
-     (list (read-input-method-name "Input method: " initial t))))
+	 (error "Can't activate an input method while multibyte characters are disabled"))
+     (list (read-input-method-name "Input method (default %s): " default t))))
   (activate-input-method input-method)
   (setq-default default-input-method default-input-method))
 
@@ -502,15 +502,14 @@
 In the latter case, if default-input-method is nil, select an input method
 interactively."
   (interactive "P")
-  (let* ((default (or previous-input-method default-input-method))
-	 (initial (if default (cons default 0))))
+  (let* ((default (or previous-input-method default-input-method)))
     (if (and current-input-method (not arg))
 	(inactivate-input-method)
       (if (not enable-multibyte-characters)
 	  (error "Can't activate any input method while multibyte characters are disabled"))
       (activate-input-method
        (if (or arg (not default-input-method))
-	   (read-input-method-name "Input method: " initial t)  
+	   (read-input-method-name "Input method (default %s): " default t)  
 	 default-input-method)))))
 
 (defun describe-input-method (input-method)