help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delete multiple repositories programmatically from elisp by supplyin


From: Robert Pluim
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

>>>>> On Wed, 8 Dec 2021 10:56:12 +0800, Hongyi Zhao <hongyi.zhao@gmail.com> 
>>>>> said:

    Hongyi> On Wed, Dec 8, 2021 at 1:05 AM Robert Pluim <rpluim@gmail.com> 
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
-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]