在 emacs 上启用空白模式
Enabling whitespace mode on emacs
我正在尝试启用空白模式,但它似乎对我不起作用。
我已将 whitespace.el 文件添加到我的 .emacs.d/ 目录中。
我在 .emacs 文件中添加了以下行:
(add-hook 'before-save-hook 'whitespace-cleanup)
(add-hook 'before-save-hook (lambda() (delete-trailing-whitespace)))
(require 'whitespace)
我在 whitespace.el 文件中做了以下操作:
M-x byte-compile-file <path to whitespace.el>
我尝试从 emacs 中的任何随机文本执行以下命令(例如:test.c):
M-x whitespace-toggle-options RET
但我刚收到一条消息说[不匹配]
我错过了什么?
另外,我每次使用 emacs 时是否都必须输入命令来启用空白模式?
whitespace.el
已经包含在 Emacs 中很长一段时间了。除非你有一个非常旧的版本,否则你不需要手动将它放在任何地方,或者做任何特别的事情来使用它。
whitespace-toggle-options
可能不是您要使用的函数。相反,尝试 whitespace-mode
:
Toggle whitespace visualization (Whitespace mode).
With a prefix argument ARG, enable Whitespace mode if ARG is
positive, and disable it otherwise. If called from Lisp, enable
the mode if ARG is omitted or nil.
如果要默认启用,添加
(global-whitespace-mode)
到您的初始文件。
我正在尝试启用空白模式,但它似乎对我不起作用。
我已将 whitespace.el 文件添加到我的 .emacs.d/ 目录中。 我在 .emacs 文件中添加了以下行:
(add-hook 'before-save-hook 'whitespace-cleanup)
(add-hook 'before-save-hook (lambda() (delete-trailing-whitespace)))
(require 'whitespace)
我在 whitespace.el 文件中做了以下操作:
M-x byte-compile-file <path to whitespace.el>
我尝试从 emacs 中的任何随机文本执行以下命令(例如:test.c):
M-x whitespace-toggle-options RET
但我刚收到一条消息说[不匹配]
我错过了什么?
另外,我每次使用 emacs 时是否都必须输入命令来启用空白模式?
whitespace.el
已经包含在 Emacs 中很长一段时间了。除非你有一个非常旧的版本,否则你不需要手动将它放在任何地方,或者做任何特别的事情来使用它。
whitespace-toggle-options
可能不是您要使用的函数。相反,尝试 whitespace-mode
:
Toggle whitespace visualization (Whitespace mode). With a prefix argument ARG, enable Whitespace mode if ARG is positive, and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil.
如果要默认启用,添加
(global-whitespace-mode)
到您的初始文件。