Open emacksnotes opened 1 year ago
Here is another variation of the above advice
... This uses eval
.
(use-package use-package
:config (advice-add 'pp-macroexpand-last-sexp :around
(defun pp-macroexpand-last-sexp--around
(orig-fun &rest orig-args)
(pcase-let*
((`(,arg)
orig-args)
(sexp (pp-last-sexp))
(env (append
(when (eq 'use-package (car sexp))
`((byte-compile-current-file ,(yes-or-no-p "Byte compilation"))
(use-package-expand-minimally ,(yes-or-no-p "Minimal")))))))
(eval `(let ,env
(if ',arg
(save-excursion
(insert "\n\n")
(apply ',orig-fun ',orig-args))
(apply ',orig-fun ',orig-args))))))))
Not a issue but a recipe ...
I wonder what variables apart from
byte-compile-current-file
affects the macroexpansion ofuse-package
. If there are other such variables, they can be prompted for and plugged in to theenv
bindings below.Slightly formalized the goings on in https://github.com/jwiegley/use-package/issues/1032
Create a quick binding for the above command
Insert the following in to
*scratch*
bufferPut the cursor after any of the above two forms and do
C-u C-c C-c
and see what happens ...For example, for
byte compilation
andminimal
scenario I getFor
no byte-compiled
, andminimal
scenario, I get