unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: master 101f3cf5b9: Add support for user edits to VC command arguments
Date: Fri, 23 Sep 2022 14:51:32 -0700	[thread overview]
Message-ID: <87bkr5ahej.fsf@melete.silentflame.com> (raw)
In-Reply-To: <jwva66plwtq.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 23 Sep 2022 15:32:48 -0400")

Hello,

On Fri 23 Sep 2022 at 03:32PM -04, Stefan Monnier wrote:

>>>> 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,
>
> Ah, that makes sense.
>
>> From b0fcba8791a1702a41df0d4f12bb47d151eec5b9 Mon Sep 17 00:00:00 2001
>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Date: Fri, 23 Sep 2022 10:43:31 -0700
>> Subject: [PATCH 1/2] vc-git--pushpull: Restore handling of vc-git-program
>>
>> * lisp/vc/vc-git.el (vc-git--pushpull): Restore handling of
>> vc-git-program before recent change: respect a buffer-local value of
>> vc-git-program, and don't ignore user edits to the git program name
>> when PROMPT.
>
> LGTM.

Thanks.

>> From 594ff0b4bdad1f756614556f3487b98ad632c617 Mon Sep 17 00:00:00 2001
>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Date: Fri, 23 Sep 2022 10:09:34 -0700
>> Subject: [PATCH 2/2] Rework user edits to VC commands to use a more functional
>>  style
>>
>> * lisp/vc/vc-dispatcher.el (vc-pre-command-functions): Delete.
>> (vc-filter-command-function): New variable.
>> (vc-user-edit-command): Factor out of vc-do-command.
>> (vc-do-command, vc-do-async-command):
>> * lisp/vc/vc-git.el (vc-git--pushpull):
>> * lisp/vc/vc.el (vc-print-branch-log): Use vc-filter-command-function
>> in place of vc-pre-command-functions and vc-pre-command-functions.
>
> IIUC you could also remove the `vc-want-edit-command-p` variable, right?

Yeah the changelog is wrong, thanks.

>> +(defvar vc-filter-command-function (lambda (&rest args) args)
>> +  "Function called to transform VC commands before execution.
>> +The function is called inside the buffer in which the command
>> +will be run and is passed the COMMAND, FILE-OR-LIST and FLAGS
>> +arguments to `vc-do-command'.  It should return a list with the
>> +same structure containing new values for these arguments.")
>
> That makes it sound like it receives 3 args (which sounds fine to me).
>
>> +(defun vc-user-edit-command (command file-or-list &rest flags)
>
> But these aren't 3 args, it's "2 or more".
> So the doc and the code don't match.
>
> BTW, `apply` and `&rest` are noticeably less efficient than `funcall`
> and normal args.  Efficiency admittedly doesn't matter much here, but
> I'd recommend we don't needlessly use apply/&rest (i.e. I recommend we
> fix the code to match the doc than the other way around).

I was thinking that having a lambda list consonant with vc-do-command
and vc-do-async-command was more important here.  Fits with how it acts
a filter on their lambda lists.

-- 
Sean Whitton



      reply	other threads:[~2022-09-23 21:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <166378878197.3568.7077863090259744101@vcs2.savannah.gnu.org>
     [not found] ` <20220921193303.1B687C11D81@vcs2.savannah.gnu.org>
2022-09-22  9:25   ` master 101f3cf5b9: Add support for user edits to VC command arguments Robert Pluim
2022-09-22 13:24     ` Stefan Monnier
2022-09-22 16:08       ` Sean Whitton
2022-09-22 16:55         ` Stefan Monnier
2022-09-22 21:18           ` Sean Whitton
2022-09-23  6:39             ` Juri Linkov
2022-09-22 22:21         ` [External] : " Drew Adams
2022-09-22 16:06     ` Sean Whitton
2022-09-23  8:03       ` Robert Pluim
2022-09-23 16:15         ` Sean Whitton
2022-09-22 18:45   ` Stefan Monnier
2022-09-22 21:38     ` Sean Whitton
2022-09-22 22:41       ` Stefan Monnier
2022-09-23 17:56         ` Sean Whitton
2022-09-23 19:32           ` Stefan Monnier
2022-09-23 21:51             ` Sean Whitton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkr5ahej.fsf@melete.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).