Tiny simplification to read-char-by-name
* lisp/international/mule-cmds.el (mule--ucs-names-sort-by-code): Sort with car-less-than-car instead of slower lambda. (mule--ucs-names-affixation): Just stick character into a list to avoid trip through format and char-to-string. (read-char-by-name): Quote function symbols as such.
This commit is contained in:
parent
817a49748f
commit
e4328d4b3e
1 changed files with 7 additions and 8 deletions
|
@ -3078,15 +3078,14 @@ on encoding."
|
|||
(setq ucs-names names))))
|
||||
|
||||
(defun mule--ucs-names-sort-by-code (names)
|
||||
(let* ((codes-and-names
|
||||
(mapcar (lambda (name) (cons (gethash name ucs-names) name)) names))
|
||||
(sorted (sort codes-and-names (lambda (a b) (< (car a) (car b))))))
|
||||
(mapcar #'cdr sorted)))
|
||||
(let ((codes-and-names
|
||||
(mapcar (lambda (name) (cons (gethash name ucs-names) name)) names)))
|
||||
(mapcar #'cdr (sort codes-and-names #'car-less-than-car))))
|
||||
|
||||
(defun mule--ucs-names-affixation (names)
|
||||
(mapcar (lambda (name)
|
||||
(let ((char (gethash name ucs-names)))
|
||||
(list name (concat (if char (format "%c" char) " ") "\t") "")))
|
||||
(list name (concat (if char (list char) " ") "\t") "")))
|
||||
names))
|
||||
|
||||
(defun mule--ucs-names-group (names)
|
||||
|
@ -3189,11 +3188,11 @@ as names, not numbers."
|
|||
`(metadata
|
||||
(display-sort-function
|
||||
. ,(when (eq read-char-by-name-sort 'code)
|
||||
'mule--ucs-names-sort-by-code))
|
||||
#'mule--ucs-names-sort-by-code))
|
||||
(affixation-function
|
||||
. ,(if read-char-by-name-group
|
||||
'mule--ucs-names-group
|
||||
'mule--ucs-names-affixation))
|
||||
#'mule--ucs-names-group
|
||||
#'mule--ucs-names-affixation))
|
||||
(category . unicode-name))
|
||||
(complete-with-action action (ucs-names) string pred)))))
|
||||
(char
|
||||
|
|
Loading…
Add table
Reference in a new issue