symbol-plist返回带有值的elisp符号列表

时间:2015-01-17 16:41:33

标签: emacs elisp

 (symbol-plist 'default-directory)

返回

(permanent-local t safe-local-variable stringp variable-documentation 341707)

如何理解elisp中default-directory符号的plist? (或)符号plist中的六个列表元素代表什么?

注意:default-directory是一个符号,当前elisp脚本dir为其值。

1 个答案:

答案 0 :(得分:2)

属性列表从概念上将键映射到值。表示形式是(KEY1 VALUE1 KEY2 VAULE2 KEY3 VALUE3 ...)形式的简单列表。

换句话说,您应该阅读属性列表,以便permanent-local的值为tsafe-local-variable的值为stringp且值为variable-documentation 341707

您可以使用plist-get获取密钥的值。不幸的是,使用此函数,您无法区分值为nil的属性以及缺少键的情况。幸运的是,你可以使用plist-member,它会从键开始返回列表的其余部分,如果键丢失,则返回nil