progfolio / elpaca

An elisp package manager
GNU General Public License v3.0
652 stars 33 forks source link

[Bug]: backquoted order fails to expand correctly when contained within certain let forms #143

Open progfolio opened 1 year ago

progfolio commented 1 year ago

Elpaca Version

Elpaca 49329e5 HEAD -> master, origin/master, origin/HEAD installer: 0.4 emacs-version: GNU Emacs 29.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.17.8) of 2023-05-28 git --version: git version 2.40.1

Operating System

Linux, Fedora 38

Description

I tried to use elpaca and followed the instructions on the README.md but it kept failing with an error about not being able to determine URL for elpaca-order

Sorry @yilkalargaw: I was in the middle of tidying up the issue tracker and accidentally deleted your previous issue. I've restored it here.

I'll still need:

yilkalargaw commented 1 year ago

elpaca -log file

 Package Status Info Time ▼ 
elpaca-order                   failed               elpaca--clone: (error "Unable to determine recipe URL")                          00.036934

debug-init

Debugger entered--Lisp error: (error "Unable to determine recipe URL")
  error("Unable to determine recipe URL")
  elpaca--repo-uri((:protocol https :inherit t :depth 1 :package "elpaca-order"))
  elpaca--clone((elpaca< elpaca-order "elpaca-order" elpaca-order (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/re..." "/home/containerland/.elpaca_dir/.emacs.d/elpaca/bu..." nil nil (elpaca--configure-remotes elpaca--checkout-ref elpaca--run-pre-build-commands elpaca--clone-dependencies elpaca--link-build-files elpaca--generate-autoloads-async elpaca--byte-compile elpaca--compile-info elpaca--install-info elpaca--add-info-path elpaca--run-post-build-commands elpaca--activate-package) (:protocol https :inherit t :depth 1 :package "elpaca-order") nil nil nil nil 0 (25728 51782 453804 59000) init nil ((queued (25728 51782 453811 797000) "Package queued" 1)) nil))
  elpaca--continue-build((elpaca< elpaca-order "elpaca-order" elpaca-order (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/re..." "/home/containerland/.elpaca_dir/.emacs.d/elpaca/bu..." nil nil (elpaca--configure-remotes elpaca--checkout-ref elpaca--run-pre-build-commands elpaca--clone-dependencies elpaca--link-build-files elpaca--generate-autoloads-async elpaca--byte-compile elpaca--compile-info elpaca--install-info elpaca--add-info-path elpaca--run-post-build-commands elpaca--activate-package) (:protocol https :inherit t :depth 1 :package "elpaca-order") nil nil nil nil 0 (25728 51782 453804 59000) init nil ((queued (25728 51782 453811 797000) "Package queued" 1)) nil))
  elpaca--process((elpaca< elpaca-order "elpaca-order" elpaca-order (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/re..." "/home/containerland/.elpaca_dir/.emacs.d/elpaca/bu..." nil nil (elpaca--configure-remotes elpaca--checkout-ref elpaca--run-pre-build-commands elpaca--clone-dependencies elpaca--link-build-files elpaca--generate-autoloads-async elpaca--byte-compile elpaca--compile-info elpaca--install-info elpaca--add-info-path elpaca--run-post-build-commands elpaca--activate-package) (:protocol https :inherit t :depth 1 :package "elpaca-order") nil nil nil nil 0 (25728 51782 453804 59000) init nil ((queued (25728 51782 453811 797000) "Package queued" 1)) nil))
  elpaca--process-queue((elpaca-q< init 0 0 incomplete (25728 51782 453113 552000) nil ((elpaca-use-package (elpaca-use-package-mode) (setq elpaca-use-package-by-default t))) ((elpaca-use-package elpaca< elpaca-use-package "elpaca-use-package" elpaca-use-package (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/re..." "/home/containerland/.elpaca_dir/.emacs.d/elpaca/bu..." nil nil (elpaca--queue-dependencies elpaca--add-info-path elpaca--activate-package) (:package "elpaca-use-package" :repo "https://github.com/progfolio/elpaca.git" :files ("extensions/elpaca-use-package.el") :main "extensions/elpaca-use-package.el" :build (:not elpaca--compile-info) :protocol https :inherit t :depth 1) nil nil nil nil 0 (25728 51782 453963 228000) init nil ((queued (25728 51782 453964 478000) "Package queued" 1)) t) (elpaca-order elpaca< elpaca-order "elpaca-order" elpaca-order (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/re..." "/home/containerland/.elpaca_dir/.emacs.d/elpaca/bu..." nil nil (elpaca--configure-remotes elpaca--checkout-ref elpaca--run-pre-build-commands elpaca--clone-dependencies elpaca--link-build-files elpaca--generate-autoloads-async elpaca--byte-compile elpaca--compile-info elpaca--install-info elpaca--add-info-path elpaca--run-post-build-commands elpaca--activate-package) (:protocol https :inherit t :depth 1 :package "elpaca-order") nil nil nil nil 0 (25728 51782 453804 59000) init nil ((queued (25728 51782 453811 797000) "Package queued" 1)) nil))))
  elpaca-process-queues()
  elpaca-wait()
  (let ((file-name-handler-alist nil)) (if (version< emacs-version "27.0") (progn (let ((dafile (expand-file-name "early-init.el" user-emacs-directory))) (if (file-exists-p dafile) (progn (load-file dafile)))))) (if (not (version< emacs-version "27.0")) (progn (if (fboundp 'native-comp-available-p) (setq comp-deferred-compilation t)) (setq warning-suppress-types '((flycheck syntax-checker) (comp))))) (setq inhibit-default-init 1) (setq initial-major-mode 'fundamental-mode) (setq ad-redefinition-action 'accept) (defalias 'yae-defer-garbage-collection-h #'(lambda nil (setq gc-cons-threshold most-positive-fixnum))) (defalias 'yae-restore-garbage-collection-h #'(lambda nil (run-at-time 1 nil #'(lambda nil ...)))) (add-hook 'minibuffer-setup-hook #'yae-defer-garbage-collection-h) (add-hook 'minibuffer-exit-hook #'yae-restore-garbage-collection-h) (defalias 'yae-gen-ver-consts (cons 'macro #'(lambda (var) (list 'defconst (intern ...) (> emacs-major-version ...))))) (seq-do #'(lambda (x) (eval (list 'yae-gen-ver-consts x))) (number-sequence 24 35)) (defconst IS-MAC (eq system-type 'darwin)) (defconst IS-LINUX (eq system-type 'gnu/linux)) (defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos))) (defconst IS-BSD (or IS-MAC (eq system-type 'berkeley-unix))) (customize-set-variable 'custom-file (expand-file-name "custom.el" user-emacs-directory)) (progn (setq gnutls-verify-error (not (getenv-internal "INSECURE"))) (setq gnutls-algorithm-priority (if (boundp 'libgnutls-version) (progn (concat "SECURE128:+SECURE192:-VERS-ALL" (if ... ":+VERS-TLS1.3") ":+VERS-TLS1.2")))) (setq gnutls-min-prime-bits 3072) (setq tls-checktrust gnutls-verify-error) (setq tls-program '("openssl s_client -connect %h:%p -CAfile %t -..." "gnutls-cli -p %p --dh-bits=3072 --ocsp --x50..." "gnutls-cli -p %p %h"))) (setq auth-sources (list (expand-file-name "authinfo.gpg" user-emacs-directory) "~/.authinfo.gpg")) (add-hook 'after-init-time-hook (setq gnutls-min-prime-bits 4096)) (setq epg-gpg-program "gpg2") (setq auth-sources '("~/.authinfo.gpg")) (progn (set-default 'lexical-binding t)) (set-window-margins nil 2) (setq inhibit-startup-message t) (column-number-mode 1) (setq initial-scratch-message nil) (setq frame-resize-pixelwise t) (setq redisplay-skip-fontification-on-input t) (setq idle-update-delay 1.0) (setq compilation-scroll-output t) (defvar my-default-font "JetBrainsMono Nerd Font 9") (add-to-list 'default-frame-alist (cons 'font my-default-font)) (set-fontset-font t nil "Dejavu Sans Mono" nil 'append) (set-fontset-font t 'ethiopic "Noto Sans Ethiopic") (if (not EMACS29+) (progn (progn (require 'face-remap) (custom-declare-variable 'global-text-scale-adjust-resizes-frames 'nil "Whether `global-text-scale-adjust' resizes t..." :type '(choice ... ...) :group 'display :version "29.1") (custom-declare-variable 'global-text-scale-adjust-limits ''... "Min/max values for `global-text-scale-adjust..." :version "29.1" :group 'display :type '(cons ... ...)) (defvar global-text-scale-adjust--default-height nil) (defvar global-text-scale-adjust--increment-factor 5) (defalias 'global-text-scale-adjust #'(lambda ... "Change (a.k.a. \"adjust\") the font size of al..." ... ...)) (define-key ctl-x-map [(control meta 43)] 'global-text-scale-adjust) (define-key ctl-x-map [(control meta 61)] 'global-text-scale-adjust) (define-key ctl-x-map [(control meta 45)] 'global-text-scale-adjust) (define-key ctl-x-map [(control meta 48)] 'global-text-scale-adjust)))) (defalias 'yae-minions--modes #'(lambda nil (let (local global) (let (...) (while tail ...)) (list (sort local ...) (sort global ...))))) (defalias 'yae-minions-minor-modes-menu #'(lambda nil (interactive) (let ((map ...) (x1 ...)) (progn (ignore ...) (let* ... ...))))) (defalias 'yae-minions--mode-menu #'(lambda (mode) (let* ((map ...) (menu ...) (menu ...)) (and menu (let ... ... ... ... ...))))) (defalias 'yae-minions--define-toggle #'(lambda (map mode) (let ((fn ...)) (if (functionp fn) (progn ...))))) (defalias 'mode-line-split--format #'(lambda (left right) "Return a string of `window-width' length con..." (let ((reserve ...)) (concat left " " (propertize " " ... ...) right)))) (progn (set-default 'mode-line-format '((:eval (mode-line-split--format ... ...))))) (if EMACS26+ (require 'cl-lib) (require 'cl)) ...)
  load-with-code-conversion("/home/containerland/.elpaca_dir/.emacs.d/myinit.el" "/home/containerland/.elpaca_dir/.emacs.d/myinit.el" nil nil)
  load-file("/home/containerland/.elpaca_dir/.emacs.d/myinit.el")
  org-babel-load-file("/home/containerland/.elpaca_dir/.emacs.d/myinit.or...")
  load-with-code-conversion("/home/containerland/.elpaca_dir/.emacs.d/init.el" "/home/containerland/.elpaca_dir/.emacs.d/init.el" t t)
  load("/home/containerland/.elpaca_dir/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0x403a77fcb664548>) #f(compiled-function () #<bytecode -0x1f3c61addc0b8a75>) t)
  command-line()
  normal-top-level()

There is nothing regarding elpaca in the messages buffer just some warnings about my custom faces

progfolio commented 1 year ago

Ok. Thanks. Can you share the init file you are using? I'll need to see at least the installer for Elpaca.

yilkalargaw commented 1 year ago

This is the installer, my init might be too long to share but it mostly consists of use-package definitions

(defvar elpaca-installer-version 0.4)
(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
                              :files (:defaults (: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 (call-process "git" nil buffer t "clone"
                                       (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)))
            (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)
    (load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))

(setq package-enable-at-startup nil)

;; Install use-package support
(elpaca elpaca-use-package
  ;; Enable :elpaca use-package keyword.
  (elpaca-use-package-mode)
  ;; Assume  unless otherwise specified.
  (setq elpaca-use-package-by-default t))

;; Block until current queue processed.
(elpaca-wait)
yilkalargaw commented 1 year ago

I also have this setting regarding TLS and https

;; Emacs is essentially one huge security vulnerability, what with all the
;; dependencies it pulls in from all corners of the globe. Let's try to be at
;; least a little more discerning.
(setq gnutls-verify-error (not (getenv-internal "INSECURE"))
      gnutls-algorithm-priority
      (when (boundp 'libgnutls-version)
        (concat "SECURE128:+SECURE192:-VERS-ALL"
                (if (and (not IS-WINDOWS)
                         (not (version< emacs-version "26.3"))
                         (>= libgnutls-version 30605))
                    ":+VERS-TLS1.3")
                ":+VERS-TLS1.2"))
      ;; `gnutls-min-prime-bits' is set based on recommendations from
      ;; https://www.keylength.com/en/4/
      gnutls-min-prime-bits 3072
      tls-checktrust gnutls-verify-error
      ;; Emacs is built with `gnutls' by default, so `tls-program' would not be
      ;; used in that case. Otherwise, people have reasons to not go with
      ;; `gnutls', we use `openssl' instead. For more details, see
      ;; https://redd.it/8sykl1
      tls-program '("openssl s_client -connect %h:%p -CAfile %t -nbio -no_ssl3 -no_tls1 -no_tls1_1 -ign_eof"
                    "gnutls-cli -p %p --dh-bits=3072 --ocsp --x509cafile=%t \
--strict-tofu --priority='SECURE192:+SECURE128:-VERS-ALL:+VERS-TLS1.2:+VERS-TLS1.3' %h"
                    ;; compatibility fallbacks
                    "gnutls-cli -p %p %h"))

;; Emacs stores `authinfo' in $HOME and in plain-text. Let's not do that, mkay?
;; This file stores usernames, passwords, and other such treasures for the
;; aspiring malicious third party.
(setq auth-sources (list (expand-file-name "authinfo.gpg"  user-emacs-directory)
                         "~/.authinfo.gpg"))

;;gnutls
(add-hook 'after-init-time-hook (setq gnutls-min-prime-bits 4096))
progfolio commented 1 year ago

It's odd to me that elpaca is being registered as: elpaca-order in the queue. That should not be the case if the order is being spliced in as indicated in the installer:

(elpaca `(,@elpaca-order))

It's hard for me to make heads or tails of that backtrace because it is truncated. You can expand all the ellipses via the backtrace-expand-ellipses command in the backtrace buffer (bound to "." by default).

my init might be too long to share

Just seeing the beginning up to and including the full installer should be fine, but the full file would be more helpful. Please also share the output of: (substring-no-properties (describe-variable 'elpaca-order))

yilkalargaw commented 1 year ago
;;; package --- Summary
;;; Commentary:
;;; Code:

;;(package-initialize)

(let ((file-name-handler-alist nil))
  ;; (require 'package)

;; Emacs is essentially one huge security vulnerability, what with all the
;; dependencies it pulls in from all corners of the globe. Let's try to be at
;; least a little more discerning.
(setq gnutls-verify-error (not (getenv-internal "INSECURE"))
      gnutls-algorithm-priority
      (when (boundp 'libgnutls-version)
        (concat "SECURE128:+SECURE192:-VERS-ALL"
                (if (and (not IS-WINDOWS)
                         (not (version< emacs-version "26.3"))
                         (>= libgnutls-version 30605))
                    ":+VERS-TLS1.3")
                ":+VERS-TLS1.2"))
      ;; `gnutls-min-prime-bits' is set based on recommendations from
      ;; https://www.keylength.com/en/4/
      gnutls-min-prime-bits 3072
      tls-checktrust gnutls-verify-error
      ;; Emacs is built with `gnutls' by default, so `tls-program' would not be
      ;; used in that case. Otherwise, people have reasons to not go with
      ;; `gnutls', we use `openssl' instead. For more details, see
      ;; https://redd.it/8sykl1
      tls-program '("openssl s_client -connect %h:%p -CAfile %t -nbio -no_ssl3 -no_tls1 -no_tls1_1 -ign_eof"
                    "gnutls-cli -p %p --dh-bits=3072 --ocsp --x509cafile=%t \
--strict-tofu --priority='SECURE192:+SECURE128:-VERS-ALL:+VERS-TLS1.2:+VERS-TLS1.3' %h"
                    ;; compatibility fallbacks
                    "gnutls-cli -p %p %h"))

;; Emacs stores `authinfo' in $HOME and in plain-text. Let's not do that, mkay?
;; This file stores usernames, passwords, and other such treasures for the
;; aspiring malicious third party.
(setq auth-sources (list (expand-file-name "authinfo.gpg"  user-emacs-directory)
                         "~/.authinfo.gpg"))

;;gnutls
(add-hook 'after-init-time-hook (setq gnutls-min-prime-bits 4096))
(defvar elpaca-installer-version 0.4)
(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
                              :files (:defaults (: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 (call-process "git" nil buffer t "clone"
                                       (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)))
            (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)
    (load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))

(setq package-enable-at-startup nil)

;; Install use-package support
(elpaca elpaca-use-package
  ;; Enable :elpaca use-package keyword.
  (elpaca-use-package-mode)
  ;; Assume  unless otherwise specified.
  (setq elpaca-use-package-by-default t))

;; Block until current queue processed.
(elpaca-wait)

(add-hook 'after-init-time-hook (progn
                 (switch-to-buffer "*scratch*")
                 (lisp-interaction-mode)))

(add-hook 'after-init-hook
          (lambda ()
            (let ((dafile (expand-file-name "custom_faces.el" user-emacs-directory)))
              (when (file-exists-p dafile) (load-file dafile)))))

(when EMACS27+
  (add-hook 'server-after-make-frame-hook
            (lambda ()
              (let ((dafile (expand-file-name "custom_faces.el" user-emacs-directory)))
                (when (file-exists-p dafile) (load-file dafile))))))

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(indicate-empty-lines t)
 ;; '(safe-local-variable-values
 ;;   ((eval add-hook 'after-save-hook
 ;;       (lambda nil
 ;;         (org-babel-tangle)
 ;;         (message "tangled-document")))))
 )

(provide 'init))

;;; init.el ends here

the expanded debug log

Debugger entered--Lisp error: (error "Unable to determine recipe URL")
  error("Unable to determine recipe URL")
  elpaca--repo-uri((:protocol https :inherit t :depth 1 :package "elpaca-order"))
  elpaca--clone((elpaca< elpaca-order "elpaca-order" elpaca-order (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/repos/elpaca-order/" "/home/containerland/.elpaca_dir/.emacs.d/elpaca/builds/elpaca-order" nil nil (elpaca--configure-remotes elpaca--checkout-ref elpaca--run-pre-build-commands elpaca--clone-dependencies elpaca--link-build-files elpaca--generate-autoloads-async elpaca--byte-compile elpaca--compile-info elpaca--install-info elpaca--add-info-path elpaca--run-post-build-commands elpaca--activate-package) (:protocol https :inherit t :depth 1 :package "elpaca-order") nil nil nil nil 0 (25728 54192 977826 111000) init nil ((queued (25728 54192 977831 427000) "Package queued" 1)) nil))
  elpaca--continue-build((elpaca< elpaca-order "elpaca-order" elpaca-order (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/repos/elpaca-order/" "/home/containerland/.elpaca_dir/.emacs.d/elpaca/builds/elpaca-order" nil nil (elpaca--configure-remotes elpaca--checkout-ref elpaca--run-pre-build-commands elpaca--clone-dependencies elpaca--link-build-files elpaca--generate-autoloads-async elpaca--byte-compile elpaca--compile-info elpaca--install-info elpaca--add-info-path elpaca--run-post-build-commands elpaca--activate-package) (:protocol https :inherit t :depth 1 :package "elpaca-order") nil nil nil nil 0 (25728 54192 977826 111000) init nil ((queued (25728 54192 977831 427000) "Package queued" 1)) nil))
  elpaca--process((elpaca< elpaca-order "elpaca-order" elpaca-order (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/repos/elpaca-order/" "/home/containerland/.elpaca_dir/.emacs.d/elpaca/builds/elpaca-order" nil nil (elpaca--configure-remotes elpaca--checkout-ref elpaca--run-pre-build-commands elpaca--clone-dependencies elpaca--link-build-files elpaca--generate-autoloads-async elpaca--byte-compile elpaca--compile-info elpaca--install-info elpaca--add-info-path elpaca--run-post-build-commands elpaca--activate-package) (:protocol https :inherit t :depth 1 :package "elpaca-order") nil nil nil nil 0 (25728 54192 977826 111000) init nil ((queued (25728 54192 977831 427000) "Package queued" 1)) nil))
  elpaca--process-queue((elpaca-q< init 0 0 incomplete (25728 54192 972621 563000) nil ((elpaca-use-package (elpaca-use-package-mode) (setq elpaca-use-package-by-default t))) ((elpaca-use-package elpaca< elpaca-use-package "elpaca-use-package" elpaca-use-package (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/repos/elpaca/" "/home/containerland/.elpaca_dir/.emacs.d/elpaca/builds/elpaca-use-package" nil nil (elpaca--queue-dependencies elpaca--add-info-path elpaca--activate-package) (:package "elpaca-use-package" :repo "https://github.com/progfolio/elpaca.git" :files ("extensions/elpaca-use-package.el") :main "extensions/elpaca-use-package.el" :build (:not elpaca--compile-info) :protocol https :inherit t :depth 1) nil nil nil nil 0 (25728 54192 985247 749000) init nil ((queued (25728 54192 985250 520000) "Package queued" 1)) t) (elpaca-order elpaca< elpaca-order "elpaca-order" elpaca-order (queued) "/home/containerland/.elpaca_dir/.emacs.d/elpaca/repos/elpaca-order/" "/home/containerland/.elpaca_dir/.emacs.d/elpaca/builds/elpaca-order" nil nil (elpaca--configure-remotes elpaca--checkout-ref elpaca--run-pre-build-commands elpaca--clone-dependencies elpaca--link-build-files elpaca--generate-autoloads-async elpaca--byte-compile elpaca--compile-info elpaca--install-info elpaca--add-info-path elpaca--run-post-build-commands elpaca--activate-package) (:protocol https :inherit t :depth 1 :package "elpaca-order") nil nil nil nil 0 (25728 54192 977826 111000) init nil ((queued (25728 54192 977831 427000) "Package queued" 1)) nil))))
  elpaca-process-queues()
  elpaca-wait()
  (let ((file-name-handler-alist nil)) (defvar elpaca-installer-version 0.4) (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 :files (:defaults (: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)) (if (file-exists-p repo) nil (make-directory repo t) (if (< emacs-major-version 28) (progn (require 'subr-x))) (condition-case err (let* ((buffer (and t (pop-to-buffer-same-window "*elpaca-bootstrap*"))) (s (and buffer (= 0 (call-process "git" nil buffer t "clone" (plist-get order :repo) repo)))) (s (and s (= 0 (call-process "git" nil buffer t "checkout" (or (plist-get order :ref) "--"))))) (emacs (and s (concat invocation-directory invocation-name))) (s (and emacs (= 0 (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" "--eval" "(byte-recompile-directory \".\" 0 'force)")))) (s (and s (require 'elpaca))) (s (and s (elpaca-generate-autoloads "elpaca" repo)))) (if s (kill-buffer buffer) (error "%s" (save-current-buffer (set-buffer buffer) (buffer-string))))) ((debug error) (warn "%s" err) (delete-directory repo 'recursive)))) (if (require 'elpaca-autoloads nil t) nil (require 'elpaca) (elpaca-generate-autoloads "elpaca" repo) (load "./elpaca-autoloads"))) (add-hook 'after-init-hook #'elpaca-process-queues) (elpaca elpaca-order) (setq package-enable-at-startup nil) (elpaca elpaca-use-package (elpaca-use-package-mode) (setq elpaca-use-package-by-default t)) (elpaca-wait) (add-hook 'after-init-time-hook (progn (switch-to-buffer "*scratch*") (lisp-interaction-mode))) (add-hook 'after-init-hook #'(lambda nil (let ((dafile (expand-file-name "custom_faces.el" user-emacs-directory))) (if (file-exists-p dafile) (progn (load-file dafile)))))) (if EMACS27+ (progn (add-hook 'server-after-make-frame-hook #'(lambda nil (let ((dafile (expand-file-name "custom_faces.el" user-emacs-directory))) (if (file-exists-p dafile) (progn (load-file dafile)))))))) (custom-set-variables '(indicate-empty-lines t)) (provide 'init))
  load-with-code-conversion("/home/containerland/.elpaca_dir/.emacs.d/myinit.el" "/home/containerland/.elpaca_dir/.emacs.d/myinit.el" nil nil)
  load-file("/home/containerland/.elpaca_dir/.emacs.d/myinit.el")
  org-babel-load-file("/home/containerland/.elpaca_dir/.emacs.d/myinit.org")
  load-with-code-conversion("/home/containerland/.elpaca_dir/.emacs.d/init.el" "/home/containerland/.elpaca_dir/.emacs.d/init.el" t t)
  load("/home/containerland/.elpaca_dir/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0xd0369a03e156548>) #f(compiled-function () #<bytecode -0x1f3c61addc0b8a75>) t)
  command-line()
  normal-top-level()
progfolio commented 1 year ago

Thanks. While I'm looking over that, we can rule out your configuration. Try running the following from a terminal:

$ mkdir -p /tmp/elpaca.test/
$ cd /tmp/elpaca.test/
$ curl https://raw.githubusercontent.com/progfolio/elpaca/master/doc/init.el > init.el
$ emacs --init-directory=. --debug-init

Let me know if you get the same error in that Emacs session.

progfolio commented 1 year ago

Think I've found out how to reliably reproduce this. It looks like the elpaca macro expansion is incorrect when the form is wrapped in a let binding. Working on a solution. I'll keep you posted.

yilkalargaw commented 1 year ago

@progfolio You were right, ```https://raw.githubusercontent.com/progfolio/elpaca/master/doc/init.el```` does not cause any errors.

progfolio commented 1 year ago

I'm puzzled by this one to be honest. I'm able to reproduce the issue, but I don't understand the cause yet. Below is the installer with a comments where the expansion fails:

;; Example Elpaca configuration -*- lexical-binding: t; -*-

;;(let () <- enclosing (elpaca `(,@elpaca-order)) here will fail to expand properly
(defvar elpaca-installer-version 0.4)
(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
                              :files (:defaults (:exclude "extensions"))
                              :build (:not elpaca--activate-package)))

;; Moving (elpaca `(,@elpaca-order)) into this let will fail to expand properly
(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 (call-process "git" nil buffer t "clone"
                                       (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)))
            (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)
    (load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)

;; Works here for some reason.
(let ((test t)) (elpaca `(,@elpaca-order)))

;; Local Variables:
;; no-byte-compile: t
;; no-native-compile: t
;; no-update-autoloads: t
;; End:

I'm not sure if we've hit an odd corner case regarding (eager?) macro expansion. What's happening in the failing cases is that `(,@elpaca-order) is being expanded to elpaca-order prior to the expansion of the surrounding elpaca macro call. So it's as if the declaration is (elpaca elpaca-order) which gets treated as a symbol and quoted. I'm stumped for now, but the workaround would be to move the declaration for elpaca, (elpaca `(,@elpaca-order)) out of your let-binding. You can use a combination of hooks/variables to unbind and restore file-name-handler-alist instead of the dynmamic binding. e.g.

(setq +file-name-handler-alist-original file-name-handler-alist
          file-name-handler-alist nil)
(add-hook 'after-init-hook (lambda () (setq file-name-handler-alist +file-name-handler-alist-original)))
progfolio commented 1 year ago

@skangas: Sorry to bother you, but have you ever run into a situation like this?

yilkalargaw commented 1 year ago

Any update regarding what is causing this error?

progfolio commented 1 year ago

It looks like it is a peculiarity of the way elisp is macroexpanded. I talked with a regular on the mailing list about it in a Matrix chatroom. He says he was able to observe a difference with a simplified reproduction case. However, I was not able to reproduce what is happening when that simple case involves a macro. I'd like to have a solid reproduction case before contacting emacs-devel with it.

For now, the best workaround is mentioned here https://github.com/progfolio/elpaca/issues/143#issuecomment-1582585108

yilkalargaw commented 1 year ago

No rush, I have done as you suggested.. I was just checking because I was fascinated by the issue