comparison lisp/international/quail.el @ 19849:1c5164d81426

(quail-simple): New function. (quail-require-guidance-buf): New function. (quail-show-guidance-buf): Do not show guidance buffer if simple input method is used in the minibuffer. (quail-update-guidance): Likewise.
author Kenichi Handa <handa@m17n.org>
date Tue, 09 Sep 1997 14:57:01 +0000
parents 1e682aef0ce0
children a69ae37e6932
comparison
equal deleted inserted replaced
19848:68c5c0b3ed0d 19849:1c5164d81426
114 "List of Quail packages. 114 "List of Quail packages.
115 A Quail package is a list of these elements: 115 A Quail package is a list of these elements:
116 NAME, TITLE, QUAIL-MAP, GUIDANCE, DOCSTRING, TRANSLATION-KEYS, 116 NAME, TITLE, QUAIL-MAP, GUIDANCE, DOCSTRING, TRANSLATION-KEYS,
117 FORGET-LAST-SELECTION, DETERMINISTIC, KBD-TRANSLATE, SHOW-LAYOUT, 117 FORGET-LAST-SELECTION, DETERMINISTIC, KBD-TRANSLATE, SHOW-LAYOUT,
118 DECODE-MAP, MAXIMUM-SHORTEST, OVERLAY-PLIST, UPDATE-TRANSLATION-FUNCTION, 118 DECODE-MAP, MAXIMUM-SHORTEST, OVERLAY-PLIST, UPDATE-TRANSLATION-FUNCTION,
119 CONVERSION-KEYS. 119 CONVERSION-KEYS, SIMPLE.
120 120
121 QUAIL-MAP is a data structure to map key strings to translations. For 121 QUAIL-MAP is a data structure to map key strings to translations. For
122 the format, see the documentation of `quail-map-p'. 122 the format, see the documentation of `quail-map-p'.
123 123
124 DECODE-MAP is an alist of translations and corresponding keys. 124 DECODE-MAP is an alist of translations and corresponding keys.
180 (defsubst quail-conversion-keymap () 180 (defsubst quail-conversion-keymap ()
181 "Return conversion keymap in the current Quail package. 181 "Return conversion keymap in the current Quail package.
182 Conversion keymap is a keymap used while conversion region is active 182 Conversion keymap is a keymap used while conversion region is active
183 but translation region is not active." 183 but translation region is not active."
184 (nth 14 quail-current-package)) 184 (nth 14 quail-current-package))
185 (defsubst quail-simple ()
186 "Return t if the current Quail package is simple."
187 (nth 15 quail-current-package))
185 188
186 (defsubst quail-package (name) 189 (defsubst quail-package (name)
187 "Return Quail package named NAME." 190 "Return Quail package named NAME."
188 (assoc name quail-package-alist)) 191 (assoc name quail-package-alist))
189 192
453 (list name title (list nil) guidance (or docstring "") 456 (list name title (list nil) guidance (or docstring "")
454 translation-keymap 457 translation-keymap
455 forget-last-selection deterministic kbd-translate show-layout 458 forget-last-selection deterministic kbd-translate show-layout
456 (if create-decode-map (list 'decode-map) nil) 459 (if create-decode-map (list 'decode-map) nil)
457 maximum-shortest overlay-plist update-translation-function 460 maximum-shortest overlay-plist update-translation-function
458 conversion-keymap)) 461 conversion-keymap simple))
459 462
460 ;; Update input-method-alist. 463 ;; Update input-method-alist.
461 (let ((slot (assoc name input-method-alist)) 464 (let ((slot (assoc name input-method-alist))
462 (val (list language 'quail-use-package title docstring))) 465 (val (list language 'quail-use-package title docstring)))
463 (if slot (setcdr slot val) 466 (if slot (setcdr slot val)
1390 (save-excursion 1393 (save-excursion
1391 (set-buffer quail-completion-buf) 1394 (set-buffer quail-completion-buf)
1392 (setq quail-overlay (make-overlay 1 1)) 1395 (setq quail-overlay (make-overlay 1 1))
1393 (overlay-put quail-overlay 'face 'highlight)))) 1396 (overlay-put quail-overlay 'face 'highlight))))
1394 1397
1398 ;; Return t iff the current Quail package requires showing guidance
1399 ;; buffer.
1400 (defun quail-require-guidance-buf ()
1401 (and input-method-verbose-flag
1402 (not (and (eq (selected-window) (minibuffer-window))
1403 (quail-simple)))))
1404
1395 (defun quail-show-guidance-buf () 1405 (defun quail-show-guidance-buf ()
1396 "Display a guidance buffer for Quail input method in some window. 1406 "Display a guidance buffer for Quail input method in some window.
1397 Create the buffer if it does not exist yet. 1407 Create the buffer if it does not exist yet.
1398 The buffer is normally displayed at the echo area, 1408 The buffer is normally displayed at the echo area,
1399 but if the current buffer is a minibuffer, it is shown in 1409 but if the current buffer is a minibuffer, it is shown in
1400 the bottom-most ordinary window of the same frame, 1410 the bottom-most ordinary window of the same frame,
1401 or in a newly created frame (if the selected frame has no other windows)." 1411 or in a newly created frame (if the selected frame has no other windows)."
1402 (if (and (not input-method-verbose-flag) 1412 (when (quail-require-guidance-buf)
1403 (eq (selected-window) (minibuffer-window)))
1404 ;; We don't need the guidance buffer.
1405 nil
1406 ;; At first, setup a guidance buffer. 1413 ;; At first, setup a guidance buffer.
1407 (or (buffer-live-p quail-guidance-buf) 1414 (or (buffer-live-p quail-guidance-buf)
1408 (setq quail-guidance-buf (generate-new-buffer " *Quail-guidance*"))) 1415 (setq quail-guidance-buf (generate-new-buffer " *Quail-guidance*")))
1409 (let ((title (quail-title))) 1416 (let ((title (quail-title)))
1410 (save-excursion 1417 (save-excursion
1470 (delete-window win))))))) 1477 (delete-window win)))))))
1471 1478
1472 (defun quail-update-guidance () 1479 (defun quail-update-guidance ()
1473 "Update the Quail guidance buffer and completion buffer (if displayed now)." 1480 "Update the Quail guidance buffer and completion buffer (if displayed now)."
1474 ;; Update guidance buffer. 1481 ;; Update guidance buffer.
1475 (if (or input-method-verbose-flag 1482 (if (quail-require-guidance-buf)
1476 (not (eq (selected-window) (minibuffer-window))))
1477 (let ((guidance (quail-guidance))) 1483 (let ((guidance (quail-guidance)))
1478 (cond ((or (eq guidance t) 1484 (cond ((or (eq guidance t)
1479 (listp guidance)) 1485 (listp guidance))
1480 ;; Show the current possible translations. 1486 ;; Show the current possible translations.
1481 (quail-show-translations)) 1487 (quail-show-translations))