From: Juri Linkov Date: Thu, 31 Jul 2008 16:52:11 +0000 (+0000) Subject: (read-char-by-name): Accept hash notation. Doc fix. X-Git-Tag: emacs-pretest-23.0.90~3760 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c0a67379ac59dea7b0491b4aa47a07a243f10f54;p=emacs.git (read-char-by-name): Accept hash notation. Doc fix. (ucs-insert): Doc fix. Convert to number only when `arg' is a string. Use separate error message when `arg' is not an integer. Bind `ucs-insert' to `C-x 8 RET'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e14832be175..1b950b39586 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,29 @@ +2008-07-31 Juri Linkov + + * dired-aux.el (dired-isearch-filenames-toggle): New command. + (dired-isearch-filenames-setup): Bind "\M-sf" to + dired-isearch-filenames-toggle in isearch-mode-map. + (dired-isearch-filenames-end): Bind "\M-sf" to nil + in isearch-mode-map. + + * isearch.el (isearch-edit-string-set-word): New command. + (minibuffer-local-isearch-map): Bind "\C-w" to + isearch-edit-string-set-word. + (isearch-new-word): Temporary internal variable. + (isearch-edit-string): Remove special case of reading the + first character and checking it for C-w. + + * simple.el (read-shell-command, shell-command): + Move code that uses minibuffer-with-setup-hook to set + minibuffer-default-add-function to minibuffer-default-add-shell-commands + from the interactive spec of `shell-command' to `read-shell-command'. + + * international/mule-cmds.el (read-char-by-name): + Accept hash notation. Doc fix. + (ucs-insert): Doc fix. Convert to number only when `arg' is + a string. Use separate error message when `arg' is not an integer. + Bind `ucs-insert' to `C-x 8 RET'. + 2008-07-31 Joachim Nilsson (tiny change) * progmodes/cc-styles.el (c-style-alist): For the Ellemtel style, diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index aa45bda2c48..08b50cbee78 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2858,26 +2858,37 @@ If CODING-SYSTEM can't safely encode CHAR, return nil." (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 Unicode property `name' or `old-name'. It also accepts -a hexadecimal number of Unicode code point. Returns a character -as a number." +Display PROMPT and read a string that represents a character by its +Unicode property `name' or `old-name'. You can type a few of first +letters of the Unicode name and use completion. 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. Returns a character as a number." (let* ((completion-ignore-case t) (input (completing-read prompt ucs-completions))) - (or (and (string-match "^[0-9a-fA-F]+$" input) - (string-to-number input 16)) - (cdr (assoc input (ucs-names)))))) + (cond + ((string-match "^[0-9a-fA-F]+$" input) + (string-to-number input 16)) + ((string-match "^#" input) + (read input)) + (t + (cdr (assoc input (ucs-names))))))) (defun ucs-insert (arg) "Insert a character of the given Unicode code point. -Interactively, prompts for a hex string giving the code." +Interactively, prompts for a Unicode character name or a hex number +using `read-char-by-name'." (interactive (list (read-char-by-name "Unicode (name or hex): "))) - (or (integerp arg) + (if (stringp arg) (setq arg (string-to-number arg 16))) - (if (or (< arg 0) (> arg #x10FFFF)) - (error "Not a Unicode character code: 0x%X" arg)) + (cond + ((not (integerp arg)) + (error "Not a Unicode character code: %S" arg)) + ((or (< arg 0) (> arg #x10FFFF)) + (error "Not a Unicode character code: 0x%X" arg))) (insert-and-inherit arg)) +(define-key ctl-x-map "8\r" 'ucs-insert) ;; arch-tag: b382c432-4b36-460e-bf4c-05efd0bb18dc ;;; mule-cmds.el ends here