Mercurial > emacs
comparison src/fns.c @ 4004:71541ea16adf
* fns.c (Fsubstring, concat): Pass all six arguments to
copy_text_properties.
* textprop.c (copy_text_properties): New function, from David
Gillespie.
* intervals.h: Declare copy_text_properties.
* fns.c: #include "intervals.h".
(Fsubstring): Copy text properties to result string.
(concat): Copy text properties to result string.
* ymakefile (fns.o): Note that this depends on INTERVAL_SRC.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Tue, 06 Jul 1993 14:43:32 +0000 |
parents | 68f28e378f50 |
children | cbfcf187b5da |
comparison
equal
deleted
inserted
replaced
4003:49918d6c6dda | 4004:71541ea16adf |
---|---|
28 #include "lisp.h" | 28 #include "lisp.h" |
29 #include "commands.h" | 29 #include "commands.h" |
30 | 30 |
31 #include "buffer.h" | 31 #include "buffer.h" |
32 #include "keyboard.h" | 32 #include "keyboard.h" |
33 #include "intervals.h" | |
33 | 34 |
34 Lisp_Object Qstring_lessp, Qprovide, Qrequire; | 35 Lisp_Object Qstring_lessp, Qprovide, Qrequire; |
35 | 36 |
36 static Lisp_Object internal_equal (); | 37 static Lisp_Object internal_equal (); |
37 | 38 |
303 | 304 |
304 this = args[argnum]; | 305 this = args[argnum]; |
305 if (!CONSP (this)) | 306 if (!CONSP (this)) |
306 thislen = Flength (this), thisleni = XINT (thislen); | 307 thislen = Flength (this), thisleni = XINT (thislen); |
307 | 308 |
309 if (XTYPE (this) == Lisp_String && XTYPE (val) == Lisp_String | |
310 && ! NULL_INTERVAL_P (XSTRING (this)->intervals)) | |
311 { | |
312 copy_text_properties (make_number (0), thislen, this, | |
313 make_number (toindex), val, Qnil); | |
314 } | |
315 | |
308 while (1) | 316 while (1) |
309 { | 317 { |
310 register Lisp_Object elt; | 318 register Lisp_Object elt; |
311 | 319 |
312 /* Fetch next element of `this' arg into `elt', or break if `this' is exhausted. */ | 320 /* Fetch next element of `this' arg into `elt', or break if |
321 `this' is exhausted. */ | |
313 if (NILP (this)) break; | 322 if (NILP (this)) break; |
314 if (CONSP (this)) | 323 if (CONSP (this)) |
315 elt = Fcar (this), this = Fcdr (this); | 324 elt = Fcar (this), this = Fcdr (this); |
316 else | 325 else |
317 { | 326 { |
387 If FROM or TO is negative, it counts from the end.") | 396 If FROM or TO is negative, it counts from the end.") |
388 (string, from, to) | 397 (string, from, to) |
389 Lisp_Object string; | 398 Lisp_Object string; |
390 register Lisp_Object from, to; | 399 register Lisp_Object from, to; |
391 { | 400 { |
401 Lisp_Object res; | |
402 | |
392 CHECK_STRING (string, 0); | 403 CHECK_STRING (string, 0); |
393 CHECK_NUMBER (from, 1); | 404 CHECK_NUMBER (from, 1); |
394 if (NILP (to)) | 405 if (NILP (to)) |
395 to = Flength (string); | 406 to = Flength (string); |
396 else | 407 else |
402 XSETINT (to, XINT (to) + XSTRING (string)->size); | 413 XSETINT (to, XINT (to) + XSTRING (string)->size); |
403 if (!(0 <= XINT (from) && XINT (from) <= XINT (to) | 414 if (!(0 <= XINT (from) && XINT (from) <= XINT (to) |
404 && XINT (to) <= XSTRING (string)->size)) | 415 && XINT (to) <= XSTRING (string)->size)) |
405 args_out_of_range_3 (string, from, to); | 416 args_out_of_range_3 (string, from, to); |
406 | 417 |
407 return make_string (XSTRING (string)->data + XINT (from), | 418 res = make_string (XSTRING (string)->data + XINT (from), |
408 XINT (to) - XINT (from)); | 419 XINT (to) - XINT (from)); |
420 copy_text_properties (from, to, string, make_number (0), res, Qnil); | |
421 return res; | |
409 } | 422 } |
410 | 423 |
411 DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0, | 424 DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0, |
412 "Take cdr N times on LIST, returns the result.") | 425 "Take cdr N times on LIST, returns the result.") |
413 (n, list) | 426 (n, list) |