comparison lisp/international/quail.el @ 89483:2f877ed80fa6

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Mon, 08 Sep 2003 12:53:41 +0000
parents 375f2633d815 f657319ddd9b
children 68c22ea6027c
comparison
equal deleted inserted replaced
88123:375f2633d815 89483:2f877ed80fa6
1267 (defun quail-error (&rest args) 1267 (defun quail-error (&rest args)
1268 (signal 'quail-error (apply 'format args))) 1268 (signal 'quail-error (apply 'format args)))
1269 1269
1270 (defun quail-input-string-to-events (str) 1270 (defun quail-input-string-to-events (str)
1271 "Convert input string STR to a list of events. 1271 "Convert input string STR to a list of events.
1272 Do so while interleaving with the following special events: 1272 If STR has `advice' text property, append the following special event:
1273 \(compose-last-chars LEN COMPONENTS) 1273 \(quail-advice STR)"
1274 \(quail-advice INPUT-STRING)" 1274 (let ((events (mapcar
1275 (let* ((events (mapcar 1275 (lambda (c)
1276 (lambda (c) 1276 ;; This gives us the chance to unify on input
1277 ;; This gives us the chance to unify on input 1277 ;; (e.g. using ucs-tables.el).
1278 ;; (e.g. using ucs-tables.el). 1278 (or (and translation-table-for-input
1279 (or (and translation-table-for-input 1279 (aref translation-table-for-input c))
1280 (aref translation-table-for-input c)) 1280 c))
1281 c)) 1281 str)))
1282 str))
1283 (len (length str))
1284 (idx len)
1285 composition from to)
1286 (while (and (> idx 0)
1287 (setq composition (find-composition idx 0 str t)))
1288 (setq from (car composition) to (nth 1 composition))
1289 (setcdr (nthcdr (1- to) events)
1290 (cons (list 'compose-last-chars (- to from)
1291 (and (not (nth 3 composition)) (nth 2 composition)))
1292 (nthcdr to events)))
1293 (setq idx (1- from)))
1294 (if (or (get-text-property 0 'advice str) 1282 (if (or (get-text-property 0 'advice str)
1295 (next-single-property-change 0 'advice str)) 1283 (next-single-property-change 0 'advice str))
1296 (setq events 1284 (setq events
1297 (nconc events (list (list 'quail-advice str))))) 1285 (nconc events (list (list 'quail-advice str)))))
1298 events)) 1286 events))
2467 (setq num (quail-build-decode-map (list (quail-map)) "" decode-map 2455 (setq num (quail-build-decode-map (list (quail-map)) "" decode-map
2468 0 512 done-list)) 2456 0 512 done-list))
2469 (when (> num 0) 2457 (when (> num 0)
2470 (insert " 2458 (insert "
2471 KEY SEQUENCE 2459 KEY SEQUENCE
2472 ----------- 2460 ------------
2473 ") 2461 ")
2474 (if (quail-show-layout) 2462 (if (quail-show-layout)
2475 (insert "You can also input more characters") 2463 (insert "You can also input more characters")
2476 (insert "You can input characters")) 2464 (insert "You can input characters"))
2477 (insert " by the following key sequences:\n") 2465 (insert " by the following key sequences:\n")
2795 (setq pkg-list (cdr pkg-list))) 2783 (setq pkg-list (cdr pkg-list)))
2796 (setq quail-dirs (cdr quail-dirs) dirnames (cdr dirnames)))) 2784 (setq quail-dirs (cdr quail-dirs) dirnames (cdr dirnames))))
2797 2785
2798 ;; At last, write out LEIM list file. 2786 ;; At last, write out LEIM list file.
2799 (with-current-buffer list-buf 2787 (with-current-buffer list-buf
2800 (setq buffer-file-coding-system 'iso-2022-7bit) 2788 (let ((coding-system-for-write 'iso-2022-7bit))
2801 (save-buffer 0)) 2789 (save-buffer 0)))
2802 (kill-buffer list-buf) 2790 (kill-buffer list-buf)
2803 (message "Updating %s ... done" leim-list))) 2791 (message "Updating %s ... done" leim-list)))
2804 2792
2805 (defun quail-advice (args) 2793 (defun quail-advice (args)
2806 "Advise users about the characters input by the current Quail package. 2794 "Advise users about the characters input by the current Quail package.