comparison src/fns.c @ 5255:b5611afbcc76

Support process plists, for greater GNU compatibility. src/ChangeLog addition: 2010-09-02 Aidan Kehoe <kehoea@parhasard.net> * process.c (process_getprop, process_putprop, process_remprop) (process_plist, process_setplist, reinit_process_early): Add functions to modify a process's property list. * process-slots.h (MARKED_SLOT): Add a plist slot. * fns.c (Fobject_setplist): New function, analogous to #'setplist, but more general. Update the documentation in the other plist functions to reflect that processes now have property lists. * emacs.c (main_1): Call reinit_process_early(), now processes have plist methods that need to be initialised. * symbols.c (reinit_symbol_objects_early): Fsetplist is the named setplist method for symbols. lisp/ChangeLog addition: 2010-09-02 Aidan Kehoe <kehoea@parhasard.net> * obsolete.el (process-get): Make #'process-get, #'process-put, #'process-plist, #'set-process-plist available as aliases to the more general functions #'get, #'put, #'object-plist, #'object-setplist, for GNU compatibility.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 02 Sep 2010 12:23:11 +0100
parents b6a398dbb403
children 69f687b3ba9d
comparison
equal deleted inserted replaced
5254:1537701f08a1 5255:b5611afbcc76
3543 DEFUN ("get", Fget, 2, 3, 0, /* 3543 DEFUN ("get", Fget, 2, 3, 0, /*
3544 Return the value of OBJECT's PROPERTY property. 3544 Return the value of OBJECT's PROPERTY property.
3545 This is the last VALUE stored with `(put OBJECT PROPERTY VALUE)'. 3545 This is the last VALUE stored with `(put OBJECT PROPERTY VALUE)'.
3546 If there is no such property, return optional third arg DEFAULT 3546 If there is no such property, return optional third arg DEFAULT
3547 \(which defaults to `nil'). OBJECT can be a symbol, string, extent, 3547 \(which defaults to `nil'). OBJECT can be a symbol, string, extent,
3548 face, or glyph. See also `put', `remprop', and `object-plist'. 3548 face, glyph, or process. See also `put', `remprop', `object-plist', and
3549 `object-setplist'.
3549 */ 3550 */
3550 (object, property, default_)) 3551 (object, property, default_))
3551 { 3552 {
3552 /* Various places in emacs call Fget() and expect it not to quit, 3553 /* Various places in emacs call Fget() and expect it not to quit,
3553 so don't quit. */ 3554 so don't quit. */
3587 return value; 3588 return value;
3588 } 3589 }
3589 3590
3590 DEFUN ("remprop", Fremprop, 2, 2, 0, /* 3591 DEFUN ("remprop", Fremprop, 2, 2, 0, /*
3591 Remove, from OBJECT's property list, PROPERTY and its corresponding value. 3592 Remove, from OBJECT's property list, PROPERTY and its corresponding value.
3592 OBJECT can be a symbol, string, extent, face, or glyph. Return non-nil 3593 OBJECT can be a symbol, string, extent, face, glyph, or process.
3593 if the property list was actually modified (i.e. if PROPERTY was present 3594 Return non-nil if the property list was actually modified (i.e. if PROPERTY
3594 in the property list). See also `get', `put', and `object-plist'. 3595 was present in the property list). See also `get', `put', `object-plist',
3596 and `object-setplist'.
3595 */ 3597 */
3596 (object, property)) 3598 (object, property))
3597 { 3599 {
3598 int ret = 0; 3600 int ret = 0;
3599 3601
3625 else 3627 else
3626 invalid_operation ("Object type has no properties", object); 3628 invalid_operation ("Object type has no properties", object);
3627 3629
3628 return Qnil; 3630 return Qnil;
3629 } 3631 }
3632
3633 DEFUN ("object-setplist", Fobject_setplist, 2, 2, 0, /*
3634 Set OBJECT's property list to NEWPLIST, and return NEWPLIST.
3635 For a symbol, this is equivalent to `setplist'.
3636
3637 OBJECT can be a symbol or a process, other objects with visible plists do
3638 not allow their modification with `object-setplist'.
3639 */
3640 (object, newplist))
3641 {
3642 if (LRECORDP (object) && XRECORD_LHEADER_IMPLEMENTATION (object)->setplist)
3643 {
3644 return XRECORD_LHEADER_IMPLEMENTATION (object)->setplist (object,
3645 newplist);
3646 }
3647
3648 invalid_operation ("Not possible to set object's plist", object);
3649 return Qnil;
3650 }
3651
3630 3652
3631 3653
3632 static Lisp_Object 3654 static Lisp_Object
3633 tweaked_internal_equal (Lisp_Object obj1, Lisp_Object obj2, 3655 tweaked_internal_equal (Lisp_Object obj1, Lisp_Object obj2,
3634 Lisp_Object depth) 3656 Lisp_Object depth)
6013 DEFSUBR (Fdestructive_alist_to_plist); 6035 DEFSUBR (Fdestructive_alist_to_plist);
6014 DEFSUBR (Fget); 6036 DEFSUBR (Fget);
6015 DEFSUBR (Fput); 6037 DEFSUBR (Fput);
6016 DEFSUBR (Fremprop); 6038 DEFSUBR (Fremprop);
6017 DEFSUBR (Fobject_plist); 6039 DEFSUBR (Fobject_plist);
6040 DEFSUBR (Fobject_setplist);
6018 DEFSUBR (Fequal); 6041 DEFSUBR (Fequal);
6019 DEFSUBR (Fequalp); 6042 DEFSUBR (Fequalp);
6020 DEFSUBR (Fold_equal); 6043 DEFSUBR (Fold_equal);
6021 DEFSUBR (Ffill); 6044 DEFSUBR (Ffill);
6022 Ffset (intern ("fillarray"), Qfill); 6045 Ffset (intern ("fillarray"), Qfill);