Skip to content

Elpaca bootstrap issue #77

@Sebagabones

Description

@Sebagabones

Hi!
Firstly let me say that I am loving minimal-emacs.d, it has been brilliant so far! :)

I am currently running into a bit of an odd issue, my configuration works brilliantly on one machine, however on another machine, the bootstrapping of Elpaca seems to not be working.

When I start emacs with --debug-init, I get the following:

Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "elpaca")
  require(elpaca)
  (if (require 'elpaca-autoloads nil t) nil (require 'elpaca) (elpaca-generate-autoloads "elpaca" repo) (load "./elpaca-autoloads"))
  (let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) (build (expand-file-name "elpaca/" elpaca-builds-directory)) (order (cdr elpaca-order)) (default-directory repo)) (add-to-$
  load-with-code-conversion("/home/bones/.emacs.d/pre-init.el" "/home/bones/.emacs.d/pre-init.el" t t)
  load("/home/bones/.emacs.d/pre-init.el" :no-error :no-message :nosuffix)
  (if (not minimal-emacs-load-compiled-init-files) (load init-file :no-error :no-message :nosuffix) (setq init-file (minimal-emacs--remove-el-file-suffix init-file)) (load init-file :no-erro$
  (let ((init-file (expand-file-name filename minimal-emacs-user-directory))) (if (not minimal-emacs-load-compiled-init-files) (load init-file :no-error :no-message :nosuffix) (setq init-fil$
  minimal-emacs-load-user-init("pre-init.el")
  (if (fboundp 'minimal-emacs-load-user-init) (minimal-emacs-load-user-init "pre-init.el") (error "The early-init.el file failed to loaded"))
  load-with-code-conversion("/home/bones/.emacs.d/init.el" "/home/bones/.emacs.d/init.el" t t)
  load("/home/bones/.emacs.d/init" noerror nomessage)
  #f(compiled-function () #<bytecode 0x86021d25b10a010>)()
  #f(compiled-function () #<bytecode -0x4307d7bb01d2857>)()
  handler-bind-1(#f(compiled-function () #<bytecode -0x4307d7bb01d2857>) (error) startup--debug)
  #<subr startup--load-user-init-file>(#f(compiled-function () #<bytecode 0x1c2901da88216013>) #f(compiled-function () #<bytecode 0x731968ef8c7b19b>) t)
  apply(#<subr startup--load-user-init-file> (#f(compiled-function () #<bytecode 0x1c2901da88216013>) #f(compiled-function () #<bytecode 0x731968ef8c7b19b>) t))
  (unwind-protect (apply fn args) (if minimal-emacs-inhibit-message-during-startup (progn (progn (set-default 'inhibit-message nil)))) (if minimal-emacs-inhibit-redisplay-during-startup (pro$
  minimal-emacs--startup-load-user-init-file(#<subr startup--load-user-init-file> #f(compiled-function () #<bytecode 0x1c2901da88216013>) #f(compiled-function () #<bytecode 0x731968ef8c7b19b$
  apply(minimal-emacs--startup-load-user-init-file #<subr startup--load-user-init-file> (#f(compiled-function () #<bytecode 0x1c2901da88216013>) #f(compiled-function () #<bytecode 0x731968ef$
  #f(advice minimal-emacs--startup-load-user-init-file :around #<subr startup--load-user-init-file>)(#f(compiled-function () #<bytecode 0x1c2901da88216013>) #f(compiled-function () #<bytecod$
  apply(#f(advice minimal-emacs--startup-load-user-init-file :around #<subr startup--load-user-init-file>) (#f(compiled-function () #<bytecode 0x1c2901da88216013>) #f(compiled-function () #<$
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1c2901da88216013>) #f(compiled-function () #<bytecode 0x731968ef8c7b19b>) t)
  command-line()
  normal-top-level()

This looked like a similar error to issue #50 , so I tried to do the recommend fix there (the above message is what happens when I use your answer in the correct files, however from what I can tell it is the same error with my original pre-early-int.el and pre-init.el), but the same issue kept happening.

My original pre-early-int.el and pre-init.el were (respectively):

;;; ~/.emacs.d/pre-early-init.el --- This file is loaded before early-init.el. Use it for configurations that need to be set even earlier in the startup sequence, typically affecting the initial setup of the Emacs environment. -*- no-byte-compile: t; lexical-binding: t; -*-

;; Reducing clutter in ~/.emacs.d by redirecting files to ~/.emacs.d/var/
;; IMPORTANT: This part should be in the pre-early-init.el file
(setq minimal-emacs-var-dir (expand-file-name "var/" minimal-emacs-user-directory))
(setq package-user-dir (expand-file-name "elpa" minimal-emacs-var-dir))
(setq user-emacs-directory minimal-emacs-var-dir)

;; By default, minimal-emacs-package-initialize-and-refresh is set to t, which
;; makes minimal-emacs.d call the built-in package manager. Since Elpaca will
;; replace the package manager, there is no need to call it.
(setq minimal-emacs-package-initialize-and-refresh nil)

(defun display-startup-time ()
  "Display the startup time and number of garbage collections."
  (message "Emacs init loaded in %.2f seconds (Full emacs-startup: %.2fs) with %d garbage collections."
           (float-time (time-subtract after-init-time before-init-time))
           (time-to-seconds (time-since before-init-time))
           gcs-done))

(add-hook 'emacs-startup-hook #'display-startup-time 100)

and

;;; ~/.emacs.d/pre-init.el --- This file is loaded before init.el. Use it to set up variables or configurations that need to be available early in the initialization process but after early-init.el. -*- no-byte-compile: t; lexical-binding: t; -*-

;; Elpaca bootstrap
(defvar elpaca-installer-version 0.11)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
                              :ref nil :depth 1 :inherit ignore
                              :files (:defaults "elpaca-test.el" (:exclude "extensions"))
                              :build (:not elpaca--activate-package)))
(let* ((repo  (expand-file-name "elpaca/" elpaca-repos-directory))
       (build (expand-file-name "elpaca/" elpaca-builds-directory))
       (order (cdr elpaca-order))
       (default-directory repo))
  (add-to-list 'load-path (if (file-exists-p build) build repo))
  (unless (file-exists-p repo)
    (make-directory repo t)
    (when (<= emacs-major-version 28) (require 'subr-x))
    (condition-case-unless-debug err
        (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
                  ((zerop (apply #'call-process `("git" nil ,buffer t "clone"
                                                  ,@(when-let* ((depth (plist-get order :depth)))
                                                      (list (format "--depth=%d" depth) "--no-single-branch"))
                                                  ,(plist-get order :repo) ,repo))))
                  ((zerop (call-process "git" nil buffer t "checkout"
                                        (or (plist-get order :ref) "--"))))
                  (emacs (concat invocation-directory invocation-name))
                  ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
                                        "--eval" "(byte-recompile-directory \".\" 0 'force)")))
                  ((require 'elpaca))
                  ((elpaca-generate-autoloads "elpaca" repo)))
            (progn (message "%s" (buffer-string)) (kill-buffer buffer))
          (error "%s" (with-current-buffer buffer (buffer-string))))
      ((error) (warn "%s" err) (delete-directory repo 'recursive))))
  (unless (require 'elpaca-autoloads nil t)
    (require 'elpaca)
    (elpaca-generate-autoloads "elpaca" repo)
    (let ((load-source-file-function nil)) (load "./elpaca-autoloads"))))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))

;; Optional: Install use-package support
;; If you enable elpaca-use-package, some use-package definitions, such as
;; Vertico's, may need modifications. See the following discussion for details:
;; https://github.com/jamescherti/minimal-emacs.d/issues/54
;;
(elpaca elpaca-use-package
        (elpaca-use-package-mode))

The emacs configuration between both machines is identical (git repo), and in theory the machines themselves should be pretty much identical (nixos), however I wonder if maybe the original machine successfully bootstrapped elpaca, and then I mistakenly made an edit to the pre-**-init.el files, which causes an unsuccessful bootstrapping? I tried to look to see if I could see anything causing that, but I couldn't see anything, and trying to use the suggested answer from the issue linked above also didn't work - any thoughts?

Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions