diff options
| author | Jim Blandy | 1993-07-06 14:43:32 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-07-06 14:43:32 +0000 |
| commit | ac811a55ab2bd8c228ea0153141c2bb89eac5acf (patch) | |
| tree | 2f6cd8c8663d6553072cdefa9dd0a7c00e7e255f /src | |
| parent | 30503c0bab8f0a86a0cb4f1133df43110b77fea2 (diff) | |
| download | emacs-ac811a55ab2bd8c228ea0153141c2bb89eac5acf.tar.gz emacs-ac811a55ab2bd8c228ea0153141c2bb89eac5acf.zip | |
* 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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 19 |
1 files changed, 16 insertions, 3 deletions
| @@ -30,6 +30,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 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 | ||
| @@ -305,11 +306,19 @@ concat (nargs, args, target_type, last_special) | |||
| 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); |
| @@ -389,6 +398,8 @@ If FROM or TO is negative, it counts from the end.") | |||
| 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)) |
| @@ -404,8 +415,10 @@ If FROM or TO is negative, it counts from the end.") | |||
| 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, |