Correct last inline hook defuns

See a3e262c7 for rationale
This commit is contained in:
Henrik Lissner 2019-07-28 14:52:59 +02:00
parent a354bba261
commit 19ecf8e46a
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
25 changed files with 39 additions and 39 deletions

View file

@ -58,7 +58,7 @@ Emacs.")
;; projectile's cache (into the hundreds of MBs). This purges those entries ;; projectile's cache (into the hundreds of MBs). This purges those entries
;; when exiting Emacs to prevent slowdowns/freezing when cache files are ;; when exiting Emacs to prevent slowdowns/freezing when cache files are
;; loaded or written to. ;; loaded or written to.
(add-hook 'kill-emacs-hook (add-hook! 'kill-emacs-hook
(defun doom-cleanup-project-cache-h () (defun doom-cleanup-project-cache-h ()
"Purge projectile cache entries that: "Purge projectile cache entries that:

View file

@ -297,7 +297,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(display-graphic-p)) (display-graphic-p))
(require 'ns-auto-titlebar nil t)) (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) (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 "On MacOS, the menu bar isn't part of the frame. Disabling it makes MacOS
treat Emacs as a non-application window." 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. ;; selection region harder to see while in evil visual mode.
(after! evil (after! evil
(defvar doom-buffer-hl-line-mode nil) (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 () (defun doom-disable-hl-line-h ()
(when hl-line-mode (when hl-line-mode
(setq-local doom-buffer-hl-line-mode t) (setq-local doom-buffer-hl-line-mode t)
(hl-line-mode -1)))) (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 () (defun doom-enable-hl-line-maybe-h ()
(when doom-buffer-hl-line-mode (when doom-buffer-hl-line-mode
(hl-line-mode +1)))))) (hl-line-mode +1))))))
@ -542,7 +542,7 @@ character that looks like a space that `whitespace-mode' won't affect.")
str)) str))
(setq nlinum-format-function #'doom-nlinum-format-fn) (setq nlinum-format-function #'doom-nlinum-format-fn)
(add-hook 'nlinum-mode-hook (add-hook! 'nlinum-mode-hook
(defun doom-init-nlinum-width-h () (defun doom-init-nlinum-width-h ()
"Calculate line number column width beforehand (optimization)." "Calculate line number column width beforehand (optimization)."
(setq nlinum--width (setq nlinum--width

View file

@ -42,7 +42,7 @@
(add-hook 'twittering-mode-hook #'solaire-mode)) (add-hook 'twittering-mode-hook #'solaire-mode))
;; Custom header-line for twitter buffers ;; Custom header-line for twitter buffers
(add-hook 'twittering-mode-hook (add-hook! 'twittering-mode-hook
(defun +twitter-switch-mode-and-header-line-h () (defun +twitter-switch-mode-and-header-line-h ()
(setq header-line-format mode-line-format (setq header-line-format mode-line-format
mode-line-format nil))) mode-line-format nil)))

View file

@ -123,7 +123,7 @@
:defer t :defer t
:config :config
(setq company-dict-dir (expand-file-name "dicts" doom-private-dir)) (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 _) (defun +company-enable-project-dicts-h (mode &rest _)
"Enable per-project dictionaries." "Enable per-project dictionaries."
(if (symbol-value mode) (if (symbol-value mode)

View file

@ -82,7 +82,7 @@ immediately runs it on the current candidate (ending the ivy session)."
(setq +ivy--origin (point-marker)))) (setq +ivy--origin (point-marker))))
(setq ivy-hooks-alist '((t . +ivy--record-position-maybe-fn))) (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 () (defun +ivy--set-jump-point-maybe-h ()
(when (and (markerp +ivy--origin) (when (and (markerp +ivy--origin)
(not (equal (with-ivy-window (point-marker)) +ivy--origin))) (not (equal (with-ivy-window (point-marker)) +ivy--origin)))

View file

@ -52,7 +52,7 @@
;; Smartparens' navigation feature is neat, but does not justify how ;; 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 ;; 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! ;; 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 () (defun doom-disable-smartparens-navigate-skip-match-h ()
(setq sp-navigate-skip-match nil (setq sp-navigate-skip-match nil
sp-navigate-consider-sgml-tags nil))) sp-navigate-consider-sgml-tags nil)))

View file

@ -10,7 +10,7 @@ current line.")
(after! electric (after! electric
(setq-default electric-indent-chars '(?\n ?\^?)) (setq-default electric-indent-chars '(?\n ?\^?))
(add-hook 'electric-indent-functions (add-hook! 'electric-indent-functions
(defun +electric-indent-char-fn (_c) (defun +electric-indent-char-fn (_c)
(when (and (eolp) +electric-indent-words) (when (and (eolp) +electric-indent-words)
(save-excursion (save-excursion

View file

@ -44,14 +44,14 @@
(global-git-commit-mode +1) (global-git-commit-mode +1)
(set-yas-minor-mode! 'git-commit-mode) (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 () (defun +vc-enforce-git-commit-conventions-h ()
"See https://chris.beams.io/posts/git-commit/" "See https://chris.beams.io/posts/git-commit/"
(setq fill-column 72 (setq fill-column 72
git-commit-summary-max-length 50 git-commit-summary-max-length 50
git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line)))) 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 () (defun +vc-start-in-insert-state-maybe ()
"Start git-commit-mode in insert state if in a blank commit message, "Start git-commit-mode in insert state if in a blank commit message,
otherwise in default state." otherwise in default state."

View file

@ -46,7 +46,7 @@
;; rather than the *cider-repl* buffer. How silly. We might want to see that ;; 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 ;; 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. ;; 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 () (defun +clojure--cider-dump-nrepl-server-log-h ()
"Copy contents of *nrepl-server* to beginning of *cider-repl*." "Copy contents of *nrepl-server* to beginning of *cider-repl*."
(save-excursion (save-excursion

View file

@ -53,7 +53,7 @@
if (buffer-local-value 'sly-mode buf) if (buffer-local-value 'sly-mode buf)
collect buf))))) collect buf)))))
(add-hook 'sly-mode-hook (add-hook! 'sly-mode-hook
(defun +common-lisp-init-sly-h () (defun +common-lisp-init-sly-h ()
"Attempt to auto-start sly when opening a lisp buffer." "Attempt to auto-start sly when opening a lisp buffer."
(cond ((or (doom-temp-buffer-p (current-buffer)) (cond ((or (doom-temp-buffer-p (current-buffer))

View file

@ -4,7 +4,7 @@
(use-package! intero (use-package! intero
:commands intero-mode :commands intero-mode
:init :init
(add-hook 'haskell-mode-local-vars-hook (add-hook! 'haskell-mode-local-vars-hook
(defun +haskell-init-intero-h () (defun +haskell-init-intero-h ()
"Initializes `intero-mode' in haskell-mode, unless stack isn't installed. "Initializes `intero-mode' in haskell-mode, unless stack isn't installed.
This is necessary because `intero-mode' doesn't do its own error checks." This is necessary because `intero-mode' doesn't do its own error checks."

View file

@ -10,7 +10,7 @@
;; happen once. ;; happen once.
;; ;;
;; rust-mode is still required for `racer'. ;; rust-mode is still required for `racer'.
(add-hook 'rust-mode-hook (add-hook! 'rust-mode-hook
(defun +rust-init-h () (defun +rust-init-h ()
"Switch to `rustic-mode', if it's available." "Switch to `rustic-mode', if it's available."
(when (require 'rustic nil t) (when (require 'rustic nil t)

View file

@ -35,7 +35,7 @@
;; 1. Fontifies variables in double quotes ;; 1. Fontifies variables in double quotes
;; 2. Fontify command substitution in double quotes ;; 2. Fontify command substitution in double quotes
;; 3. Fontify built-in/common commands (see `+sh-builtin-keywords') ;; 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 () (defun +sh-init-extra-fontification-h ()
(font-lock-add-keywords (font-lock-add-keywords
nil `((+sh--match-variables-in-quotes 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)) (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... ;; 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 () (defun +sh-detect-zsh-h ()
(when (or (and buffer-file-name (when (or (and buffer-file-name
(string-match-p "\\.zsh\\'" buffer-file-name)) (string-match-p "\\.zsh\\'" buffer-file-name))

View file

@ -88,12 +88,12 @@ You should use `set-eshell-alias!' to change this.")
(add-hook 'persp-before-switch-functions #'+eshell-save-workspace-fn)) (add-hook 'persp-before-switch-functions #'+eshell-save-workspace-fn))
;; UI enhancements ;; UI enhancements
(add-hook 'eshell-mode-hook (add-hook! 'eshell-mode-hook
(defun +eshell-remove-fringes-h () (defun +eshell-remove-fringes-h ()
(set-window-fringes nil 0 0) (set-window-fringes nil 0 0)
(set-window-margins nil 1 nil))) (set-window-margins nil 1 nil)))
(add-hook 'eshell-mode-hook (add-hook! 'eshell-mode-hook
(defun +eshell-enable-text-wrapping-h () (defun +eshell-enable-text-wrapping-h ()
(visual-line-mode +1) (visual-line-mode +1)
(set-display-table-slot standard-display-table 0 ?\ ))) (set-display-table-slot standard-display-table 0 ?\ )))
@ -109,7 +109,7 @@ You should use `set-eshell-alias!' to change this.")
(after! em-term (after! em-term
(pushnew! eshell-visual-commands "tmux" "htop" "vim" "nvim" "ncmpcpp")) (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 () (defun +eshell-init-aliases-h ()
(setq +eshell--default-aliases eshell-command-aliases-list (setq +eshell--default-aliases eshell-command-aliases-list
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 (advice-add #'evil-collection-eshell-next-prompt-on-insert
:override #'+eshell-goto-prompt-on-insert-a)) :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 () (defun +eshell-init-keymap-h ()
;; Keys must be bound in a hook because eshell resets its keymap every ;; 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 ;; time `eshell-mode' is enabled. Why? It is not for us mere mortals to

View file

@ -9,7 +9,7 @@
(add-hook 'vterm-mode-hook #'doom-mark-buffer-as-real-h) (add-hook 'vterm-mode-hook #'doom-mark-buffer-as-real-h)
;; Automatically kill buffer when vterm exits. ;; Automatically kill buffer when vterm exits.
(add-hook 'vterm-exit-functions (add-hook! 'vterm-exit-functions
(defun +vterm-kill-buffer-on-quit-fn (buffer) (defun +vterm-kill-buffer-on-quit-fn (buffer)
(if buffer (kill-buffer buffer)))) (if buffer (kill-buffer buffer))))
;; Modeline serves no purpose in vterm ;; Modeline serves no purpose in vterm

View file

@ -10,7 +10,7 @@
(use-package! direnv (use-package! direnv
:after-call (after-find-file dired-initial-position-hook) :after-call (after-find-file dired-initial-position-hook)
:config :config
(add-hook 'direnv-mode-hook (add-hook! 'direnv-mode-hook
(defun +direnv-init-h () (defun +direnv-init-h ()
"Instead of checking for direnv on `post-command-hook', check on "Instead of checking for direnv on `post-command-hook', check on
buffer/window/frame switch, which is less expensive." 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 ;; Fontify special .envrc keywords; it's a good indication of whether or not
;; we've typed them correctly. ;; we've typed them correctly.
(add-hook 'direnv-envrc-mode-hook (add-hook! 'direnv-envrc-mode-hook
(defun +direnv-envrc-fontify-keywords-h () (defun +direnv-envrc-fontify-keywords-h ()
(font-lock-add-keywords (font-lock-add-keywords
nil `((,(regexp-opt +direnv--keywords 'symbols) nil `((,(regexp-opt +direnv--keywords 'symbols)

View file

@ -34,14 +34,14 @@ extension, try to guess one."
""))))) "")))))
(funcall orig-fn))) (funcall orig-fn)))
(add-hook 'editorconfig-after-apply-functions (add-hook! 'editorconfig-after-apply-functions
(defun +editorconfig-disable-ws-butler-maybe-h (props) (defun +editorconfig-disable-ws-butler-maybe-h (props)
"Disable `ws-butler-mode' if trim_trailing_whitespace is true." "Disable `ws-butler-mode' if trim_trailing_whitespace is true."
(when (and (equal (gethash 'trim_trailing_whitespace props) "true") (when (and (equal (gethash 'trim_trailing_whitespace props) "true")
(bound-and-true-p ws-butler-mode)) (bound-and-true-p ws-butler-mode))
(ws-butler-mode -1)))) (ws-butler-mode -1))))
(add-hook 'editorconfig-after-apply-functions (add-hook! 'editorconfig-after-apply-functions
(defun +editorconfig-disable-indent-detection-h (props) (defun +editorconfig-disable-indent-detection-h (props)
"Inhibit `dtrt-indent' if an explicit indent_style and indent_size is "Inhibit `dtrt-indent' if an explicit indent_style and indent_size is
specified by editorconfig." specified by editorconfig."

View file

@ -38,7 +38,7 @@
(insert output)) (insert output))
(setq quickrun-option-outputter quickrun--original-outputter)))) (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 () (defun +eval-quickrun-shrink-window-h ()
"Shrink the quickrun output window once code evaluation is complete." "Shrink the quickrun output window once code evaluation is complete."
(when-let (win (get-buffer-window quickrun--buffer-name)) (when-let (win (get-buffer-window quickrun--buffer-name))
@ -46,7 +46,7 @@
(let ((ignore-window-parameters t)) (let ((ignore-window-parameters t))
(shrink-window-if-larger-than-buffer)))))) (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 () (defun +eval-quickrun-scroll-to-bof-h ()
"Ensures window is scrolled to BOF on invocation." "Ensures window is scrolled to BOF on invocation."
(when-let (win (get-buffer-window quickrun--buffer-name)) (when-let (win (get-buffer-window quickrun--buffer-name))

View file

@ -15,7 +15,7 @@ errors.")
;; new-line checks are a mote excessive; idle checks are more than enough ;; new-line checks are a mote excessive; idle checks are more than enough
(delq! 'new-line flycheck-check-syntax-automatically) (delq! 'new-line flycheck-check-syntax-automatically)
(add-hook 'doom-escape-hook (add-hook! 'doom-escape-hook
(defun +flycheck-buffer-h () (defun +flycheck-buffer-h ()
"Flycheck buffer on ESC in normal mode." "Flycheck buffer on ESC in normal mode."
(when flycheck-mode (when flycheck-mode
@ -23,7 +23,7 @@ errors.")
nil)) nil))
'append) 'append)
(add-hook 'flycheck-after-syntax-check-hook (add-hook! 'flycheck-after-syntax-check-hook
(defun +flycheck-adjust-syntax-check-eagerness-h () (defun +flycheck-adjust-syntax-check-eagerness-h ()
"Check for errors less often when there aren't any. "Check for errors less often when there aren't any.
Done to reduce the load flycheck imposes on the current buffer." Done to reduce the load flycheck imposes on the current buffer."

View file

@ -27,7 +27,7 @@ Since spellchecking can be slow in some buffers, this can be disabled with:
(setq ispell-program-name "aspell" (setq ispell-program-name "aspell"
ispell-extra-args '("--sug-mode=ultra" "--run-together")) 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 () (defun +flyspell-remove-run-together-switch-for-aspell-h ()
(setq-local ispell-extra-args (remove "--run-together" ispell-extra-args)))) (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) (when (featurep! +prog)
(add-hook 'prog-mode-hook #'flyspell-prog-mode)) (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 () (defun +flyspell-inhibit-duplicate-detection-maybe-h ()
"Don't mark duplicates when style/grammar linters are present. "Don't mark duplicates when style/grammar linters are present.
e.g. proselint and langtool." e.g. proselint and langtool."
@ -60,7 +60,7 @@ e.g. proselint and langtool."
(featurep 'langtool)) (featurep 'langtool))
(setq-local flyspell-mark-duplications-flag nil)))) (setq-local flyspell-mark-duplications-flag nil))))
(add-hook 'flyspell-mode-hook (add-hook! 'flyspell-mode-hook
(defun +flyspell-immediately-h () (defun +flyspell-immediately-h ()
"Spellcheck the buffer when `flyspell-mode' is enabled." "Spellcheck the buffer when `flyspell-mode' is enabled."
(when (and flyspell-mode +flyspell-immediately) (when (and flyspell-mode +flyspell-immediately)

View file

@ -37,7 +37,7 @@
(add-hook '+doom-dashboard-mode-hook #'doom-modeline-set-project-modeline) (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 () (defun +modeline-hide-in-non-status-buffer-h ()
"Show minimal modeline in magit-status buffer, no modeline elsewhere." "Show minimal modeline in magit-status buffer, no modeline elsewhere."
(if (eq major-mode 'magit-status-mode) (if (eq major-mode 'magit-status-mode)

View file

@ -45,7 +45,7 @@
;; The cursor always sits at bol. `+neotree--fix-cursor-h' and ;; The cursor always sits at bol. `+neotree--fix-cursor-h' and
;; `+neotree--indent-cursor-a' change that behavior so that the cursor is ;; `+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. ;; 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 _) (defun +neotree-fix-cursor-h (&rest _)
(with-current-buffer neo-global--buffer (with-current-buffer neo-global--buffer
(+neotree*indent-cursor)))) (+neotree*indent-cursor))))

View file

@ -8,7 +8,7 @@
centaur-tabs-set-modified-marker t) centaur-tabs-set-modified-marker t)
:config :config
(add-hook 'centaur-tabs-mode-hook (add-hook! 'centaur-tabs-mode-hook
(defun +tabbar-init-frames-h () (defun +tabbar-init-frames-h ()
(dolist (frame (frame-list)) (dolist (frame (frame-list))
(if (not centaur-tabs-mode) (if (not centaur-tabs-mode)

View file

@ -1,7 +1,7 @@
;;; ui/unicode/autoload.el -*- lexical-binding: t; -*- ;;; ui/unicode/autoload.el -*- lexical-binding: t; -*-
;;;###autoload ;;;###autoload
(add-hook 'doom-init-ui-hook (add-hook! 'doom-init-ui-hook
(defun +unicode-init-fonts-h () (defun +unicode-init-fonts-h ()
"Set up `unicode-fonts' to eventually run; accomodating the daemon, if "Set up `unicode-fonts' to eventually run; accomodating the daemon, if
necessary." necessary."

View file

@ -176,7 +176,7 @@ stored in `persp-save-dir'.")
;; Fix #1017: stop session persistence from restoring a broken posframe ;; Fix #1017: stop session persistence from restoring a broken posframe
(after! posframe (after! posframe
(add-hook 'persp-after-load-state-functions (add-hook! 'persp-after-load-state-functions
(defun +workspaces-delete-all-posframes-h (&rest _) (defun +workspaces-delete-all-posframes-h (&rest _)
(posframe-delete-all)))) (posframe-delete-all))))