如何在org-mode中使用其他标题样式,如twiki --- +或mediawiki == h2 ==?

Kra*_*lew 6 emacs org-mode

我真的想用org-mode.

但是,我想使用org-mode来理解已经使用不同的标题语法编写的结构化文档,

例如使用twiki的--- +

---+ H1 

Top level

---++ H2

Nested

---+ H1 #2

Second top level
Run Code Online (Sandbox Code Playgroud)

或者像mediawiki一样

= H1 = 

Top level

== H2 ==

Nested

= H1 #2 =

Second top level
Run Code Online (Sandbox Code Playgroud)

我想拥有组织模式折叠的所有优点,只需使用这些不同的标题样式.


实际上,更糟糕的是:

我想,比如,twiki或mediawaiki标题优先于组织模式星号标题.但我想两者都在使用.

= H1 =

Top level

* this is a list
** nested
* list
** nested

== H2 ==

Nested

= H1 #2 =

Second top level
Run Code Online (Sandbox Code Playgroud)

- +到目前为止我尝试过的

我已经能够使用轮廓模式来处理twiki,例如via

---+ Emacs stuff
# try (defvar twiki-outline-regexp "---+\\++ \\|\\(\\(?:   \\)+\\)[0-9*] ")
Local Variables: ***
outline-regexp: "^---\\++" ***
org-outline-regexp: "^---\\++" ***
End: ***
Run Code Online (Sandbox Code Playgroud)

但是,org-outline-regexp不会做我希望的hwat.

emacs的outline-mode的out-level函数看起来几乎就像我想要的那样.

(defvar outline-level 'outline-level
  "*Function of no args to compute a header's nesting level in an outline.
It can assume point is at the beginning of a header line and that the match
data reflects the `outline-regexp'.")
Run Code Online (Sandbox Code Playgroud)

ie而不是regexps,一个通用函数.

但我还没有设法使用org-mode.看起来org-mode并没有真正使用它,或者更确切地说,还有其他东西.

;; In Org buffers, the value of `outline-regexp' is that of
;; `org-outline-regexp'.  The only function still directly relying on
;; `outline-regexp' is `org-overview' so that `org-cycle' can do its
;; job when `orgstruct-mode' is active.
(defvar org-outline-regexp "\\*+ "
  "Regexp to match Org headlines.")
(defconst org-outline-regexp-bol "^\\*+ "
  "Regexp to match Org headlines.
This is similar to `org-outline-regexp' but additionally makes
sure that we are at the beginning of the line.")

(defconst org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
  "Matches an headline, putting stars and text into groups.
Stars are put in group 1 and the trimmed body in group 2.")
Run Code Online (Sandbox Code Playgroud)

失败了,好吧,我想从org-mode获得的主要内容是链接,在这里问另一个问题 如何在emacs中"链接"非组织模式缓冲区

nea*_*mcb 4

我的沮丧只是因为 org-mode 对于新大纲部分的构成规则与大纲模式不同。它需要在星号后面有一个空格,所以它不适用于我的大量笔记,我放弃了这些空格。

我通过删除未详细记录的org-outline-regexp变量中的尾随空格来解决这个问题,该变量用于初始化缓冲区局部变量outline-regexp,这似乎对我有用。例如(set-variable 'org-outline-regexp "\\*+")

至于你的实际问题,我的猜测是其他正则表达式和代码必须更改才能处理完全不同的内容,例如 twiki 或 mediawiki 标题。