Subject: bug#72293: closed (Re: bug#72453: 29.4; "use-package" macro does not load all expected related files)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 20 Aug 2024 00:01:03 +0000

Your bug report

#72453: 29.4; use-package-ensure does not get autoloaded (in time?)

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
72453: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72453
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#72453: 29.4; "use-package" macro does not load all expected related files
From: Stefan Kangas <[email-masked]>
To: Derek Upham <[email-masked]>
Cc: [email-masked]
Date: Mon, 19 Aug 2024 16:58:22 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 31.1

Derek Upham <[email-masked]> writes:

> I’m seeing the outputs that we expect:
>
>  Warning (emacs): use-package-ensure-trace faces (t) nil
>  Warning (emacs): use-package-ensure-trace ansi-color (t) nil
>  Warning (emacs): use-package-ensure-trace files (t) nil
>  Warning (emacs): use-package-ensure-trace rx (t) nil
>  Warning (emacs): use-package-ensure-trace avoid (t) nil

Thanks for testing.

So I've pushed this to master as commit 644d2a83316.  I'm consequently
closing this bug report.

Subject: 29.4; use-package-ensure does not get autoloaded (in time?)
From: Thalis Charakas <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Thu, 25 Jul 2024 16:09:44 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

The variable `use-package-always-ensure` cannot be used reliably in
init.el or early-init.el without adding the line `(require
'use-package-ensure)` or `(require 'use-package)`.

I tested the following init.el files, each time with a completely empty
.emacs.d directory. Note that I'm using which-key as an example of a
package that is not included in Emacs (29.4), the same results happened with
other packages. What I include in this report is the entirety of the
init.el files tested.

The following init.el file failed to download which-key:

(setq use-package-always-ensure t)
(use-package which-key
  :init
  (setq which-key-idle-delay 0.1)
  :config
  (which-key-mode))

With the error:

⛔ Error (use-package): Cannot load which-key

Even when putting `(setq use-package-always-ensure t)` in an
early-init.el and having only that line in it, and having only the
`use-package` statement in the init.el

The following init.el files downloaded which-key:

1.

(use-package which-key
  :ensure t
  :init
  (setq which-key-idle-delay 0.1)
  :config
  (which-key-mode))

2.

(setq use-package-always-ensure t)
(use-package which-key ;; after 30 will be in
  :ensure t
  :init
  (setq which-key-idle-delay 0.1)
  :config
  (which-key-mode))

3.

(require 'use-package-ensure)
(setq use-package-always-ensure t)
(use-package which-key
  :init
  (setq which-key-idle-delay 0.1)
  :config
  (which-key-mode))

4.

(require 'use-package)
(setq use-package-always-ensure t)
(use-package which-key ;; after 30 will be in
  :init
  (setq which-key-idle-delay 0.1)
  :config
  (which-key-mode))

The reason I consider this a bug is because in my real much bigger
init.el, which does not require `use-package-ensure` or `use-package`,
when opening Emacs with nothing else in the .emacs.d directory, some
packages get downloaded and some don't. This makes me think that at some
point `use-package-ensure` gets loaded. Also since `use-package` is
autoloaded, requiring it should not make a difference.

The user jmml in the #emacs IRC channel found that requiring
`use-package-ensure` or `use-package` fixes the problem.

In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
 cairo version 1.16.0) of 2024-07-22, modified by Debian built on
 x86-ubc-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12201009
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/reproducible-path/emacs-29.4+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: el_GR.UTF-8
  value of $LC_NUMERIC: el_GR.UTF-8
  value of $LC_TIME: el_GR.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra
help-mode bytecomp byte-compile cl-lib sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 77029 12726)
 (symbols 48 7140 0)
 (strings 32 19388 1382)
 (string-bytes 1 591546)
 (vectors 16 15412)
 (vector-slots 8 325849 20050)
 (floats 8 27 46)
 (intervals 56 281 0)
 (buffers 984 11))