]> code.delx.au - gnu-emacs/commitdiff
Make insert-char interactive, and ucs-insert an obsolete alias for it.
authorRené Kyllingstad <Rene@Kyllingstad.com>
Tue, 17 Jul 2012 04:17:23 +0000 (12:17 +0800)
committerChong Yidong <cyd@gnu.org>
Tue, 17 Jul 2012 04:17:23 +0000 (12:17 +0800)
* 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.

etc/NEWS
lisp/ChangeLog
lisp/international/mule-cmds.el
src/ChangeLog
src/editfns.c

index 88887ebf9da754090b2ee18e77a15eb948cb233c..9eac4af64a34e4df77d4b1deffdc1545ad387975 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -140,6 +140,9 @@ invokes `set-buffer-file-coding-system'.
 ** Setting `enable-remote-dir-locals' to non-nil allows directory
 local variables on remote hosts.
 
+** `insert-char' is now a command, and `ucs-insert' an obsolete alias
+for it.
+
 \f
 * Editing Changes in Emacs 24.2
 
index 55c8f3a793381776fdefd27483371aea344e0ddd..6606940740cd58eefcb6afa79d75528d0559a040 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-16  René Kyllingstad  <Rene@Kyllingstad.com>  (tiny change)
+
+       * international/mule-cmds.el (ucs-insert): Make it an obsolete
+       alias for insert-char.
+
 2012-07-16  Fabián Ezequiel Gallina  <fgallina@cuca>
 
        * progmodes/python.el: Simplified imenu implementation.
index 137a43b3d11a2b79481529d9869da444ca684271..a91c71b0304329b8c03344423f165ad5424ab2b1 100644 (file)
@@ -2954,43 +2954,7 @@ point or a number in hash notation, e.g. #o21430 for octal,
      (t
       (cdr (assoc-string input (ucs-names) t))))))
 
-(defun ucs-insert (character &optional count inherit)
-  "Insert COUNT copies of CHARACTER of the given Unicode code point.
-Interactively, prompts for a Unicode character name or a hex number
-using `read-char-by-name'.
-
-You can type a few of the first letters of the Unicode name and
-use completion.  If you type a substring of the Unicode name
-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."
-  (interactive
-   (list (read-char-by-name "Unicode (name or hex): ")
-        (prefix-numeric-value current-prefix-arg)
-        t))
-  (unless count (setq count 1))
-  (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))
-    (error "Not a Unicode character code: 0x%X" character)))
-  (if inherit
-      (dotimes (i count) (insert-and-inherit character))
-    (dotimes (i count) (insert character))))
-
-(define-key ctl-x-map "8\r" 'ucs-insert)
+(define-obsolete-variable-alias 'ucs-insert 'insert-char "24.2")
+(define-key ctl-x-map "8\r" 'insert-char)
 
 ;;; mule-cmds.el ends here
index 9949c65ba713c5e8da3368262dd039c125c06714..4a77507e557f29d36eb226bdce493d50e2d1b8a8 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-16  René Kyllingstad  <Rene@Kyllingstad.com>  (tiny change)
+
+       * editfns.c (Finsert_char): Make it interactive, and make the
+       second arg optional.  Copy interactive spec and docstring from
+       ucs-insert.
+
 2012-07-17  Paul Eggert  <eggert@cs.ucla.edu>
 
        * floatfns.c (Fabs): Do not wrap fabs inside IN_FLOAT (Bug#11913).
index 32d11faa21690d51fe6e97df067bd05b392135e8..5dc561a400ecf3536ff2f4426681042b2bdaed65 100644 (file)
@@ -2368,11 +2368,28 @@ usage: (insert-before-markers-and-inherit &rest ARGS)  */)
   return Qnil;
 }
 \f
-DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0,
+DEFUN ("insert-char", Finsert_char, Sinsert_char, 1, 3,
+       "(list (read-char-by-name \"Unicode (name or hex): \")\
+        (prefix-numeric-value current-prefix-arg)\
+        t))",
        doc: /* Insert COUNT copies of CHARACTER.
+Interactively, prompts for a Unicode character name or a hex number
+using `read-char-by-name'.
+
+You can type a few of the first letters of the Unicode name and
+use completion.  If you type a substring of the Unicode name
+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.
+
 Point, and before-insertion markers, are relocated as in the function `insert'.
 The optional third arg INHERIT, if non-nil, says to inherit text properties
-from adjoining text, if those properties are sticky.  */)
+from adjoining text, if those properties are sticky.  If called
+interactively, INHERIT is t.  */)
   (Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
 {
   int i, stringlen;
@@ -2382,6 +2399,8 @@ from adjoining text, if those properties are sticky.  */)
   char string[4000];
 
   CHECK_CHARACTER (character);
+  if (NILP (count))
+    XSETFASTINT (count, 1);
   CHECK_NUMBER (count);
   c = XFASTINT (character);