如何在 Verilog 模式 Emacs 中删除尾随空格
How to delete trailing whitespace in Verilog Mode Emacs
我正在尝试在 Verilog 模式下删除尾随空格。我已经使用菜单自定义了 Verilog 模式:"Verilog --> Customize Verilog Mode...".
编辑或保存 Verilog 文件时不会删除尾随空格。我尝试了一些命令 'add hook' 但仍然没有成功。
我错过了什么?
那是我的 .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.
)`
一般来说,不仅仅是 Verilog,我在保存前使用以下清理:
;; Before save
;; (add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-hook 'before-save-hook 'whitespace-cleanup)
您可以尝试仅启用 'delete-trailing-whitespace
,如果 'whitespace-cleanup
做得太多。
我正在尝试在 Verilog 模式下删除尾随空格。我已经使用菜单自定义了 Verilog 模式:"Verilog --> Customize Verilog Mode...".
编辑或保存 Verilog 文件时不会删除尾随空格。我尝试了一些命令 'add hook' 但仍然没有成功。 我错过了什么?
那是我的 .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.
)`
一般来说,不仅仅是 Verilog,我在保存前使用以下清理:
;; Before save
;; (add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-hook 'before-save-hook 'whitespace-cleanup)
您可以尝试仅启用 'delete-trailing-whitespace
,如果 'whitespace-cleanup
做得太多。