2016-05-14 119 views
0

我試圖刪除Verilog模式中的尾隨空白。我用菜單定製了Verilog模式:「Verilog - > Customize Verilog Mode ...」。如何刪除Verilog模式中的尾隨空白Emacs

編輯或保存Verilog文件時,尾隨的空格不會被刪除。我嘗試了索姆命令'添加鉤',但仍然沒有成功。 我錯過了什麼?

這是我的.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. 
)` 

回答

0

在一般情況下,不只是對Verilog,我用下面的清理之前保存:

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

你可以嘗試啓用只有'delete-trailing-whitespace,如果'whitespace-cleanup做得太多。

+0

這終於奏效了。我必須關閉Emacs並再次打開它才能使用此鉤子。 – Respoc