如何在 Emacs 中启动时执行一个函数
How to execute a function at start in Emacs
当我在文件管理器中右键单击文件以使用 Emacs 打开文档时,我想开始跟踪功能(从 )到 运行。
(defun space12 ()
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "\. \([^ ]\)" nil t)
(replace-match ". \1" t))))
这会将 ". "
转换为 ". "
,而不会增加现有两个 space 出现的 space。
这怎么能做到。我想添加 (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.
尝试将此添加到您的 init.el:
(add-hook 'find-file-hook 'space12)
但是,这将 运行 您打开的 每个 文件的功能。那是你想要的吗?
当我在文件管理器中右键单击文件以使用 Emacs 打开文档时,我想开始跟踪功能(从
(defun space12 ()
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "\. \([^ ]\)" nil t)
(replace-match ". \1" t))))
这会将 ". "
转换为 ". "
,而不会增加现有两个 space 出现的 space。
这怎么能做到。我想添加 (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.
尝试将此添加到您的 init.el:
(add-hook 'find-file-hook 'space12)
但是,这将 运行 您打开的 每个 文件的功能。那是你想要的吗?