gpt4 book ai didi

emacs - 组织模式嵌套属性?

转载 作者:行者123 更新时间:2023-12-01 14:12:24 25 4
gpt4 key购买 nike

Org manual “属性是与条目关联的键值对”。一个合适的key-value data structure可以在值中存储任何内容,包括另一个关联数组。但属性似乎不能。

  • 我可以模拟嵌套属性吗?
  • 如果我不能,理论上应该如何优雅地实现它?

嵌套属性可以通过大量使用 Property API 为 org-mode 启用许多可能性。无数的功能。脑海中浮现的示例包括:键值数据库、图形数据库、向条目添加复杂的语义元数据、语义 Web 应用程序,甚至是文本查询。

类似ID markers的想法( all posts of the thread ) 于 2009 年在 org-mode 邮件列表中进行了讨论。ID 标记的想法与我从 Org-mode: using special properties in the drawer 概括 org-mode 属性语法的另一个愿望无关。 .不幸的是,ID 标记引入了更多新语法,我想在当前的组织模式能力范围内启用增量存储嵌套数据。

Babel可能是一个解决方案,但它需要使用编程语言并可能限制灵 active 。最好只使用属性 API。

最佳答案

这是你的想法吗:

** subheading
:PROPERTIES:
:my-prop: (:property-1 red :property-2 (nested-prop . 5))
:END:`


#+BEGIN_SRC emacs-lisp
(defun get-my-prop-value (property)
(interactive)
(plist-get
(read (org-entry-get (point) "my-prop"))
property))
#+END_SRC

#+RESULTS:
: get-my-prop-value



#+BEGIN_SRC emacs-lisp
(get-my-prop-value :property-2)
#+END_SRC

#+RESULTS:
: (nested-prop . 5)

关于emacs - 组织模式嵌套属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13228001/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com