aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2018-11-08 13:19:42 -0500
committerJesús <heckyel@hyperbola.info>2018-11-08 13:19:42 -0500
commitbb80ec4def3ec8f0930f1d9f23f5bdf427ca72ef (patch)
tree649c561a5f1cf9af3fca76a8fcd0b6004ae26f5a /lisp
parentcf4c6d84fa9478fb69277581cf5245708827ae56 (diff)
downloademacs-personal-bb80ec4def3ec8f0930f1d9f23f5bdf427ca72ef.tar.lz
emacs-personal-bb80ec4def3ec8f0930f1d9f23f5bdf427ca72ef.tar.xz
emacs-personal-bb80ec4def3ec8f0930f1d9f23f5bdf427ca72ef.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-editing-utils.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/init-editing-utils.el b/lisp/init-editing-utils.el
index ff7bc39..292fa1d 100644
--- a/lisp/init-editing-utils.el
+++ b/lisp/init-editing-utils.el
@@ -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.