Use add-hook! for inline hook defuns

This commit is contained in:
Henrik Lissner 2019-07-26 22:46:05 +02:00
parent fe5d285a50
commit 09d13fd60d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 10 additions and 10 deletions

View file

@ -59,7 +59,7 @@ directives. By default, this only recognizes C directives.")
(advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1))) (advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1)))
;; Done in a hook to ensure the popup rules load as late as possible ;; Done in a hook to ensure the popup rules load as late as possible
(add-hook 'doom-init-modules-hook (add-hook! 'doom-init-modules-hook
(defun +evil--init-popup-rules-h () (defun +evil--init-popup-rules-h ()
(set-popup-rules! (set-popup-rules!
'(("^\\*evil-registers" :size 0.3) '(("^\\*evil-registers" :size 0.3)
@ -71,7 +71,7 @@ directives. By default, this only recognizes C directives.")
(defvar +evil--default-cursor-color "#ffffff") (defvar +evil--default-cursor-color "#ffffff")
(defvar +evil--emacs-cursor-color "#ff9999") (defvar +evil--emacs-cursor-color "#ff9999")
(add-hook 'doom-load-theme-hook (add-hook! 'doom-load-theme-hook
(defun +evil-update-cursor-color-h () (defun +evil-update-cursor-color-h ()
(setq +evil--default-cursor-color (face-background 'cursor) (setq +evil--default-cursor-color (face-background 'cursor)
+evil--emacs-cursor-color (face-foreground 'warning)))) +evil--emacs-cursor-color (face-foreground 'warning))))
@ -90,7 +90,7 @@ directives. By default, this only recognizes C directives.")
;; `evil-delete' in wgrep buffers. ;; `evil-delete' in wgrep buffers.
(define-key wgrep-mode-map [remap evil-delete] #'+evil-delete)) (define-key wgrep-mode-map [remap evil-delete] #'+evil-delete))
(add-hook 'doom-escape-hook (add-hook! 'doom-escape-hook
(defun +evil-disable-ex-highlights-h () (defun +evil-disable-ex-highlights-h ()
"Disable ex search buffer highlights." "Disable ex search buffer highlights."
(when (evil-ex-hl-active-p 'evil-ex-search) (when (evil-ex-hl-active-p 'evil-ex-search)
@ -101,7 +101,7 @@ directives. By default, this only recognizes C directives.")
;; --- evil hacks ------------------------- ;; --- evil hacks -------------------------
(unless noninteractive (unless noninteractive
(setq save-silently t) (setq save-silently t)
(add-hook 'after-save-hook (add-hook! 'after-save-hook
(defun +evil-display-vimlike-save-message-h () (defun +evil-display-vimlike-save-message-h ()
"Shorter, vim-esque save messages." "Shorter, vim-esque save messages."
(message "\"%s\" %dL, %dC written" (message "\"%s\" %dL, %dC written"
@ -264,7 +264,7 @@ directives. By default, this only recognizes C directives.")
(use-package! evil-exchange (use-package! evil-exchange
:commands evil-exchange :commands evil-exchange
:config :config
(add-hook 'doom-escape-hook (add-hook! 'doom-escape-hook
(defun +evil--escape-exchange-h () (defun +evil--escape-exchange-h ()
(when evil-exchange--overlays (when evil-exchange--overlays
(evil-exchange-cancel) (evil-exchange-cancel)

View file

@ -234,7 +234,7 @@ underlying, modified buffer. This fixes that."
(when (bound-and-true-p org-capture-is-refiling) (when (bound-and-true-p org-capture-is-refiling)
(org-save-all-org-buffers))) (org-save-all-org-buffers)))
(add-hook 'org-capture-mode-hook (add-hook! 'org-capture-mode-hook
(defun +org-show-target-in-capture-header-h () (defun +org-show-target-in-capture-header-h ()
(setq header-line-format (setq header-line-format
(format "%s%s%s" (format "%s%s%s"
@ -408,7 +408,7 @@ file isn't in `org-directory'."
(defvar +org-habit-graph-window-ratio 0.3 (defvar +org-habit-graph-window-ratio 0.3
"The ratio of the consistency graphs relative to the window width") "The ratio of the consistency graphs relative to the window width")
(add-hook 'org-agenda-mode-hook (add-hook! 'org-agenda-mode-hook
(defun +org-habit-resize-graph-h () (defun +org-habit-resize-graph-h ()
"Right align and resize the consistency graphs based on "Right align and resize the consistency graphs based on
`+org-habit-graph-window-ratio'" `+org-habit-graph-window-ratio'"
@ -439,7 +439,7 @@ file isn't in `org-directory'."
;; Therefore, don't highlight when creating a sparse tree. ;; Therefore, don't highlight when creating a sparse tree.
(setq org-highlight-sparse-tree-matches nil) (setq org-highlight-sparse-tree-matches nil)
(add-hook 'org-follow-link-hook (add-hook! 'org-follow-link-hook
(defun +org-delayed-recenter-h () (defun +org-delayed-recenter-h ()
"`recenter', but after a tiny delay. Necessary to prevent certain race "`recenter', but after a tiny delay. Necessary to prevent certain race
conditions where a window's buffer hasn't changed at the time this hook is run." conditions where a window's buffer hasn't changed at the time this hook is run."
@ -461,7 +461,7 @@ eldoc string."
nil 'face `(:foreground ,(face-foreground face nil t) :weight bold))) nil 'face `(:foreground ,(face-foreground face nil t) :weight bold)))
separator))) separator)))
(add-hook 'org-agenda-finalize-hook (add-hook! 'org-agenda-finalize-hook
(defun +org-exclude-agenda-buffers-from-workspace-h () (defun +org-exclude-agenda-buffers-from-workspace-h ()
"Prevent from temporarily-opened agenda buffers from being associated with "Prevent from temporarily-opened agenda buffers from being associated with
the current workspace." the current workspace."

View file

@ -8,7 +8,7 @@
(setq ob-ipython-resources-dir ".ob-ipython-resrc") (setq ob-ipython-resources-dir ".ob-ipython-resrc")
(add-hook '+org-babel-load-functions (add-hook! '+org-babel-load-functions
(defun +org-babel-load-ipython-h (lang) (defun +org-babel-load-ipython-h (lang)
(and (string-prefix-p "jupyter-" (symbol-name lang)) (and (string-prefix-p "jupyter-" (symbol-name lang))
(require 'ob-ipython nil t)))) (require 'ob-ipython nil t))))