diff options
| author | René Kyllingstad | 2012-07-17 12:17:23 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-07-17 12:17:23 +0800 |
| commit | ddfc8813451b43f1cdb06fd07a47123b9f92bd70 (patch) | |
| tree | 88fc0e2b4bfbf9cd675f569e07e6b5fd6f6552fa | |
| parent | 7c26cf3ccd4ea49d42c2b3d21e59330143085f17 (diff) | |
| download | emacs-ddfc8813451b43f1cdb06fd07a47123b9f92bd70.tar.gz emacs-ddfc8813451b43f1cdb06fd07a47123b9f92bd70.zip | |
Make insert-char interactive, and ucs-insert an obsolete alias for it.
* lisp/international/mule-cmds.el (ucs-insert): Make it an obsolete
alias for insert-char.
* editfns.c (Finsert_char): Make it interactive, and make the second
arg optional. Copy interactive spec and docstring from ucs-insert.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/international/mule-cmds.el | 40 | ||||
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/editfns.c | 23 |
5 files changed, 37 insertions, 40 deletions
| @@ -140,6 +140,9 @@ invokes `set-buffer-file-coding-system'. | |||
| 140 | ** Setting `enable-remote-dir-locals' to non-nil allows directory | 140 | ** Setting `enable-remote-dir-locals' to non-nil allows directory |
| 141 | local variables on remote hosts. | 141 | local variables on remote hosts. |
| 142 | 142 | ||
| 143 | ** `insert-char' is now a command, and `ucs-insert' an obsolete alias | ||
| 144 | for it. | ||
| 145 | |||
| 143 | 146 | ||
| 144 | * Editing Changes in Emacs 24.2 | 147 | * Editing Changes in Emacs 24.2 |
| 145 | 148 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 55c8f3a7933..6606940740c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-07-16 René Kyllingstad <Rene@Kyllingstad.com> (tiny change) | ||
| 2 | |||
| 3 | * international/mule-cmds.el (ucs-insert): Make it an obsolete | ||
| 4 | alias for insert-char. | ||
| 5 | |||
| 1 | 2012-07-16 Fabián Ezequiel Gallina <fgallina@cuca> | 6 | 2012-07-16 Fabián Ezequiel Gallina <fgallina@cuca> |
| 2 | 7 | ||
| 3 | * progmodes/python.el: Simplified imenu implementation. | 8 | * progmodes/python.el: Simplified imenu implementation. |
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 137a43b3d11..a91c71b0304 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -2954,43 +2954,7 @@ point or a number in hash notation, e.g. #o21430 for octal, | |||
| 2954 | (t | 2954 | (t |
| 2955 | (cdr (assoc-string input (ucs-names) t)))))) | 2955 | (cdr (assoc-string input (ucs-names) t)))))) |
| 2956 | 2956 | ||
| 2957 | (defun ucs-insert (character &optional count inherit) | 2957 | (define-obsolete-variable-alias 'ucs-insert 'insert-char "24.2") |
| 2958 | "Insert COUNT copies of CHARACTER of the given Unicode code point. | 2958 | (define-key ctl-x-map "8\r" 'insert-char) |
| 2959 | Interactively, prompts for a Unicode character name or a hex number | ||
| 2960 | using `read-char-by-name'. | ||
| 2961 | |||
| 2962 | You can type a few of the first letters of the Unicode name and | ||
| 2963 | use completion. If you type a substring of the Unicode name | ||
| 2964 | preceded by an asterisk `*' and use completion, it will show all | ||
| 2965 | the characters whose names include that substring, not necessarily | ||
| 2966 | at the beginning of the name. | ||
| 2967 | |||
| 2968 | This function also accepts a hexadecimal number of Unicode code | ||
| 2969 | point or a number in hash notation, e.g. #o21430 for octal, | ||
| 2970 | #x2318 for hex, or #10r8984 for decimal. | ||
| 2971 | |||
| 2972 | The optional third arg INHERIT (non-nil when called interactively), | ||
| 2973 | says to inherit text properties from adjoining text, if those | ||
| 2974 | properties are sticky." | ||
| 2975 | (interactive | ||
| 2976 | (list (read-char-by-name "Unicode (name or hex): ") | ||
| 2977 | (prefix-numeric-value current-prefix-arg) | ||
| 2978 | t)) | ||
| 2979 | (unless count (setq count 1)) | ||
| 2980 | (if (and (stringp character) | ||
| 2981 | (string-match-p "\\`[0-9a-fA-F]+\\'" character)) | ||
| 2982 | (setq character (string-to-number character 16))) | ||
| 2983 | (cond | ||
| 2984 | ((null character) | ||
| 2985 | (error "Not a Unicode character")) | ||
| 2986 | ((not (integerp character)) | ||
| 2987 | (error "Not a Unicode character code: %S" character)) | ||
| 2988 | ((or (< character 0) (> character #x10FFFF)) | ||
| 2989 | (error "Not a Unicode character code: 0x%X" character))) | ||
| 2990 | (if inherit | ||
| 2991 | (dotimes (i count) (insert-and-inherit character)) | ||
| 2992 | (dotimes (i count) (insert character)))) | ||
| 2993 | |||
| 2994 | (define-key ctl-x-map "8\r" 'ucs-insert) | ||
| 2995 | 2959 | ||
| 2996 | ;;; mule-cmds.el ends here | 2960 | ;;; mule-cmds.el ends here |
diff --git a/src/ChangeLog b/src/ChangeLog index 9949c65ba71..4a77507e557 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-07-16 René Kyllingstad <Rene@Kyllingstad.com> (tiny change) | ||
| 2 | |||
| 3 | * editfns.c (Finsert_char): Make it interactive, and make the | ||
| 4 | second arg optional. Copy interactive spec and docstring from | ||
| 5 | ucs-insert. | ||
| 6 | |||
| 1 | 2012-07-17 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2012-07-17 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | * floatfns.c (Fabs): Do not wrap fabs inside IN_FLOAT (Bug#11913). | 9 | * floatfns.c (Fabs): Do not wrap fabs inside IN_FLOAT (Bug#11913). |
diff --git a/src/editfns.c b/src/editfns.c index 32d11faa216..5dc561a400e 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2368,11 +2368,28 @@ usage: (insert-before-markers-and-inherit &rest ARGS) */) | |||
| 2368 | return Qnil; | 2368 | return Qnil; |
| 2369 | } | 2369 | } |
| 2370 | 2370 | ||
| 2371 | DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0, | 2371 | DEFUN ("insert-char", Finsert_char, Sinsert_char, 1, 3, |
| 2372 | "(list (read-char-by-name \"Unicode (name or hex): \")\ | ||
| 2373 | (prefix-numeric-value current-prefix-arg)\ | ||
| 2374 | t))", | ||
| 2372 | doc: /* Insert COUNT copies of CHARACTER. | 2375 | doc: /* Insert COUNT copies of CHARACTER. |
| 2376 | Interactively, prompts for a Unicode character name or a hex number | ||
| 2377 | using `read-char-by-name'. | ||
| 2378 | |||
| 2379 | You can type a few of the first letters of the Unicode name and | ||
| 2380 | use completion. If you type a substring of the Unicode name | ||
| 2381 | preceded by an asterisk `*' and use completion, it will show all | ||
| 2382 | the characters whose names include that substring, not necessarily | ||
| 2383 | at the beginning of the name. | ||
| 2384 | |||
| 2385 | This function also accepts a hexadecimal number of Unicode code | ||
| 2386 | point or a number in hash notation, e.g. #o21430 for octal, | ||
| 2387 | #x2318 for hex, or #10r8984 for decimal. | ||
| 2388 | |||
| 2373 | Point, and before-insertion markers, are relocated as in the function `insert'. | 2389 | Point, and before-insertion markers, are relocated as in the function `insert'. |
| 2374 | The optional third arg INHERIT, if non-nil, says to inherit text properties | 2390 | The optional third arg INHERIT, if non-nil, says to inherit text properties |
| 2375 | from adjoining text, if those properties are sticky. */) | 2391 | from adjoining text, if those properties are sticky. If called |
| 2392 | interactively, INHERIT is t. */) | ||
| 2376 | (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) | 2393 | (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) |
| 2377 | { | 2394 | { |
| 2378 | int i, stringlen; | 2395 | int i, stringlen; |
| @@ -2382,6 +2399,8 @@ from adjoining text, if those properties are sticky. */) | |||
| 2382 | char string[4000]; | 2399 | char string[4000]; |
| 2383 | 2400 | ||
| 2384 | CHECK_CHARACTER (character); | 2401 | CHECK_CHARACTER (character); |
| 2402 | if (NILP (count)) | ||
| 2403 | XSETFASTINT (count, 1); | ||
| 2385 | CHECK_NUMBER (count); | 2404 | CHECK_NUMBER (count); |
| 2386 | c = XFASTINT (character); | 2405 | c = XFASTINT (character); |
| 2387 | 2406 | ||