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: Wed, 08 Dec 2021 10:07:28 +0100 Message-ID: <87lf0vqxbj.fsf@gmail.com> References: <87sfv4l50b.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39146"; 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 Wed Dec 08 10:08:28 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 1musw8-0009tw-GT for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 08 Dec 2021 10:08:28 +0100 Original-Received: from localhost ([::1]:41516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1musw7-0002VK-07 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 08 Dec 2021 04:08:27 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1musvE-0002Us-Je for help-gnu-emacs@gnu.org; Wed, 08 Dec 2021 04:07:33 -0500 Original-Received: from [2a00:1450:4864:20::432] (port=33408 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 1musvD-0002ox-4y for help-gnu-emacs@gnu.org; Wed, 08 Dec 2021 04:07:32 -0500 Original-Received: by mail-wr1-x432.google.com with SMTP id d24so2945578wra.0 for ; Wed, 08 Dec 2021 01:07:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version; bh=kPCvKiwBADYCTeWAqbv2aD7JVP3SmzJ7iJzULodwC3g=; b=jKMJdO/thmay0FTDpxDKLJr8tUdLok+YZyAen+9qVMSflENV91FXvmfPdT8KtSoLs8 ioTBdDhCb3YecgGcSUjNI0Xj+7v8C2oirx45J4H/xu9MV5ygmmVqhLdVnjYMi/jjIwjq D6ug/7D784yjtEalL6FMw0Zucg0oLn7yqW2Lur4zSfsQTGtOC2x79NEwr7PFktwtFLS4 xc5dxxAhBPxVWC3Ngy+08TMHhEdw94oHi0LhEZyKGtD3xjDG2l98oQCRMd+BqTc40oV+ Dur5IJs7MP65zxJ+rn/oJubCJLo2ak44/ym3Jg39RooHCrTmmY0JWZ1vwf6DW2xmi5vz sPRw== 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:date:in-reply-to :message-id:mime-version; bh=kPCvKiwBADYCTeWAqbv2aD7JVP3SmzJ7iJzULodwC3g=; b=Wul13eAuInePaEhDJZFgRcG+QAA8AFJLIsxF83I9ygeV8qo0Mn8XmnnbsdHXwe15tH U7urDxQi6cqqdfkkMZ3lJIq7VvASd7ZJqscLP9pbiDXhJTrw5cY8ARUi6a2HMpQx3Zfi aM9gnoF934eUKu5rwci6IQ9q6VsAqTSVLIFrkhz+I23YAg2U/2LbVDoDSdDy9KIu4HdD 9Kx9l/1g5LEZOiJTkbytumEBI8d75hYPXyXz51Q4h8TtrRmEjLaRmsS5/16V+jDT/x84 axIHBS+mt2NoPPAR/v9Jo7BZwJQ1RHJQWRUJNHNrVl33pu5j/OWHhqbdddqyFOt2Kzfn qqGg== X-Gm-Message-State: AOAM533PbR8IvKXiOiD9SB+cq1cynnUvTmL7/1f2PIUSK1evtCMBfSyz ateVoJIkbHW81SjM2CyPZ1OXuZawoY8= X-Google-Smtp-Source: ABdhPJykuGEYsYeZkjqgtwrEGPEjGt4jMJRGh3+UJ1Kcr9Cikz1PTWjgLU2MC4zE8ZKNCIgqgY7zmg== X-Received: by 2002:a5d:604b:: with SMTP id j11mr59917882wrt.22.1638954449357; Wed, 08 Dec 2021 01:07:29 -0800 (PST) Original-Received: from rltb ([2a01:e0a:3f3:fb50:e06b:fb08:141a:5ed3]) by smtp.gmail.com with ESMTPSA id j17sm2474849wmq.41.2021.12.08.01.07.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 01:07:28 -0800 (PST) In-Reply-To: (Hongyi Zhao's message of "Wed, 8 Dec 2021 10:56:12 +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:134888 Archived-At: >>>>> On Wed, 8 Dec 2021 10:56:12 +0800, Hongyi Zhao said: Hongyi> On Wed, Dec 8, 2021 at 1:05 AM Robert Pluim wrote: >> 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)) Hongyi> The author told me the following solution here [1]: Hongyi> ========== Hongyi> Please see: https://www.gnu.org/software/emacs/manual/html_node/emacs/Arguments.html Hongyi> You can pass the universal argument to the command and force will be non-nil. Hongyi> And if you wish to use the command in an elisp program you can just Hongyi> pass the force argument you desire: Hongyi> (straight-remove-unused-repos 'force) Hongyi> ========== Hongyi> [1] https://github.com/raxod502/straight.el/issues/898#issuecomment-988352840 Yes, that works for `straight-remove-unused-repos', because it only cares about the argument being non-nil. There are commands that care about the actual value of `current-prefix-arg', and then you have to bind it via `let'. Robert --