From a5fe45e8db98f2405b6ec3d325d9d4366434faa7 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 21 May 2021 10:48:05 -0500 Subject: Comment out `hook-defun' The only plus `hook-defun' has over (add-hook 'hook (defun name ... )) is the ability to add the same function to multiple hooks at once. My init files don't use that functionality, so I've retired this macro for now. I'm thinking, honestly, that if a function is used in more than one hook, it should be defined separately and added to each hook in turn ... you know, like Emacs does it by default. --- init.el | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index cf69c1b..a114c94 100644 --- a/init.el +++ b/init.el @@ -274,10 +274,12 @@ (:leader "s" eshell-pop-or-quit) - (hook-defun eshell-setup 'eshell-mode-hook - (define-key eshell-mode-map (kbd "C-d") #'eshell-quit-or-delete-char) - (when (boundp 'simple-modeline--mode-line) - (setq mode-line-format '(:eval simple-modeline--mode-line))))) + (add-hook 'eshell-mode-hook + (defun eshell-mode@setup () + (define-key eshell-mode-map (kbd "C-d") + #'eshell-quit-or-delete-char) + (when (boundp 'simple-modeline--mode-line) + (setq mode-line-format '(:eval simple-modeline--mode-line)))))) (setup eww (:option eww-search-prefix "https://duckduckgo.com/html?q=" @@ -418,9 +420,10 @@ (setup prog (:option smie-indent-basic tab-width) - (hook-defun auto-fill-prog-mode prog-mode-hook - (setq-local comment-auto-fill-only-comments t) - (turn-on-auto-fill)) + (add-hook 'prog-mode-hook + (defun prog-mode@auto-fill () + (setq-local comment-auto-fill-only-comments t) + (turn-on-auto-fill))) (:option show-paren-delay 0 show-paren-style 'mixed @@ -526,11 +529,12 @@ "Welcome to GNU Emacs.\n\n") initial-major-mode 'emacs-lisp-mode) - (hook-defun immortal-scratch kill-buffer-query-functions - (if (eq (current-buffer) (get-buffer "*scratch*")) - (progn (bury-buffer) - nil) - t))) + (add-hook 'kill-buffer-query-functions + (defun kill-buffer-query@immortal-scratch () + (if (eq (current-buffer) (get-buffer "*scratch*")) + (progn (bury-buffer) + nil) + t)))) (setup scrolling (:option auto-window-vscroll nil @@ -673,14 +677,16 @@ (apheleia-global-mode +1) ;; Use a dumb formatter on modes that `apheleia' doesn't work for. - (hook-defun dumb-auto-format before-save-hook - (setq stupid-modes '(makefile-mode - org-mode)) - ;; If there's no apheleia formatter for the mode, just indent the buffer. - (unless (or (apply #'derived-mode-p stupid-modes) - (and (fboundp 'apheleia--get-formatter-command) - (apheleia--get-formatter-command))) - (indent-region (point-min) (point-max))))) + (add-hook 'before-save-hook + (defun before-save@dumb-auto-format () + (setq stupid-modes '(makefile-mode + org-mode)) + ;; If there's no apheleia formatter for the mode, just indent the + ;; buffer. + (unless (or (apply #'derived-mode-p stupid-modes) + (and (fboundp 'apheleia--get-formatter-command) + (apheleia--get-formatter-command))) + (indent-region (point-min) (point-max)))))) (setup (:straight async) (autoload 'dired-async-mode "dired-async.el" nil t) -- cgit 1.4.1-21-gabe81