如何在Verilog模式Emacs中删除尾部空格

时间:2016-05-14 11:55:00

标签: emacs verilog

我试图在Verilog模式中删除尾随空格。我已经使用菜单定制了Verilog模式:" Verilog - >自定义Verilog模式..."。

编辑或保存Verilog文件时,不会删除尾随空格。我尝试过somme命令并添加钩子'但仍然没有成功。 我错过了什么?

那是我的.emacs(Emacs 24.3.1):

`(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(cua-mode t nil (cua-base))
'(global-whitespace-mode t)
'(indent-tabs-mode nil)
'(show-paren-mode t)
'(verilog-align-ifelse t)
'(verilog-auto-delete-trailing-whitespace t)
'(verilog-auto-endcomments nil)
'(verilog-auto-hook (quote (delete-trailing-whitespace)))
'(verilog-auto-indent-on-newline t)
'(verilog-auto-lineup (quote declarations))
'(verilog-auto-newline nil)
'(verilog-indent-level 2)
'(verilog-indent-level-behavioral 2)
'(verilog-indent-level-declaration 2)
'(verilog-indent-level-directive 2)
'(verilog-indent-level-module 2)
'(verilog-indent-lists nil)
'(verilog-tab-always-indent t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)`

1 个答案:

答案 0 :(得分:0)

一般来说,不仅仅是Verilog,我在保存前使用下面的清理:

;; Before save
;; (add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-hook 'before-save-hook 'whitespace-cleanup)

如果'delete-trailing-whitespace执行过多,您可以尝试启用'whitespace-cleanup