1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-28 10:56:36 +00:00

(Other Plists): Note that plist-get may signal error.

Add safe-plist-get.
This commit is contained in:
Kim F. Storm 2004-11-15 15:19:48 +00:00
parent 6d073ae1e3
commit 442f927b42

View File

@ -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