summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
authorCase Duckworth2021-05-21 10:48:05 -0500
committerCase Duckworth2021-05-21 10:57:58 -0500
commita5fe45e8db98f2405b6ec3d325d9d4366434faa7 (patch)
treea10665b4197b1417eb5cc2af865460f3ad025b84 /init.el
parentFix `acdw/system' argument parsing (diff)
downloademacs-a5fe45e8db98f2405b6ec3d325d9d4366434faa7.tar.gz
emacs-a5fe45e8db98f2405b6ec3d325d9d4366434faa7.zip
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.
Diffstat (limited to 'init.el')
-rw-r--r--init.el46
1 files changed, 26 insertions, 20 deletions
diff --git a/init.el b/init.el index cf69c1b..a114c94 100644 --- a/init.el +++ b/init.el
@@ -274,10 +274,12 @@
274 274
275 (:leader "s" eshell-pop-or-quit) 275 (:leader "s" eshell-pop-or-quit)
276 276
277 (hook-defun eshell-setup 'eshell-mode-hook 277 (add-hook 'eshell-mode-hook
278 (define-key eshell-mode-map (kbd "C-d") #'eshell-quit-or-delete-char) 278 (defun eshell-mode@setup ()
279 (when (boundp 'simple-modeline--mode-line) 279 (define-key eshell-mode-map (kbd "C-d")
280 (setq mode-line-format '(:eval simple-modeline--mode-line))))) 280 #'eshell-quit-or-delete-char)
281 (when (boundp 'simple-modeline--mode-line)
282 (setq mode-line-format '(:eval simple-modeline--mode-line))))))
281 283
282(setup eww 284(setup eww
283 (:option eww-search-prefix "https://duckduckgo.com/html?q=" 285 (:option eww-search-prefix "https://duckduckgo.com/html?q="
@@ -418,9 +420,10 @@
418(setup prog 420(setup prog
419 (:option smie-indent-basic tab-width) 421 (:option smie-indent-basic tab-width)
420 422
421 (hook-defun auto-fill-prog-mode prog-mode-hook 423 (add-hook 'prog-mode-hook
422 (setq-local comment-auto-fill-only-comments t) 424 (defun prog-mode@auto-fill ()
423 (turn-on-auto-fill)) 425 (setq-local comment-auto-fill-only-comments t)
426 (turn-on-auto-fill)))
424 427
425 (:option show-paren-delay 0 428 (:option show-paren-delay 0
426 show-paren-style 'mixed 429 show-paren-style 'mixed
@@ -526,11 +529,12 @@
526 "Welcome to GNU Emacs.\n\n") 529 "Welcome to GNU Emacs.\n\n")
527 initial-major-mode 'emacs-lisp-mode) 530 initial-major-mode 'emacs-lisp-mode)
528 531
529 (hook-defun immortal-scratch kill-buffer-query-functions 532 (add-hook 'kill-buffer-query-functions
530 (if (eq (current-buffer) (get-buffer "*scratch*")) 533 (defun kill-buffer-query@immortal-scratch ()
531 (progn (bury-buffer) 534 (if (eq (current-buffer) (get-buffer "*scratch*"))
532 nil) 535 (progn (bury-buffer)
533 t))) 536 nil)
537 t))))
534 538
535(setup scrolling 539(setup scrolling
536 (:option auto-window-vscroll nil 540 (:option auto-window-vscroll nil
@@ -673,14 +677,16 @@
673 (apheleia-global-mode +1) 677 (apheleia-global-mode +1)
674 678
675 ;; Use a dumb formatter on modes that `apheleia' doesn't work for. 679 ;; Use a dumb formatter on modes that `apheleia' doesn't work for.
676 (hook-defun dumb-auto-format before-save-hook 680 (add-hook 'before-save-hook
677 (setq stupid-modes '(makefile-mode 681 (defun before-save@dumb-auto-format ()
678 org-mode)) 682 (setq stupid-modes '(makefile-mode
679 ;; If there's no apheleia formatter for the mode, just indent the buffer. 683 org-mode))
680 (unless (or (apply #'derived-mode-p stupid-modes) 684 ;; If there's no apheleia formatter for the mode, just indent the
681 (and (fboundp 'apheleia--get-formatter-command) 685 ;; buffer.
682 (apheleia--get-formatter-command))) 686 (unless (or (apply #'derived-mode-p stupid-modes)
683 (indent-region (point-min) (point-max))))) 687 (and (fboundp 'apheleia--get-formatter-command)
688 (apheleia--get-formatter-command)))
689 (indent-region (point-min) (point-max))))))
684 690
685(setup (:straight async) 691(setup (:straight async)
686 (autoload 'dired-async-mode "dired-async.el" nil t) 692 (autoload 'dired-async-mode "dired-async.el" nil t)