当我手动使用fill-paragraph
时,我想让emacs删除所有以前插入的连字符(由其他人?)。这意味着自动将所有"-\n"
替换为""
。
我该怎么做?
答案 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)