Function: read-input-method-name

read-input-method-name is a byte-compiled function defined in mule-cmds.el.gz.

Signature

(read-input-method-name PROMPT &optional DEFAULT INHIBIT-NULL)

Documentation

Read a name of input method from a minibuffer prompting with PROMPT.

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.

The return value is a string.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/international/mule-cmds.el.gz
(defun read-input-method-name (prompt &optional default inhibit-null)
  "Read a name of input method from a minibuffer prompting with PROMPT.
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.

The return value is a string."
  (if default
      (setq prompt (format prompt default)))
  (let* ((completion-ignore-case t)
	 ;; As it is quite normal to change input method in the
	 ;; minibuffer, we must enable it even if
	 ;; enable-recursive-minibuffers is currently nil.
	 (enable-recursive-minibuffers t)
	 ;; This binding is necessary because input-method-history is
	 ;; buffer local.
	 (input-method (completing-read prompt input-method-alist
					nil t nil 'input-method-history
					(if (and default (symbolp default))
                                            (symbol-name default)
                                          default))))
    (if (and input-method (symbolp input-method))
	(setq input-method (symbol-name input-method)))
    (if (> (length input-method) 0)
	input-method
      (if inhibit-null
	  (error "No valid input method is specified")))))