【问题标题】:How to remove hyphens during fill-paragraph?如何在填充段落期间删除连字符?
【发布时间】:2017-03-04 11:24:58
【问题描述】:

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

我该怎么做?

【问题讨论】:

    标签: emacs hyphenation


    【解决方案1】:

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

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

    【讨论】:

    • 酷。我不知道你可以神奇地将自己连接到这样的现有函数中。到目前为止工作正常。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多