all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thibaut Verron <thibaut.verron@gmail.com>
To: Hongyi Zhao <hongyi.zhao@gmail.com>,
	help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Combine multiple (straight-)use-package commands into one.
Date: Sun, 13 Jun 2021 12:22:00 +0200	[thread overview]
Message-ID: <90b352da-bcc8-0599-3d30-1299231f14e9@gmail.com> (raw)
In-Reply-To: <CAGP6POKYPjS=Hw-uG5hPb6qyZQrEdw+bv7Tcws+WFdNObgXpoA@mail.gmail.com>

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




  parent reply	other threads:[~2021-06-13 10:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-06-13 12:53     ` Hongyi Zhao
2021-06-13 13:29       ` Hongyi Zhao
2021-06-13 14:54         ` Thibaut Verron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90b352da-bcc8-0599-3d30-1299231f14e9@gmail.com \
    --to=thibaut.verron@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=hongyi.zhao@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.