I'd like to untabify whenever I save a buffer. This worked fine until I upgraded to Emacs 24 which broke it, as there is no make-local-hook anymore. Have a look:;;; untabify on C-x C-s (except for GNUmakefiles that needs tabs);;;   (note: `stringp` check to avoid bug (?) in HTML-mode)(defun untab-all ()  (unless (and (stringp mode-name)               (string= mode-name GNUmakefile) )    (untabify (point-min) (point-max)) ));; TODO: doesn't work anymore as no make-local-hook in Emacs 24 - ;; it won't work with simply dropping that line,;; or doing that, and passing a 4th `t` argument in the second;; add-hook call (which is the LOCAL parameter);; (add-hook 'emacs-lisp-mode-hook;;    '(lambda ();;       (make-local-hook 'write-contents-hooks);;       (add-hook 'write-contents-hooks 'untab-all) ))EDITGot it to work with the below help and this site.Ironic thing is, with my old solution (using make-local-hook), somehow I got this globally (which is why I had to add that check for GNU makefiles).Now, this seems to be a local thing: this is good as that check needn't be done at every save; only, you have to state for what modes untabify should be done. (I guess you could just add them one by one as you go along, every time you discover a tab, until you're done. Although it feels like you're using 5-6 modes, when you think about it, you use tons!)But, to confuse things even more, the HTML mode seems to do this, with no intervention! If you read the code above, you see that even for the old solution, HTML was the cat among the ermines...Anyway, this seems to work:(defun untab-all ()  (untabify (point-min) (point-max))   nil ) ; did not write buffer to disk(defun add-write-contents-hooks-hook ()  (add-hook   'write-contents-hooks   'untab-all     nil  ; APPEND  unrelated, explicit default nil as optional :)     t )) ; LOCAL   non-nil => make hook local;; more modes: http://www.emacswiki.org/CategoryModes(add-hook 'emacs-lisp-mode-hook #'add-write-contents-hooks-hook)(add-hook 'c-mode-common-hook   #'add-write-contents-hooks-hook)(add-hook 'sh-mode-hook         #'add-write-contents-hooks-hook)(add-hook 'text-mode-hook       #'add-write-contents-hooks-hook)(add-hook 'sql-mode-hook        #'add-write-contents-hooks-hook)(add-hook 'css-mode-hook        #'add-write-contents-hooks-hook)
untabify on save in Emacs 24 without make-local-hook
emacs
Emacs 24 uses the LOCAL parameter of add-hook instead of make-local-hook.  (I believe that was added in Emacs 21.1, but make-local-hook wasn't removed until Emacs 24.)Try this:(add-hook 'emacs-lisp-mode-hook    '(lambda ()       (add-hook 'write-contents-hooks 'untab-all nil t) ))Your other problem is that untab-all must return nil to indicate that it did not write the buffer to disk (as explained in the docs for write-contents-hooks, or as it's now called, write-contents-functions):(defun untab-all ()  (unless (and (stringp mode-name)               (string= mode-name GNUmakefile) )    (untabify (point-min) (point-max)) )  nil) ; did not write buffer to disk