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 21:29:44 +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="37237"; 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 15:30:55 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 1lsQCU-0009Qt-B8 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Jun 2021 15:30:54 +0200 Original-Received: from localhost ([::1]:41548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsQCS-0007Vw-Fw for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Jun 2021 09:30:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsQBd-0007VG-1w for help-gnu-emacs@gnu.org; Sun, 13 Jun 2021 09:30:01 -0400 Original-Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:39916) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsQBb-00071c-12 for help-gnu-emacs@gnu.org; Sun, 13 Jun 2021 09:30:00 -0400 Original-Received: by mail-lf1-x133.google.com with SMTP id p17so16392487lfc.6 for ; Sun, 13 Jun 2021 06:29:58 -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=DKN6ay2yenKUCm0/y1s2rnH5Ax3VjMhlNSzabwJIk54=; b=mM4BfL7SbUMIXddnvNYqpTsC6mP1t8q5Y30Df8Thd218+6wlUSL15dqgYyRb94ci+e LWptq065lO30DkSxF6gYbO/0Tl2oyp5NF38a7t8uFU7wSOtyO22gTUETZCFcv4S26CCd QqsAXDeTeeq4dXVVxewQ/wp7X+uToM1KuQnuFFTDB94lq6V4c465ONCAhiJJGMnDdsHh AK/1+fGJuVMzKV+pJpeeqzoHpw2lJETFVVScm8r9eTX9a8+gW5xdjezW58TWtnb07LDP ycfdkdsu61qFiEYYYxtyQuKhPgf51kEhH+ctJ3x1yL+lspmVq0VnSoxA7+OzGjJ2x20A USdg== 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=DKN6ay2yenKUCm0/y1s2rnH5Ax3VjMhlNSzabwJIk54=; b=d2dyCb3TgbjX15j+pIr6+1ujnF4x6bRMEt4uNrw435md1Joz2tCIdSifPc58m0gDHq 7QTmbd+fk2I7ePwNwqM7VBy6Sd7h/IpXUVb23rhWz7os1UTD/7ACJK+ifXOqqgnMIHFI cX4UAn02S51OMa0jLnY7ie1nlUnUCwN6tPIhdUbl4edh/Pram8mwSr/EV4YVHA4qeIvd uwI2f53T1q7jOMTMY+FYOlvsI6k6FxI/2dapyLvoO2Ls8U7KRO1f0nKhvl7rG0tjNUF3 Ep5jUHPWfcX6gXvlBw5pzpT5WGKIzmrNdfxbck8e+ymio9eFCZqgaRbjp7ZVqFECzrek wQXw== X-Gm-Message-State: AOAM5333Cmd1yO7khCsXIpgLmHKb7jUfivJ/+cGQP8SuGiFcKlqByDU2 B6nO39Iig5rIjmxo0Lih8Gxe147G/xWn5XhNDiU= X-Google-Smtp-Source: ABdhPJwjChiHxcTHNI2+uKdltJtrQgecfc1ockSo2j90mdFbBLsT23fio8H/j1elfYcA6hRwEM/AXGtO+rVd3EyuZvY= X-Received: by 2002:ac2:5084:: with SMTP id f4mr9026163lfm.466.1623590996402; Sun, 13 Jun 2021 06:29:56 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=hongyi.zhao@gmail.com; helo=mail-lf1-x133.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:130790 Archived-At: 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. > > > 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 -- Assoc. Prof. Hongyi Zhao Theory and Simulation of Materials Hebei Vocational University of Technology and Engineering NO. 552 North Gangtie Road, Xingtai, China