blob: 72b885d87d67330640bab41bd597607aa8915703 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<h4 class="subsection">Property Lists Outside Symbols</h4> <p>The following functions can be used to manipulate property lists. They all compare property names using <code>eq</code>. </p> <dl> <dt id="plist-get">Function: <strong>plist-get</strong> <em>plist property</em>
</dt> <dd>
<p>This returns the value of the <var>property</var> property stored in the property list <var>plist</var>. It accepts a malformed <var>plist</var> argument. If <var>property</var> is not found in the <var>plist</var>, it returns <code>nil</code>. For example, </p> <div class="example"> <pre class="example">(plist-get '(foo 4) 'foo)
⇒ 4
(plist-get '(foo 4 bad) 'foo)
⇒ 4
(plist-get '(foo 4 bad) 'bad)
⇒ nil
(plist-get '(foo 4 bad) 'bar)
⇒ nil
</pre>
</div> </dd>
</dl> <dl> <dt id="plist-put">Function: <strong>plist-put</strong> <em>plist property value</em>
</dt> <dd>
<p>This stores <var>value</var> as the value of the <var>property</var> property in the property list <var>plist</var>. It may modify <var>plist</var> destructively, or it may construct a new list structure without altering the old. The function returns the modified property list, so you can store that back in the place where you got <var>plist</var>. For example, </p> <div class="example"> <pre class="example">(setq my-plist (list 'bar t 'foo 4))
⇒ (bar t foo 4)
(setq my-plist (plist-put my-plist 'foo 69))
⇒ (bar t foo 69)
(setq my-plist (plist-put my-plist 'quux '(a)))
⇒ (bar t foo 69 quux (a))
</pre>
</div> </dd>
</dl> <dl> <dt id="lax-plist-get">Function: <strong>lax-plist-get</strong> <em>plist property</em>
</dt> <dd><p>Like <code>plist-get</code> except that it compares properties using <code>equal</code> instead of <code>eq</code>. </p></dd>
</dl> <dl> <dt id="lax-plist-put">Function: <strong>lax-plist-put</strong> <em>plist property value</em>
</dt> <dd><p>Like <code>plist-put</code> except that it compares properties using <code>equal</code> instead of <code>eq</code>. </p></dd>
</dl> <dl> <dt id="plist-member">Function: <strong>plist-member</strong> <em>plist property</em>
</dt> <dd><p>This returns non-<code>nil</code> if <var>plist</var> contains the given <var>property</var>. Unlike <code>plist-get</code>, this allows you to distinguish between a missing property and a property with the value <code>nil</code>. The value is actually the tail of <var>plist</var> whose <code>car</code> is <var>property</var>. </p></dd>
</dl><div class="_attribution">
<p class="_attribution-p">
Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Plist-Access.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Plist-Access.html</a>
</p>
</div>
|