From 48ef988f74da0a93c07ebf70174dfa8e1d25ce94 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 20 Aug 2002 13:05:44 +0000 Subject: [PATCH] (Finsert_byte): New function. (syms_of_editfns): Defsubr it. --- src/editfns.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/editfns.c b/src/editfns.c index f758484ed0..ed0821b9e2 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2158,6 +2158,29 @@ from adjoining text, if those properties are sticky. */) 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 @@ functions if all the text being accessed has this property. */); 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); -- 2.20.1