add-hook is a function, so all of its args are evaluated before it does its thing (using their values).
The value of the sexp you passed as its second arg is the symbol delete-trailing-whitespace, because the arg to when is a non-nil list (because you quoted it). So the when condition is always true. And you never invoke function delete-trailing-whitespace; you just return the symbol that names that function.
This commit is contained in:
parent
cf4c6d84fa
commit
bb80ec4def
@ -6,8 +6,9 @@
|
||||
|
||||
;; Delete-trailing-whitespace-when-saving-except-certain-modes
|
||||
(add-hook 'before-save-hook
|
||||
(when '(not diff-mode))
|
||||
'delete-trailing-whitespace)
|
||||
(lambda ()
|
||||
(unless (eq major-mode 'diff-mode)
|
||||
(delete-trailing-whitespace))))
|
||||
;;----------------------------------------------------------------------------
|
||||
;; Automatic pairs open symbols (, {, [...
|
||||
;; Disable for default.
|
||||
|
Loading…
x
Reference in New Issue
Block a user