2

在 Emacs 中,如何避免 |...| 中的换行符 使用 Mq(填充段落)时?

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)
4

1 回答 1

2

这似乎可以解决问题:

(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)
于 2012-12-17T17:14:00.530 回答