如何在填充段落中删除连字符?

时间:2017-03-04 11:24:59

标签: emacs hyphenation

当我手动使用fill-paragraph时,我想让emacs删除所有以前插入的连字符(由其他人?)。这意味着自动将所有"-\n"替换为""

我该怎么做?

1 个答案:

答案 0 :(得分:4)

我可以想象,在某些情况下效果不佳,但是......

(defadvice fill-delete-newlines (before my-before-fill-delete-newlines)
  "Replace -\\n with an empty string when calling `fill-paragraph'."
  (when (eq this-command 'fill-paragraph)
    (goto-char (ad-get-arg 0))
    (while (search-forward "-\n" (ad-get-arg 1) t)
      (replace-match "")
      (ad-set-arg 1 (- (ad-get-arg 1) 2)))))

(ad-activate 'fill-delete-newlines)