From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#73387: 30.0.90; C-x v v in diff-mode doesn't work after C-c C-n Date: Tue, 24 Sep 2024 01:41:00 +0300 Message-ID: <8d0b046e-4b29-4551-b421-e98e212a7b40@yandex.ru> References: <87zfo28fzu.fsf@zephyr.silentflame.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26436"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: monnier@iro.umontreal.ca, juri@linkov.net To: Sean Whitton , 73387@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 24 00:41:58 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ssrkk-0006hO-Bc for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Sep 2024 00:41:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ssrkT-0004aE-Pb; Mon, 23 Sep 2024 18:41:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ssrkR-0004Zi-6Y for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2024 18:41:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ssrkQ-0004FJ-T7 for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2024 18:41:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=O2RTnCR0YD00zuOW7ErTYzclJptEFp5AgbCc99XlFaw=; b=lye/eerJEXNRWacrORBWnl3FlBpBfmFXY3NtVM+MZDiERXLDj9Nirk5aVKxw+ub+sdHibstrGQceOBLXuAKOF+u+DX1nAtpvNGxhkOPziEDTCoFeRx7m13OsX6j6jsO/mgm8smVUZMe5OZ2CFZOZzMBs7wjX32Zlz2pTrntpxplqTeaV2/wRGgATwVlORqhM8NVmSbh+BZfXYJNwqOtbBJZfBf8py4jb9TOR5zzoUPb1LzGh7a4Nt0K4biE63bOji6OcxJfMFkSyg4n+05gXp/1LnqUmxluqvQ0lW7150PRPa+asjC7yW7durm5TN7da28OOFonK9BjAAoKhx9fa5w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ssrko-00034q-B0 for bug-gnu-emacs@gnu.org; Mon, 23 Sep 2024 18:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Sep 2024 22:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73387 X-GNU-PR-Package: emacs Original-Received: via spool by 73387-submit@debbugs.gnu.org id=B73387.172713130011794 (code B ref 73387); Mon, 23 Sep 2024 22:42:02 +0000 Original-Received: (at 73387) by debbugs.gnu.org; 23 Sep 2024 22:41:40 +0000 Original-Received: from localhost ([127.0.0.1]:44886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ssrkR-00034A-Rv for submit@debbugs.gnu.org; Mon, 23 Sep 2024 18:41:40 -0400 Original-Received: from forward502a.mail.yandex.net ([178.154.239.82]:45382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ssrkO-00033u-Q5 for 73387@debbugs.gnu.org; Mon, 23 Sep 2024 18:41:38 -0400 Original-Received: from mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net [IPv6:2a02:6b8:c15:2984:0:640:b1d5:0]) by forward502a.mail.yandex.net (Yandex) with ESMTPS id CD0AA60DF4; Tue, 24 Sep 2024 01:41:09 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 5fbFOwdo8a60-xYbatGiJ; Tue, 24 Sep 2024 01:41:09 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1727131269; bh=O2RTnCR0YD00zuOW7ErTYzclJptEFp5AgbCc99XlFaw=; h=In-Reply-To:From:Subject:Message-ID:Cc:References:Date:To; b=qHCXjognlHXcPd6kbBZOiPofpifFc+gKI5X/SXiEJeg4fUazgM9EQRWaWpuR54wCm nWxxqWYLVgg0nwMjgjHyqHYFTENjYe/EQNLqZeFoah9AAkPl/BKkq4VmWk7uYYVulW 1JPryzIg5Eu/KTgha3ZniNF9926waCDOAoUthlDQ= Authentication-Results: mail-nwsmtp-smtp-production-main-64.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfauth.phl.internal (Postfix) with ESMTP id A864C120006D; Mon, 23 Sep 2024 18:41:05 -0400 (EDT) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Mon, 23 Sep 2024 18:41:05 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddttddgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegughhuthhovheshigrnhguvgigrd hruheqnecuggftrfgrthhtvghrnhepiefhjeeuveetffffvdefteffffekhfeuudejieeh heeiudelgfehgffffeduffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepughguhhtohhvodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhi thihqddufeeffeelleehhedvqddvleegjeejjeejiedqughguhhtohhvpeephigrnhguvg igrdhruhesfhgrshhtmhgrihhlrdgtohhmpdhnsggprhgtphhtthhopeegpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehsphifhhhithhtohhnsehsphifhhhithhtohhnrd hnrghmvgdprhgtphhtthhopeejfeefkeejseguvggssghughhsrdhgnhhurdhorhhgpdhr tghpthhtohepmhhonh X-ME-Proxy: Feedback-ID: ib1d9465d:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Sep 2024 18:41:03 -0400 (EDT) Content-Language: en-US In-Reply-To: <87zfo28fzu.fsf@zephyr.silentflame.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292296 Archived-At: Hi! On 20/09/2024 19:08, Sean Whitton wrote: > X-debbugs-cc: monnier@iro.umontreal.ca, dgutov@yandex.ru, juri@linkov.net > > Hello, > > If you do C-c C-n in a diff-mode buffer with multiple hunks, a > subsequent C-x v v signals a user-error from diff-file-next. I think > that the bug is in how diff-vc-deduce-fileset invokes diff-file-next. > I'm not sure exactly how to rework diff-vc-deduce-fileset. > > It would be nice to fix this because then C-c C-n C-x v v would be a > convenient way to commit just a single hunk. This seems to work: diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 4810b9ce01c..dc59621200c 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -3133,11 +3133,16 @@ diff-syntax-fontify-props ;;;###autoload (defun diff-vc-deduce-fileset () (let ((backend (vc-responsible-backend default-directory)) + (start (point-min)) + (end (point-max)) files) (save-excursion - (goto-char (point-min)) - (while (progn (diff-file-next) (not (eobp))) - (push (diff-find-file-name nil t) files))) + (save-restriction + (widen) + (goto-char start) + (diff-beginning-of-file-and-junk) + (while (progn (diff-file-next) (<= (point) end)) + (push (diff-find-file-name nil t) files)))) (list backend (delete nil (nreverse files)) nil nil 'patch))) (defun diff--filter-substring (str) But to really commit the narrowed diff I think you'll need to do something about this line in vc-next-action ((eq model 'patch) (vc-checkin files backend nil nil nil (buffer-string))) ...to specify altered buffer contents as the diff to use.