comparison src/editfns.c @ 4714:350231e38e68

(Finsert_and_inherit): New function. (Finsert_and_inherit_before_markers): New function. (Finsert, Finsert_before_markers): Pass new arg to insert_from_string*.
author Richard M. Stallman <rms@gnu.org>
date Tue, 14 Sep 1993 12:08:49 +0000
parents 1fc792473491
children 7a6aea972b7e
comparison
equal deleted inserted replaced
4713:b6697b2a56ca 4714:350231e38e68
717 str[0] = XINT (tem); 717 str[0] = XINT (tem);
718 insert (str, 1); 718 insert (str, 1);
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
734 DEFUN ("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\
737 Point moves forward so that it ends up after the inserted text.\n\
738 Any 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 {
726 tem = wrong_type_argument (Qchar_or_string_p, tem); 762 tem = wrong_type_argument (Qchar_or_string_p, tem);
727 goto retry; 763 goto retry;
752 str[0] = XINT (tem); 788 str[0] = XINT (tem);
753 insert_before_markers (str, 1); 789 insert_before_markers (str, 1);
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
805 DEFUN ("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\
809 Point moves forward so that it ends up after the inserted text.\n\
810 Any 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 {
761 tem = wrong_type_argument (Qchar_or_string_p, tem); 834 tem = wrong_type_argument (Qchar_or_string_p, tem);
762 goto retry; 835 goto retry;
916 if (beg < end) 989 if (beg < end)
917 insert (BUF_CHAR_ADDRESS (bp, beg), end - beg); 990 insert (BUF_CHAR_ADDRESS (bp, beg), end - beg);
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 }
925 998
926 DEFUN ("compare-buffer-substrings", Fcompare_buffer_substrings, Scompare_buffer_substrings, 999 DEFUN ("compare-buffer-substrings", Fcompare_buffer_substrings, Scompare_buffer_substrings,
1531 defsubr (&Sfollowing_char); 1604 defsubr (&Sfollowing_char);
1532 defsubr (&Sprevious_char); 1605 defsubr (&Sprevious_char);
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);
1539 defsubr (&Suser_real_login_name); 1614 defsubr (&Suser_real_login_name);
1540 defsubr (&Suser_uid); 1615 defsubr (&Suser_uid);