From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.help Subject: Re: Delete multiple repositories programmatically from elisp by supplying `y' as the answer to an interactively called function. Date: Tue, 07 Dec 2021 18:05:40 +0100 Message-ID: <87sfv4l50b.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36960"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 07 18:07:07 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 1mudvn-0009Mf-Ap for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 07 Dec 2021 18:07:07 +0100 Original-Received: from localhost ([::1]:43256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mudvm-000811-0L for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 07 Dec 2021 12:07:06 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muduT-0007C5-GO for help-gnu-emacs@gnu.org; Tue, 07 Dec 2021 12:05:45 -0500 Original-Received: from [2a00:1450:4864:20::432] (port=45780 helo=mail-wr1-x432.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1muduR-0004V3-Db for help-gnu-emacs@gnu.org; Tue, 07 Dec 2021 12:05:45 -0500 Original-Received: by mail-wr1-x432.google.com with SMTP id o13so30798888wrs.12 for ; Tue, 07 Dec 2021 09:05:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:gmane-reply-to-list:date:in-reply-to :message-id:mime-version; bh=DgNKrAcgwUFRnC8NQGoVHNIq13KXIS6jmQl/VvhpM5g=; b=FwAolBUwznQdAWMoBo3iPBUuRNLmYWoqpyHVLTxAbiojO5keKmLVrtVRp6brmOuJ0D AAyOb34mI0joydHfaMrdc1hCf+MCd6EtSc3slQawpDF8KWKDIgETbwu4MEl0Lbxx8Lrc I/uMDVIdn/7japZpuUdou2Y04F40Zhn1hyXOmGpnBQpEFJ0K2ofjDs5jNvIObI+sk53p 8rfXxK+ce2gC5rc+n2z1Ql3XyYruSKLn1kAFpWwYoWk/Q0eHIWwbtc1/8GkQ6C1V1GkK io945ssxibmA0fCUqhJBw6R0tlW5U3eC+azjI2r6wuQMvAt4BEXJ0lcO10xklONRk/HL 9ziw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references :gmane-reply-to-list:date:in-reply-to:message-id:mime-version; bh=DgNKrAcgwUFRnC8NQGoVHNIq13KXIS6jmQl/VvhpM5g=; b=wZlpbrV3nGuUrjRZbYleGMP9bJAvVBnj47fjOfpnxJ92usjigokn7w/p5vAWIqPuRy htz/xfX0qRn4VTR1HTB5f9emt4eKukK3NJkadTQaqkOXSAm13BqvB35hYMCoMMz4zP1x CuiLDKoqAaCJHDaWIwKP5Oh67V+f4NAQ4Uo1v575jkH5JyVfBPmQJn/cZpfSKZCVQ5zz jWrjvHhTMIpcIre21a2Q8DFG7sRdwXTMSGGx8Ptg7J0kBLP0cUh0iL9WerwVNynVVTCW g7M1JldaJ19AUDkFrwQ4O5IkCC2JP/4YarwgUbYxd7ChH93Yyf34meAQafqkHESgPfTu iyWw== X-Gm-Message-State: AOAM530oxqcrfuHA+Op+3GboVlvIIrPKmU5R+GGAquivgdm/B3inkzKT 2X+DL+hhz7Z53j/Pp8B/YlMvx+Cc5qo= X-Google-Smtp-Source: ABdhPJzehtB4/wgYrt0ckrizepn5CkNSokaZi//tn3SSlAv/tPADwyuTPz4g6x1Fa3QD8rqexgT70g== X-Received: by 2002:a5d:4ccc:: with SMTP id c12mr53602698wrt.453.1638896741668; Tue, 07 Dec 2021 09:05:41 -0800 (PST) Original-Received: from rltb ([2a01:e0a:3f3:fb50:cebf:1ade:d5ce:2eb3]) by smtp.gmail.com with ESMTPSA id s8sm321586wra.9.2021.12.07.09.05.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 09:05:41 -0800 (PST) Gmane-Reply-To-List: yes In-Reply-To: (Hongyi Zhao's message of "Tue, 7 Dec 2021 21:16:00 +0800") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::432 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=rpluim@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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:134868 Archived-At: >>>>> On Tue, 7 Dec 2021 21:16:00 +0800, Hongyi Zhao said: Hongyi> The straight package manager [1] supplies the following interactive Hongyi> function, which can be used to delete the unused repositories: Hongyi> straight-remove-unused-repos. As we all know, the normal way to call Hongyi> this function is `M-x straight-remove-unused-repos RET package-name Hongyi> RET`. However, the above method can only delete one repository at a Hongyi> time. If I have many unused repositories that I want to clean up now, Hongyi> this method is very inefficient. Hongyi> In order to achieve a more efficient way, I want to loop over the Hongyi> following command programmatically from elisp, and supply `y' as the Hongyi> answer repeatedly: Hongyi> (call-interactively #'straight-remove-unused-repos) Hongyi> But I still can't figure out the code snippet for doing the above Hongyi> work. Any hints will be greatly appreciated. Hongyi> [1] https://github.com/raxod502/straight.el That function takes a 'force' argument, so if you manage to supply any prefix arg at all it will delete all the repos without prompting. One way to do that is by using `current-prefix-arg': (let ((current-prefix-arg '(4))) (call-interactively #'straight-remove-unused-repos)) Robert --