aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann1999-09-25 19:57:50 +0000
committerGerd Moellmann1999-09-25 19:57:50 +0000
commit2d9811c4103f12fefd2e86c9ddf50b0f9b857bdb (patch)
tree7b926068358838c74a3be92ea4fb40da977524e1 /src
parent6904df7a9cd09b849d52b94014e98e5242fdbe4f (diff)
downloademacs-2d9811c4103f12fefd2e86c9ddf50b0f9b857bdb.tar.gz
emacs-2d9811c4103f12fefd2e86c9ddf50b0f9b857bdb.zip
(Fproperties): New.
(syms_of_editfns): Defsubr it.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 7068b358c9e..7edf4ef89c1 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2465,6 +2465,44 @@ DEFUN ("current-message", Fcurrent_message, Scurrent_message, 0, 0, 0,
2465 return current_message (); 2465 return current_message ();
2466} 2466}
2467 2467
2468
2469DEFUN ("properties", Fproperties, Sproperties, 3, MANY, 0,
2470 "Return a copy of STRING with text properties added.\n\
2471First argument is the string to copy.\n\
2472Remaining arguments are sequences of PROPERTY VALUE pairs for text\n\
2473properties to add to the result ")
2474 (nargs, args)
2475 int nargs;
2476 Lisp_Object *args;
2477{
2478 Lisp_Object properties, string;
2479 struct gcpro gcpro1, gcpro2;
2480 int i;
2481
2482 /* Number of args must be odd. */
2483 if ((nargs & 1) == 0 || nargs < 3)
2484 error ("Wrong number of arguments");
2485
2486 properties = string = Qnil;
2487 GCPRO2 (properties, string);
2488
2489 /* First argument must be a string. */
2490 CHECK_STRING (args[0], 0);
2491 string = Fcopy_sequence (args[0]);
2492
2493 for (i = 1; i < nargs; i += 2)
2494 {
2495 CHECK_SYMBOL (args[i], i);
2496 properties = Fcons (args[i], Fcons (args[i + 1], properties));
2497 }
2498
2499 Fadd_text_properties (make_number (0),
2500 make_number (XSTRING (string)->size),
2501 properties, string);
2502 RETURN_UNGCPRO (string);
2503}
2504
2505
2468/* Number of bytes that STRING will occupy when put into the result. 2506/* Number of bytes that STRING will occupy when put into the result.
2469 MULTIBYTE is nonzero if the result should be multibyte. */ 2507 MULTIBYTE is nonzero if the result should be multibyte. */
2470 2508
@@ -2848,6 +2886,7 @@ Use %% to put a single % into the output.")
2848 return val; 2886 return val;
2849} 2887}
2850 2888
2889
2851/* VARARGS 1 */ 2890/* VARARGS 1 */
2852Lisp_Object 2891Lisp_Object
2853#ifdef NO_ARG_ARRAY 2892#ifdef NO_ARG_ARRAY
@@ -3365,6 +3404,7 @@ functions if all the text being accessed has this property.");
3365 DEFVAR_LISP ("user-real-login-name", &Vuser_real_login_name, 3404 DEFVAR_LISP ("user-real-login-name", &Vuser_real_login_name,
3366 "The user's name, based upon the real uid only."); 3405 "The user's name, based upon the real uid only.");
3367 3406
3407 defsubr (&Sproperties);
3368 defsubr (&Schar_equal); 3408 defsubr (&Schar_equal);
3369 defsubr (&Sgoto_char); 3409 defsubr (&Sgoto_char);
3370 defsubr (&Sstring_to_char); 3410 defsubr (&Sstring_to_char);