I am studying the following code snippet taken from prelude-c.el:
;; taken from prelude-c.el (defun prelude-makefile-mode-defaults () (whitespace-toggle-options '(tabs)) (setq indent-tabs-mode t)) (setq prelude-makefile-mode-hook 'prelude-makefile-mode-defaults) (add-hook 'makefile-mode-hook (lambda () (run-hooks 'prelude-makefile-mode-hook)))
The author defined a function named
prelude-makefile-mode-defaults, then made
prelude-makefile-mode-hook an alias to it, and finally run it with
run-hooks. This looks tedious to me. In my humble opinion, it can be simplified to
(defun prelude-makefile-mode-defaults () (whitespace-toggle-options '(tabs)) (setq indent-tabs-mode t)) (add-hook 'makefile-mode-hook #'prelude-makefile-mode-defaults)
Now it is much clearer, and they appears to have the same effect, but of course, the authors of prelude.el must be much more sophisticated than me, who is just a beginner. Is there any hidden advantage of writing down all these seemingly redundant code?