如何在填充段落期间删除连字符?
How to remove hyphens during fill-paragraph?
当我手动使用 fill-paragraph
时,我想让 emacs 删除所有以前插入的连字符(由其他人插入?)。这意味着自动将所有 "-\n"
替换为 ""
。
我该怎么做?
我可以想象在某些情况下效果不佳,但是...
(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)
当我手动使用 fill-paragraph
时,我想让 emacs 删除所有以前插入的连字符(由其他人插入?)。这意味着自动将所有 "-\n"
替换为 ""
。
我该怎么做?
我可以想象在某些情况下效果不佳,但是...
(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)