From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Whitton Newsgroups: gmane.emacs.devel Subject: Re: master 101f3cf5b9: Add support for user edits to VC command arguments Date: Fri, 23 Sep 2022 14:51:32 -0700 Message-ID: <87bkr5ahej.fsf@melete.silentflame.com> References: <166378878197.3568.7077863090259744101@vcs2.savannah.gnu.org> <20220921193303.1B687C11D81@vcs2.savannah.gnu.org> <87sfkjjdie.fsf@melete.silentflame.com> <87tu4y0yag.fsf@melete.silentflame.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="16715"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 23 23:59:30 2022 Return-path: Envelope-to: ged-emacs-devel@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 1obqhk-00049C-M3 for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Sep 2022 23:59:30 +0200 Original-Received: from localhost ([::1]:35062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obqhj-0001sb-57 for ged-emacs-devel@m.gmane-mx.org; Fri, 23 Sep 2022 17:59:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obqaG-0000EA-4X for emacs-devel@gnu.org; Fri, 23 Sep 2022 17:51:44 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:41647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obqaC-0007DG-Sd for emacs-devel@gnu.org; Fri, 23 Sep 2022 17:51:43 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id ED81E5C00DC; Fri, 23 Sep 2022 17:51:33 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 23 Sep 2022 17:51:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1663969893; x=1664056293; bh=FF MqL+0yF7eZlNeq81XgQXZBvkGqyonBvW4JRcOrICA=; b=pMQC0dLQrVkOqY6vNB Vh8MquIspkctW08aUku0E6bQ0GpZ7YV3kycGTVzXsxx/hW3pLJGjBLZUh2e9pYWp Iti8xyXCP+Uvf6dkxf05ICr+0bd2PZmyGHwTLyeozm2xYgcEBKhGG6SuxBwS2s0t fJhsimHGBoIScdVH/5wPFtsP1vrRyYbqs07ar33ET0eVNo6ugqSYF+gz9wbX8/Im LlKz8qfmtAIO28t2iYrOCjYhl118FIETDvGZJLmWjlWZk03+WfK562YA75/jFL4W JXvltVkhwYmaoI4SF3qpwYl7V5uXxubjHf/dAiHB5B2qPNg5lly8Ts4s/9zwEZSb szEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1663969893; x=1664056293; bh=FFMqL+0yF7eZlNeq81XgQXZBvkGq yonBvW4JRcOrICA=; b=GtLWwjl3fMrgY+SW4v+7cpz0rULFXjinpbwrx8AhjhmG SfPaD109+oz44fHol/EYCD3e3cMqQWn+0ntaWVWkSz9OyoKkkPipkSJ+ajG7c7cN aWdU7SH2ArQ8cgyqqnCJE674R5fkmJhejXbwFydEv8ysee/IkRvPYFdEhzNjyY+K iF+ZG/efUP7Tv5mseFWPhJRVZA/bmzDXe6Uykgy/lEnk1yc+Djf219EBMzNzf66Z vY4QfIy8qUe164HWHUlyCrKtDbgiXSa+y2DQ1/Praubl5jZcCWoc0Bt/Yj8ssSoF VOOmbonxj9UW1qQR6/+jgDUwZQBfJ3srQtCSkJCYIg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeefjedgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkfgggtgesthdttddttdertdenucfhrhhomhepufgvrghn ucghhhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpedtffdvffeuleeuvdetkedvveehgfehvdegvefghfevudek geegleevgeejkeetkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 23 Sep 2022 17:51:33 -0400 (EDT) Original-Received: by melete.silentflame.com (Postfix, from userid 1000) id 7E56B7F30EA; Fri, 23 Sep 2022 14:51:32 -0700 (MST) In-Reply-To: (Stefan Monnier's message of "Fri, 23 Sep 2022 15:32:48 -0400") Received-SPF: pass client-ip=66.111.4.25; envelope-from=spwhitton@spwhitton.name; helo=out1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:296096 Archived-At: 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 >> 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 >> 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