[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 101f3cf5b9: Add support for user edits to VC command argument
From: |
Sean Whitton |
Subject: |
Re: master 101f3cf5b9: Add support for user edits to VC command arguments |
Date: |
Fri, 23 Sep 2022 10:56:55 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Hello,
On Thu 22 Sep 2022 at 06:41PM -04, Stefan Monnier wrote:
>>> This prompting seems a bit too specific to particular callers of this
>>> function, so I suggest you replace it with some kind of hook which takes
>>> the command as arg and returns the command to use instead. It should be
>>> a `<foo>-function` with a default value of `identity`.
>>
>> Each command that uses this would have to ensure that the prompting
>> function is removed again once used, right? How would you suggest
>> handling that? Perhaps we could have a macro doing something like what
>> we see in vc-exec-after, `add-once-function' or something.
>
> I was thinking of having the caller simply let-bind the variable, or, as
> your code does, have the function set the var's value back to
> `identity`.
>
[...]
>
> I don't have anything in mind, I just see that you added two "hooks",
> one specifically for prompting the user to modify the command and another
> more open ended. Currently neither subsumes the other, but I wonder if
> we couldn't provide a single hook that could satisfy both needs.
I'm attaching a refactoring attempt for review.
>>> Your commit message says:
>>>
>>> (vc-do-async-command): Use the new hook to insert into BUFFER the
>>> command that's next to be run.
>>>
>>> but I don't understand what this changes does.
>>> Wasn't it already inserted into BUFFER? What's changed?
>>
>> Previously it was inserted without going via the hook.
>
> But why did you change the code so it goes via the hook?
So that it uses the user-updated value of the command, rather than the
original value. Hopefully that is clearer in the attached.
--
Sean Whitton
0001-vc-git-pushpull-Restore-handling-of-vc-git-program.patch
Description: Text Data
0002-Rework-user-edits-to-VC-commands-to-use-a-more-funct.patch
Description: Text Data
Re: master 101f3cf5b9: Add support for user edits to VC command arguments, Sean Whitton, 2022/09/22
Re: master 101f3cf5b9: Add support for user edits to VC command arguments, Stefan Monnier, 2022/09/22