diff options
| author | Stefan Monnier | 2015-03-25 13:45:34 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-03-25 13:45:34 -0400 |
| commit | 7c4a0e3b46dff5ccd2233c24ac0143d3f30747ff (patch) | |
| tree | 5612b6707f6b78acbe677e0c02bcd609ab6443f3 | |
| parent | 599ca626d760215b090012c69c749d391cfd6fbe (diff) | |
| download | emacs-7c4a0e3b46dff5ccd2233c24ac0143d3f30747ff.tar.gz emacs-7c4a0e3b46dff5ccd2233c24ac0143d3f30747ff.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/international/mule-cmds.el | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 91decb31ff0..e74733015c9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2015-03-25 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2015-03-25 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * international/mule-cmds.el (mule--ucs-names-annotation): New func. | ||
| 4 | (read-char-by-name): Use it. | ||
| 5 | |||
| 3 | * xt-mouse.el (xterm-mouse--read-number-from-terminal): Fix last commit. | 6 | * xt-mouse.el (xterm-mouse--read-number-from-terminal): Fix last commit. |
| 4 | 7 | ||
| 5 | 2015-03-25 Nicolas Petton <nicolas@petton.fr> | 8 | 2015-03-25 Nicolas Petton <nicolas@petton.fr> |
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." | |||
| 2941 | ;; char with that name. | 2941 | ;; char with that name. |
| 2942 | (setq ucs-names `(("BELL (BEL)" . 7) ,@names))))) | 2942 | (setq ucs-names `(("BELL (BEL)" . 7) ,@names))))) |
| 2943 | 2943 | ||
| 2944 | (defun mule--ucs-names-annotation (name) | ||
| 2945 | ;; FIXME: It would be much better to add this annotation before rather than | ||
| 2946 | ;; after the char name, so the annotations are aligned. | ||
| 2947 | ;; FIXME: The default behavior of displaying annotations in italics | ||
| 2948 | ;; doesn't work well here. | ||
| 2949 | (let ((char (assoc name ucs-names))) | ||
| 2950 | (when char (format " (%c)" (cdr char))))) | ||
| 2951 | |||
| 2944 | (defun read-char-by-name (prompt) | 2952 | (defun read-char-by-name (prompt) |
| 2945 | "Read a character by its Unicode name or hex number string. | 2953 | "Read a character by its Unicode name or hex number string. |
| 2946 | Display PROMPT and read a string that represents a character by its | 2954 | 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, | |||
| 2964 | prompt | 2972 | prompt |
| 2965 | (lambda (string pred action) | 2973 | (lambda (string pred action) |
| 2966 | (if (eq action 'metadata) | 2974 | (if (eq action 'metadata) |
| 2967 | '(metadata (category . unicode-name)) | 2975 | '(metadata |
| 2976 | (annotation-function . mule--ucs-names-annotation) | ||
| 2977 | (category . unicode-name)) | ||
| 2968 | (complete-with-action action (ucs-names) string pred))))) | 2978 | (complete-with-action action (ucs-names) string pred))))) |
| 2969 | (char | 2979 | (char |
| 2970 | (cond | 2980 | (cond |