aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c81
1 files changed, 78 insertions, 3 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 0a868abe761..ae6fb4f685b 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -719,7 +719,43 @@ Any other markers at the point of insertion remain before the text.")
719 } 719 }
720 else if (XTYPE (tem) == Lisp_String) 720 else if (XTYPE (tem) == Lisp_String)
721 { 721 {
722 insert_from_string (tem, 0, XSTRING (tem)->size); 722 insert_from_string (tem, 0, XSTRING (tem)->size, 0);
723 }
724 else
725 {
726 tem = wrong_type_argument (Qchar_or_string_p, tem);
727 goto retry;
728 }
729 }
730
731 return Qnil;
732}
733
734DEFUN ("insert-and-inherit", Finsert_and_inherit, Sinsert_and_inherit,
735 0, MANY, 0,
736 "Insert the arguments at point, inheriting properties from adjoining text.\n\
737Point moves forward so that it ends up after the inserted text.\n\
738Any other markers at the point of insertion remain before the text.")
739 (nargs, args)
740 int nargs;
741 register Lisp_Object *args;
742{
743 register int argnum;
744 register Lisp_Object tem;
745 char str[1];
746
747 for (argnum = 0; argnum < nargs; argnum++)
748 {
749 tem = args[argnum];
750 retry:
751 if (XTYPE (tem) == Lisp_Int)
752 {
753 str[0] = XINT (tem);
754 insert (str, 1);
755 }
756 else if (XTYPE (tem) == Lisp_String)
757 {
758 insert_from_string (tem, 0, XSTRING (tem)->size, 1);
723 } 759 }
724 else 760 else
725 { 761 {
@@ -754,7 +790,44 @@ Any other markers at the point of insertion also end up after the text.")
754 } 790 }
755 else if (XTYPE (tem) == Lisp_String) 791 else if (XTYPE (tem) == Lisp_String)
756 { 792 {
757 insert_from_string_before_markers (tem, 0, XSTRING (tem)->size); 793 insert_from_string_before_markers (tem, 0, XSTRING (tem)->size, 0);
794 }
795 else
796 {
797 tem = wrong_type_argument (Qchar_or_string_p, tem);
798 goto retry;
799 }
800 }
801
802 return Qnil;
803}
804
805DEFUN ("insert-before-markers-and-inherit",
806 Finsert_and_inherit_before_markers, Sinsert_and_inherit_before_markers,
807 0, MANY, 0,
808 "Insert text at point, relocating markers and inheriting properties.\n\
809Point moves forward so that it ends up after the inserted text.\n\
810Any other markers at the point of insertion also end up after the text.")
811 (nargs, args)
812 int nargs;
813 register Lisp_Object *args;
814{
815 register int argnum;
816 register Lisp_Object tem;
817 char str[1];
818
819 for (argnum = 0; argnum < nargs; argnum++)
820 {
821 tem = args[argnum];
822 retry:
823 if (XTYPE (tem) == Lisp_Int)
824 {
825 str[0] = XINT (tem);
826 insert_before_markers (str, 1);
827 }
828 else if (XTYPE (tem) == Lisp_String)
829 {
830 insert_from_string_before_markers (tem, 0, XSTRING (tem)->size, 1);
758 } 831 }
759 else 832 else
760 { 833 {
@@ -918,7 +991,7 @@ They default to the beginning and the end of BUFFER.")
918 991
919 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ 992 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */
920 graft_intervals_into_buffer (copy_intervals (bp->intervals, start, len), 993 graft_intervals_into_buffer (copy_intervals (bp->intervals, start, len),
921 opoint, bp); 994 opoint, bp, 0);
922 995
923 return Qnil; 996 return Qnil;
924} 997}
@@ -1533,6 +1606,8 @@ syms_of_editfns ()
1533 defsubr (&Schar_after); 1606 defsubr (&Schar_after);
1534 defsubr (&Sinsert); 1607 defsubr (&Sinsert);
1535 defsubr (&Sinsert_before_markers); 1608 defsubr (&Sinsert_before_markers);
1609 defsubr (&Sinsert_and_inherit);
1610 defsubr (&Sinsert_and_inherit_before_markers);
1536 defsubr (&Sinsert_char); 1611 defsubr (&Sinsert_char);
1537 1612
1538 defsubr (&Suser_login_name); 1613 defsubr (&Suser_login_name);