diff src/editfns.c @ 89034:63f566c131d7

(Finsert_byte): New function. (syms_of_editfns): Defsubr it.
author Kenichi Handa <handa@m17n.org>
date Tue, 20 Aug 2002 13:05:44 +0000
parents 1c45126c0974
children 3903a3ae19cb
line wrap: on
line diff
--- a/src/editfns.c	Tue Aug 20 11:25:27 2002 +0000
+++ b/src/editfns.c	Tue Aug 20 13:05:44 2002 +0000
@@ -2158,6 +2158,29 @@
   return Qnil;
 }
 
+DEFUN ("insert-byte", Finsert_byte, Sinsert_byte, 2, 3, 0,
+       doc: /* Insert COUNT (second arg) copies of BYTE (first arg).
+Both arguments are required.
+BYTE is a number of the range 0..255.
+
+If BYTE is 128..255 and the current buffer is multibyte, the
+corresponding eight-bit character is inserted.
+
+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.  */)
+     (byte, count, inherit)
+       Lisp_Object byte, count, inherit;
+{
+  CHECK_NUMBER (byte);
+  if (XINT (byte) < 0 || XINT (byte) > 255)
+    args_out_of_range_3 (byte, make_number (0), make_number (255));
+  if (XINT (byte) >= 128
+      && ! NILP (current_buffer->enable_multibyte_characters))
+    XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte)));
+  Finsert_char (byte, count, inherit);
+}
+
 
 /* Making strings from buffer contents.  */
 
@@ -4103,6 +4126,7 @@
   defsubr (&Sinsert_and_inherit);
   defsubr (&Sinsert_and_inherit_before_markers);
   defsubr (&Sinsert_char);
+  defsubr (&Sinsert_byte);
 
   defsubr (&Suser_login_name);
   defsubr (&Suser_real_login_name);