【发布时间】:2021-07-08 01:27:05
【问题描述】:
我正在尝试编写一个简单的 Elisp Emacs 函数,该函数接受一个段落(由[X] 指示的点)并将其扩展为一系列项目符号点,每个项目符号包含一个句子。
much more useful, especially with huge windows. In my experience, it slows down redraw a little bit, but it’s worth it.There are two ways to enable it: the first is with M-x visual-line-mode[X] (for those with real menus, apparently Options->Line Wrapping in this Buffer->Word Wrap), which will give you a minor mode “wrap” in the mode line.
然后返回
+ much more useful, especially with huge windows.
+ In my experience, it slows down redraw a little bit, but it’s worth it.
+ There are two ways to enable it: the first is with M-x visual-line-mode[X] (for those with real menus, apparently Options->Line Wrapping in this Buffer->Word Wrap), which will give you a minor mode “wrap” in the mode line.
这是我目前所拥有的:
(defun jds/explode ()
"explode paragraph, more documentation needed"
(interactive)
(save-excursion
(let ((bop (copy-marker (progn (backward-paragraph) (point))))
(eop (copy-marker (progn (forward-paragraph) (point)))))
(goto-char bop)
(back-to-indentation) ;; goto first non-whitespace character
(if (re-search-forward "^[:blank:]*[+-x] " nil t) nil (insert "+ "))
(while (< (point) eop)
(forward-sentence)
(forward-whitespace 1)
(unless (>= (point) eop)
(org-meta-return)))))))))
但这似乎只是运行但没有做任何事情。我认为问题可能在于backward-paragraph 函数可能没有将点放在第一个非黑色字符上(m 很多)。但话虽如此,我的 Elisp 很弱,我正在努力找出问题所在。
【问题讨论】: