【发布时间】:2017-04-15 15:35:32
【问题描述】:
当我在文件管理器中右键单击文件以使用 Emacs 打开文档时,我想启动以下功能(来自Replace one space by two after sentences in Emacs)。
(defun space12 ()
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "\\. \\([^ ]\\)" nil t)
(replace-match ". \\1" t))))
这会将". " 转换为". ",而不会增加现有两个空格出现的空格。
如何做到这一点。我想将 (space12) 添加到 init.el 但它似乎是在加载文档之前加载的。
样本输入:
This is for test. This is second line with only one space at start. This is third line which already has 2 spaces before it. End of document.
【问题讨论】:
-
这是针对特定类型的文件吗?我可能会在适当的主要模式中添加一个钩子。