Function: quail-help
quail-help is a byte-compiled function defined in quail.el.gz.
Signature
(quail-help &optional PACKAGE)
Documentation
Show brief description of the current Quail package.
Optional arg PACKAGE specifies the name of alternative Quail package to describe.
Probably introduced at or before Emacs version 24.4.
Source Code
;; Defined in /usr/src/emacs/lisp/international/quail.el.gz
(defun quail-help (&optional package)
"Show brief description of the current Quail package.
Optional arg PACKAGE specifies the name of alternative Quail
package to describe."
(require 'help-mode)
(let ((help-xref-mule-regexp help-xref-mule-regexp-template)
(mb enable-multibyte-characters)
(package-def
(if package
(assoc package quail-package-alist)
quail-current-package)))
;; At first, make sure that the help buffer has window.
(let ((temp-buffer-show-hook nil))
(with-output-to-temp-buffer (help-buffer)
(with-current-buffer standard-output
(set-buffer-multibyte mb)
(setq quail-current-package package-def))))
;; Then, insert text in the help buffer while paying attention to
;; the width of the window in which the buffer displayed.
(with-current-buffer (help-buffer)
(setq buffer-read-only nil)
;; Without this, a keyboard layout with R2L characters might be
;; displayed reversed, right to left. See the thread starting at
;; https://lists.gnu.org/r/emacs-devel/2012-03/msg00062.html
;; for a description of one such situation.
(setq bidi-paragraph-direction 'left-to-right)
(insert "Input method: " (quail-name)
" (mode line indicator:"
(quail-title)
")\n\n")
(save-restriction
(narrow-to-region (point) (point))
(insert (substitute-command-keys (quail-docstring)))
(goto-char (point-min))
(with-syntax-table emacs-lisp-mode-syntax-table
(while (re-search-forward "\\\\<\\sw\\(\\sw\\|\\s_\\)+>" nil t)
(let ((sym (intern-soft
(buffer-substring (+ (match-beginning 0) 2)
(1- (point))))))
(if (and (boundp sym)
(stringp (symbol-value sym)))
(replace-match (symbol-value sym) t t)))))
(goto-char (point-max)))
(or (bolp)
(insert "\n"))
(insert "\n")
(let ((done-list nil))
;; Show keyboard layout if the current package requests it..
(when (quail-show-layout)
(insert (substitute-command-keys "
KEYBOARD LAYOUT
---------------
This input method works by translating individual input characters.
Assuming that your actual keyboard has the `"))
(help-insert-xref-button
quail-keyboard-layout-type
'quail-keyboard-layout-button
quail-keyboard-layout-type)
(insert (substitute-command-keys "' layout,
translation results in the following \"virtual\" keyboard layout
\(the labels on the keys indicate what character will be produced
by each key, with and without holding Shift):
"))
(setq done-list
(quail-insert-kbd-layout quail-keyboard-layout))
(insert (substitute-command-keys "\
If your keyboard has a different layout, rearranged from
`"))
(help-insert-xref-button
"standard"
'quail-keyboard-layout-button "standard")
(insert (substitute-command-keys "\
', the \"virtual\" keyboard you get with this input method
will be rearranged in the same way.
You can set the variable `quail-keyboard-layout-type' to specify
the physical layout of your keyboard; the tables shown in
documentation of input methods including this one are based on the
physical keyboard layout as specified with that variable.
"))
(help-insert-xref-button
"[customize keyboard layout]"
'quail-keyboard-customize-button 'quail-keyboard-layout-type)
(insert "\n"))
;; Show key sequences.
(let* ((decode-map (list 'decode-map))
(num (quail-build-decode-map (list (quail-map)) "" decode-map
;; We used to use 512 here, but
;; TeX has more than 1000 and
;; it's good to see the list.
0 5120 done-list)))
(when (> num 0)
(insert "
KEY SEQUENCE
------------
")
(if (quail-show-layout)
(insert "You can also input more characters")
(insert "You can input characters"))
(insert " by the following key sequences:\n")
(quail-insert-decode-map decode-map))))
(quail-help-insert-keymap-description
(quail-translation-keymap)
"\
KEY BINDINGS FOR TRANSLATION
----------------------------\n")
(insert ?\n)
(if (quail-conversion-keymap)
(quail-help-insert-keymap-description
(quail-conversion-keymap)
"\
KEY BINDINGS FOR CONVERSION
---------------------------\n"))
(setq quail-current-package nil)
(set-buffer-modified-p nil)
;; Resize the help window again, now that it has all its contents.
(save-selected-window
(select-window (get-buffer-window (current-buffer) t))
(run-hooks 'temp-buffer-show-hook)))))