Mercurial > emacs
comparison lisp/international/quail.el @ 54999:894e3fd388c2
(quail-lookup-key): New optional arg
NOT-RESET-INDICES.
(quail-get-translations): Call quail-lookup-key with
NOT-RESET-INDICES t.
(quail-completion): Likewise.
(quail-lookup-map-and-concat): Likewise.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 20 Apr 2004 08:18:02 +0000 |
parents | 21d4358a7507 |
children | 1cd6f125aac9 |
comparison
equal
deleted
inserted
replaced
54998:a9da0517d087 | 54999:894e3fd388c2 |
---|---|
1216 (cons (list 0 0 0 0 nil) def))) | 1216 (cons (list 0 0 0 0 nil) def))) |
1217 | 1217 |
1218 (t | 1218 (t |
1219 (error "Invalid object in Quail map: %s" def)))) | 1219 (error "Invalid object in Quail map: %s" def)))) |
1220 | 1220 |
1221 (defun quail-lookup-key (key &optional len) | 1221 (defun quail-lookup-key (key &optional len not-reset-indices) |
1222 "Lookup KEY of length LEN in the current Quail map and return the definition. | 1222 "Lookup KEY of length LEN in the current Quail map and return the definition. |
1223 The returned value is a Quail map specific to KEY." | 1223 The returned value is a Quail map specific to KEY." |
1224 (or len | 1224 (or len |
1225 (setq len (length key))) | 1225 (setq len (length key))) |
1226 (let ((idx 0) | 1226 (let ((idx 0) |
1254 ;; We must reflect TRANSLATION to car part of MAP. | 1254 ;; We must reflect TRANSLATION to car part of MAP. |
1255 (setcar map translation))) | 1255 (setcar map translation))) |
1256 (if (and (consp translation) (vectorp (cdr translation))) | 1256 (if (and (consp translation) (vectorp (cdr translation))) |
1257 (progn | 1257 (progn |
1258 (setq quail-current-translations translation) | 1258 (setq quail-current-translations translation) |
1259 (if (quail-forget-last-selection) | 1259 (if (and (not not-reset-indices) (quail-forget-last-selection)) |
1260 (setcar (car quail-current-translations) 0)))))) | 1260 (setcar (car quail-current-translations) 0)))))) |
1261 ;; We may have to reform cdr part of MAP. | 1261 ;; We may have to reform cdr part of MAP. |
1262 (if (and (cdr map) (functionp (cdr map))) | 1262 (if (and (cdr map) (functionp (cdr map))) |
1263 (setcdr map (funcall (cdr map) key len))) | 1263 (setcdr map (funcall (cdr map) key len))) |
1264 map)) | 1264 map)) |
2041 (set-window-start win pos)) | 2041 (set-window-start win pos)) |
2042 )))))) | 2042 )))))) |
2043 | 2043 |
2044 (defun quail-get-translations () | 2044 (defun quail-get-translations () |
2045 "Return a string containing the current possible translations." | 2045 "Return a string containing the current possible translations." |
2046 (let ((map (quail-lookup-key quail-current-key)) | 2046 (let ((map (quail-lookup-key quail-current-key nil t)) |
2047 (str (copy-sequence quail-current-key))) | 2047 (str (copy-sequence quail-current-key))) |
2048 (if quail-current-translations | 2048 (if quail-current-translations |
2049 (quail-update-current-translations)) | 2049 (quail-update-current-translations)) |
2050 | 2050 |
2051 ;; Show the current key. | 2051 ;; Show the current key. |
2112 are shown (at most to the depth specified `quail-completion-max-depth')." | 2112 are shown (at most to the depth specified `quail-completion-max-depth')." |
2113 (interactive) | 2113 (interactive) |
2114 (quail-setup-completion-buf) | 2114 (quail-setup-completion-buf) |
2115 (let ((win (get-buffer-window quail-completion-buf 'visible)) | 2115 (let ((win (get-buffer-window quail-completion-buf 'visible)) |
2116 (key quail-current-key) | 2116 (key quail-current-key) |
2117 (map (quail-lookup-key quail-current-key)) | 2117 (map (quail-lookup-key quail-current-key nil t)) |
2118 (require-update nil)) | 2118 (require-update nil)) |
2119 (with-current-buffer quail-completion-buf | 2119 (with-current-buffer quail-completion-buf |
2120 (if (and win | 2120 (if (and win |
2121 (equal key quail-current-key) | 2121 (equal key quail-current-key) |
2122 (eq last-command 'quail-completion)) | 2122 (eq last-command 'quail-completion)) |
2693 (defun quail-lookup-map-and-concat (key) | 2693 (defun quail-lookup-map-and-concat (key) |
2694 (let* ((len (length key)) | 2694 (let* ((len (length key)) |
2695 (translation-list nil) | 2695 (translation-list nil) |
2696 map) | 2696 map) |
2697 (while (> len 0) | 2697 (while (> len 0) |
2698 (setq map (quail-lookup-key key len) | 2698 (setq map (quail-lookup-key key len t) |
2699 len (1- len)) | 2699 len (1- len)) |
2700 (if map | 2700 (if map |
2701 (let* ((def (quail-map-definition map)) | 2701 (let* ((def (quail-map-definition map)) |
2702 (trans (if (consp def) (aref (cdr def) (car (car def))) | 2702 (trans (if (consp def) (aref (cdr def) (car (car def))) |
2703 def))) | 2703 def))) |