diff 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
line wrap: on
line diff
--- a/src/fns.c	Thu Sep 02 12:00:06 2010 +0100
+++ b/src/fns.c	Thu Sep 02 12:23:11 2010 +0100
@@ -3545,7 +3545,8 @@
 This is the last VALUE stored with `(put OBJECT PROPERTY VALUE)'.
 If there is no such property, return optional third arg DEFAULT
 \(which defaults to `nil').  OBJECT can be a symbol, string, extent,
-face, or glyph.  See also `put', `remprop', and `object-plist'.
+face, glyph, or process.  See also `put', `remprop', `object-plist', and
+`object-setplist'.
 */
        (object, property, default_))
 {
@@ -3589,9 +3590,10 @@
 
 DEFUN ("remprop", Fremprop, 2, 2, 0, /*
 Remove, from OBJECT's property list, PROPERTY and its corresponding value.
-OBJECT can be a symbol, string, extent, face, or glyph.  Return non-nil
-if the property list was actually modified (i.e. if PROPERTY was present
-in the property list).  See also `get', `put', and `object-plist'.
+OBJECT can be a symbol, string, extent, face, glyph, or process.
+Return non-nil if the property list was actually modified (i.e. if PROPERTY
+was present in the property list).  See also `get', `put', `object-plist',
+and `object-setplist'.
 */
        (object, property))
 {
@@ -3628,6 +3630,26 @@
   return Qnil;
 }
 
+DEFUN ("object-setplist", Fobject_setplist, 2, 2, 0, /*
+Set OBJECT's property list to NEWPLIST, and return NEWPLIST.
+For a symbol, this is equivalent to `setplist'.
+
+OBJECT can be a symbol or a process, other objects with visible plists do
+not allow their modification with `object-setplist'.
+*/
+       (object, newplist))
+{
+  if (LRECORDP (object) && XRECORD_LHEADER_IMPLEMENTATION (object)->setplist)
+    {
+      return XRECORD_LHEADER_IMPLEMENTATION (object)->setplist (object,
+								newplist);
+    }
+
+  invalid_operation ("Not possible to set object's plist", object);
+  return Qnil;
+}
+
+
 
 static Lisp_Object
 tweaked_internal_equal (Lisp_Object obj1, Lisp_Object obj2,
@@ -6015,6 +6037,7 @@
   DEFSUBR (Fput);
   DEFSUBR (Fremprop);
   DEFSUBR (Fobject_plist);
+  DEFSUBR (Fobject_setplist);
   DEFSUBR (Fequal);
   DEFSUBR (Fequalp);
   DEFSUBR (Fold_equal);