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: Thu, 26 Sep 2024 02:46:08 +0300 Message-ID: References: <87zfo28fzu.fsf@zephyr.silentflame.com> <8d0b046e-4b29-4551-b421-e98e212a7b40@yandex.ru> <86msjxefkv.fsf@mail.linkov.net> <87cykt2gkl.fsf@zephyr.silentflame.com> <87jzf01bsk.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="40907"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 73387@debbugs.gnu.org, monnier@iro.umontreal.ca, Juri Linkov To: Sean Whitton Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 26 01:47:55 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 1stbje-000AV6-4U for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Sep 2024 01:47:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stbjP-0006Ec-Ox; Wed, 25 Sep 2024 19:47:40 -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 1stbjM-0006DW-Io for bug-gnu-emacs@gnu.org; Wed, 25 Sep 2024 19:47:37 -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 1stbjM-0008BQ-9a for bug-gnu-emacs@gnu.org; Wed, 25 Sep 2024 19:47:36 -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=Pifhr3PRCtQznjWYS5bFmnKpWBOz7M4Ta+Hk2ismNWY=; b=bF12vqsTvcxZR/e/nKE1u4QK5kDfMdDoyGSZfhJWPMFfSDN5XiB+LxmrhX5FzOiGQlVrUKKYO2NNBfNuVNENNBCfAV4OrTFrOtkzViKB7e7bLJ6AZdLvBwL14FeS1Z+AcmgihPATI9/IZ9g9R9jlcboC7unNDc5K+fr51rX8f7wVVjNF1CIy17AUo33L+taFNvuKgmJztnOhtEP7+JkFieEt80G8uaY0txLvG+MHHQxK2+Wo9WCJL3SE11EEFQ6oRqnhB/bSC9lFvPtFQ6p/NEI2E10tIKzaYqYRKBLJh4doHzNrq7MOZFk3sStuhU8ywGQ9ZwGONQtUL7tWDRtXBQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stbjm-0004bd-8M for bug-gnu-emacs@gnu.org; Wed, 25 Sep 2024 19:48: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: Wed, 25 Sep 2024 23:48: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.172730804017648 (code B ref 73387); Wed, 25 Sep 2024 23:48:02 +0000 Original-Received: (at 73387) by debbugs.gnu.org; 25 Sep 2024 23:47:20 +0000 Original-Received: from localhost ([127.0.0.1]:35379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stbj6-0004aX-0b for submit@debbugs.gnu.org; Wed, 25 Sep 2024 19:47:20 -0400 Original-Received: from forward502d.mail.yandex.net ([178.154.239.210]:45020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stbj2-0004aK-Ge for 73387@debbugs.gnu.org; Wed, 25 Sep 2024 19:47:18 -0400 Original-Received: from mail-nwsmtp-smtp-production-main-77.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-77.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:3e0b:0:640:c81:0]) by forward502d.mail.yandex.net (Yandex) with ESMTPS id 3558A60BC6; Thu, 26 Sep 2024 02:46:17 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-77.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id DkeC935o9Cg0-3Lbvhh7I; Thu, 26 Sep 2024 02:46:16 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1727307976; bh=Pifhr3PRCtQznjWYS5bFmnKpWBOz7M4Ta+Hk2ismNWY=; h=In-Reply-To:From:Subject:Message-ID:Cc:References:Date:To; b=iB1ynIjo3aJehLyYa3fNN5XIQbpRu+xOAq+5uqgIAewlbAmLDlh3npUnoGw9K2J4s 7DUKEKkKF5tYS0NEJvczLBOKusiMtgqiR60V6t1NcaVtrgbZyTYDs+qAu32S7kOb9a wMPkGKZTkJEF8ktJThli/f3KS20OXwI8yWOr+H4I= Authentication-Results: mail-nwsmtp-smtp-production-main-77.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfauth.phl.internal (Postfix) with ESMTP id 8D9F21200066; Wed, 25 Sep 2024 19:46:13 -0400 (EDT) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 25 Sep 2024 19:46:13 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddtiedgvdejucetufdoteggodetrfdotf 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; Wed, 25 Sep 2024 19:46:11 -0400 (EDT) Content-Language: en-US In-Reply-To: <87jzf01bsk.fsf@zephyr.silentflame.com> X-Yandex-Filter: 1 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:292427 Archived-At: On 25/09/2024 09:34, Sean Whitton wrote: > On Tue 24 Sep 2024 at 08:36pm +03, Dmitry Gutov wrote: > >> OTOH, maybe what you want to do here could be reached some other way - >> e.g. instead of 'C-x n n' we would have a command which edits the diff buffer >> to leave in only the hunks intersecting the current region. When the >> subsequent (buffer-string) would do the right thing. >> >> The latter might also be a better fit for the overall workflow we were >> thinking about (create a diff -> alter it as necessary -> commit). > Yeah, I already wrote something like that for my init.el. I would like > to find some way to combine it with the existing C-c C-n, if we can. > > Maybe: > if (equal (diff-bounds-of-hunk) (list (point-min) (point-max)), > then C-x v v prompts, "Kill all hunks but this one and commit? (y/n)" ? > > Else if the buffer is narrowed, C-x v v signals a user-error that it > can't handle arbitrary narrowings. > > Then it's just C-c C-n C-x v v but you're asked to confirm before all > the killing occurs, just in case. Suppose C-c C-n (or probably a different but similar binding) edited the diff instead of applying the narrowing, in a way that retained the file header(s), but keeping only the hunks intersecting the region or just the current one. Would that work for you just as well, or do you prefer to use narrowing anyway, for some other reasons?