From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: Combine multiple (straight-)use-package commands into one. Date: Sun, 13 Jun 2021 20:53:51 +0800 Message-ID: References: <90b352da-bcc8-0599-3d30-1299231f14e9@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20584"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Thibaut Verron Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 13 14:54:50 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lsPdZ-00057F-US for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Jun 2021 14:54:50 +0200 Original-Received: from localhost ([::1]:60798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsPdY-0006a7-Vq for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Jun 2021 08:54:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsPct-0006YW-UC for help-gnu-emacs@gnu.org; Sun, 13 Jun 2021 08:54:08 -0400 Original-Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:38455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsPcr-0005yq-L3 for help-gnu-emacs@gnu.org; Sun, 13 Jun 2021 08:54:07 -0400 Original-Received: by mail-lj1-x22f.google.com with SMTP id s22so16175706ljg.5 for ; Sun, 13 Jun 2021 05:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UlAvEC/5sM7IiNfXUVhH9sDtH6lrA0iPD/fOKy3+6TU=; b=Y6urQ/KTFo56ai7DNyOnbTTYPzJaMdYGz2s6y5vKpEdiPMUaLc6ajwRDZjC/yAbsGf uGAi6+kZA0n0MzNb3vZxWM5LHN1Xnf5ladC0DFSOf8GV7k27WLCevkXRVofKM3Z33TGF JUCt/bTidK/mGWnnlS/EXLNMt3el178WZmIMyxXSckXVZ0MIU9BC4qAgBdYhgn6pFgtj vEyyvCFMu1TrpMiY7LwPCvWVixXgIWutKG0Hk56eKsyRAz29BP9Q+Q/0uez0Aj/5X481 5qbtFHRtVvZPDQPfopOv+IOhWJioGMaE3s9/FMnVkHhsgnPhiZeweIBLuwoZxFRfo9pa khWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UlAvEC/5sM7IiNfXUVhH9sDtH6lrA0iPD/fOKy3+6TU=; b=rssxvk/kx7d2rlllyj7f8A2RAy6eX3q0YcI5owyb3+vfDO5gJuYuIwBg0fD3o80kOi 9IT6xNg3UQimsfIo86cRirI7nrXjSS+CpgkQAzE7dDB4H97q9u3ksD4y12rKrgh9050c KNrc7berPYiui6dE6tcHTR3l6unyTsCzQj7iMa9hSLD0LnqLDAlszb0Egbyj+Oe2ezyy TTQwspkDIBZ72ny4IMy3/TMqRHp+uBYpiUEjYCRU8VfjZcGIIuSHaVuJMrSedhN2i1w9 ctTOMscvHJHHWB+RzXN6AHmpCcqqR0NEvmclC7qWhj6YBsrqF+DKmrN5odEsRDcvRnZg hKeg== X-Gm-Message-State: AOAM531JKx0yL0qLk7p5g2IuACCsnUELqJev8EBbvwaA+HSvRhr+RMzp UeDJe3lwW8WMca0reTVQ1GVzM+vwuPGENluot2w= X-Google-Smtp-Source: ABdhPJzICGTvsaYdYk6X4s6tTaWXMAH7sbaASTW9ysP/gZ07wrlNzZG3I1sfAURTZpLGdWGvwsYsdi33Z2Ucj77sBvE= X-Received: by 2002:a2e:b169:: with SMTP id a9mr9641661ljm.320.1623588843003; Sun, 13 Jun 2021 05:54:03 -0700 (PDT) In-Reply-To: <90b352da-bcc8-0599-3d30-1299231f14e9@gmail.com> Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=hongyi.zhao@gmail.com; helo=mail-lj1-x22f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:130789 Archived-At: On Sun, Jun 13, 2021 at 6:22 PM Thibaut Verron wrote: > > On 12/06/2021 16:57, Hongyi Zhao wrote: > > On Sat, Jun 12, 2021 at 5:57 PM Hongyi Zhao 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 > > , > > 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 for more detailed info. > but also initialization, configuration, > bindings...). Could it be your problem as well? > > Best wishes, > > Thibaut > -- Assoc. Prof. Hongyi Zhao Theory and Simulation of Materials Hebei Vocational University of Technology and Engineering NO. 552 North Gangtie Road, Xingtai, China