Function: quail-activate

quail-activate is a byte-compiled function defined in quail.el.gz.

Signature

(quail-activate &optional ARG)

Documentation

Activate Quail input method.

With ARG, activate Quail input method if and only if arg is positive.

This function runs quail-activate-hook if it activates the input method, quail-deactivate-hook if it deactivates it.

While this input method is active, the variable input-method-function is bound to the function quail-input-method.

Source Code

;; Defined in /usr/src/emacs/lisp/international/quail.el.gz
(defun quail-activate (&optional arg)
  "Activate Quail input method.
With ARG, activate Quail input method if and only if arg is positive.

This function runs `quail-activate-hook' if it activates the input
method, `quail-deactivate-hook' if it deactivates it.

While this input method is active, the variable
`input-method-function' is bound to the function `quail-input-method'."
  (if (and arg
	  (< (prefix-numeric-value arg) 0))
      ;; Let's deactivate Quail input method.
      (unwind-protect
	  (progn
	    (quail-delete-overlays)
	    (setq describe-current-input-method-function nil)
	    (quail-hide-guidance)
	    (remove-hook 'post-command-hook #'quail-show-guidance t)
	    (run-hooks 'quail-deactivate-hook))
	(kill-local-variable 'input-method-function))
    ;; Let's activate Quail input method.
    (if (null quail-current-package)
	;; Quail package is not yet selected.  Select one now.
	(let (name)
	  (if quail-package-alist
	      (setq name (car (car quail-package-alist)))
	    (error "No Quail package loaded"))
	  (quail-select-package name)))
    (setq deactivate-current-input-method-function #'quail-deactivate)
    (setq describe-current-input-method-function #'quail-help)
    (quail-delete-overlays)
    (setq quail-guidance-str "")
    (quail-show-guidance)
    ;; If we are in minibuffer, turn off the current input method
    ;; before exiting.
    (when (eq (selected-window) (minibuffer-window))
      (add-hook 'minibuffer-exit-hook #'quail-exit-from-minibuffer)
      (add-hook 'post-command-hook #'quail-show-guidance nil t))
    (run-hooks 'quail-activate-hook)
    (setq-local input-method-function #'quail-input-method)))