From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thibaut Verron Newsgroups: gmane.emacs.help Subject: Re: Combine multiple (straight-)use-package commands into one. Date: Sun, 13 Jun 2021 16:54:03 +0200 Message-ID: References: <90b352da-bcc8-0599-3d30-1299231f14e9@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23840"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 Cc: help-gnu-emacs To: Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 13 16:54:40 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 1lsRVW-0005wX-6N for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Jun 2021 16:54:38 +0200 Original-Received: from localhost ([::1]:52238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsRVV-0005wY-84 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Jun 2021 10:54:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsRV3-0005vC-9W for help-gnu-emacs@gnu.org; Sun, 13 Jun 2021 10:54:09 -0400 Original-Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:44634) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsRV1-0002O9-56 for help-gnu-emacs@gnu.org; Sun, 13 Jun 2021 10:54:08 -0400 Original-Received: by mail-ed1-x531.google.com with SMTP id u24so43059695edy.11 for ; Sun, 13 Jun 2021 07:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=gjYkc5OE8azAeWWJqI+9hI+otqhX3w7prqAYox7K7zs=; b=K8jZH1xOlAEp809WDFPknTyyDB74f2xtEKQt14HQ3RykwBtm9HUXNxw2nO+/CiRRIX EkrG/tqMG/vmaSi5ZlnME0Xyqaj+04Pba/BJ29saYAW5LcoCSmNdaQwGEz7c+bH60u21 6BbJekeO3SusyMpQB6Loypq0ZbyzSzdSE07+uFH11FVsXiZrRDLAWCKOIppOmgrxcXl4 bnlDfKcSDs/zDhRV5LBU+le9y2GU5EeiN3w/b3RPWo5Jb1MswApH5tC6EM/RmDUnqy1C UJAq1alrKEXjrQ19YPVCr6Vsq4FLztVHtS6ciUQB0k8SkI83YKA6v/1z1sKmY/eTvJpo aCcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=gjYkc5OE8azAeWWJqI+9hI+otqhX3w7prqAYox7K7zs=; b=ohtR4eV/jOeyLXg5wRHO7UTVBaB9cSfg+dlYvSd3OvpKLdspSuXt5iphPVdJRY6Qx9 7UKTU57vsUQ9CFshdrqtc/ydHcVo+nSl+SZ4TUEobHKfXsDgYT0dVx3K6cBOvuO3tGdC Yy2J9PU6Fo7MA3YTFq6QtUJpiT8gwavK+U+7GpuseQ0xMP/dT3ymOBAbQ/RloUwxiQD9 jQLeqy54NRejrqycFw3fIChD0X959/0XXLd+k4vuUavOWzWT/86QqL/sS1jfXjbmHBvN +r17aJ0k+zTWtPPbUCIzxaZSWPrLi0avJcu0CdVoAGab6N8yXjn2MWqX4qZjQmLatVe9 hV9A== X-Gm-Message-State: AOAM531gJU2ye+LT8DBnW20w/GJU2barVdmgN7Dz0Lll1FyOtvN0znxD VPT/R9ZauZ9Pe2b/J1DaonVCTs1TZN0d7b5O20w= X-Google-Smtp-Source: ABdhPJznNqFJ4o/wC0S1BK+pDDQyfXBO7IR5QGFMqN6sKtHA0qQg5UhYJ4GpnSMrkpUjOXLhhoAo+w== X-Received: by 2002:a05:6402:74e:: with SMTP id p14mr12912452edy.17.1623596045133; Sun, 13 Jun 2021 07:54:05 -0700 (PDT) Original-Received: from [192.168.2.110] (dslb-088-066-248-118.088.066.pools.vodafone-ip.de. [88.66.248.118]) by smtp.gmail.com with ESMTPSA id du16sm4775946ejc.42.2021.06.13.07.54.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Jun 2021 07:54:04 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=thibaut.verron@gmail.com; helo=mail-ed1-x531.google.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 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, NICE_REPLY_A=-0.144, 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:130792 Archived-At: On 6/13/21 3:29 PM, Hongyi Zhao wrote: > On Sun, Jun 13, 2021 at 8:53 PM Hongyi Zhao wrote: >> 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. > Also see : > > 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.