diff options
| author | Juri Linkov | 2008-07-29 14:46:18 +0000 |
|---|---|---|
| committer | Juri Linkov | 2008-07-29 14:46:18 +0000 |
| commit | 838d78d411955dbe3ef5d75ff404ced8ca832c5a (patch) | |
| tree | 4747ab1d94a4c4f0e8c6682907077272b646402a | |
| parent | 8677dea3af74e8253bb85a00beb9dd4975946d63 (diff) | |
| download | emacs-838d78d411955dbe3ef5d75ff404ced8ca832c5a.tar.gz emacs-838d78d411955dbe3ef5d75ff404ced8ca832c5a.zip | |
(ucs-names): New internal variable.
(ucs-names): New function.
(ucs-completions): New lazy completion variable.
(read-char-by-name): New function.
(ucs-insert): Replace interactive spec letter "s" with the call to
`read-char-by-name'.
| -rw-r--r-- | lisp/ChangeLog | 31 | ||||
| -rw-r--r-- | lisp/international/mule-cmds.el | 38 |
2 files changed, 68 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4f30596b3b2..b3c7d59a49d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,34 @@ | |||
| 1 | 2008-07-29 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * international/mule-cmds.el (ucs-names): New internal variable. | ||
| 4 | (ucs-names): New function. | ||
| 5 | (ucs-completions): New lazy completion variable. | ||
| 6 | (read-char-by-name): New function. | ||
| 7 | (ucs-insert): Replace interactive spec letter "s" with the call to | ||
| 8 | `read-char-by-name'. | ||
| 9 | |||
| 10 | * replace.el (read-regexp): Add second arg `default'. Doc fix. | ||
| 11 | |||
| 12 | * replace.el (occur-read-primary-args): | ||
| 13 | * hi-lock.el (hi-lock-line-face-buffer, hi-lock-face-buffer) | ||
| 14 | (hi-lock-face-phrase-buffer): Use `(car regexp-history)' as the | ||
| 15 | second arg of `read-regexp'. | ||
| 16 | |||
| 17 | * dired-aux.el (dired-isearch-filenames): New user option. | ||
| 18 | (dired-isearch-orig-success-function): New internal variable. | ||
| 19 | (dired-isearch-filenames-setup, dired-isearch-filenames-end) | ||
| 20 | (dired-isearch-success-function): New functions. | ||
| 21 | (dired-isearch-filenames, dired-isearch-filenames-regexp): | ||
| 22 | New commands. | ||
| 23 | |||
| 24 | * dired.el (dired-insert-set-properties): Add new text property | ||
| 25 | `dired-filename' to put on file names. | ||
| 26 | (dired-mode-map): Bind `M-s f C-s' to `dired-isearch-filenames' | ||
| 27 | and `M-s f M-C-s' to `dired-isearch-filenames-regexp'. | ||
| 28 | Add menu items. | ||
| 29 | (dired-mode): Add hook `dired-isearch-filenames-setup' to | ||
| 30 | buffer-local `isearch-mode-hook'. | ||
| 31 | |||
| 1 | 2008-07-29 Juanma Barranquero <lekktu@gmail.com> | 32 | 2008-07-29 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 33 | ||
| 3 | * progmodes/ada-mode.el (ada-batch-reformat): Doc fix. | 34 | * progmodes/ada-mode.el (ada-batch-reformat): Doc fix. |
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 4b8ee720d7e..aa45bda2c48 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -2832,10 +2832,46 @@ If CODING-SYSTEM can't safely encode CHAR, return nil." | |||
| 2832 | (defvar nonascii-insert-offset 0 "This variable is obsolete.") | 2832 | (defvar nonascii-insert-offset 0 "This variable is obsolete.") |
| 2833 | (defvar nonascii-translation-table nil "This variable is obsolete.") | 2833 | (defvar nonascii-translation-table nil "This variable is obsolete.") |
| 2834 | 2834 | ||
| 2835 | (defvar ucs-names nil | ||
| 2836 | "Alist of cached (CHAR-NAME . CHAR-CODE) pairs.") | ||
| 2837 | |||
| 2838 | (defun ucs-names () | ||
| 2839 | "Return alist of (CHAR-NAME . CHAR-CODE) pairs cached in `ucs-names'." | ||
| 2840 | (or ucs-names | ||
| 2841 | (setq ucs-names | ||
| 2842 | (let (name names) | ||
| 2843 | (dotimes (c #xEFFFF) | ||
| 2844 | (unless (or | ||
| 2845 | (and (>= c #x3400 ) (<= c #x4dbf )) ; CJK Ideograph Extension A | ||
| 2846 | (and (>= c #x4e00 ) (<= c #x9fff )) ; CJK Ideograph | ||
| 2847 | (and (>= c #xd800 ) (<= c #xfaff )) ; Private/Surrogate | ||
| 2848 | (and (>= c #x20000) (<= c #x2ffff)) ; CJK Ideograph Extension B | ||
| 2849 | ) | ||
| 2850 | (if (setq name (get-char-code-property c 'name)) | ||
| 2851 | (setq names (cons (cons name c) names))) | ||
| 2852 | (if (setq name (get-char-code-property c 'old-name)) | ||
| 2853 | (setq names (cons (cons name c) names))))) | ||
| 2854 | names)))) | ||
| 2855 | |||
| 2856 | (defvar ucs-completions (lazy-completion-table ucs-completions ucs-names) | ||
| 2857 | "Lazy completion table for completing on Unicode character names.") | ||
| 2858 | |||
| 2859 | (defun read-char-by-name (prompt) | ||
| 2860 | "Read a character by its Unicode name or hex number string. | ||
| 2861 | Display PROMPT and read a string that represents a character | ||
| 2862 | by its Unicode property `name' or `old-name'. It also accepts | ||
| 2863 | a hexadecimal number of Unicode code point. Returns a character | ||
| 2864 | as a number." | ||
| 2865 | (let* ((completion-ignore-case t) | ||
| 2866 | (input (completing-read prompt ucs-completions))) | ||
| 2867 | (or (and (string-match "^[0-9a-fA-F]+$" input) | ||
| 2868 | (string-to-number input 16)) | ||
| 2869 | (cdr (assoc input (ucs-names)))))) | ||
| 2870 | |||
| 2835 | (defun ucs-insert (arg) | 2871 | (defun ucs-insert (arg) |
| 2836 | "Insert a character of the given Unicode code point. | 2872 | "Insert a character of the given Unicode code point. |
| 2837 | Interactively, prompts for a hex string giving the code." | 2873 | Interactively, prompts for a hex string giving the code." |
| 2838 | (interactive "sUnicode (hex): ") | 2874 | (interactive (list (read-char-by-name "Unicode (name or hex): "))) |
| 2839 | (or (integerp arg) | 2875 | (or (integerp arg) |
| 2840 | (setq arg (string-to-number arg 16))) | 2876 | (setq arg (string-to-number arg 16))) |
| 2841 | (if (or (< arg 0) (> arg #x10FFFF)) | 2877 | (if (or (< arg 0) (> arg #x10FFFF)) |