changeset 58236:ff6fd8552b2f

(Other Plists): Note that plist-get may signal error. Add safe-plist-get.
author Kim F. Storm <storm@cua.dk>
date Mon, 15 Nov 2004 15:19:48 +0000
parents a47bcc18aed8
children f02cbb3be7fa
files lispref/symbols.texi
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lispref/symbols.texi	Mon Nov 15 15:12:29 2004 +0000
+++ b/lispref/symbols.texi	Mon Nov 15 15:19:48 2004 +0000
@@ -528,11 +528,29 @@
 
 @defun plist-get plist property
 This returns the value of the @var{property} property
-stored in the property list @var{plist}.  For example,
+stored in the property list @var{plist}.
+A @code{wrong-type-argument} error may be signaled if @var{plist} is
+not a valid property list.  For example,
 
 @example
 (plist-get '(foo 4) 'foo)
      @result{} 4
+(plist-get '(foo 4 bad) 'foo)
+     @result{} 4
+(plist-get '(foo 4 bad) 'bar)
+     @result{} @code{wrong-type-argument} error
+@end example
+@end defun
+
+@defun safe-plist-get plist property
+This returns the value of the @var{property} property
+stored in the property list @var{plist}.  Unlike @code{plist-get}, it
+accepts a malformed @var{plist} argument and always returns @code{nil}
+if @var{property} is not found in the @var{plist}.  For example,
+
+@example
+(safe-plist-get '(foo 4 bad) 'bar)
+     @result{} nil
 @end example
 @end defun