comparison src/editfns.c @ 8646:0f05e3e89f87

(Finsert_char): New arg INHERIT. Use insert_and_inherit if requested.
author Richard M. Stallman <rms@gnu.org>
date Sun, 28 Aug 1994 06:07:15 +0000
parents e23908a4fa09
children abd7ff9a94da
comparison
equal deleted inserted replaced
8645:8217ec286828 8646:0f05e3e89f87
854 } 854 }
855 855
856 return Qnil; 856 return Qnil;
857 } 857 }
858 858
859 DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 2, 0, 859 DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0,
860 "Insert COUNT (second arg) copies of CHAR (first arg).\n\ 860 "Insert COUNT (second arg) copies of CHAR (first arg).\n\
861 Point and all markers are affected as in the function `insert'.\n\ 861 Point and all markers are affected as in the function `insert'.\n\
862 Both arguments are required.") 862 Both arguments are required.\n\
863 (chr, count) 863 The optional third arg INHERIT, if non-nil, says to inherit text properties\n\
864 Lisp_Object chr, count; 864 from adjoining text, if those properties are sticky.")
865 (chr, count, inherit)
866 Lisp_Object chr, count, inherit;
865 { 867 {
866 register unsigned char *string; 868 register unsigned char *string;
867 register int strlen; 869 register int strlen;
868 register int i, n; 870 register int i, n;
869 871
877 string = (unsigned char *) alloca (strlen); 879 string = (unsigned char *) alloca (strlen);
878 for (i = 0; i < strlen; i++) 880 for (i = 0; i < strlen; i++)
879 string[i] = XFASTINT (chr); 881 string[i] = XFASTINT (chr);
880 while (n >= strlen) 882 while (n >= strlen)
881 { 883 {
882 insert (string, strlen); 884 if (!NILP (inherit))
885 insert_and_inherit (string, strlen);
886 else
887 insert (string, strlen);
883 n -= strlen; 888 n -= strlen;
884 } 889 }
885 if (n > 0) 890 if (n > 0)
886 insert (string, n); 891 insert (string, n);
887 return Qnil; 892 return Qnil;