use-package icon indicating copy to clipboard operation
use-package copied to clipboard

:ensure does not work with byte-compiled .emacs

Open ywwry66 opened this issue 5 years ago • 1 comments

I have these lines near the top of my .emacs file:

<...some code about package.el...>
(package-initialize)
(eval-when-compile
  (require 'use-package))
(require 'use-package-ensure)
(setq use-package-always-ensure t)
(use-package diminish :demand t)

If I manually delete 'diminish package, I would expect it to be reinstalled automatically upon loading .emacs, since use-package-always-ensure is set to t.

This works as expected if .emacs is not byte-compiled.

When .emacs is byte-compiled, I got error message "Error (use-package): Cannot load diminish", and 'diminish was not downloaded to my disk. If I then evaluate (use-package-ensure-elpa 'diminish '(t) '(:demand t) (as the code in macro expansion suggests), 'diminish gets installed normally.

I was wondering if I am missing something or this is a bug.

ywwry66 avatar May 09 '20 09:05 ywwry66

In general, it boosts startup speed of emacs if you have lots of custom functions in your .emacs. I guess this does not conflicts with the philosophy of use-package.

Here I just do it for fun since my .emacs file is quite compact.

On Aug 27, 2020, at 10:52 AM, D.K. [email protected] wrote:

What's the reason to use byte compilation with use-package?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jwiegley/use-package/issues/839#issuecomment-682099315, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3AP3ITVLE33AFDF7G77N3SC2MMRANCNFSM4M4XL7MA.

ywwry66 avatar Aug 27 '20 18:08 ywwry66