2015-03-25 Stefan Monnier <monnier@iro.umontreal.ca>
+ * international/mule-cmds.el (mule--ucs-names-annotation): New func.
+ (read-char-by-name): Use it.
+
* xt-mouse.el (xterm-mouse--read-number-from-terminal): Fix last commit.
2015-03-25 Nicolas Petton <nicolas@petton.fr>
;; 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
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