Skip to content

Commit

Permalink
Merge pull request #156 from yk-kd/elpaca-integration
Browse files Browse the repository at this point in the history
add :elpaca keyword
  • Loading branch information
conao3 authored Jun 18, 2024
2 parents 9b304a5 + 6770543 commit febda99
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 1 deletion.
95 changes: 95 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [[#feather-keyword][:feather keyword]]
- [[#el-get-keyword][:el-get keyword]]
- [[#straight-keyword][:straight keyword]]
- [[#elpaca-keyword][:elpaca keyword]]
- [[#ensure-system-package-keyword][:ensure-system-package keyword]]
- [[#bind-keywords][Bind keywords]]
- [[#bind-bind-keywords][:bind, :bind* keywords]]
Expand Down Expand Up @@ -438,6 +439,100 @@ Given a list, the arguments are passed as is to ~straight-use-package~.
(leaf-init)))))
#+end_src

** :elpaca keyword
~:eplaca~ provides a frontend for ~elpaca~.

If you specify ~t~, leaf assumes that you specified the name of the leaf-block.

Given a list, the arguments are passed as is to ~elpaca~.

#+begin_src elisp
(cort-deftest-with-macroexpand leaf/elpaca
'(((leaf leaf
:init (leaf-pre-init)
:elpaca t
:config (leaf-init))
(prog1 'leaf
(elpaca 'leaf
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca nil t
:config (leaf-init))
(prog1 'leaf
(leaf-pre-init)
(leaf-init)))

((leaf leaf
:init (leaf-pre-init)
:elpaca leaf leaf-polyfill
:config (leaf-init))
(prog1 'leaf
(elpaca 'leaf)
(elpaca 'leaf-polyfill
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca t
:elpaca leaf-polyfill
:config (leaf-init))
(prog1 'leaf
(elpaca 'leaf)
(elpaca 'leaf-polyfill
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca t leaf-polyfill
:config (leaf-init))
(prog1 'leaf
(elpaca 'leaf)
(elpaca 'leaf-polyfill
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca (zenburn-theme :host github :repo "fake/fake")
:config (leaf-init))
(prog1 'leaf
(elpaca '(zenburn-theme :host github :repo "fake/fake")
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca
(zenburn-theme :host github :repo "fake/fake")
(yaicomplete :host github :repo "fake/faker")
(mew :host gitlab :repo "fake/fakest")
:config (leaf-init))
(prog1 'leaf
(elpaca '(zenburn-theme :host github :repo "fake/fake"))
(elpaca '(yaicomplete :host github :repo "fake/faker"))
(elpaca '(mew :host gitlab :repo "fake/fakest")
(leaf-pre-init)
(leaf-init))))))
#+end_src

Nesting is not recommended in elpaca.
If nesting is used, please specify them together in the first leaf block.
#+begin_src elisp
(leaf leaf
:elpaca leaf leaf-polyfill
:config
(leaf-init)
(leaf leaf-polyfill
:elpaca nil
:config
(leaf-polyfill-init)))
#+end_src

** :ensure-system-package keyword
~:ensure-system-package~ provides a frontend for [[https://gitlab.com/jabranham/system-packages][system-packages]].

Expand Down
73 changes: 73 additions & 0 deletions leaf-keywords-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,79 @@ Example
(leaf-pre-init)
(leaf-init)))))


(cort-deftest-with-macroexpand leaf/elpaca
'(((leaf leaf
:init (leaf-pre-init)
:elpaca t
:config (leaf-init))
(prog1 'leaf
(elpaca leaf
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca nil t
:config (leaf-init))
(prog1 'leaf
(leaf-pre-init)
(leaf-init)))

((leaf leaf
:init (leaf-pre-init)
:elpaca leaf leaf-polyfill
:config (leaf-init))
(prog1 'leaf
(elpaca leaf)
(elpaca leaf-polyfill
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca t
:elpaca leaf-polyfill
:config (leaf-init))
(prog1 'leaf
(elpaca leaf)
(elpaca leaf-polyfill
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca t leaf-polyfill
:config (leaf-init))
(prog1 'leaf
(elpaca leaf)
(elpaca leaf-polyfill
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca (zenburn-theme :host github :repo "fake/fake")
:config (leaf-init))
(prog1 'leaf
(elpaca (zenburn-theme :host github :repo "fake/fake")
(leaf-pre-init)
(leaf-init))))

((leaf leaf
:init (leaf-pre-init)
:elpaca
(zenburn-theme :host github :repo "fake/fake")
(yaicomplete :host github :repo "fake/faker")
(mew :host gitlab :repo "fake/fakest")
:config (leaf-init))
(prog1 'leaf
(elpaca (zenburn-theme :host github :repo "fake/fake"))
(elpaca (yaicomplete :host github :repo "fake/faker"))
(elpaca (mew :host gitlab :repo "fake/fakest")
(leaf-pre-init)
(leaf-init))))))

(cort-deftest-with-macroexpand leaf/key-combo
'(((leaf key-combo
:combo (("=" . (" = " " == " " === " ))
Expand Down
4 changes: 3 additions & 1 deletion leaf-keywords.el
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
:feather `(,@(mapcar (lambda (elm) `(leaf-handler-package ,leaf--name ,(car elm) ,(cdr elm))) leaf--value)
(feather-add-after-installed-hook-sexp ,(caar (last leaf--value)) ,@leaf--body))
:straight `(,@(mapcar (lambda (elm) `(straight-use-package ',elm)) leaf--value) ,@leaf--body)
:elpaca `(,@(mapcar (lambda (elm) `(elpaca ,elm)) (butlast leaf--value))
,@(if (eq nil leaf--value) leaf--body `((elpaca ,@(last leaf--value) ,@leaf--body))))
:el-get `(,@(mapcar (lambda (elm) `(el-get-bundle ,@elm)) leaf--value) ,@leaf--body)
:ensure-system-package
`(,@(mapcar (lambda (elm)
Expand Down Expand Up @@ -356,7 +358,7 @@
(leaf-keywords-normalize-list-in-list (if (eq t elm) leaf--name elm) 'allow-dotlist))
leaf--value)))

((memq leaf--key '(:straight))
((memq leaf--key '(:straight :elpaca))
(unless (eq (car-safe leaf--value) nil)
(mapcar
(lambda (elm)
Expand Down

0 comments on commit febda99

Please sign in to comment.