From 442f927b424c12a78ff6f7bb876c445a2a9c24e0 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Mon, 15 Nov 2004 15:19:48 +0000 Subject: [PATCH] (Other Plists): Note that plist-get may signal error. Add safe-plist-get. --- lispref/symbols.texi | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lispref/symbols.texi b/lispref/symbols.texi index d6743898d6f..858918445ff 100644 --- a/lispref/symbols.texi +++ b/lispref/symbols.texi @@ -528,11 +528,29 @@ that are stored in places other than symbols: @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 -- 2.39.2