* Combine multiple (straight-)use-package commands into one.
@ 2021-06-12 9:57 Hongyi Zhao
2021-06-12 14:57 ` Hongyi Zhao
0 siblings, 1 reply; 8+ messages in thread
From: Hongyi Zhao @ 2021-06-12 9:57 UTC (permalink / raw)
To: help-gnu-emacs
On Ubuntu 20.04, according to the instruction
[here](https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336),
I use the following settings in my Emacs init file:
```
;;Bootstrap straight
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el"
user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; Install use-package via straight
(straight-use-package 'use-package)
;; Setting this to `t' makes it so that you don't need to include the :straight
;; keyword in use-package declarations unless you want to add/extend the package
;; installation recipe.
(setq straight-use-package-by-default t) ; straight's equivalent of
`use-package-always-ensure'.
```
Now, I want to install multiple package hosted in recipe repositories
(such as MELPA) as shown below with only one (straight-)use-package
command, is it possible?
```
(use-package flycheck)
(use-package lsp-mode)
(use-package dash)
(use-package posframe)
(use-package s)
(use-package ein)
(use-package smartparens)
(use-package valign)
(use-package multi-term)
```
Regards
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Combine multiple (straight-)use-package commands into one.
2021-06-12 9:57 Combine multiple (straight-)use-package commands into one Hongyi Zhao
@ 2021-06-12 14:57 ` Hongyi Zhao
2021-06-12 16:08 ` Omar Polo
2021-06-13 10:22 ` Thibaut Verron
0 siblings, 2 replies; 8+ messages in thread
From: Hongyi Zhao @ 2021-06-12 14:57 UTC (permalink / raw)
To: help-gnu-emacs
On Sat, Jun 12, 2021 at 5:57 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> On Ubuntu 20.04, according to the instruction
> [here](https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336),
> I use the following settings in my Emacs init file:
>
> ```
> ;;Bootstrap straight
> (defvar bootstrap-version)
> (let ((bootstrap-file
> (expand-file-name "straight/repos/straight.el/bootstrap.el"
> user-emacs-directory))
> (bootstrap-version 5))
> (unless (file-exists-p bootstrap-file)
> (with-current-buffer
> (url-retrieve-synchronously
> "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
> 'silent 'inhibit-cookies)
> (goto-char (point-max))
> (eval-print-last-sexp)))
> (load bootstrap-file nil 'nomessage))
>
> ;; Install use-package via straight
> (straight-use-package 'use-package)
>
> ;; Setting this to `t' makes it so that you don't need to include the :straight
> ;; keyword in use-package declarations unless you want to add/extend the package
> ;; installation recipe.
>
> (setq straight-use-package-by-default t) ; straight's equivalent of
> `use-package-always-ensure'.
> ```
> Now, I want to install multiple package hosted in recipe repositories
> (such as MELPA) as shown below with only one (straight-)use-package
> command, is it possible?
> ```
> (use-package flycheck)
> (use-package lsp-mode)
> (use-package dash)
> (use-package posframe)
> (use-package s)
> (use-package ein)
> (use-package smartparens)
> (use-package valign)
> (use-package multi-term)
> ```
Based on the code snippets at
<https://github.com/flakyhermit/emacs.d/blob/6b488895071e980433facf648f482974526d6a13/init.el#L22>,
I figured out the following solution with `straight-use-package'
command:
(defvar package-list)
(setq package-list '(
flycheck lsp-mode dash posframe
s ein smartparens valign
multi-term
))
(mapc (lambda(package-name)
(straight-use-package package-name)) package-list)
But I still don't know the corresponding implementation with
`use-package' command.
Regards
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Combine multiple (straight-)use-package commands into one.
2021-06-12 14:57 ` Hongyi Zhao
@ 2021-06-12 16:08 ` Omar Polo
2021-06-13 1:29 ` Hongyi Zhao
2021-06-13 10:22 ` Thibaut Verron
1 sibling, 1 reply; 8+ messages in thread
From: Omar Polo @ 2021-06-12 16:08 UTC (permalink / raw)
To: Hongyi Zhao; +Cc: help-gnu-emacs
Hongyi Zhao <hongyi.zhao@gmail.com> writes:
> On Sat, Jun 12, 2021 at 5:57 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>>
>> On Ubuntu 20.04, according to the instruction
>> [here](https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336),
>> I use the following settings in my Emacs init file:
>>
>> ```
>> ;;Bootstrap straight
>> (defvar bootstrap-version)
>> (let ((bootstrap-file
>> (expand-file-name "straight/repos/straight.el/bootstrap.el"
>> user-emacs-directory))
>> (bootstrap-version 5))
>> (unless (file-exists-p bootstrap-file)
>> (with-current-buffer
>> (url-retrieve-synchronously
>> "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
>> 'silent 'inhibit-cookies)
>> (goto-char (point-max))
>> (eval-print-last-sexp)))
>> (load bootstrap-file nil 'nomessage))
>>
>> ;; Install use-package via straight
>> (straight-use-package 'use-package)
>>
>> ;; Setting this to `t' makes it so that you don't need to include the :straight
>> ;; keyword in use-package declarations unless you want to add/extend the package
>> ;; installation recipe.
>>
>> (setq straight-use-package-by-default t) ; straight's equivalent of
>> `use-package-always-ensure'.
>> ```
>> Now, I want to install multiple package hosted in recipe repositories
>> (such as MELPA) as shown below with only one (straight-)use-package
>> command, is it possible?
>> ```
>> (use-package flycheck)
>> (use-package lsp-mode)
>> (use-package dash)
>> (use-package posframe)
>> (use-package s)
>> (use-package ein)
>> (use-package smartparens)
>> (use-package valign)
>> (use-package multi-term)
>> ```
>
> Based on the code snippets at
> <https://github.com/flakyhermit/emacs.d/blob/6b488895071e980433facf648f482974526d6a13/init.el#L22>,
> I figured out the following solution with `straight-use-package'
> command:
>
> (defvar package-list)
> (setq package-list '(
> flycheck lsp-mode dash posframe
> s ein smartparens valign
> multi-term
> ))
>
> (mapc (lambda(package-name)
> (straight-use-package package-name)) package-list)
>
> But I still don't know the corresponding implementation with
> `use-package' command.
C-h f use-package RET says that
> use-package is a Lisp macro in ‘use-package-core.el’.
being a macro and not a function[0], it means that it follows different
rule for the evaluation. (use-package foo ...) is something that gets
*expanded* at *compile time* in some other lisp code, it's not something
you can pass to mapc. You need to expand the loop *at compile* time to
load multiple packages, something like the following (untested)
--------8<--------
(defmacro use-multiple-packages (&rest packages)
`(progn
,@(mapcar (lambda (p) `(use-package ,p))
packages)))
(use-multiple-pacakges foo
bar
baz
...)
-------->8--------
but it becomes not useful, since the main point of use-package is IMHO
the syntax sugar for adding hooks, bindings etc. If you don't care
about that stuff, a simple loop over package-install/package-installed-p
is probably enough.
> Regards
[0]: see (info "(elisp)macros") for more information about how elisp
macros works.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Combine multiple (straight-)use-package commands into one.
2021-06-12 16:08 ` Omar Polo
@ 2021-06-13 1:29 ` Hongyi Zhao
0 siblings, 0 replies; 8+ messages in thread
From: Hongyi Zhao @ 2021-06-13 1:29 UTC (permalink / raw)
To: Omar Polo; +Cc: help-gnu-emacs
On Sun, Jun 13, 2021 at 12:08 AM Omar Polo <op@omarpolo.com> wrote:
>
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> > On Sat, Jun 12, 2021 at 5:57 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> >>
> >> On Ubuntu 20.04, according to the instruction
> >> [here](https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336),
> >> I use the following settings in my Emacs init file:
> >>
> >> ```
> >> ;;Bootstrap straight
> >> (defvar bootstrap-version)
> >> (let ((bootstrap-file
> >> (expand-file-name "straight/repos/straight.el/bootstrap.el"
> >> user-emacs-directory))
> >> (bootstrap-version 5))
> >> (unless (file-exists-p bootstrap-file)
> >> (with-current-buffer
> >> (url-retrieve-synchronously
> >> "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
> >> 'silent 'inhibit-cookies)
> >> (goto-char (point-max))
> >> (eval-print-last-sexp)))
> >> (load bootstrap-file nil 'nomessage))
> >>
> >> ;; Install use-package via straight
> >> (straight-use-package 'use-package)
> >>
> >> ;; Setting this to `t' makes it so that you don't need to include the :straight
> >> ;; keyword in use-package declarations unless you want to add/extend the package
> >> ;; installation recipe.
> >>
> >> (setq straight-use-package-by-default t) ; straight's equivalent of
> >> `use-package-always-ensure'.
> >> ```
> >> Now, I want to install multiple package hosted in recipe repositories
> >> (such as MELPA) as shown below with only one (straight-)use-package
> >> command, is it possible?
> >> ```
> >> (use-package flycheck)
> >> (use-package lsp-mode)
> >> (use-package dash)
> >> (use-package posframe)
> >> (use-package s)
> >> (use-package ein)
> >> (use-package smartparens)
> >> (use-package valign)
> >> (use-package multi-term)
> >> ```
> >
> > Based on the code snippets at
> > <https://github.com/flakyhermit/emacs.d/blob/6b488895071e980433facf648f482974526d6a13/init.el#L22>,
> > I figured out the following solution with `straight-use-package'
> > command:
> >
> > (defvar package-list)
> > (setq package-list '(
> > flycheck lsp-mode dash posframe
> > s ein smartparens valign
> > multi-term
> > ))
> >
> > (mapc (lambda(package-name)
> > (straight-use-package package-name)) package-list)
> >
> > But I still don't know the corresponding implementation with
> > `use-package' command.
>
> C-h f use-package RET says that
>
> > use-package is a Lisp macro in ‘use-package-core.el’.
>
> being a macro and not a function[0], it means that it follows different
> rule for the evaluation. (use-package foo ...) is something that gets
> *expanded* at *compile time* in some other lisp code, it's not something
> you can pass to mapc. You need to expand the loop *at compile* time to
> load multiple packages, something like the following (untested)
>
> --------8<--------
> (defmacro use-multiple-packages (&rest packages)
> `(progn
> ,@(mapcar (lambda (p) `(use-package ,p))
> packages)))
>
> (use-multiple-pacakges foo
There is typo:
(use-multiple-packages foo
> bar
> baz
> ...)
> -------->8--------
Thank you. It works like a charm.
>
> but it becomes not useful, since the main point of use-package is IMHO
> the syntax sugar for adding hooks, bindings etc. If you don't care
> about that stuff, a simple loop over package-install/package-installed-p
> is probably enough.
>
> > Regards
>
> [0]: see (info "(elisp)macros") for more information about how elisp
> macros works.
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Combine multiple (straight-)use-package commands into one.
2021-06-12 14:57 ` Hongyi Zhao
2021-06-12 16:08 ` Omar Polo
@ 2021-06-13 10:22 ` Thibaut Verron
2021-06-13 12:53 ` Hongyi Zhao
1 sibling, 1 reply; 8+ messages in thread
From: Thibaut Verron @ 2021-06-13 10:22 UTC (permalink / raw)
To: Hongyi Zhao, help-gnu-emacs
On 12/06/2021 16:57, Hongyi Zhao wrote:
> On Sat, Jun 12, 2021 at 5:57 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>> On Ubuntu 20.04, according to the instruction
>> [here](https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336),
>> I use the following settings in my Emacs init file:
>>
>> ```
>> ;;Bootstrap straight
>> (defvar bootstrap-version)
>> (let ((bootstrap-file
>> (expand-file-name "straight/repos/straight.el/bootstrap.el"
>> user-emacs-directory))
>> (bootstrap-version 5))
>> (unless (file-exists-p bootstrap-file)
>> (with-current-buffer
>> (url-retrieve-synchronously
>> "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
>> 'silent 'inhibit-cookies)
>> (goto-char (point-max))
>> (eval-print-last-sexp)))
>> (load bootstrap-file nil 'nomessage))
>>
>> ;; Install use-package via straight
>> (straight-use-package 'use-package)
>>
>> ;; Setting this to `t' makes it so that you don't need to include the :straight
>> ;; keyword in use-package declarations unless you want to add/extend the package
>> ;; installation recipe.
>>
>> (setq straight-use-package-by-default t) ; straight's equivalent of
>> `use-package-always-ensure'.
>> ```
>> Now, I want to install multiple package hosted in recipe repositories
>> (such as MELPA) as shown below with only one (straight-)use-package
>> command, is it possible?
>> ```
>> (use-package flycheck)
>> (use-package lsp-mode)
>> (use-package dash)
>> (use-package posframe)
>> (use-package s)
>> (use-package ein)
>> (use-package smartparens)
>> (use-package valign)
>> (use-package multi-term)
>> ```
> Based on the code snippets at
> <https://github.com/flakyhermit/emacs.d/blob/6b488895071e980433facf648f482974526d6a13/init.el#L22>,
> I figured out the following solution with `straight-use-package'
> command:
>
> (defvar package-list)
> (setq package-list '(
> flycheck lsp-mode dash posframe
> s ein smartparens valign
> multi-term
> ))
>
> (mapc (lambda(package-name)
> (straight-use-package package-name)) package-list)
>
> But I still don't know the corresponding implementation with
> `use-package' command.
I don't understand what you don't like about this code: as far as I know
(straight-use-package 'foo) is strictly equivalent to (use-package foo
:straight t), and with straight-use-package-by-default you don't need
the :straight t.
Why is it such a problem to have straight-use-package in this loop
instead of use-package?
One confusion which took me quite a long time to clear, is that despite
the similar names, straight-use-package and use-package have very
different purposes: straight-use-package is for installing the package
(similar to package-install) while use-package is for grouping together
everything related to a package (this includes installation, either by
straight or package.el, but also initialization, configuration,
bindings...). Could it be your problem as well?
Best wishes,
Thibaut
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Combine multiple (straight-)use-package commands into one.
2021-06-13 10:22 ` Thibaut Verron
@ 2021-06-13 12:53 ` Hongyi Zhao
2021-06-13 13:29 ` Hongyi Zhao
0 siblings, 1 reply; 8+ messages in thread
From: Hongyi Zhao @ 2021-06-13 12:53 UTC (permalink / raw)
To: Thibaut Verron; +Cc: help-gnu-emacs
On Sun, Jun 13, 2021 at 6:22 PM Thibaut Verron <thibaut.verron@gmail.com> wrote:
>
> On 12/06/2021 16:57, Hongyi Zhao wrote:
> > On Sat, Jun 12, 2021 at 5:57 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> >> On Ubuntu 20.04, according to the instruction
> >> [here](https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336),
> >> I use the following settings in my Emacs init file:
> >>
> >> ```
> >> ;;Bootstrap straight
> >> (defvar bootstrap-version)
> >> (let ((bootstrap-file
> >> (expand-file-name "straight/repos/straight.el/bootstrap.el"
> >> user-emacs-directory))
> >> (bootstrap-version 5))
> >> (unless (file-exists-p bootstrap-file)
> >> (with-current-buffer
> >> (url-retrieve-synchronously
> >> "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
> >> 'silent 'inhibit-cookies)
> >> (goto-char (point-max))
> >> (eval-print-last-sexp)))
> >> (load bootstrap-file nil 'nomessage))
> >>
> >> ;; Install use-package via straight
> >> (straight-use-package 'use-package)
> >>
> >> ;; Setting this to `t' makes it so that you don't need to include the :straight
> >> ;; keyword in use-package declarations unless you want to add/extend the package
> >> ;; installation recipe.
> >>
> >> (setq straight-use-package-by-default t) ; straight's equivalent of
> >> `use-package-always-ensure'.
> >> ```
> >> Now, I want to install multiple package hosted in recipe repositories
> >> (such as MELPA) as shown below with only one (straight-)use-package
> >> command, is it possible?
> >> ```
> >> (use-package flycheck)
> >> (use-package lsp-mode)
> >> (use-package dash)
> >> (use-package posframe)
> >> (use-package s)
> >> (use-package ein)
> >> (use-package smartparens)
> >> (use-package valign)
> >> (use-package multi-term)
> >> ```
> > Based on the code snippets at
> > <https://github.com/flakyhermit/emacs.d/blob/6b488895071e980433facf648f482974526d6a13/init.el#L22>,
> > I figured out the following solution with `straight-use-package'
> > command:
> >
> > (defvar package-list)
> > (setq package-list '(
> > flycheck lsp-mode dash posframe
> > s ein smartparens valign
> > multi-term
> > ))
> >
> > (mapc (lambda(package-name)
> > (straight-use-package package-name)) package-list)
> >
> > But I still don't know the corresponding implementation with
> > `use-package' command.
>
> I don't understand what you don't like about this code: as far as I know
> (straight-use-package 'foo) is strictly equivalent to (use-package foo
> :straight t), and with straight-use-package-by-default you don't need
> the :straight t.
>
> Why is it such a problem to have straight-use-package in this loop
> instead of use-package?
Just out of curiosity to learn Lisp's ability: understanding and grasp
different methods for the same job.
>
> One confusion which took me quite a long time to clear, is that despite
> the similar names, straight-use-package and use-package have very
> different purposes: straight-use-package is for installing the package
> (similar to package-install) while use-package is for grouping together
> everything related to a package (this includes installation, either by
> straight or package.el,
AFAIK, straight is not compatible with package.el, see
<https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336>
for more detailed info.
> but also initialization, configuration,
> bindings...). Could it be your problem as well?
>
> Best wishes,
>
> Thibaut
>
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Combine multiple (straight-)use-package commands into one.
2021-06-13 12:53 ` Hongyi Zhao
@ 2021-06-13 13:29 ` Hongyi Zhao
2021-06-13 14:54 ` Thibaut Verron
0 siblings, 1 reply; 8+ messages in thread
From: Hongyi Zhao @ 2021-06-13 13:29 UTC (permalink / raw)
To: Thibaut Verron; +Cc: help-gnu-emacs
On Sun, Jun 13, 2021 at 8:53 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> On Sun, Jun 13, 2021 at 6:22 PM Thibaut Verron <thibaut.verron@gmail.com> wrote:
> >
> > On 12/06/2021 16:57, Hongyi Zhao wrote:
> > > On Sat, Jun 12, 2021 at 5:57 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> > >> On Ubuntu 20.04, according to the instruction
> > >> [here](https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336),
> > >> I use the following settings in my Emacs init file:
> > >>
> > >> ```
> > >> ;;Bootstrap straight
> > >> (defvar bootstrap-version)
> > >> (let ((bootstrap-file
> > >> (expand-file-name "straight/repos/straight.el/bootstrap.el"
> > >> user-emacs-directory))
> > >> (bootstrap-version 5))
> > >> (unless (file-exists-p bootstrap-file)
> > >> (with-current-buffer
> > >> (url-retrieve-synchronously
> > >> "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
> > >> 'silent 'inhibit-cookies)
> > >> (goto-char (point-max))
> > >> (eval-print-last-sexp)))
> > >> (load bootstrap-file nil 'nomessage))
> > >>
> > >> ;; Install use-package via straight
> > >> (straight-use-package 'use-package)
> > >>
> > >> ;; Setting this to `t' makes it so that you don't need to include the :straight
> > >> ;; keyword in use-package declarations unless you want to add/extend the package
> > >> ;; installation recipe.
> > >>
> > >> (setq straight-use-package-by-default t) ; straight's equivalent of
> > >> `use-package-always-ensure'.
> > >> ```
> > >> Now, I want to install multiple package hosted in recipe repositories
> > >> (such as MELPA) as shown below with only one (straight-)use-package
> > >> command, is it possible?
> > >> ```
> > >> (use-package flycheck)
> > >> (use-package lsp-mode)
> > >> (use-package dash)
> > >> (use-package posframe)
> > >> (use-package s)
> > >> (use-package ein)
> > >> (use-package smartparens)
> > >> (use-package valign)
> > >> (use-package multi-term)
> > >> ```
> > > Based on the code snippets at
> > > <https://github.com/flakyhermit/emacs.d/blob/6b488895071e980433facf648f482974526d6a13/init.el#L22>,
> > > I figured out the following solution with `straight-use-package'
> > > command:
> > >
> > > (defvar package-list)
> > > (setq package-list '(
> > > flycheck lsp-mode dash posframe
> > > s ein smartparens valign
> > > multi-term
> > > ))
> > >
> > > (mapc (lambda(package-name)
> > > (straight-use-package package-name)) package-list)
> > >
> > > But I still don't know the corresponding implementation with
> > > `use-package' command.
> >
> > I don't understand what you don't like about this code: as far as I know
> > (straight-use-package 'foo) is strictly equivalent to (use-package foo
> > :straight t), and with straight-use-package-by-default you don't need
> > the :straight t.
> >
> > Why is it such a problem to have straight-use-package in this loop
> > instead of use-package?
>
> Just out of curiosity to learn Lisp's ability: understanding and grasp
> different methods for the same job.
>
> >
> > One confusion which took me quite a long time to clear, is that despite
> > the similar names, straight-use-package and use-package have very
> > different purposes: straight-use-package is for installing the package
> > (similar to package-install) while use-package is for grouping together
> > everything related to a package (this includes installation, either by
> > straight or package.el,
>
> AFAIK, straight is not compatible with package.el, see
> <https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336>
> for more detailed info.
Also see <https://github.com/raxod502/straight.el#getting-started>:
You should remove any code that relates to package.el; for example,
references to package-initialize, package-archives, and (if you're
using use-package) :ensure or use-package-always-ensure.
>
> > but also initialization, configuration,
> > bindings...). Could it be your problem as well?
> >
> > Best wishes,
> >
> > Thibaut
> >
>
>
> --
> Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
> Theory and Simulation of Materials
> Hebei Vocational University of Technology and Engineering
> NO. 552 North Gangtie Road, Xingtai, China
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Combine multiple (straight-)use-package commands into one.
2021-06-13 13:29 ` Hongyi Zhao
@ 2021-06-13 14:54 ` Thibaut Verron
0 siblings, 0 replies; 8+ messages in thread
From: Thibaut Verron @ 2021-06-13 14:54 UTC (permalink / raw)
To: Hongyi Zhao; +Cc: help-gnu-emacs
On 6/13/21 3:29 PM, Hongyi Zhao wrote:
> On Sun, Jun 13, 2021 at 8:53 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>> On Sun, Jun 13, 2021 at 6:22 PM Thibaut Verron <thibaut.verron@gmail.com> wrote:
>>> On 12/06/2021 16:57, Hongyi Zhao wrote:
>>>> On Sat, Jun 12, 2021 at 5:57 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>>>>> On Ubuntu 20.04, according to the instruction
>>>>> [here](https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336),
>>>>> I use the following settings in my Emacs init file:
>>>>>
>>>>> ```
>>>>> ;;Bootstrap straight
>>>>> (defvar bootstrap-version)
>>>>> (let ((bootstrap-file
>>>>> (expand-file-name "straight/repos/straight.el/bootstrap.el"
>>>>> user-emacs-directory))
>>>>> (bootstrap-version 5))
>>>>> (unless (file-exists-p bootstrap-file)
>>>>> (with-current-buffer
>>>>> (url-retrieve-synchronously
>>>>> "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
>>>>> 'silent 'inhibit-cookies)
>>>>> (goto-char (point-max))
>>>>> (eval-print-last-sexp)))
>>>>> (load bootstrap-file nil 'nomessage))
>>>>>
>>>>> ;; Install use-package via straight
>>>>> (straight-use-package 'use-package)
>>>>>
>>>>> ;; Setting this to `t' makes it so that you don't need to include the :straight
>>>>> ;; keyword in use-package declarations unless you want to add/extend the package
>>>>> ;; installation recipe.
>>>>>
>>>>> (setq straight-use-package-by-default t) ; straight's equivalent of
>>>>> `use-package-always-ensure'.
>>>>> ```
>>>>> Now, I want to install multiple package hosted in recipe repositories
>>>>> (such as MELPA) as shown below with only one (straight-)use-package
>>>>> command, is it possible?
>>>>> ```
>>>>> (use-package flycheck)
>>>>> (use-package lsp-mode)
>>>>> (use-package dash)
>>>>> (use-package posframe)
>>>>> (use-package s)
>>>>> (use-package ein)
>>>>> (use-package smartparens)
>>>>> (use-package valign)
>>>>> (use-package multi-term)
>>>>> ```
>>>> Based on the code snippets at
>>>> <https://github.com/flakyhermit/emacs.d/blob/6b488895071e980433facf648f482974526d6a13/init.el#L22>,
>>>> I figured out the following solution with `straight-use-package'
>>>> command:
>>>>
>>>> (defvar package-list)
>>>> (setq package-list '(
>>>> flycheck lsp-mode dash posframe
>>>> s ein smartparens valign
>>>> multi-term
>>>> ))
>>>>
>>>> (mapc (lambda(package-name)
>>>> (straight-use-package package-name)) package-list)
>>>>
>>>> But I still don't know the corresponding implementation with
>>>> `use-package' command.
>>> I don't understand what you don't like about this code: as far as I know
>>> (straight-use-package 'foo) is strictly equivalent to (use-package foo
>>> :straight t), and with straight-use-package-by-default you don't need
>>> the :straight t.
>>>
>>> Why is it such a problem to have straight-use-package in this loop
>>> instead of use-package?
>> Just out of curiosity to learn Lisp's ability: understanding and grasp
>> different methods for the same job.
>>
>>> One confusion which took me quite a long time to clear, is that despite
>>> the similar names, straight-use-package and use-package have very
>>> different purposes: straight-use-package is for installing the package
>>> (similar to package-install) while use-package is for grouping together
>>> everything related to a package (this includes installation, either by
>>> straight or package.el,
>> AFAIK, straight is not compatible with package.el, see
>> <https://github.com/raxod502/straight.el/issues/786#issuecomment-859155336>
>> for more detailed info.
> Also see <https://github.com/raxod502/straight.el#getting-started>:
>
> You should remove any code that relates to package.el; for example,
> references to package-initialize, package-archives, and (if you're
> using use-package) :ensure or use-package-always-ensure.
Yes, use-package can be used with straight and package.el by just
changing a keyword (:ensure <-> :straight), but mixing them in the same
configuration is definitely not recommended.
Straight itself is not compatible with package.el and has no reason to
be, since it is intended as a replacement.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-06-13 14:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-12 9:57 Combine multiple (straight-)use-package commands into one Hongyi Zhao
2021-06-12 14:57 ` Hongyi Zhao
2021-06-12 16:08 ` Omar Polo
2021-06-13 1:29 ` Hongyi Zhao
2021-06-13 10:22 ` Thibaut Verron
2021-06-13 12:53 ` Hongyi Zhao
2021-06-13 13:29 ` Hongyi Zhao
2021-06-13 14:54 ` Thibaut Verron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).