我定義上的順乎自然段工作的主要模式:如何獲取Emacs Lisp中的所有段落?
: Identifier
1. some text
2. ...
3. some more text
: New Identifier
: Another Identifier
some text
我想寫一個defun
稱爲get-paragraphs
將返回,看起來像一個列表:
( ("Identifier", ("1. some text", "2. ...", "3. some more text")),
("New Identifier",()),
("Another Identifier", ("some text"))
)
怎麼辦我開始在Emacs Lisp中分割這樣的文本:
是否有函數來遍歷它們(並隨後將它們按照我的喜好切分)?我應該使用正則表達式嗎?有更容易的方法嗎?
這幾乎是完美的 - 有一個額外的'='我把':'標題下的行作爲另一個列表。非常感謝! – sdasdadas