From 19ecf8e46a336ca05733f43f40d1cefdf0833aaf Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 28 Jul 2019 14:52:59 +0200 Subject: [PATCH] Correct last inline hook defuns See a3e262c7 for rationale --- core/core-projects.el | 2 +- core/core-ui.el | 8 ++++---- modules/app/twitter/config.el | 2 +- modules/completion/company/config.el | 2 +- modules/completion/ivy/config.el | 2 +- modules/config/default/config.el | 2 +- modules/emacs/electric/config.el | 2 +- modules/emacs/vc/config.el | 4 ++-- modules/lang/clojure/config.el | 2 +- modules/lang/common-lisp/config.el | 2 +- modules/lang/haskell/+intero.el | 2 +- modules/lang/rust/config.el | 2 +- modules/lang/sh/config.el | 4 ++-- modules/term/eshell/config.el | 8 ++++---- modules/term/vterm/config.el | 2 +- modules/tools/direnv/config.el | 4 ++-- modules/tools/editorconfig/config.el | 4 ++-- modules/tools/eval/config.el | 4 ++-- modules/tools/flycheck/config.el | 4 ++-- modules/tools/flyspell/config.el | 6 +++--- modules/ui/modeline/config.el | 2 +- modules/ui/neotree/config.el | 2 +- modules/ui/tabbar/config.el | 2 +- modules/ui/unicode/autoload.el | 2 +- modules/ui/workspaces/config.el | 2 +- 25 files changed, 39 insertions(+), 39 deletions(-) diff --git a/core/core-projects.el b/core/core-projects.el index dd65204ce..88c34ba99 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -58,7 +58,7 @@ Emacs.") ;; projectile's cache (into the hundreds of MBs). This purges those entries ;; when exiting Emacs to prevent slowdowns/freezing when cache files are ;; loaded or written to. - (add-hook 'kill-emacs-hook + (add-hook! 'kill-emacs-hook (defun doom-cleanup-project-cache-h () "Purge projectile cache entries that: diff --git a/core/core-ui.el b/core/core-ui.el index 05c471920..d58a94b7c 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -297,7 +297,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (display-graphic-p)) (require 'ns-auto-titlebar nil t)) - (add-hook 'after-make-frame-functions + (add-hook! 'after-make-frame-functions (defun doom-init-menu-bar-in-gui-frames-h (frame) "On MacOS, the menu bar isn't part of the frame. Disabling it makes MacOS treat Emacs as a non-application window." @@ -406,12 +406,12 @@ treat Emacs as a non-application window." ;; selection region harder to see while in evil visual mode. (after! evil (defvar doom-buffer-hl-line-mode nil) - (add-hook 'evil-visual-state-entry-hook + (add-hook! 'evil-visual-state-entry-hook (defun doom-disable-hl-line-h () (when hl-line-mode (setq-local doom-buffer-hl-line-mode t) (hl-line-mode -1)))) - (add-hook 'evil-visual-state-exit-hook + (add-hook! 'evil-visual-state-exit-hook (defun doom-enable-hl-line-maybe-h () (when doom-buffer-hl-line-mode (hl-line-mode +1)))))) @@ -542,7 +542,7 @@ character that looks like a space that `whitespace-mode' won't affect.") str)) (setq nlinum-format-function #'doom-nlinum-format-fn) - (add-hook 'nlinum-mode-hook + (add-hook! 'nlinum-mode-hook (defun doom-init-nlinum-width-h () "Calculate line number column width beforehand (optimization)." (setq nlinum--width diff --git a/modules/app/twitter/config.el b/modules/app/twitter/config.el index 114cb12b0..db8849a50 100644 --- a/modules/app/twitter/config.el +++ b/modules/app/twitter/config.el @@ -42,7 +42,7 @@ (add-hook 'twittering-mode-hook #'solaire-mode)) ;; Custom header-line for twitter buffers - (add-hook 'twittering-mode-hook + (add-hook! 'twittering-mode-hook (defun +twitter-switch-mode-and-header-line-h () (setq header-line-format mode-line-format mode-line-format nil))) diff --git a/modules/completion/company/config.el b/modules/completion/company/config.el index ba62f0b3c..9c92a53c0 100644 --- a/modules/completion/company/config.el +++ b/modules/completion/company/config.el @@ -123,7 +123,7 @@ :defer t :config (setq company-dict-dir (expand-file-name "dicts" doom-private-dir)) - (add-hook 'doom-project-hook + (add-hook! 'doom-project-hook (defun +company-enable-project-dicts-h (mode &rest _) "Enable per-project dictionaries." (if (symbol-value mode) diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index 7edd6df70..31685296a 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -82,7 +82,7 @@ immediately runs it on the current candidate (ending the ivy session)." (setq +ivy--origin (point-marker)))) (setq ivy-hooks-alist '((t . +ivy--record-position-maybe-fn))) - (add-hook 'minibuffer-exit-hook + (add-hook! 'minibuffer-exit-hook (defun +ivy--set-jump-point-maybe-h () (when (and (markerp +ivy--origin) (not (equal (with-ivy-window (point-marker)) +ivy--origin))) diff --git a/modules/config/default/config.el b/modules/config/default/config.el index 7ac5f3645..e3671d1d9 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -52,7 +52,7 @@ ;; Smartparens' navigation feature is neat, but does not justify how ;; expensive it is. It's also less useful for evil users. This may need to ;; be reactivated for non-evil users though. Needs more testing! - (add-hook 'after-change-major-mode-hook + (add-hook! 'after-change-major-mode-hook (defun doom-disable-smartparens-navigate-skip-match-h () (setq sp-navigate-skip-match nil sp-navigate-consider-sgml-tags nil))) diff --git a/modules/emacs/electric/config.el b/modules/emacs/electric/config.el index f4baa8631..82188a6d2 100644 --- a/modules/emacs/electric/config.el +++ b/modules/emacs/electric/config.el @@ -10,7 +10,7 @@ current line.") (after! electric (setq-default electric-indent-chars '(?\n ?\^?)) - (add-hook 'electric-indent-functions + (add-hook! 'electric-indent-functions (defun +electric-indent-char-fn (_c) (when (and (eolp) +electric-indent-words) (save-excursion diff --git a/modules/emacs/vc/config.el b/modules/emacs/vc/config.el index d8f4d582c..8193281c7 100644 --- a/modules/emacs/vc/config.el +++ b/modules/emacs/vc/config.el @@ -44,14 +44,14 @@ (global-git-commit-mode +1) (set-yas-minor-mode! 'git-commit-mode) - (add-hook 'git-commit-mode-hook + (add-hook! 'git-commit-mode-hook (defun +vc-enforce-git-commit-conventions-h () "See https://chris.beams.io/posts/git-commit/" (setq fill-column 72 git-commit-summary-max-length 50 git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line)))) - (add-hook 'git-commit-setup-hook + (add-hook! 'git-commit-setup-hook (defun +vc-start-in-insert-state-maybe () "Start git-commit-mode in insert state if in a blank commit message, otherwise in default state." diff --git a/modules/lang/clojure/config.el b/modules/lang/clojure/config.el index a8c8004f6..f4aa1f519 100644 --- a/modules/lang/clojure/config.el +++ b/modules/lang/clojure/config.el @@ -46,7 +46,7 @@ ;; rather than the *cider-repl* buffer. How silly. We might want to see that ;; stuff and who's going to check *nrepl-server* on every startup? I've got a ;; better idea: we copy these errors into the *cider-repl* buffer. - (add-hook 'cider-connected-hook + (add-hook! 'cider-connected-hook (defun +clojure--cider-dump-nrepl-server-log-h () "Copy contents of *nrepl-server* to beginning of *cider-repl*." (save-excursion diff --git a/modules/lang/common-lisp/config.el b/modules/lang/common-lisp/config.el index 69862a2e1..a90f53c3c 100644 --- a/modules/lang/common-lisp/config.el +++ b/modules/lang/common-lisp/config.el @@ -53,7 +53,7 @@ if (buffer-local-value 'sly-mode buf) collect buf))))) - (add-hook 'sly-mode-hook + (add-hook! 'sly-mode-hook (defun +common-lisp-init-sly-h () "Attempt to auto-start sly when opening a lisp buffer." (cond ((or (doom-temp-buffer-p (current-buffer)) diff --git a/modules/lang/haskell/+intero.el b/modules/lang/haskell/+intero.el index 7c211000c..309a92aac 100644 --- a/modules/lang/haskell/+intero.el +++ b/modules/lang/haskell/+intero.el @@ -4,7 +4,7 @@ (use-package! intero :commands intero-mode :init - (add-hook 'haskell-mode-local-vars-hook + (add-hook! 'haskell-mode-local-vars-hook (defun +haskell-init-intero-h () "Initializes `intero-mode' in haskell-mode, unless stack isn't installed. This is necessary because `intero-mode' doesn't do its own error checks." diff --git a/modules/lang/rust/config.el b/modules/lang/rust/config.el index 2ff04927f..8a975722b 100644 --- a/modules/lang/rust/config.el +++ b/modules/lang/rust/config.el @@ -10,7 +10,7 @@ ;; happen once. ;; ;; rust-mode is still required for `racer'. - (add-hook 'rust-mode-hook + (add-hook! 'rust-mode-hook (defun +rust-init-h () "Switch to `rustic-mode', if it's available." (when (require 'rustic nil t) diff --git a/modules/lang/sh/config.el b/modules/lang/sh/config.el index d8c2dd564..34af5d4d0 100644 --- a/modules/lang/sh/config.el +++ b/modules/lang/sh/config.el @@ -35,7 +35,7 @@ ;; 1. Fontifies variables in double quotes ;; 2. Fontify command substitution in double quotes ;; 3. Fontify built-in/common commands (see `+sh-builtin-keywords') - (add-hook 'sh-mode-hook + (add-hook! 'sh-mode-hook (defun +sh-init-extra-fontification-h () (font-lock-add-keywords nil `((+sh--match-variables-in-quotes @@ -52,7 +52,7 @@ (sp-local-pair 'sh-mode "`" "`" :unless '(sp-point-before-word-p sp-point-before-same-p)) ;; sh-mode has file extensions checks for other shells, but not zsh, so... - (add-hook 'sh-mode-hook + (add-hook! 'sh-mode-hook (defun +sh-detect-zsh-h () (when (or (and buffer-file-name (string-match-p "\\.zsh\\'" buffer-file-name)) diff --git a/modules/term/eshell/config.el b/modules/term/eshell/config.el index ca75f05dd..d2b9b5c76 100644 --- a/modules/term/eshell/config.el +++ b/modules/term/eshell/config.el @@ -88,12 +88,12 @@ You should use `set-eshell-alias!' to change this.") (add-hook 'persp-before-switch-functions #'+eshell-save-workspace-fn)) ;; UI enhancements - (add-hook 'eshell-mode-hook + (add-hook! 'eshell-mode-hook (defun +eshell-remove-fringes-h () (set-window-fringes nil 0 0) (set-window-margins nil 1 nil))) - (add-hook 'eshell-mode-hook + (add-hook! 'eshell-mode-hook (defun +eshell-enable-text-wrapping-h () (visual-line-mode +1) (set-display-table-slot standard-display-table 0 ?\ ))) @@ -109,7 +109,7 @@ You should use `set-eshell-alias!' to change this.") (after! em-term (pushnew! eshell-visual-commands "tmux" "htop" "vim" "nvim" "ncmpcpp")) - (add-hook 'eshell-alias-load-hook + (add-hook! 'eshell-alias-load-hook (defun +eshell-init-aliases-h () (setq +eshell--default-aliases eshell-command-aliases-list eshell-command-aliases-list @@ -120,7 +120,7 @@ You should use `set-eshell-alias!' to change this.") (advice-add #'evil-collection-eshell-next-prompt-on-insert :override #'+eshell-goto-prompt-on-insert-a)) - (add-hook 'eshell-first-time-mode-hook + (add-hook! 'eshell-first-time-mode-hook (defun +eshell-init-keymap-h () ;; Keys must be bound in a hook because eshell resets its keymap every ;; time `eshell-mode' is enabled. Why? It is not for us mere mortals to diff --git a/modules/term/vterm/config.el b/modules/term/vterm/config.el index 58cb02183..c5d155b6b 100644 --- a/modules/term/vterm/config.el +++ b/modules/term/vterm/config.el @@ -9,7 +9,7 @@ (add-hook 'vterm-mode-hook #'doom-mark-buffer-as-real-h) ;; Automatically kill buffer when vterm exits. - (add-hook 'vterm-exit-functions + (add-hook! 'vterm-exit-functions (defun +vterm-kill-buffer-on-quit-fn (buffer) (if buffer (kill-buffer buffer)))) ;; Modeline serves no purpose in vterm diff --git a/modules/tools/direnv/config.el b/modules/tools/direnv/config.el index dd432e919..1993d8d26 100644 --- a/modules/tools/direnv/config.el +++ b/modules/tools/direnv/config.el @@ -10,7 +10,7 @@ (use-package! direnv :after-call (after-find-file dired-initial-position-hook) :config - (add-hook 'direnv-mode-hook + (add-hook! 'direnv-mode-hook (defun +direnv-init-h () "Instead of checking for direnv on `post-command-hook', check on buffer/window/frame switch, which is less expensive." @@ -23,7 +23,7 @@ buffer/window/frame switch, which is less expensive." ;; Fontify special .envrc keywords; it's a good indication of whether or not ;; we've typed them correctly. - (add-hook 'direnv-envrc-mode-hook + (add-hook! 'direnv-envrc-mode-hook (defun +direnv-envrc-fontify-keywords-h () (font-lock-add-keywords nil `((,(regexp-opt +direnv--keywords 'symbols) diff --git a/modules/tools/editorconfig/config.el b/modules/tools/editorconfig/config.el index 01b902857..7880c5efb 100644 --- a/modules/tools/editorconfig/config.el +++ b/modules/tools/editorconfig/config.el @@ -34,14 +34,14 @@ extension, try to guess one." ""))))) (funcall orig-fn))) - (add-hook 'editorconfig-after-apply-functions + (add-hook! 'editorconfig-after-apply-functions (defun +editorconfig-disable-ws-butler-maybe-h (props) "Disable `ws-butler-mode' if trim_trailing_whitespace is true." (when (and (equal (gethash 'trim_trailing_whitespace props) "true") (bound-and-true-p ws-butler-mode)) (ws-butler-mode -1)))) - (add-hook 'editorconfig-after-apply-functions + (add-hook! 'editorconfig-after-apply-functions (defun +editorconfig-disable-indent-detection-h (props) "Inhibit `dtrt-indent' if an explicit indent_style and indent_size is specified by editorconfig." diff --git a/modules/tools/eval/config.el b/modules/tools/eval/config.el index 6809e9038..23b28e80d 100644 --- a/modules/tools/eval/config.el +++ b/modules/tools/eval/config.el @@ -38,7 +38,7 @@ (insert output)) (setq quickrun-option-outputter quickrun--original-outputter)))) - (add-hook 'quickrun-after-run-hook + (add-hook! 'quickrun-after-run-hook (defun +eval-quickrun-shrink-window-h () "Shrink the quickrun output window once code evaluation is complete." (when-let (win (get-buffer-window quickrun--buffer-name)) @@ -46,7 +46,7 @@ (let ((ignore-window-parameters t)) (shrink-window-if-larger-than-buffer)))))) - (add-hook 'quickrun-after-run-hook + (add-hook! 'quickrun-after-run-hook (defun +eval-quickrun-scroll-to-bof-h () "Ensures window is scrolled to BOF on invocation." (when-let (win (get-buffer-window quickrun--buffer-name)) diff --git a/modules/tools/flycheck/config.el b/modules/tools/flycheck/config.el index 73e8c896e..538024b5e 100644 --- a/modules/tools/flycheck/config.el +++ b/modules/tools/flycheck/config.el @@ -15,7 +15,7 @@ errors.") ;; new-line checks are a mote excessive; idle checks are more than enough (delq! 'new-line flycheck-check-syntax-automatically) - (add-hook 'doom-escape-hook + (add-hook! 'doom-escape-hook (defun +flycheck-buffer-h () "Flycheck buffer on ESC in normal mode." (when flycheck-mode @@ -23,7 +23,7 @@ errors.") nil)) 'append) - (add-hook 'flycheck-after-syntax-check-hook + (add-hook! 'flycheck-after-syntax-check-hook (defun +flycheck-adjust-syntax-check-eagerness-h () "Check for errors less often when there aren't any. Done to reduce the load flycheck imposes on the current buffer." diff --git a/modules/tools/flyspell/config.el b/modules/tools/flyspell/config.el index 984d5dfdd..09bace57a 100644 --- a/modules/tools/flyspell/config.el +++ b/modules/tools/flyspell/config.el @@ -27,7 +27,7 @@ Since spellchecking can be slow in some buffers, this can be disabled with: (setq ispell-program-name "aspell" ispell-extra-args '("--sug-mode=ultra" "--run-together")) - (add-hook 'text-mode-hook + (add-hook! 'text-mode-hook (defun +flyspell-remove-run-together-switch-for-aspell-h () (setq-local ispell-extra-args (remove "--run-together" ispell-extra-args)))) @@ -51,7 +51,7 @@ Since spellchecking can be slow in some buffers, this can be disabled with: (when (featurep! +prog) (add-hook 'prog-mode-hook #'flyspell-prog-mode)) - (add-hook 'flyspell-mode-hook + (add-hook! 'flyspell-mode-hook (defun +flyspell-inhibit-duplicate-detection-maybe-h () "Don't mark duplicates when style/grammar linters are present. e.g. proselint and langtool." @@ -60,7 +60,7 @@ e.g. proselint and langtool." (featurep 'langtool)) (setq-local flyspell-mark-duplications-flag nil)))) - (add-hook 'flyspell-mode-hook + (add-hook! 'flyspell-mode-hook (defun +flyspell-immediately-h () "Spellcheck the buffer when `flyspell-mode' is enabled." (when (and flyspell-mode +flyspell-immediately) diff --git a/modules/ui/modeline/config.el b/modules/ui/modeline/config.el index 7956f5913..43d35bcdf 100644 --- a/modules/ui/modeline/config.el +++ b/modules/ui/modeline/config.el @@ -37,7 +37,7 @@ (add-hook '+doom-dashboard-mode-hook #'doom-modeline-set-project-modeline) - (add-hook 'magit-mode-hook + (add-hook! 'magit-mode-hook (defun +modeline-hide-in-non-status-buffer-h () "Show minimal modeline in magit-status buffer, no modeline elsewhere." (if (eq major-mode 'magit-status-mode) diff --git a/modules/ui/neotree/config.el b/modules/ui/neotree/config.el index b93165b98..f9a729427 100644 --- a/modules/ui/neotree/config.el +++ b/modules/ui/neotree/config.el @@ -45,7 +45,7 @@ ;; The cursor always sits at bol. `+neotree--fix-cursor-h' and ;; `+neotree--indent-cursor-a' change that behavior so that the cursor is ;; always on the first non-blank character on the line, in the neo buffer. - (add-hook 'neo-enter-hook + (add-hook! 'neo-enter-hook (defun +neotree-fix-cursor-h (&rest _) (with-current-buffer neo-global--buffer (+neotree*indent-cursor)))) diff --git a/modules/ui/tabbar/config.el b/modules/ui/tabbar/config.el index 34ad00954..8b8aa271d 100644 --- a/modules/ui/tabbar/config.el +++ b/modules/ui/tabbar/config.el @@ -8,7 +8,7 @@ centaur-tabs-set-modified-marker t) :config - (add-hook 'centaur-tabs-mode-hook + (add-hook! 'centaur-tabs-mode-hook (defun +tabbar-init-frames-h () (dolist (frame (frame-list)) (if (not centaur-tabs-mode) diff --git a/modules/ui/unicode/autoload.el b/modules/ui/unicode/autoload.el index 613291be8..279176d97 100644 --- a/modules/ui/unicode/autoload.el +++ b/modules/ui/unicode/autoload.el @@ -1,7 +1,7 @@ ;;; ui/unicode/autoload.el -*- lexical-binding: t; -*- ;;;###autoload -(add-hook 'doom-init-ui-hook +(add-hook! 'doom-init-ui-hook (defun +unicode-init-fonts-h () "Set up `unicode-fonts' to eventually run; accomodating the daemon, if necessary." diff --git a/modules/ui/workspaces/config.el b/modules/ui/workspaces/config.el index a9c88fc88..1ae2ca96b 100644 --- a/modules/ui/workspaces/config.el +++ b/modules/ui/workspaces/config.el @@ -176,7 +176,7 @@ stored in `persp-save-dir'.") ;; Fix #1017: stop session persistence from restoring a broken posframe (after! posframe - (add-hook 'persp-after-load-state-functions + (add-hook! 'persp-after-load-state-functions (defun +workspaces-delete-all-posframes-h (&rest _) (posframe-delete-all))))