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
|
||||
:filter-args #'crm-indicator))
|
||||
|
||||
(with-eval-after-load 'vertico
|
||||
(with-eval-after-load 'consult
|
||||
(when (boundp 'consult-crm-map)
|
||||
(define-key consult-crm-map "\r" #'+vertico-crm-exit)
|
||||
(define-key consult-crm-map "\t" #'vertico-exit)
|
||||
(defun +vertico-crm-exit ()
|
||||
(interactive)
|
||||
(run-at-time 0 nil #'vertico-exit)
|
||||
(funcall #'vertico-exit))))))
|
||||
(with-eval-after-loads (vertico consult)
|
||||
(when (boundp 'consult-crm-map)
|
||||
(define-key consult-crm-map "\r" #'+vertico-crm-exit)
|
||||
(define-key consult-crm-map "\t" #'vertico-exit)
|
||||
(defun +vertico-crm-exit ()
|
||||
(interactive)
|
||||
(run-at-time 0 nil #'vertico-exit)
|
||||
(funcall #'vertico-exit)))))
|
||||
|
||||
(setup (:straight crux)
|
||||
|
||||
|
@ -1089,11 +1088,10 @@ if ripgrep is installed, otherwise `consult-grep'."
|
|||
#'which-key--hide-popup-ignore-command)
|
||||
embark-become-indicator embark-action-indicator)
|
||||
|
||||
(with-eval-after-load 'embark
|
||||
(with-eval-after-load 'consult
|
||||
(setup (:straight embark-consult)
|
||||
(add-hook 'embark-collect-mode-hook
|
||||
#'consult-preview-at-point-mode)))))
|
||||
(with-eval-after-loads (embark consult)
|
||||
(setup (:straight embark-consult)
|
||||
(add-hook 'embark-collect-mode-hook
|
||||
#'consult-preview-at-point-mode))))
|
||||
|
||||
(setup (:straight epithet)
|
||||
(add-hook 'Info-selection-hook #'epithet-rename-buffer)
|
||||
|
|
16
lisp/acdw.el
16
lisp/acdw.el
|
@ -108,6 +108,22 @@ is unfocused."
|
|||
,@body)
|
||||
(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
|
||||
;; from https://endlessparentheses.com/a-comment-or-uncomment-sexp-command.html
|
||||
|
|
Loading…
Reference in New Issue