diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-03-25 13:45:34 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2015-03-25 13:45:34 -0400 |
commit | 7c4a0e3b46dff5ccd2233c24ac0143d3f30747ff (patch) | |
tree | 5612b6707f6b78acbe677e0c02bcd609ab6443f3 /lisp/international | |
parent | 599ca626d760215b090012c69c749d391cfd6fbe (diff) | |
download | emacs-7c4a0e3b46dff5ccd2233c24ac0143d3f30747ff.tar.gz |
* international/mule-cmds.el: Show chars in C-x 8 RET completions
* lisp/international/mule-cmds.el (mule--ucs-names-annotation): New func.
(read-char-by-name): Use it.
Diffstat (limited to 'lisp/international')
-rw-r--r-- | lisp/international/mule-cmds.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index dcf850d9425..cca659f2cc1 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2941,6 +2941,14 @@ on encoding." ;; char with that name. (setq ucs-names `(("BELL (BEL)" . 7) ,@names))))) +(defun mule--ucs-names-annotation (name) + ;; FIXME: It would be much better to add this annotation before rather than + ;; after the char name, so the annotations are aligned. + ;; FIXME: The default behavior of displaying annotations in italics + ;; doesn't work well here. + (let ((char (assoc name ucs-names))) + (when char (format " (%c)" (cdr char))))) + (defun read-char-by-name (prompt) "Read a character by its Unicode name or hex number string. Display PROMPT and read a string that represents a character by its @@ -2964,7 +2972,9 @@ point or a number in hash notation, e.g. #o21430 for octal, prompt (lambda (string pred action) (if (eq action 'metadata) - '(metadata (category . unicode-name)) + '(metadata + (annotation-function . mule--ucs-names-annotation) + (category . unicode-name)) (complete-with-action action (ucs-names) string pred))))) (char (cond |