Closed ddoherty03 closed 1 year ago
Hi. Thanks for taking the time to fill out a report.
I am having trouble using the (elpaca) function programatically.
elpaca
is a macro. Macros generally do not evaluate their arguments.
However, elpaca
does have a special case where it will evaluate the first argument if it is backquoted. The following test case shows how to map over a list of packages, queuing each one with the elpaca
macro. You probably want mapc
instead of mapcar
if you're not using the resultant list, too.
elpaca | 4446ea2 HEAD -> master |
git | git version 2.41.0 |
emacs | GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-06-21 |
isntaller | 0.5 |
Does that help?
@progfolio, yes that helped enormously. You da man. Many thanks.
Hey, @progfolio, before I leave this topic, would you mind seeing if you can see what's wrong with my code to install all the theme packages available. I know it's a little extravagant, but I kind of like to try out different themes just to avoid boredom. Anyway, here's my approach:
Write a function to extract all the packages that end in -theme of -themes:
(require 'dash)
(defun ded:pack-name (recipe)
"Extract a theme package name from an elpaca RECIPE"
(plist-get (plist-get (cdr recipe) :recipe) :package))
(setq ded:bad-themes '(abyss-theme))
(defun ded:all-theme-syms ()
"Return a list of all themes available through elpaca"
(let* ((packs (elpaca-menu-melpa 'index))
(theme-packs (--filter (string-match "-themes?$" (ded:pack-name it)) packs))
(theme-names (--map (ded:pack-name it) theme-packs))
(theme-syms (--map (make-symbol it) theme-names)))
(-difference theme-syms ded:bad-themes)))
This seems to work, also allowing me to filter out themes to ignore (ded:bad-themes).
Then, based on your prior answer, I write a function to install a list of themes:
(defun ded:install-theme-list (theme-syms)
"Install the themes whose symbols are in THEME-SYMS"
(mapc (lambda (it)
(elpaca `,it)
(message (symbol-name it))
(add-to-list 'custom-theme-load-path
(expand-file-name (symbol-name `,it)
elpaca-builds-directory)))
theme-syms))
This works with an explicit list of themes:
(setq ded:themes-to-install '(atom-theme zenburn-theme))
(ded:install-theme-list ded:themes-to-install)
But it chokes when I try to install all themes with the above function:
(ded:install-theme-list (ded:all-theme-syms))
I get an error like this:
Debugger entered--Lisp error: (error "Unable to determine recipe URL")
signal(error ("Unable to determine recipe URL"))
error("Unable to determine recipe URL")
elpaca--repo-uri((:protocol https :inherit t :depth 1 :package "abyss-theme"))
elpaca--clone((elpaca< abyss-theme "abyss-theme" abyss-theme (queued) nil "/home/ded/.emacs.d/elpaca/builds/abyss-theme" 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 "abyss-theme") nil nil nil nil 5 (25756 4374 245126 660000) nil nil ((failed (25756 4374 132617 850000) "Unable to determine repo dir: (error \"Cannot deter..." 0)) nil))
elpaca--continue-build((elpaca< abyss-theme "abyss-theme" abyss-theme (queued) nil "/home/ded/.emacs.d/elpaca/builds/abyss-theme" 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 "abyss-theme") nil nil nil nil 5 (25756 4374 245126 660000) nil nil ((failed (25756 4374 132617 850000) "Unable to determine repo dir: (error \"Cannot deter..." 0)) nil))
elpaca--process((elpaca< abyss-theme "abyss-theme" abyss-theme (queued) nil "/home/ded/.emacs.d/elpaca/builds/abyss-theme" 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 "abyss-theme") nil nil nil nil 5 (25756 4374 245126 660000) nil nil ((failed (25756 4374 132617 850000) "Unable to determine repo dir: (error \"Cannot deter..." 0)) nil))
elpaca--process-queue((elpaca-q< nil 5 0 incomplete (25756 1418 874353 819000) nil nil ((abyss-theme elpaca< abyss-theme "abyss-theme" abyss-theme (queued) nil "/home/ded/.emacs.d/elpaca/builds/abyss-theme" 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 "abyss-theme") nil nil nil nil 5 (25756 4374 245126 660000) nil nil ((failed (25756 4374 132617 850000) "Unable to determine repo dir: (error \"Cannot deter..." 0)) nil))))
elpaca-process-queues()
(progn (elpaca-process-queues))
(if (member this-command '(eval-last-sexp eval-defun)) (progn (elpaca-process-queues)))
(progn (let* ((e (and t (elpaca-get item-55)))) (if e (progn (elpaca--maybe-log t) (elpaca--unprocess e) (let* ((c (nthcdr 4 e))) (setcar c (cons 'queued (car c))))) nil)) (if (member this-command '(eval-last-sexp eval-defun)) (progn (elpaca-process-queues))) (if (member this-command '(eval-region eval-buffer org-ctrl-c-ctrl-c)) (progn (if elpaca--interactive-timer (progn (cancel-timer elpaca--interactive-timer))) (run-at-time elpaca-interactive-interval nil #'elpaca-process-queues))))
(if after-init-time (progn (let* ((e (and t (elpaca-get item-55)))) (if e (progn (elpaca--maybe-log t) (elpaca--unprocess e) (let* ((c ...)) (setcar c (cons ... ...)))) nil)) (if (member this-command '(eval-last-sexp eval-defun)) (progn (elpaca-process-queues))) (if (member this-command '(eval-region eval-buffer org-ctrl-c-ctrl-c)) (progn (if elpaca--interactive-timer (progn (cancel-timer elpaca--interactive-timer))) (run-at-time elpaca-interactive-interval nil #'elpaca-process-queues)))))
(let* ((order-54 it) (item-55 (elpaca--first order-54)) (q-56 (or (and after-init-time (elpaca--q (elpaca-get item-55))) (car elpaca--queues)))) (if order-54 (progn (elpaca--queue order-54 q-56))) (if after-init-time (progn (let* ((e (and t (elpaca-get item-55)))) (if e (progn (elpaca--maybe-log t) (elpaca--unprocess e) (let* (...) (setcar c ...))) nil)) (if (member this-command '(eval-last-sexp eval-defun)) (progn (elpaca-process-queues))) (if (member this-command '(eval-region eval-buffer org-ctrl-c-ctrl-c)) (progn (if elpaca--interactive-timer (progn (cancel-timer elpaca--interactive-timer))) (run-at-time elpaca-interactive-interval nil #'elpaca-process-queues))))) nil)
(lambda (it) (let* ((order-54 it) (item-55 (elpaca--first order-54)) (q-56 (or (and after-init-time (elpaca--q ...)) (car elpaca--queues)))) (if order-54 (progn (elpaca--queue order-54 q-56))) (if after-init-time (progn (let* ((e ...)) (if e (progn ... ... ...) nil)) (if (member this-command '...) (progn (elpaca-process-queues))) (if (member this-command '...) (progn (if elpaca--interactive-timer ...) (run-at-time elpaca-interactive-interval nil ...))))) nil) (message (symbol-name it)) (add-to-list 'custom-theme-load-path (expand-file-name (symbol-name it) elpaca-builds-directory)))(abyss-theme)
mapc((lambda (it) (let* ((order-54 it) (item-55 (elpaca--first order-54)) (q-56 (or (and after-init-time (elpaca--q ...)) (car elpaca--queues)))) (if order-54 (progn (elpaca--queue order-54 q-56))) (if after-init-time (progn (let* ((e ...)) (if e (progn ... ... ...) nil)) (if (member this-command '...) (progn (elpaca-process-queues))) (if (member this-command '...) (progn (if elpaca--interactive-timer ...) (run-at-time elpaca-interactive-interval nil ...))))) nil) (message (symbol-name it)) (add-to-list 'custom-theme-load-path (expand-file-name (symbol-name it) elpaca-builds-directory))) (abyss-theme acme-theme adwaita-dark-theme afternoon-theme ahungry-theme airline-themes alect-themes almost-mono-themes ample-theme ample-zen-theme ancient-one-dark-theme anti-zenburn-theme apropospriate-theme arjen-grey-theme atom-dark-theme atom-one-dark-theme autumn-light-theme avk-emacs-themes ayu-theme badger-theme badwolf-theme base16-theme basic-theme berrys-theme birds-of-paradise-plus-theme blackboard-theme bliss-theme borland-blue-theme boron-theme brutalist-theme bubbleberry-theme busybee-theme calmer-forest-theme caroline-theme catppuccin-theme challenger-deep-theme cherry-blossom-theme chocolate-theme chyla-theme cloud-theme clues-theme colonoscopy-theme color-theme colorless-themes commentary-theme constant-theme creamsody-theme curry-on-theme cyanometric-theme cyberpunk-2019-theme ...))
ded:install-theme-list((abyss-theme acme-theme adwaita-dark-theme afternoon-theme ahungry-theme airline-themes alect-themes almost-mono-themes ample-theme ample-zen-theme ancient-one-dark-theme anti-zenburn-theme apropospriate-theme arjen-grey-theme atom-dark-theme atom-one-dark-theme autumn-light-theme avk-emacs-themes ayu-theme badger-theme badwolf-theme base16-theme basic-theme berrys-theme birds-of-paradise-plus-theme blackboard-theme bliss-theme borland-blue-theme boron-theme brutalist-theme bubbleberry-theme busybee-theme calmer-forest-theme caroline-theme catppuccin-theme challenger-deep-theme cherry-blossom-theme chocolate-theme chyla-theme cloud-theme clues-theme colonoscopy-theme color-theme colorless-themes commentary-theme constant-theme creamsody-theme curry-on-theme cyanometric-theme cyberpunk-2019-theme ...))
eval((ded:install-theme-list (ded:all-theme-syms)) nil)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
Again, I'm puzzled. Any ideas?
ded:pack-name
shouldn't be necessary.
You can convert the car of each menu item to a string.
ded:install-theme-list
:
Adding the theme to custom-theme-load-path
should be taken care of by the package itself.
If you find a theme which doesn't do that, it should be addressed upstream with the theme's maintainer.
The second backquote is unnecesssary. You can pass the symbol directly to symbol-name
e.g.
(symbol-name it)
(elpaca<-build-dir (elpaca-get item))
e.g. (elpaca<-build-dir (elpaca-get 'afternoon-theme))
Debugger entered--Lisp error: (error "Unable to determine recipe URL")
That error occurs when the recipe is incomplete.
Looks like the MELPA menu cache is corrupted or ignored somewhere along the line.
So the recipe lookup failed and your recipe only has the properties it inherited from elpaca-order-functions
which defaults to elpaca-order-defaults
.
The following two examples work for me:
elpaca | 2e65018 HEAD -> master, origin/master, origin/HEAD |
isntaller | 0.5 |
emacs | GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-06-21 |
git | git version 2.41.0 |
elpaca | 2e65018 HEAD -> master, origin/master, origin/HEAD |
isntaller | 0.5 |
emacs | GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-06-21 |
git | git version 2.41.0 |
Nicholas (@progfolio) thanks for looking at this. You got me unstuck. Best wishes.
Glad you got it sorted. Have fun!
Elpaca Version
Elpaca b40afe0 HEAD -> master, origin/master, origin/HEAD installer: 0.4 emacs-version: GNU Emacs 29.0.60 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-03-29 git --version: git version 2.34.1
Operating System
Ubuntu 22.04 jammy Kernel: x86_64 Linux 5.19.0-41-generic
Description
I am having trouble using the (elpaca) function programatically. Specifically, I want to install a whole list of theme packages with a function in my init. Here is what I have:
I am not sure why, but elpaca doen't install the packages. I know I must be missing something obvious, but I can't come up with what it is.
Consider this a support request, and thanks for elpaca!