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: Tue, 07 Dec 2021 18:05:40 +0100

>>>>> On Tue, 7 Dec 2021 21:16:00 +0800, Hongyi Zhao <hongyi.zhao@gmail.com> 
>>>>> 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
-- 



reply via email to

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