From: Juri Linkov Date: Wed, 22 Feb 2012 23:35:07 +0000 (+0200) Subject: * international/mule-cmds.el (read-char-by-name): Use \` and \'. X-Git-Tag: emacs-pretest-24.0.94~66 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=19e9789e196ba5eea44ecac3ccf25658a6ffc04b;p=emacs.git * international/mule-cmds.el (read-char-by-name): Use \` and \'. (ucs-insert): Doc fix. Check for hex digits in the string. Don't display `nil' in the error message. Fixes: debbugs:10857 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ab39eb4d03c..eaf04e72ecd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-02-22 Juri Linkov + + * international/mule-cmds.el (read-char-by-name): Use \` and \'. + (ucs-insert): Doc fix. Check for hex digits in the string. + Don't display `nil' in the error message. (Bug#10857) + 2012-02-22 Alan Mackenzie * progmodes/cc-modes: revert change #2012-02-06T22:08:41Z!larsi@gnus.org from 2012-02-06. diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index a7fac427e41..debc328c551 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2949,9 +2949,9 @@ point or a number in hash notation, e.g. #o21430 for octal, '(metadata (category . unicode-name)) (complete-with-action action (ucs-names) string pred)))))) (cond - ((string-match-p "^[0-9a-fA-F]+$" input) + ((string-match-p "\\`[0-9a-fA-F]+\\'" input) (string-to-number input 16)) - ((string-match-p "^#" input) + ((string-match-p "\\`#" input) (read input)) (t (cdr (assoc-string input (ucs-names) t)))))) @@ -2967,6 +2967,10 @@ preceded by an asterisk `*' and use completion, it will show all the characters whose names include that substring, not necessarily at the beginning of the name. +This function also accepts a hexadecimal number of Unicode code +point or a number in hash notation, e.g. #o21430 for octal, +#x2318 for hex, or #10r8984 for decimal. + The optional third arg INHERIT (non-nil when called interactively), says to inherit text properties from adjoining text, if those properties are sticky." @@ -2975,9 +2979,12 @@ properties are sticky." (prefix-numeric-value current-prefix-arg) t)) (unless count (setq count 1)) - (if (stringp character) + (if (and (stringp character) + (string-match-p "\\`[0-9a-fA-F]+\\'" character)) (setq character (string-to-number character 16))) (cond + ((null character) + (error "Not a Unicode character")) ((not (integerp character)) (error "Not a Unicode character code: %S" character)) ((or (< character 0) (> character #x10FFFF))