comparison lisp/international/quail.el @ 34725:30f56d213a09

(quail-input-method): Resize the help window again after it has all its contents. Remove unneeded progn.
author Miles Bader <miles@gnu.org>
date Wed, 20 Dec 2000 06:05:17 +0000
parents 1afa708b89ea
children 778deeeffb6d
comparison
equal deleted inserted replaced
34724:15c6663e5676 34725:30f56d213a09
1 ;;; quail.el --- Provides simple input method for multilingual text 1 ;;; quail.el --- Provides simple input method for multilingual text
2 2
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. 3 ;; Copyright (C) 1995, 2000 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation. 4 ;; Licensed to the Free Software Foundation.
5 5
6 ;; Author: Kenichi HANDA <handa@etl.go.jp> 6 ;; Author: Kenichi HANDA <handa@etl.go.jp>
7 ;; Naoto TAKAHASHI <ntakahas@etl.go.jp> 7 ;; Naoto TAKAHASHI <ntakahas@etl.go.jp>
8 ;; Maintainer: Kenichi HANDA <handa@etl.go.jp> 8 ;; Maintainer: Kenichi HANDA <handa@etl.go.jp>
2405 (set-buffer standard-output) 2405 (set-buffer standard-output)
2406 (setq quail-current-package package))) 2406 (setq quail-current-package package)))
2407 ;; Then, insert text in the help buffer while paying attention to 2407 ;; Then, insert text in the help buffer while paying attention to
2408 ;; the width of the frame in which the buffer displayed. 2408 ;; the width of the frame in which the buffer displayed.
2409 (save-excursion 2409 (save-excursion
2410 (progn 2410 (set-buffer (get-buffer "*Help*"))
2411 (set-buffer (get-buffer "*Help*")) 2411 (setq buffer-read-only nil)
2412 (setq buffer-read-only nil) 2412 (insert "Input method: " (quail-name)
2413 (insert "Input method: " (quail-name) 2413 " (mode line indicator:"
2414 " (mode line indicator:" 2414 (quail-title)
2415 (quail-title) 2415 ")\n\n")
2416 ")\n\n") 2416 (save-restriction
2417 (save-restriction 2417 (narrow-to-region (point) (point))
2418 (narrow-to-region (point) (point)) 2418 (insert (quail-docstring))
2419 (insert (quail-docstring)) 2419 (goto-char (point-min))
2420 (goto-char (point-min)) 2420 (with-syntax-table emacs-lisp-mode-syntax-table
2421 (with-syntax-table emacs-lisp-mode-syntax-table 2421 (while (re-search-forward "\\\\<\\sw\\(\\sw\\|\\s_\\)+>" nil t)
2422 (while (re-search-forward "\\\\<\\sw\\(\\sw\\|\\s_\\)+>" nil t) 2422 (let ((sym (intern-soft
2423 (let ((sym (intern-soft 2423 (buffer-substring (+ (match-beginning 0) 2)
2424 (buffer-substring (+ (match-beginning 0) 2) 2424 (1- (point))))))
2425 (1- (point)))))) 2425 (if (and (boundp sym)
2426 (if (and (boundp sym) 2426 (stringp (symbol-value sym)))
2427 (stringp (symbol-value sym))) 2427 (replace-match (symbol-value sym) t t)))))
2428 (replace-match (symbol-value sym) t t))))) 2428 (goto-char (point-max)))
2429 (goto-char (point-max))) 2429 (or (bolp)
2430 (or (bolp) 2430 (insert "\n"))
2431 (insert "\n")) 2431 (insert "\n")
2432 (insert "\n") 2432
2433 2433 (let ((done-list nil))
2434 (let ((done-list nil)) 2434 ;; Show keyboard layout if the current package requests it..
2435 ;; Show keyboard layout if the current package requests it.. 2435 (when (quail-show-layout)
2436 (when (quail-show-layout) 2436 (insert "
2437 (insert "
2438 KEYBOARD LAYOUT 2437 KEYBOARD LAYOUT
2439 --------------- 2438 ---------------
2440 This input method works by translating individual input characters. 2439 This input method works by translating individual input characters.
2441 Assuming that your actual keyboard has the `") 2440 Assuming that your actual keyboard has the `")
2442 (help-insert-xref-button 2441 (help-insert-xref-button
2443 quail-keyboard-layout-type 2442 quail-keyboard-layout-type
2444 #'quail-show-keyboard-layout quail-keyboard-layout-type 2443 #'quail-show-keyboard-layout quail-keyboard-layout-type
2445 "mouse-2, RET: show this layout") 2444 "mouse-2, RET: show this layout")
2446 (insert "' layout, 2445 (insert "' layout,
2447 translation results in the following \"virtual\" keyboard layout: 2446 translation results in the following \"virtual\" keyboard layout:
2448 ") 2447 ")
2449 (setq done-list 2448 (setq done-list
2450 (quail-insert-kbd-layout quail-keyboard-layout)) 2449 (quail-insert-kbd-layout quail-keyboard-layout))
2451 (insert "If your keyboard has a different layout, rearranged from 2450 (insert "If your keyboard has a different layout, rearranged from
2452 `") 2451 `")
2453 (help-insert-xref-button 2452 (help-insert-xref-button
2454 "standard" 2453 "standard"
2455 #'quail-show-keyboard-layout "standard" 2454 #'quail-show-keyboard-layout "standard"
2456 "mouse-2, RET: show this layout") 2455 "mouse-2, RET: show this layout")
2457 (insert "', the \"virtual\" keyboard you get with this input method 2456 (insert "', the \"virtual\" keyboard you get with this input method
2458 will be rearranged in the same way. 2457 will be rearranged in the same way.
2459 2458
2460 You can set the variable `quail-keyboard-layout-type' to specify 2459 You can set the variable `quail-keyboard-layout-type' to specify
2461 the physical layout of your keyboard; the tables shown in 2460 the physical layout of your keyboard; the tables shown in
2462 documentation of input methods including this one are based on the 2461 documentation of input methods including this one are based on the
2463 physical keyboard layout as specified with that variable. 2462 physical keyboard layout as specified with that variable.
2464 ") 2463 ")
2465 (help-insert-xref-button 2464 (help-insert-xref-button
2466 "[customize keyboard layout]" 2465 "[customize keyboard layout]"
2467 #'customize-variable 'quail-keyboard-layout-type 2466 #'customize-variable 'quail-keyboard-layout-type
2468 "mouse-2, RET: set keyboard layout type") 2467 "mouse-2, RET: set keyboard layout type")
2469 (insert "\n")) 2468 (insert "\n"))
2470 2469
2471 ;; Show key sequences. 2470 ;; Show key sequences.
2472 (let ((decode-map (list 'decode-map)) 2471 (let ((decode-map (list 'decode-map))
2473 elt pos num) 2472 elt pos num)
2474 (setq num (quail-build-decode-map (list (quail-map)) "" decode-map 2473 (setq num (quail-build-decode-map (list (quail-map)) "" decode-map
2475 0 512 done-list)) 2474 0 512 done-list))
2476 (when (> num 0) 2475 (when (> num 0)
2477 (insert " 2476 (insert "
2478 KEY SEQUENCE 2477 KEY SEQUENCE
2479 ----------- 2478 -----------
2480 ") 2479 ")
2481 (if (quail-show-layout) 2480 (if (quail-show-layout)
2482 (insert "You can also input more characters") 2481 (insert "You can also input more characters")
2483 (insert "You can input characters")) 2482 (insert "You can input characters"))
2484 (insert " by the following key sequences:\n") 2483 (insert " by the following key sequences:\n")
2485 (quail-insert-decode-map decode-map)))) 2484 (quail-insert-decode-map decode-map))))
2486 2485
2487 (quail-help-insert-keymap-description 2486 (quail-help-insert-keymap-description
2488 (quail-translation-keymap) 2487 (quail-translation-keymap)
2489 "\ 2488 "\
2490 KEY BINDINGS FOR TRANSLATION 2489 KEY BINDINGS FOR TRANSLATION
2491 ----------------------------\n") 2490 ----------------------------\n")
2492 (insert ?\n) 2491 (insert ?\n)
2493 (if (quail-conversion-keymap) 2492 (if (quail-conversion-keymap)
2494 (quail-help-insert-keymap-description 2493 (quail-help-insert-keymap-description
2495 (quail-conversion-keymap) 2494 (quail-conversion-keymap)
2496 "\ 2495 "\
2497 KEY BINDINGS FOR CONVERSION 2496 KEY BINDINGS FOR CONVERSION
2498 ---------------------------\n")) 2497 ---------------------------\n"))
2499 (help-setup-xref (list #'quail-help (quail-name)) 2498 (help-setup-xref (list #'quail-help (quail-name))
2500 (interactive-p)) 2499 (interactive-p))
2501 (setq quail-current-package nil))))) 2500 (setq quail-current-package nil)
2501 ;; Resize the help window again, now that it has all its contents.
2502 (save-selected-window
2503 (select-window (get-buffer-window (current-buffer)))
2504 (run-hooks 'temp-buffer-show-hook)))))
2502 2505
2503 (defun quail-help-insert-keymap-description (keymap &optional header) 2506 (defun quail-help-insert-keymap-description (keymap &optional header)
2504 (let (pos1 pos2 eol) 2507 (let (pos1 pos2 eol)
2505 (setq pos1 (point)) 2508 (setq pos1 (point))
2506 (if header 2509 (if header