2017-04-15 77 views
0

我想要启动以下功能(从Replace one space by two after sentences in Emacs)运行时,我右键单击文件管理器中的文件以使用Emacs打开文档。如何在Emacs启动时执行一个函数

(defun space12() 
    (interactive) 
    (save-excursion 
    (goto-char (point-min)) 
    (while (re-search-forward "\\. \\([^ ]\\)" nil t) 
     (replace-match ". \\1" t)))) 

这种转换". "". "在不增加现有两家空间发生的空间。

这是怎么做到的。我想为init.el添加(space12),但它似乎在文档加载之前加载。

样品输入:

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. 
+0

这是针对特定类型的文件吗?我可能会添加一个钩子到适当的主要模式。 – Chris

回答

1

尝试添加以下内容到init.el:

(add-hook 'find-file-hook 'space12) 

然而,这将在运行功能的每一文件打开。那是你要的吗?

相关问题