diff options
| author | Mark Oteiza | 2017-08-31 17:22:39 -0400 |
|---|---|---|
| committer | Mark Oteiza | 2017-08-31 17:22:39 -0400 |
| commit | 96c2c098aeed5c85733577ebbdaf33af6fbb59e9 (patch) | |
| tree | d80538fd4ed9047f29b07aeff40feffa6d464005 /lisp/leim | |
| parent | e6a2b4c2df96ed8780ff407481a18e3f4299c8ad (diff) | |
| download | emacs-96c2c098aeed5c85733577ebbdaf33af6fbb59e9.tar.gz emacs-96c2c098aeed5c85733577ebbdaf33af6fbb59e9.zip | |
Make ucs-names a hash table (Bug#28302)
* etc/NEWS: Mention the type change.
* lisp/descr-text.el (describe-char): Use gethash to access ucs-names.
Hardcode BEL's name into the function instead of needlessly mapping
over the hash table in the spirit of rassoc.
* lisp/international/mule-cmds.el (ucs-names): Fix variable and
function docstrings. Initialize a hash table for ucs-names--the
number of entries is 42845 here. Switch to hash-table
getters/setters.
(mule--ucs-names-annotation): Use hash-table getter.
(char-from-name): Upcase the string if ignore-case is truthy.
* lisp/leim/quail/latin-ltx.el: Use maphash instead of dolist.
Diffstat (limited to 'lisp/leim')
| -rw-r--r-- | lisp/leim/quail/latin-ltx.el | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lisp/leim/quail/latin-ltx.el b/lisp/leim/quail/latin-ltx.el index 6c5afcd4f93..d8ea90ec3ec 100644 --- a/lisp/leim/quail/latin-ltx.el +++ b/lisp/leim/quail/latin-ltx.el | |||
| @@ -75,20 +75,20 @@ system, including many technical ones. Examples: | |||
| 75 | (`(,seq ,re) | 75 | (`(,seq ,re) |
| 76 | (let ((count 0) | 76 | (let ((count 0) |
| 77 | (re (eval re t))) | 77 | (re (eval re t))) |
| 78 | (dolist (pair (ucs-names)) | 78 | (maphash |
| 79 | (let ((name (car pair)) | 79 | (lambda (name char) |
| 80 | (char (cdr pair))) | 80 | (when (and (characterp char) ;; Ignore char-ranges. |
| 81 | (when (and (characterp char) ;; Ignore char-ranges. | 81 | (string-match re name)) |
| 82 | (string-match re name)) | 82 | (let ((keys (if (stringp seq) |
| 83 | (let ((keys (if (stringp seq) | 83 | (replace-match seq nil nil name) |
| 84 | (replace-match seq nil nil name) | 84 | (funcall seq name char)))) |
| 85 | (funcall seq name char)))) | 85 | (if (listp keys) |
| 86 | (if (listp keys) | 86 | (dolist (x keys) |
| 87 | (dolist (x keys) | 87 | (setq count (1+ count)) |
| 88 | (setq count (1+ count)) | 88 | (push (list x char) newrules)) |
| 89 | (push (list x char) newrules)) | 89 | (setq count (1+ count)) |
| 90 | (setq count (1+ count)) | 90 | (push (list keys char) newrules))))) |
| 91 | (push (list keys char) newrules)))))) | 91 | (ucs-names)) |
| 92 | ;; (message "latin-ltx: %d mappings for %S" count re) | 92 | ;; (message "latin-ltx: %d mappings for %S" count re) |
| 93 | )))) | 93 | )))) |
| 94 | (setq newrules (delete-dups newrules)) | 94 | (setq newrules (delete-dups newrules)) |
| @@ -206,7 +206,7 @@ system, including many technical ones. Examples: | |||
| 206 | 206 | ||
| 207 | ((lambda (name char) | 207 | ((lambda (name char) |
| 208 | (let* ((base (concat (match-string 1 name) (match-string 3 name))) | 208 | (let* ((base (concat (match-string 1 name) (match-string 3 name))) |
| 209 | (basechar (cdr (assoc base (ucs-names))))) | 209 | (basechar (gethash base (ucs-names)))) |
| 210 | (when (latin-ltx--ascii-p basechar) | 210 | (when (latin-ltx--ascii-p basechar) |
| 211 | (string (if (match-end 2) ?^ ?_) basechar)))) | 211 | (string (if (match-end 2) ?^ ?_) basechar)))) |
| 212 | "\\(.*\\)SU\\(?:B\\|\\(PER\\)\\)SCRIPT \\(.*\\)") | 212 | "\\(.*\\)SU\\(?:B\\|\\(PER\\)\\)SCRIPT \\(.*\\)") |