diff options
author | Kim F. Storm <[email protected]> | 2004-11-15 15:19:48 +0000 |
---|---|---|
committer | Kim F. Storm <[email protected]> | 2004-11-15 15:19:48 +0000 |
commit | 442f927b424c12a78ff6f7bb876c445a2a9c24e0 (patch) | |
tree | a0b3b629e76c286dbff454fda77ed2c72e4eded8 /lispref | |
parent | 6d073ae1e354b64e9dc32c20ef96094a76beae02 (diff) |
(Other Plists): Note that plist-get may signal error.
Add safe-plist-get.
Diffstat (limited to 'lispref')
-rw-r--r-- | lispref/symbols.texi | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lispref/symbols.texi b/lispref/symbols.texi index d6743898d6..858918445f 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 |