I personally have dealt with the issue where I cannot add untabify directly to write-file-functions hook, because untabify does not return nil.
I need some sort of custom wrapper that runs untabify and then returns nil.
Today I noticed that another user on help-gnu-emacs list faced the same problem.
That made me submit this minor edit to the untabify function; it simply returns nil. I noticed that similar edit had to be done for another function commonly added to write-file-functions: delete-trailing-whitespace.
From 1e12773ffa7c94610df070e38aaf8b2315c18fa8 Mon Sep 17 00:00:00 2001
Date: Tue, 15 Sep 2015 23:24:27 -0400
Subject: [PATCH] Make untabify work with write-file-functions hook
- write-file-functions requires the hooked functions to return nil in
order to proceed with the file saving.
- So the return value of untabify is set to nil.
---
lisp/tabify.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lisp/tabify.el b/lisp/tabify.el
index c2f4e0c..9df3eaa 100644
--- a/lisp/tabify.el
+++ b/lisp/tabify.el
@@ -53,7 +53,9 @@ The variable `tab-width' controls the spacing of tab stops."
(setq column (current-column))
(delete-region tab-beg (point))
(indent-to column)))))
- (move-to-column c)))
+ (move-to-column c))
+ ;; Return nil for the benefit of `write-file-functions'.
+ nil)
(defvar tabify-regexp " [ \t]+"
"Regexp matching whitespace that tabify should consider.
--
2.6.0.rc0.24.gec371ff