jwiegley / use-package

A use-package declaration for simplifying your .emacs
https://jwiegley.github.io/use-package
GNU General Public License v3.0
4.37k stars 260 forks source link

discuss: when/if keyword #1067

Open seagle0128 opened 6 months ago

seagle0128 commented 6 months ago

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)
    ))
sjrmanning commented 3 months ago

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.