diff options
| author | Kim F. Storm | 2004-11-15 15:19:48 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-11-15 15:19:48 +0000 |
| commit | 442f927b424c12a78ff6f7bb876c445a2a9c24e0 (patch) | |
| tree | a0b3b629e76c286dbff454fda77ed2c72e4eded8 | |
| parent | 6d073ae1e354b64e9dc32c20ef96094a76beae02 (diff) | |
| download | emacs-442f927b424c12a78ff6f7bb876c445a2a9c24e0.tar.gz emacs-442f927b424c12a78ff6f7bb876c445a2a9c24e0.zip | |
(Other Plists): Note that plist-get may signal error.
Add safe-plist-get.
| -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 d6743898d6f..858918445ff 100644 --- a/lispref/symbols.texi +++ b/lispref/symbols.texi | |||
| @@ -528,11 +528,29 @@ that are stored in places other than symbols: | |||
| 528 | 528 | ||
| 529 | @defun plist-get plist property | 529 | @defun plist-get plist property |
| 530 | This returns the value of the @var{property} property | 530 | This returns the value of the @var{property} property |
| 531 | stored in the property list @var{plist}. For example, | 531 | stored in the property list @var{plist}. |
| 532 | A @code{wrong-type-argument} error may be signaled if @var{plist} is | ||
| 533 | not a valid property list. For example, | ||
| 532 | 534 | ||
| 533 | @example | 535 | @example |
| 534 | (plist-get '(foo 4) 'foo) | 536 | (plist-get '(foo 4) 'foo) |
| 535 | @result{} 4 | 537 | @result{} 4 |
| 538 | (plist-get '(foo 4 bad) 'foo) | ||
| 539 | @result{} 4 | ||
| 540 | (plist-get '(foo 4 bad) 'bar) | ||
| 541 | @result{} @code{wrong-type-argument} error | ||
| 542 | @end example | ||
| 543 | @end defun | ||
| 544 | |||
| 545 | @defun safe-plist-get plist property | ||
| 546 | This returns the value of the @var{property} property | ||
| 547 | stored in the property list @var{plist}. Unlike @code{plist-get}, it | ||
| 548 | accepts a malformed @var{plist} argument and always returns @code{nil} | ||
| 549 | if @var{property} is not found in the @var{plist}. For example, | ||
| 550 | |||
| 551 | @example | ||
| 552 | (safe-plist-get '(foo 4 bad) 'bar) | ||
| 553 | @result{} nil | ||
| 536 | @end example | 554 | @end example |
| 537 | @end defun | 555 | @end defun |
| 538 | 556 | ||