在 Emacs 中,如何避免 |...| 中的换行符当使用 M-q(填充段落)时?
在 https://groups.google.com/forum/?fromgroups#!searchin/gnu.emacs.help/fill-nobreak-predicate/gnu.emacs.help/qNuZZjQnsww/99oJ1fb4OSUJ我找到了 [[...]] 的以下解决方案,但当打开和关闭分隔符相同时它不起作用:
(defun fill-open-link-nobreak-p ()
"Don't break a line after an unclosed \"[[link \"."
(save-excursion
(skip-chars-backward " ")
(let ((opoint (point))
spoint inside)
(save-excursion
(beginning-of-line)
(setq spoint (point)))
(when (re-search-backward "\\[\\[" spoint t)
;; (message "found") (sit-for 2)
(unless (re-search-forward "\\]\\]" opoint t)
(setq inside t)))
inside)))
(add-to-list 'fill-nobreak-predicate 'fill-open-link-nobreak-p)
最佳答案
这似乎可以解决问题:
(defun odd-number-of-pipes-this-paragraph-so-far ()
(oddp (how-many "|" (save-excursion (backward-paragraph) (point)) (point))))
(add-to-list 'fill-nobreak-predicate 'odd-number-of-pipes-this-paragraph-so-far)
关于emacs - 如何避免 |...| 中的换行符在 Emacs 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13915400/