# HG changeset patch # User Richard M. Stallman # Date 748008529 0 # Node ID 350231e38e684aa73ce47d8e3aab953ceaa3cf99 # Parent b6697b2a56ca2693839dbed6415df88143540ec1 (Finsert_and_inherit): New function. (Finsert_and_inherit_before_markers): New function. (Finsert, Finsert_before_markers): Pass new arg to insert_from_string*. diff -r b6697b2a56ca -r 350231e38e68 src/editfns.c --- a/src/editfns.c Tue Sep 14 12:08:30 1993 +0000 +++ b/src/editfns.c Tue Sep 14 12:08:49 1993 +0000 @@ -719,7 +719,43 @@ } else if (XTYPE (tem) == Lisp_String) { - insert_from_string (tem, 0, XSTRING (tem)->size); + insert_from_string (tem, 0, XSTRING (tem)->size, 0); + } + else + { + tem = wrong_type_argument (Qchar_or_string_p, tem); + goto retry; + } + } + + return Qnil; +} + +DEFUN ("insert-and-inherit", Finsert_and_inherit, Sinsert_and_inherit, + 0, MANY, 0, + "Insert the arguments at point, inheriting properties from adjoining text.\n\ +Point moves forward so that it ends up after the inserted text.\n\ +Any other markers at the point of insertion remain before the text.") + (nargs, args) + int nargs; + register Lisp_Object *args; +{ + register int argnum; + register Lisp_Object tem; + char str[1]; + + for (argnum = 0; argnum < nargs; argnum++) + { + tem = args[argnum]; + retry: + if (XTYPE (tem) == Lisp_Int) + { + str[0] = XINT (tem); + insert (str, 1); + } + else if (XTYPE (tem) == Lisp_String) + { + insert_from_string (tem, 0, XSTRING (tem)->size, 1); } else { @@ -754,7 +790,44 @@ } else if (XTYPE (tem) == Lisp_String) { - insert_from_string_before_markers (tem, 0, XSTRING (tem)->size); + insert_from_string_before_markers (tem, 0, XSTRING (tem)->size, 0); + } + else + { + tem = wrong_type_argument (Qchar_or_string_p, tem); + goto retry; + } + } + + return Qnil; +} + +DEFUN ("insert-before-markers-and-inherit", + Finsert_and_inherit_before_markers, Sinsert_and_inherit_before_markers, + 0, MANY, 0, + "Insert text at point, relocating markers and inheriting properties.\n\ +Point moves forward so that it ends up after the inserted text.\n\ +Any other markers at the point of insertion also end up after the text.") + (nargs, args) + int nargs; + register Lisp_Object *args; +{ + register int argnum; + register Lisp_Object tem; + char str[1]; + + for (argnum = 0; argnum < nargs; argnum++) + { + tem = args[argnum]; + retry: + if (XTYPE (tem) == Lisp_Int) + { + str[0] = XINT (tem); + insert_before_markers (str, 1); + } + else if (XTYPE (tem) == Lisp_String) + { + insert_from_string_before_markers (tem, 0, XSTRING (tem)->size, 1); } else { @@ -918,7 +991,7 @@ /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ graft_intervals_into_buffer (copy_intervals (bp->intervals, start, len), - opoint, bp); + opoint, bp, 0); return Qnil; } @@ -1533,6 +1606,8 @@ defsubr (&Schar_after); defsubr (&Sinsert); defsubr (&Sinsert_before_markers); + defsubr (&Sinsert_and_inherit); + defsubr (&Sinsert_and_inherit_before_markers); defsubr (&Sinsert_char); defsubr (&Suser_login_name);