无法使用“org-match-sparse-tree”匹配包含连字符的属性

问题描述 投票:0回答:1

最终我想匹配以下形式的属性:

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:

其他:

emacs org-mode
1个回答
0
投票

只是使用

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

Code to be executed After execution

© www.soinside.com 2019 - 2024. All rights reserved.