GNU bug report logs - #72556
29.1.90; vc-diff does not undo hunk in end of source file

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Tomas Nordin <tomasn@HIDDEN>; dated Sat, 10 Aug 2024 12:12:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 72556 <at> debbugs.gnu.org:


Received: (at 72556) by debbugs.gnu.org; 15 Sep 2024 10:42:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 15 06:42:09 2024
Received: from localhost ([127.0.0.1]:48497 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spmhl-0003w6-0Q
	for submit <at> debbugs.gnu.org; Sun, 15 Sep 2024 06:42:09 -0400
Received: from mout02.posteo.de ([185.67.36.66]:41487)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tomasn@HIDDEN>) id 1spmhi-0003vZ-Jw
 for 72556 <at> debbugs.gnu.org; Sun, 15 Sep 2024 06:42:07 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 8279B240101
 for <72556 <at> debbugs.gnu.org>; Sun, 15 Sep 2024 12:41:48 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1726396908; bh=5XCZ9bLwSmynwvffyzE7XA7/8QsC980+ITgdw8xna/4=;
 h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From;
 b=KUW+3bCdH2yIdSfldheEokK5/xCx1GhDe0uEsTk6SLHDZSE7lg8z609B7+HsL+A6Z
 NH25RKtp4O1DmC7EdjXNTKSX+khTe9XzxQNp1AiOtsw46POMH30pHEZPEigOTMk9Pm
 QpvaDKtB6vma0Mio8UmUi2nqHKL72Nh1lCslqm3kgRKNqWA09MNTvMbKgUkfyajbTJ
 5npRhU9SsSMddCOoUXI3V8W7VWmdXO/PWbHxIzDCtTBYRdXKFGJbprRqlEvpZR7joV
 NCnWBa+fHWBfbh+DkeQx2OMxwZ2wXHVpkq+PjFU6zy1QtamrolyoZpTQTFHBuJj0/z
 Yjr8fL5vqQOBg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4X64NV1j9Dz6tvp;
 Sun, 15 Sep 2024 12:41:45 +0200 (CEST)
From: Tomas Nordin <tomasn@HIDDEN>
To: Dmitry Gutov <dmitry@HIDDEN>, 72556 <at> debbugs.gnu.org
Subject: Re: bug#72556: 29.1.90; vc-diff does not undo hunk in end of source
 file
In-Reply-To: <b6964d32-aa15-46d1-8a2f-20a12588efc5@HIDDEN>
References: <87ttfs60ir.fsf@HIDDEN>
 <b6964d32-aa15-46d1-8a2f-20a12588efc5@HIDDEN>
Date: Sun, 15 Sep 2024 10:41:45 +0000
Message-ID: <87o74pmc5y.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72556
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Dmitry Gutov <dmitry@HIDDEN> writes:

> Hi!
>
> On 10/08/2024 15:11, Tomas Nordin wrote:
>> I have
>> noticed that if the diff hunk is an addition in the end of the source
>> file, I dont get the expected question if I want to undo the hunk.
>> Instead, the hunk is applied again.
>
> No matter the resolution of this bug, just wanted to make sure you know 
> that you can force the reverse direction by adding the prefix to the 
> command.
>
> So while 'C-c C-a' applies the hunk, 'C-u C-c C-a' reverses it (with a 
> similar check that sees whether the hunk has been applied already).

I was loosely aware of that but never got it into my fingers. Instead I
was relying on that dwim behavior of diff-mode. But trying the prefix
variant out, it seems to be a solid way of "un-applying" a hunk.

Might not be worth the trouble to try and fix this problem if it is
complicated. There is a solid way to do what I want (which is maybe the
proper way), and my complaint about this is the only one I have seen. A
wont-fix is fine with me.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72556; Package emacs. Full text available.

Message received at 72556 <at> debbugs.gnu.org:


Received: (at 72556) by debbugs.gnu.org; 14 Sep 2024 15:50:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 11:50:54 2024
Received: from localhost ([127.0.0.1]:47674 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spV30-0006p3-Kr
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2024 11:50:54 -0400
Received: from fhigh6-smtp.messagingengine.com ([103.168.172.157]:42429)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1spV2y-0006oj-Rd
 for 72556 <at> debbugs.gnu.org; Sat, 14 Sep 2024 11:50:53 -0400
Received: from phl-compute-09.internal (phl-compute-09.phl.internal
 [10.202.2.49])
 by mailfhigh.phl.internal (Postfix) with ESMTP id 80E16114013F;
 Sat, 14 Sep 2024 11:50:36 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
 by phl-compute-09.internal (MEProxy); Sat, 14 Sep 2024 11:50:36 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :content-transfer-encoding:content-type:content-type:date:date
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm3; t=1726329036;
 x=1726415436; bh=58WHvjwndl31J3rn56hSA2OZfS2TQQY8CzuLfhwWl/s=; b=
 hTF0p8UMIZ6UEFPKpr51KbmEcKdFCO6EoMdf/FNi5kmJ5bFjU7SvzrtXlRwjkJWu
 XUN25EahhoLiJ9ktzx/dVEx2YU4SIPay/AqFVsH8nIgqlfWRPKkkFnMg4e39xshq
 MXCl9p9wlokC4aGujl8raa4DzWYewXTYLnZ20PMgc9rRBc5FEtPgmjs+TCxlKSCd
 R978892snzNjupfsaIWNkR4ZBxS5gISFIuu+wAw66Bj/8NAZleedJZRKPJhGy8hJ
 h21akLnnhCNTNFkYxXq5SkIX5dwGZNsreDnXiTrxeUEMbR6c5FQwgjk5eEG0OshZ
 UFWsspy/7Css/brN6bPuLQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1726329036; x=
 1726415436; bh=58WHvjwndl31J3rn56hSA2OZfS2TQQY8CzuLfhwWl/s=; b=E
 5V9MB6Cv9VxJQSySLF0RwZniQPHMx/m4+b4erE66aCjXSx9YiEfXZ59gJl0SCeal
 8HEwc5vRoACxF3za+EP3OVVQQQsf649qVhzrOzGIf0GurvBp/levbufwkU6WPDTo
 x+N8xcQbTIu2skbgE+eoEg8LfcAQjfnn00gCsX+g+456EMFbiWExlb5d/eRAiFMs
 F2XTo5EK7mjfcuKymjxPIkUEufwNQ6Q2nDj2F/WzZjusZu6AKmyZD2t1Ma4NNSmy
 86tbiVC8rdHJkDLjn3AjLW94VxryEUnmWU90zkpbEvLpajCtx0PsOrabpipsw3tv
 p4trRGV1QJhbjBOrtj8bw==
X-ME-Sender: <xms:zLDlZkrDcFPu_vk2RMO6DETJdXxmWsvcB3aURQqCdQPDj4PssjfLBw>
 <xme:zLDlZqq-pVL5PFSwityixZv8UXDQzDzBWSCkszlC_T1yG3A19szOlZ6pxjRtGbYks
 XqIW6yPlbAzBMOuZUY>
X-ME-Received: <xmr:zLDlZpNC90FQ42mME1h1cHBeksU0-6StuNYswUcVnD-rKD93YSeP1kMTexUcCa1j9qTD>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudektddgleehucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
 rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
 htshculddquddttddmnecujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeen
 ucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvg
 hvqeenucggtffrrghtthgvrhhnpedthfeuvddtveelgeeuleevvdejveehffevveehvdeu
 ffdtfefhvdeugefgtefgtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh
 grihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthhtohep
 vddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepthhomhgrshhnsehpohhsthgvoh
 drnhgvthdprhgtphhtthhopeejvdehheeiseguvggssghughhsrdhgnhhurdhorhhg
X-ME-Proxy: <xmx:zLDlZr7WflpRLP3MgCmLwCvwa-Y8vPGSuG7LWqqU-aS8UeNP6h5ugw>
 <xmx:zLDlZj7nW3QCdhHWlJT5m2upk3P2MFxbtLibJtBxR_lTmP34691XLg>
 <xmx:zLDlZrjF8Y7vC4HaaIFo8NsW8A_CWA1JMZAibg714g1TikVKvexISg>
 <xmx:zLDlZt4Q0lyHjjX5_Jut9Cd99FOeXIQhJHOec30waWbfyfZYZhkWow>
 <xmx:zLDlZjFeOb_oy39x0q8uU_KMYVPGMI0PZuhd4zsWYfh8aDjc3sIPRicS>
Feedback-ID: i07de48aa:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 14 Sep 2024 11:50:35 -0400 (EDT)
Message-ID: <b6964d32-aa15-46d1-8a2f-20a12588efc5@HIDDEN>
Date: Sat, 14 Sep 2024 18:50:33 +0300
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#72556: 29.1.90; vc-diff does not undo hunk in end of source
 file
To: Tomas Nordin <tomasn@HIDDEN>, 72556 <at> debbugs.gnu.org
References: <87ttfs60ir.fsf@HIDDEN>
Content-Language: en-US
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <87ttfs60ir.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 72556
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi!

On 10/08/2024 15:11, Tomas Nordin wrote:
> I have
> noticed that if the diff hunk is an addition in the end of the source
> file, I dont get the expected question if I want to undo the hunk.
> Instead, the hunk is applied again.

No matter the resolution of this bug, just wanted to make sure you know 
that you can force the reverse direction by adding the prefix to the 
command.

So while 'C-c C-a' applies the hunk, 'C-u C-c C-a' reverses it (with a 
similar check that sees whether the hunk has been applied already).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72556; Package emacs. Full text available.

Message received at 72556 <at> debbugs.gnu.org:


Received: (at 72556) by debbugs.gnu.org; 14 Sep 2024 15:48:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 11:48:02 2024
Received: from localhost ([127.0.0.1]:47669 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spV0D-0006aN-Ud
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2024 11:48:02 -0400
Received: from fhigh6-smtp.messagingengine.com ([103.168.172.157]:44697)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1spV0B-0006Zz-3l
 for 72556 <at> debbugs.gnu.org; Sat, 14 Sep 2024 11:48:00 -0400
Received: from phl-compute-08.internal (phl-compute-08.phl.internal
 [10.202.2.48])
 by mailfhigh.phl.internal (Postfix) with ESMTP id 098381140146;
 Sat, 14 Sep 2024 11:47:43 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
 by phl-compute-08.internal (MEProxy); Sat, 14 Sep 2024 11:47:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm3; t=1726328863;
 x=1726415263; bh=nZSVqsYWDxC6IY6VlGe43kzP6jxZMp8EqO5/ZibX+4I=; b=
 GCIxMOrTVsiISbwqqbHSeFVzvB/fOpdF3qJg8BSJfRdYK91Uo/Lxlt9WBdVfvEJB
 uOPEF5MA9xa//mwQfzGiPBjYNdXZrXaX7TgxyPozobyLMCb/h5r4Mw05bOecphSm
 lYjiLsr63o8fOKSyuiquJ0miv7BB68H1Oqnohh1+cBUMkbNMD2jUtPk49WYQTpST
 KBuqFP6tP/WNYCaf34XLlaK1nW8Rzt+msH62GShPbyFv55Myru77ANk/PtixlCbz
 sqXCIf28dYGclGRQcxCr2jRrrH/H6Rk8faQ6n+CRhWgs3Ld7fMbaIJdZM5fNxwu1
 rzxz9MfQUwSZQKxc9NeHmA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1726328863; x=
 1726415263; bh=nZSVqsYWDxC6IY6VlGe43kzP6jxZMp8EqO5/ZibX+4I=; b=j
 YODsbcxVEMXA9nWYkV7fXJHEwAbIG6atUyHcQc+mOpPNzZCjvDUx3hoxtM/TuSo8
 cc1BOC/Pe9T8JLiIjwBlt/Csz1mYUe/jVjwoxrq+/3jFfT9ejZDhvQVpmSVbH8jk
 BVK6CVvBkXmt3VGLTKzkMoqEzOZKaCkhvgywgDe1riLwaU/TsEpiBykE3WgISWpE
 +/LdnXEec5bcuRpgP5Vx2HiJ3+bghVZ60u48yo0X47eWRZEpTB1UtSfM1FjLq/7P
 73GDCemYzrWDSp4NMYRiy3GEyYb3fgM+ed868vzDH00ntlh7lWvms/nfOp0q3IMA
 LrQUxkienHkGUrqvXcaVQ==
X-ME-Sender: <xms:HrDlZgqXHdMGFtFKVLvoV1kDDCpDz47SeRfRrOQjREveznUxDux9ig>
 <xme:HrDlZmpneqrU83oFIfUEywhXC0vyTNLNpfQOsoY-1ZACSoE6TFpD19fmiJM44sGCn
 YxHH8hpQI7D2v0INmE>
X-ME-Received: <xmr:HrDlZlOcH8jMwmCwlppaznn2xHM5KjjcUxXMXWGa_IA7_ilfEmfUYGOSFLPH5WMoMl3h>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudektddgleegucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
 rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
 htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdej
 necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdrug
 gvvheqnecuggftrfgrthhtvghrnhepteduleejgeehtefgheegjeekueehvdevieekueef
 tddvtdevfefhvdevgedujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe
 hmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthho
 peegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjuhhriheslhhinhhkohhvrd
 hnvghtpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepthhomhgr
 shhnsehpohhsthgvohdrnhgvthdprhgtphhtthhopeejvdehheeiseguvggssghughhsrd
 hgnhhurdhorhhg
X-ME-Proxy: <xmx:HrDlZn6NT_fema-PWRv4LoIde0-ODgC-DatrEER9y_nfLqa8zYHQSA>
 <xmx:HrDlZv42araWBDdD3gJbLl9KaoHnRkHbKD0JDvRcl84vKg_Ok2Mq2Q>
 <xmx:HrDlZng6sI_skxW9liKfEoDySvWkAzsMVaBKAtEB22BifzUayC9MoA>
 <xmx:HrDlZp5Gzus17N0p_gOhIzFar-j2WuDwFO87WszxhjLvaENwRbSeMg>
 <xmx:H7DlZi3LOi8oww5LRGmFm_YM7lkZ_dM-NvDdt7MqfrYcpe_mkaS50l6L>
Feedback-ID: i07de48aa:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat,
 14 Sep 2024 11:47:41 -0400 (EDT)
Message-ID: <3e529eff-daf6-4518-b397-a21656b97199@HIDDEN>
Date: Sat, 14 Sep 2024 18:47:39 +0300
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#72556: 29.1.90; vc-diff does not undo hunk in end of source
 file
To: Juri Linkov <juri@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
References: <87ttfs60ir.fsf@HIDDEN> <86ttfj32wk.fsf@HIDDEN>
 <861q2lhrxc.fsf@HIDDEN>
Content-Language: en-US
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <861q2lhrxc.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 72556
Cc: Tomas Nordin <tomasn@HIDDEN>, 72556 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 19/08/2024 19:49, Juri Linkov wrote:
> A possible solution would be to add a condition to detect the case
> when the hunk is at the beginning/end of the diff buffer.

This might have drawbacks. Sometimes we want to split a hunk and then 
apply the top part. And when a hunk is split, the top part can't have 
context at the end.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72556; Package emacs. Full text available.

Message received at 72556 <at> debbugs.gnu.org:


Received: (at 72556) by debbugs.gnu.org; 14 Sep 2024 07:35:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 03:35:36 2024
Received: from localhost ([127.0.0.1]:44658 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spNJf-0002pf-Pk
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2024 03:35:36 -0400
Received: from eggs.gnu.org ([209.51.188.92]:52524)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1spNJd-0002pO-QG
 for 72556 <at> debbugs.gnu.org; Sat, 14 Sep 2024 03:35:34 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1spNJN-0000lz-Of; Sat, 14 Sep 2024 03:35:17 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=+090XjaAqF/z3NEN+LV5PRogHfXLHAR6nU1a1Pm5Kwc=; b=jEIIVMg+fu9y
 lHdfIRWHUeDPewzXY5D8ju7WExIrvVoVTAopuYv10XeGVv9AQU5RTp3+pnsDM/pdRkDJP+T6AsjYC
 uV3JlbyX5FZMWs2KfeLqR2R2E32gThZdybC7J/ynUMJZZZmK4cCl90HvZpu4Wemn/gE1eiNxnkZQn
 ura6EmOnmUBlg8ZPOj2W16uB5rg5SEIaJKTkoxUQiK+xis5GJHVaSMbz5sZohCHayhFQGssIsdlQF
 adzCFygPlm0hIhHNvfwyxPjaeeEMlgzVLXihC7uppovDWRutBq0xq9r3FEY/+hA2eAMCv8a1dFx3h
 qjAp4lAfKkHwRyNz0yL2fA==;
Date: Sat, 14 Sep 2024 10:35:15 +0300
Message-Id: <86ed5mit70.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: dmitry@HIDDEN, juri@HIDDEN
In-Reply-To: <86msktcdvj.fsf@HIDDEN> (message from Eli Zaretskii on Sat, 31
 Aug 2024 11:09:36 +0300)
Subject: Re: bug#72556: 29.1.90;
 vc-diff does not undo hunk in end of source file
References: <87ttfs60ir.fsf@HIDDEN> <86ttfj32wk.fsf@HIDDEN>
 <861q2lhrxc.fsf@HIDDEN> <86msktcdvj.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72556
Cc: tomasn@HIDDEN, 72556 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ping! Would someone want to work on a patch, or should I close this
bug as wontfix?

> Cc: 72556 <at> debbugs.gnu.org
> Date: Sat, 31 Aug 2024 11:09:36 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: Juri Linkov <juri@HIDDEN>
> > Cc: Tomas Nordin <tomasn@HIDDEN>,  Dmitry Gutov <dmitry@HIDDEN>,
> >   72556 <at> debbugs.gnu.org
> > Date: Mon, 19 Aug 2024 19:49:05 +0300
> > 
> > >> To reproduce:
> > >>
> > >> $ mkdir apply
> > >> $ cd apply
> > >> $ echo "first line of code" > example.file
> > >> $ git init
> > >> $ git add .
> > >> $ git commit -m 'init'
> > >> $ echo "last line of code" >> example.file
> > >> $ emacs -Q example.file
> > >>
> > >> C-x v =
> > >> n
> > >> C-c C-a
> > >>
> > >> The hunk is applied in the source buffer.
> > >
> > > Juri and Dmitry, any comments or suggestions?
> > 
> > I don't know why it fails at the end, so I tried to debug 'diff-apply-hunk',
> > and found that the problem is in these lines of 'diff-find-source-location':
> > 
> >     ;; FIXME: Check for case where both OLD and NEW are found.
> >     (pos (or (diff-find-text (car old))
> > 
> > When the hunk is at the beginning/end of the diff buffer,
> > then it misses the top/bottom part of the context,
> > so 'diff-find-text' wrongly matches it because it fails
> > to see any changes in it due to insufficient context,
> > and returns switched=nil.
> > 
> > A possible solution would be to add a condition to detect the case
> > when the hunk is at the beginning/end of the diff buffer.
> 
> Thanks.  Would anyone like to submit a patch along these lines?
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72556; Package emacs. Full text available.

Message received at 72556 <at> debbugs.gnu.org:


Received: (at 72556) by debbugs.gnu.org; 31 Aug 2024 08:10:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 31 04:10:44 2024
Received: from localhost ([127.0.0.1]:53873 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1skJC0-0006UT-BJ
	for submit <at> debbugs.gnu.org; Sat, 31 Aug 2024 04:10:44 -0400
Received: from eggs.gnu.org ([209.51.188.92]:51144)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1skJBx-0006U8-HG
 for 72556 <at> debbugs.gnu.org; Sat, 31 Aug 2024 04:10:42 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1skJAw-0007Cc-5l; Sat, 31 Aug 2024 04:09:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=nyNcG5dDapUy+6kYMXKXBwLsk1dlkh8fQ5L/AnB3jbA=; b=sH+BHNk7Ui8I
 aFYKoJdICVSepw5OSH3n4OYE5Stv7VnNV3zR0QQL6DO5HR4pB2AjXaSoCInaZqOkNFKSTpDvPdR23
 XtT4lala+br7/9Ehx+i+VAtHDfN3rar8dbia6UMU9Ksl4gSDSYPSecDCt4ICHzCbagNnmEHjcasRX
 BlmRuXtY25Cqa7ON4TZn3t7BS0cuigoakG4QVAMoo6VfPKSHiI7ZMVEmAXlaw69BvWCUWDrlaFdvu
 S++RWly8RiZp8o6gxiC+5cRPfvq3pxNMs7H9kB4+5tnGTAmDcUEuFdBNvAMlpOEGL4HCGKrweOiey
 AA87HwumfemCdwi9aAH1sQ==;
Date: Sat, 31 Aug 2024 11:09:36 +0300
Message-Id: <86msktcdvj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: tomasn@HIDDEN, dmitry@HIDDEN, Juri Linkov <juri@HIDDEN>
In-Reply-To: <861q2lhrxc.fsf@HIDDEN> (message from Juri Linkov on
 Mon, 19 Aug 2024 19:49:05 +0300)
Subject: Re: bug#72556: 29.1.90; vc-diff does not undo hunk in end of source
 file
References: <87ttfs60ir.fsf@HIDDEN> <86ttfj32wk.fsf@HIDDEN>
 <861q2lhrxc.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72556
Cc: 72556 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: Tomas Nordin <tomasn@HIDDEN>,  Dmitry Gutov <dmitry@HIDDEN>,
>   72556 <at> debbugs.gnu.org
> Date: Mon, 19 Aug 2024 19:49:05 +0300
> 
> >> To reproduce:
> >>
> >> $ mkdir apply
> >> $ cd apply
> >> $ echo "first line of code" > example.file
> >> $ git init
> >> $ git add .
> >> $ git commit -m 'init'
> >> $ echo "last line of code" >> example.file
> >> $ emacs -Q example.file
> >>
> >> C-x v =
> >> n
> >> C-c C-a
> >>
> >> The hunk is applied in the source buffer.
> >
> > Juri and Dmitry, any comments or suggestions?
> 
> I don't know why it fails at the end, so I tried to debug 'diff-apply-hunk',
> and found that the problem is in these lines of 'diff-find-source-location':
> 
>     ;; FIXME: Check for case where both OLD and NEW are found.
>     (pos (or (diff-find-text (car old))
> 
> When the hunk is at the beginning/end of the diff buffer,
> then it misses the top/bottom part of the context,
> so 'diff-find-text' wrongly matches it because it fails
> to see any changes in it due to insufficient context,
> and returns switched=nil.
> 
> A possible solution would be to add a condition to detect the case
> when the hunk is at the beginning/end of the diff buffer.

Thanks.  Would anyone like to submit a patch along these lines?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72556; Package emacs. Full text available.

Message received at 72556 <at> debbugs.gnu.org:


Received: (at 72556) by debbugs.gnu.org; 19 Aug 2024 16:50:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 19 12:50:37 2024
Received: from localhost ([127.0.0.1]:59019 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sg5aX-0001qr-7l
	for submit <at> debbugs.gnu.org; Mon, 19 Aug 2024 12:50:37 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:35599)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1sg5aV-0001qa-Nr
 for 72556 <at> debbugs.gnu.org; Mon, 19 Aug 2024 12:50:36 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 7AE93E0002;
 Mon, 19 Aug 2024 16:49:25 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72556: 29.1.90; vc-diff does not undo hunk in end of source
 file
In-Reply-To: <86ttfj32wk.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 17 Aug
 2024 12:38:19 +0300")
Organization: LINKOV.NET
References: <87ttfs60ir.fsf@HIDDEN> <86ttfj32wk.fsf@HIDDEN>
Date: Mon, 19 Aug 2024 19:49:05 +0300
Message-ID: <861q2lhrxc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 72556
Cc: Dmitry Gutov <dmitry@HIDDEN>, Tomas Nordin <tomasn@HIDDEN>,
 72556 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

>> To reproduce:
>>
>> $ mkdir apply
>> $ cd apply
>> $ echo "first line of code" > example.file
>> $ git init
>> $ git add .
>> $ git commit -m 'init'
>> $ echo "last line of code" >> example.file
>> $ emacs -Q example.file
>>
>> C-x v =
>> n
>> C-c C-a
>>
>> The hunk is applied in the source buffer.
>
> Juri and Dmitry, any comments or suggestions?

I don't know why it fails at the end, so I tried to debug 'diff-apply-hunk',
and found that the problem is in these lines of 'diff-find-source-location':

    ;; FIXME: Check for case where both OLD and NEW are found.
    (pos (or (diff-find-text (car old))

When the hunk is at the beginning/end of the diff buffer,
then it misses the top/bottom part of the context,
so 'diff-find-text' wrongly matches it because it fails
to see any changes in it due to insufficient context,
and returns switched=nil.

A possible solution would be to add a condition to detect the case
when the hunk is at the beginning/end of the diff buffer.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72556; Package emacs. Full text available.

Message received at 72556 <at> debbugs.gnu.org:


Received: (at 72556) by debbugs.gnu.org; 17 Aug 2024 09:39:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 17 05:39:33 2024
Received: from localhost ([127.0.0.1]:53537 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sfFuG-0002sD-Lr
	for submit <at> debbugs.gnu.org; Sat, 17 Aug 2024 05:39:32 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33258)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sfFuD-0002rv-J2
 for 72556 <at> debbugs.gnu.org; Sat, 17 Aug 2024 05:39:30 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sfFtR-0005VL-9n; Sat, 17 Aug 2024 05:38:41 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=oSf39bR6cTBFW3DQfiC7qHCmGW2dVjkuyONcTuCALV4=; b=ASPZeWu1YJd4
 yinVuS3PswYxUG0LKffMRIM2QwtRgbvmTGxoTT6azZIcqiigOC7KDrispmP48E4SHY4alE0vfnfgg
 CeqqLd2GNKnyphatwByMnrr53DKeUi2aJvBeEHhpTxboiOECsierztRzz/6VQB2FTpNHnqg6IT5NP
 ZMO5iDA/BQNspoDuClLBmH/pE5FQrF8E9vExf/OqDumLvEe8wDLmKt8uNzOB0yt5OC5GDH7l8QaMq
 6i6Yw+UIiyAnflwKb7JQYppvyfrOiHKHTWFL7wdHpoC6FK44Kg7wsybQ82ZhT+mZyMsVb4+ujCBnp
 aFguD4DVCTg17sYlhzyKTw==;
Date: Sat, 17 Aug 2024 12:38:19 +0300
Message-Id: <86ttfj32wk.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Tomas Nordin <tomasn@HIDDEN>, Juri Linkov <juri@HIDDEN>,
 Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <87ttfs60ir.fsf@HIDDEN> (message from Tomas Nordin on Sat, 10
 Aug 2024 12:11:08 +0000)
Subject: Re: bug#72556: 29.1.90;
 vc-diff does not undo hunk in end of source file
References: <87ttfs60ir.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72556
Cc: 72556 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Tomas Nordin <tomasn@HIDDEN>
> Date: Sat, 10 Aug 2024 12:11:08 +0000
> 
> I have got used to the diff-mode feature of undoing hunks. I have
> noticed that if the diff hunk is an addition in the end of the source
> file, I dont get the expected question if I want to undo the hunk.
> Instead, the hunk is applied again.
> 
> My example is with a git repo, some edits made (and saved to disk) in a
> file, and hitting C-x v = to view the diff. Move to one of the hunks.
> One can now diff-apply-hunk to reverse the hunk. But if that hunk is the
> last thing in the source file, the hunk is applied (again). This is not
> what I expect.
> 
> To reproduce:
> 
> $ mkdir apply
> $ cd apply
> $ echo "first line of code" > example.file
> $ git init
> $ git add .
> $ git commit -m 'init'
> $ echo "last line of code" >> example.file
> $ emacs -Q example.file
> 
> C-x v =
> n
> C-c C-a
> 
> The hunk is applied in the source buffer.

Juri and Dmitry, any comments or suggestions?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72556; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Aug 2024 12:11:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 10 08:11:51 2024
Received: from localhost ([127.0.0.1]:39152 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sckwo-0004BD-Pr
	for submit <at> debbugs.gnu.org; Sat, 10 Aug 2024 08:11:51 -0400
Received: from lists.gnu.org ([209.51.188.17]:45872)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tomasn@HIDDEN>) id 1sckwm-0004B5-B8
 for submit <at> debbugs.gnu.org; Sat, 10 Aug 2024 08:11:49 -0400
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 <tomasn@HIDDEN>) id 1sckwI-0003XD-Fg
 for bug-gnu-emacs@HIDDEN; Sat, 10 Aug 2024 08:11:18 -0400
Received: from mout01.posteo.de ([185.67.36.65])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tomasn@HIDDEN>) id 1sckwF-0003HC-0N
 for bug-gnu-emacs@HIDDEN; Sat, 10 Aug 2024 08:11:18 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 9B88E240027
 for <bug-gnu-emacs@HIDDEN>; Sat, 10 Aug 2024 14:11:09 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1723291869; bh=IXlxI6WYNnDwE5m9QkW/n0qyJpx950s08R4fCUI8V1A=;
 h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From;
 b=WHjS2vixKVP/4eUGc03AaeeeCRU/XCeZHfFX0h/JGW3sriA/wsqJS9fstAVX6T/PZ
 pmk1BVfj6vCJaF2kZEJ09KP1lKmp5OR+fql6rykfdbwgQYiFbdPAGUttd2sH1vmYet
 aZ0PdGwRrGyxKOhuLitxQQrOVtWbQ6hQYms80BaXd/nEu6DX3xAZJmazb0iXyunZ03
 9V6mtLMGkFSBzq19MeLi9CMj+ZTX9y2Tf1T17ePG1i21sSeRSBge772D7p3Gabcp/1
 HkRMMNy+JEmoTaf/ILcyKP5nBGDRj8pO1Fc7jGRHQg31CRHh/7bSoFz/66qvF0lcy2
 9JXufeP071qMQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Wh04F0mwrz6tsB
 for <bug-gnu-emacs@HIDDEN>; Sat, 10 Aug 2024 14:11:08 +0200 (CEST)
From: Tomas Nordin <tomasn@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.1.90; vc-diff does not undo hunk in end of source file
Date: Sat, 10 Aug 2024 12:11:08 +0000
Message-ID: <87ttfs60ir.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=185.67.36.65; envelope-from=tomasn@HIDDEN;
 helo=mout01.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hello Emacs

I have got used to the diff-mode feature of undoing hunks. I have
noticed that if the diff hunk is an addition in the end of the source
file, I dont get the expected question if I want to undo the hunk.
Instead, the hunk is applied again.

My example is with a git repo, some edits made (and saved to disk) in a
file, and hitting C-x v = to view the diff. Move to one of the hunks.
One can now diff-apply-hunk to reverse the hunk. But if that hunk is the
last thing in the source file, the hunk is applied (again). This is not
what I expect.

To reproduce:

$ mkdir apply
$ cd apply
$ echo "first line of code" > example.file
$ git init
$ git add .
$ git commit -m 'init'
$ echo "last line of code" >> example.file
$ emacs -Q example.file

C-x v =
n
C-c C-a

The hunk is applied in the source buffer.

In GNU Emacs 29.1.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.16.0) of 2023-11-18 built on fliptop2
Repository revision: d9e43f2197fa1d5ade1d483b15cc50c6d705b969
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: sv_SE.UTF-8
  value of $LC_NUMERIC: sv_SE.UTF-8
  value of $LC_TIME: sv_SE.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x
smerge-mode diff vc vc-git diff-mode easy-mmode vc-dispatcher
cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 44032 13907)
 (symbols 48 5959 0)
 (strings 32 16246 1269)
 (string-bytes 1 466537)
 (vectors 16 10894)
 (vector-slots 8 165303 14637)
 (floats 8 28 20)
 (intervals 56 226 0)
 (buffers 976 13))




Acknowledgement sent to Tomas Nordin <tomasn@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#72556; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.