0

I have installed Emacs 28 with snap from https://snapcraft.io/install/emacs-28. My init.el is configured using use-package. However, I get the following errors when I try to install and load custom packages with use-package. Suppose I have the following.

(use-package async
  :functions async-bytecomp-package-mode
  :commands async-bytecomp-package-mode
  :init (async-bytecomp-package-mode 1))

This is the error I get.

Warning (initialization): An error occurred while loading `/home/swarnendu/.emacs.d/init.el':

File is missing: Cannot open load file, No such file or directory, ../../../../.emacs.d/elpa/async-20210823.528/async-bytecomp

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace. Disable showing Disable logging

This happens regularly for several packages I have added. The package installations continue when I disable the problematic packages with :disabled t, but the problem then arises for some other package.

Warning (initialization): An error occurred while loading `/home/swarnendu/.emacs.d/init.el':

File is missing: Cannot open load file, No such file or directory, ../../../../.emacs.d/elpa/anzu-20211002.2255/anzu

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace. Disable showing Disable logging

This is what I get with /snap/bin/emacs -nw --debug-init. Note that the files .emacs.d/elpa/anzu-20211002.2255/anzu* exist.

swarnendu:~$
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory"
"../../../../.emacs.d/elpa/anzu-20211002.2255/anzu")
  (global-anzu-mode 1)
  load-with-code-conversion("/home/swarnendu/.emacs.d/init.el" "/home/swarnendu/.emacs.d/init.el" t t)
  load("/home/swarnendu/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0xf4340e0e34e19f6>) #f(compiled-function () #<bytecode
-0x1f3c686ddc0cd5f5>) t)
  command-line()
  normal-top-level()

This problem arises on multiple systems with Emacs 28, but the same config works with Emacs 27.

UPDATE: Dec 10, 2021

Emacs loads if I comment all use-package lines like :init (global-anzu-mode 1) and :hook (ibuffer . ibuffer-projectile-set-filter-groups). However, the error appears when I try to enable the modes manually.

UPDATE: Dec 29, 2021

The issue appears with Emacs 28 pretest built from source, but I can run Doom Emacs successfully. My guess is that the path ../../../../.emacs.d/elpa/anzu-20211002.2255/anzu is wrong, it possibly has an extra ... I can see the entry in package-quickstart.el. How can I track where the path is constructed?

Here are a few more symptoms I have found. The following declaration works in both Emacs 27 and 28, but the one below only works with Emacs 27 but does not work with Emacs 28.

(use-package doom-modeline
  ;; Requires the fonts included with `all-the-icons', run `M-x all-the-icons-install-fonts'
  :ensure all-the-icons
  :ensure doom-modeline
  :if (eq sb/modeline-theme 'doom-modeline)
  :commands doom-modeline-mode
  :demand t
  :init
  (setq doom-modeline-buffer-encoding nil
        doom-modeline-checker-simple-format nil
        doom-modeline-indent-info nil
        doom-modeline-lsp nil
        doom-modeline-minor-modes t
        ;; Reduce space on the modeline
        doom-modeline-buffer-file-name-style 'file-name)
        :config
  (doom-modeline-mode 1))

(use-package doom-modeline
  ;; Requires the fonts included with `all-the-icons', run `M-x all-the-icons-install-fonts'
  :ensure all-the-icons
  :ensure doom-modeline
  :if (eq sb/modeline-theme 'doom-modeline)
  :commands doom-modeline-mode
  :init
  (setq doom-modeline-buffer-encoding nil
        doom-modeline-checker-simple-format nil
        doom-modeline-indent-info nil
        doom-modeline-lsp nil
        doom-modeline-minor-modes t
        ;; Reduce space on the modeline
        doom-modeline-buffer-file-name-style 'file-name)
  (doom-modeline-mode 1))
Swarnendu Biswas
  • 1,378
  • 1
  • 11
  • 24

1 Answers1

0

I used the following instructions to build GNU Emacs 28 source.

./autogen.sh
./configure --with-cairo --with-modules --with-x-toolkit=lucid --without-compress-install --with-x-toolkit=no --with-gnutls --without-gconf --without-xwidgets --without-toolkit-scroll-bars --without-xaw3d --without-gsettings --with-mailutils --with-native-compilation --with-json --with-harfbuzz --with-imagemagick --with-jpeg --with-png --with-rsvg --with-tiff --with-wide-int --with-xft --with-xml2 --with-xpm --with-gif --with-threads --with-included-regex --with-zlib --without-sound --without-pop CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer" prefix=/usr/local
make -j2 NATIVE_FULL_AOT=1
sudo make install

For some reason which I do not understand yet, the issue describe persists if I try to run Emacs from /usr/local/bin, that is, run the last line sudo make install.

The issue does not appear when I run Emacs from the emacs-28.0.91/src directory. All the packages work as expected with this scheme. This per-usage location is a reasonable workaround for me now.

UPDATE: April 18, 2022

I posted the question on Oct 24, and I must have encountered the issue sometime around September 2021. The workaround I had posted seemed unsatisfying, until I came across this post today.

https://www.reddit.com/r/emacs/comments/rcg4r2/help_transitioning_to_emacs_28.

It seems the issue is because of a bug with find-file-visit-truename. Setting (setq find-file-visit-truename nil) resolves the error, and my config works as expected.

There is a bug report with Emacs: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=52292

There is more discussion available in the following links if you are interested.

https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00780.html https://github.com/raxod502/straight.el/issues/701

Swarnendu Biswas
  • 1,378
  • 1
  • 11
  • 24