最终我想匹配以下形式的属性:
header-args: :tangle <any path>
。然而,1)-
的存在导致没有输出(我猜-
被解释为“排除”)2)我还没有找到表达<any path>
的有效方法。这些对应于标记为 blah
和 qux
的 MWE,并且为了比较,分别标记为 bar
和 foo
。
* match
Matches `bar` as expected
#+begin_src emacs-lisp
(org-match-sparse-tree nil "prefix_key=\"value\"")
#+end_src
Fails to match `blah`
#+begin_src emacs-lisp
(org-match-sparse-tree nil "prefix-key=\"value\"")
#+end_src
Matches `foo` as expected
#+begin_src emacs-lisp
(org-match-sparse-tree nil "key=\"value\"")
#+end_src
Fails to match `qux`
#+begin_src emacs-lisp
(org-match-sparse-tree nil "key=\"prefix.*\"")
#+end_src
* sample
** bar
:PROPERTIES:
:prefix_key: value
:END:
** blah
:PROPERTIES:
:prefix-key: value
:END:
** foo
:PROPERTIES:
:key: value
:END:
** qux
:PROPERTIES:
:key: prefix value
:END:
其他:
只是使用
org-occur
的替代方法有效(尽管有 wrong type argument
消息)。
.org
* code
[same as in the original]
Matches baz as expected.
#+begin_src emacs-lisp
(org-occur ":header-args: :tangle.+$")
#+end_src
* sample
[same as in the original]
** baz
:PROPERTIES:
:header-args: :tangle "/path"
:END:
*留言*
Executing Emacs-Lisp code block at position 513...
org-babel-execute-src-block: Wrong type argument: integer-or-marker-p, nil