Implement `with-eval-after-loads' macro
This commit is contained in:
parent
8d8e56272e
commit
4b3ebd99a0
26
init.el
26
init.el
|
@ -1009,15 +1009,14 @@ if ripgrep is installed, otherwise `consult-grep'."
|
||||||
(:advise completing-read-multiple
|
(:advise completing-read-multiple
|
||||||
:filter-args #'crm-indicator))
|
:filter-args #'crm-indicator))
|
||||||
|
|
||||||
(with-eval-after-load 'vertico
|
(with-eval-after-loads (vertico consult)
|
||||||
(with-eval-after-load 'consult
|
(when (boundp 'consult-crm-map)
|
||||||
(when (boundp 'consult-crm-map)
|
(define-key consult-crm-map "\r" #'+vertico-crm-exit)
|
||||||
(define-key consult-crm-map "\r" #'+vertico-crm-exit)
|
(define-key consult-crm-map "\t" #'vertico-exit)
|
||||||
(define-key consult-crm-map "\t" #'vertico-exit)
|
(defun +vertico-crm-exit ()
|
||||||
(defun +vertico-crm-exit ()
|
(interactive)
|
||||||
(interactive)
|
(run-at-time 0 nil #'vertico-exit)
|
||||||
(run-at-time 0 nil #'vertico-exit)
|
(funcall #'vertico-exit)))))
|
||||||
(funcall #'vertico-exit))))))
|
|
||||||
|
|
||||||
(setup (:straight crux)
|
(setup (:straight crux)
|
||||||
|
|
||||||
|
@ -1089,11 +1088,10 @@ if ripgrep is installed, otherwise `consult-grep'."
|
||||||
#'which-key--hide-popup-ignore-command)
|
#'which-key--hide-popup-ignore-command)
|
||||||
embark-become-indicator embark-action-indicator)
|
embark-become-indicator embark-action-indicator)
|
||||||
|
|
||||||
(with-eval-after-load 'embark
|
(with-eval-after-loads (embark consult)
|
||||||
(with-eval-after-load 'consult
|
(setup (:straight embark-consult)
|
||||||
(setup (:straight embark-consult)
|
(add-hook 'embark-collect-mode-hook
|
||||||
(add-hook 'embark-collect-mode-hook
|
#'consult-preview-at-point-mode))))
|
||||||
#'consult-preview-at-point-mode)))))
|
|
||||||
|
|
||||||
(setup (:straight epithet)
|
(setup (:straight epithet)
|
||||||
(add-hook 'Info-selection-hook #'epithet-rename-buffer)
|
(add-hook 'Info-selection-hook #'epithet-rename-buffer)
|
||||||
|
|
16
lisp/acdw.el
16
lisp/acdw.el
|
@ -108,6 +108,22 @@ is unfocused."
|
||||||
,@body)
|
,@body)
|
||||||
(message "%s... Done." ,message)))
|
(message "%s... Done." ,message)))
|
||||||
|
|
||||||
|
(defmacro with-eval-after-loads (files &rest body)
|
||||||
|
"Execute BODY after FILES are loaded.
|
||||||
|
This macro simplifies `with-eval-after-load' for multiple nested
|
||||||
|
features."
|
||||||
|
(declare (indent 1) (debug (form def-body)))
|
||||||
|
(waterfall-list 'with-eval-after-load files body))
|
||||||
|
|
||||||
|
(defun waterfall-list (car list rest)
|
||||||
|
"Cons CAR with each element in LIST in a waterfall fashion, end with REST.
|
||||||
|
For use with the `with-eval-after-loads' function."
|
||||||
|
(cond ((atom list) `(,car ',list ,@rest))
|
||||||
|
((= 1 (length list)) `(,car ',(car list) ,@rest))
|
||||||
|
(t
|
||||||
|
`(,car ',(car list)
|
||||||
|
,(waterfall-list car (cdr list) rest)))))
|
||||||
|
|
||||||
|
|
||||||
;;; Comment-or-uncomment-sexp
|
;;; Comment-or-uncomment-sexp
|
||||||
;; from https://endlessparentheses.com/a-comment-or-uncomment-sexp-command.html
|
;; from https://endlessparentheses.com/a-comment-or-uncomment-sexp-command.html
|
||||||
|
|
Loading…
Reference in New Issue