diff options
| author | K. Handa | 2014-12-29 22:39:38 +0900 |
|---|---|---|
| committer | K. Handa | 2014-12-29 22:39:38 +0900 |
| commit | 3fa5f4416ed219688b9d0e370edf40dce15a5de3 (patch) | |
| tree | c6a033650f1414b2d0c445de3866822d53d4f023 | |
| parent | a45d4b846434cf9fb70ac9e4d591956af4259214 (diff) | |
| download | emacs-3fa5f4416ed219688b9d0e370edf40dce15a5de3.tar.gz emacs-3fa5f4416ed219688b9d0e370edf40dce15a5de3.zip | |
international/mule.el (make-translation-table-from-alist): Accept nil or zero-length vector for FROM and TO.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/international/mule.el | 39 |
2 files changed, 29 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 193e0c0ebf2..48c73bb4196 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-12-29 K. Handa <handa@gnu.org> | ||
| 2 | |||
| 3 | * international/mule.el (make-translation-table-from-alist): | ||
| 4 | Accept nil or zero-length vector for FROM and TO. | ||
| 5 | |||
| 1 | 2014-12-28 Ivan Shmakov <ivan@siamics.net> | 6 | 2014-12-28 Ivan Shmakov <ivan@siamics.net> |
| 2 | 7 | ||
| 3 | * net/shr.el (shr-tag-table): Fix handling of tbody/header/footer | 8 | * net/shr.el (shr-tag-table): Fix handling of tbody/header/footer |
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 4f8d50c8c84..fd527b1059e 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -2317,7 +2317,13 @@ ALIST is an alist, each element has the form (FROM . TO). | |||
| 2317 | FROM and TO are a character or a vector of characters. | 2317 | FROM and TO are a character or a vector of characters. |
| 2318 | If FROM is a character, that character is translated to TO. | 2318 | If FROM is a character, that character is translated to TO. |
| 2319 | If FROM is a vector of characters, that sequence is translated to TO. | 2319 | If FROM is a vector of characters, that sequence is translated to TO. |
| 2320 | The first extra-slot of the value is a translation table for reverse mapping." | 2320 | The first extra-slot of the value is a translation table for reverse mapping. |
| 2321 | |||
| 2322 | FROM and TO may be nil. If TO is nil, the translation from FROM | ||
| 2323 | to nothing is defined in the translation table and that element | ||
| 2324 | is ignored in the reverse map. If FROM is nil, the translation | ||
| 2325 | from TO to nothing is defined in the reverse map only. A vector | ||
| 2326 | of length zero has the same meaning as specifying nil." | ||
| 2321 | (let ((tables (vector (make-char-table 'translation-table) | 2327 | (let ((tables (vector (make-char-table 'translation-table) |
| 2322 | (make-char-table 'translation-table))) | 2328 | (make-char-table 'translation-table))) |
| 2323 | table max-lookup from to idx val) | 2329 | table max-lookup from to idx val) |
| @@ -2330,20 +2336,23 @@ The first extra-slot of the value is a translation table for reverse mapping." | |||
| 2330 | (setq from (cdr elt) to (car elt))) | 2336 | (setq from (cdr elt) to (car elt))) |
| 2331 | (if (characterp from) | 2337 | (if (characterp from) |
| 2332 | (setq idx from) | 2338 | (setq idx from) |
| 2333 | (setq idx (aref from 0) | 2339 | (if (= (length from) 0) |
| 2334 | max-lookup (max max-lookup (length from)))) | 2340 | (setq idx nil) |
| 2335 | (setq val (aref table idx)) | 2341 | (setq idx (aref from 0) |
| 2336 | (if val | 2342 | max-lookup (max max-lookup (length from))))) |
| 2337 | (progn | 2343 | (when idx |
| 2338 | (or (consp val) | 2344 | (setq val (aref table idx)) |
| 2339 | (setq val (list (cons (vector idx) val)))) | 2345 | (if val |
| 2340 | (if (characterp from) | 2346 | (progn |
| 2341 | (setq from (vector from))) | 2347 | (or (consp val) |
| 2342 | (setq val (nconc val (list (cons from to))))) | 2348 | (setq val (list (cons (vector idx) val)))) |
| 2343 | (if (characterp from) | 2349 | (if (characterp from) |
| 2344 | (setq val to) | 2350 | (setq from (vector from))) |
| 2345 | (setq val (list (cons from to))))) | 2351 | (setq val (nconc val (list (cons from to))))) |
| 2346 | (aset table idx val)) | 2352 | (if (characterp from) |
| 2353 | (setq val to) | ||
| 2354 | (setq val (list (cons from to))))) | ||
| 2355 | (aset table idx val))) | ||
| 2347 | (set-char-table-extra-slot table 1 max-lookup)) | 2356 | (set-char-table-extra-slot table 1 max-lookup)) |
| 2348 | (set-char-table-extra-slot (aref tables 0) 0 (aref tables 1)) | 2357 | (set-char-table-extra-slot (aref tables 0) 0 (aref tables 1)) |
| 2349 | (aref tables 0))) | 2358 | (aref tables 0))) |