jwiegley/use-package

discuss: when/if keyword

seagle0128 opened this issue · 1 comments

Think about this snippet

(use-package vertico-posframe
  :when (display-graphic-p))

According to the current design, the snippet will expand to

(progn
  (use-package-ensure-elpa 'vertico-posframe
                           '(t)
                           'nil)
  (when
      (display-graphic-p)))

But, I think it's better expand to below,, so that the package will not be installed in TUI. Does it make sense?

(progn
   (when
      (display-graphic-p)
          (use-package-ensure-elpa 'vertico-posframe
                           '(t)
                           'nil)
    ))

Yeah this seems like a bug. I think this used to work, but it definitely doesn't now. I use :if (display-graphic-p) a lot but packages are still being loaded in my terminal emacs.