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.bugs Subject: bug#73407: [PATCH v4] bug#73407: 31.0.50; Add diff-discard-hunk Date: Tue, 24 Sep 2024 18:56:07 +0100 Message-ID: <87wmj10wco.fsf@zephyr.silentflame.com> References: <87jzf58g2t.fsf@zephyr.silentflame.com> <865xqleexg.fsf@mail.linkov.net> <87y13hmold.fsf@zephyr.silentflame.com> <86ikuldyy1.fsf@gnu.org> <87r0992h1n.fsf_-_@zephyr.silentflame.com> <867cb1dm3r.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10243"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 73407@debbugs.gnu.org, dgutov@yandex.ru To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 24 19:56:51 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 1st9mL-0002Ox-AI for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Sep 2024 19:56:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1st9mF-0001VN-28; Tue, 24 Sep 2024 13:56:43 -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 1st9m9-0001UW-Ll for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 13:56: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 1st9m9-0005Ew-9r for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 13:56:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=Y92icV6L2ViD8eFefpOVWJ+bsKZGruJVL8G40MDIQrU=; b=pLt3nIyYTLCKVWbYD/+nWLJfkEDbBGpa9GxknSc13VHryQYKls6bVGfRfhONteKNW6t+XnMYJd8LqIAnGO5FXd4ZD68XQtOv2tMLxErY+PKnUv79nXRrUlkvIOkmNBnfVWoNqFwQhp2//GwNRzZC9M8dOoNdfSxJ1vpPd9hH1lTPrkIER8N+pxy08oPYfRVwkn4A0/z8N6SOR/KecekufT4fumFf9IobEIwhJBgGLSbslJ7hycnVUrkXuS2w0iIK+pHnxRpSnHIfBg23/U/RnfxYiEMogoHGIyZSDAZVVDkVTVDkprLMw3I+ygpRIMQZ0j9tm9fUuO4lNTUG+fRVLw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1st9mX-0003gg-Rq for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 13:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Sep 2024 17:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73407 X-GNU-PR-Package: emacs Original-Received: via spool by 73407-submit@debbugs.gnu.org id=B73407.172720060314141 (code B ref 73407); Tue, 24 Sep 2024 17:57:01 +0000 Original-Received: (at 73407) by debbugs.gnu.org; 24 Sep 2024 17:56:43 +0000 Original-Received: from localhost ([127.0.0.1]:60360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1st9mE-0003g1-Pi for submit@debbugs.gnu.org; Tue, 24 Sep 2024 13:56:43 -0400 Original-Received: from sendmail.purelymail.com ([34.202.193.197]:51910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1st9mC-0003fj-IG for 73407@debbugs.gnu.org; Tue, 24 Sep 2024 13:56:41 -0400 DKIM-Signature: a=rsa-sha256; b=SCx7uojEtfpo2i8cB8rzgoSL3lLUOvnj+7K+VRm2cNdDB+BMvJZ1tP2JYMo3WuEDeH0SnISeeznnb4HO2AgVo8+PVpP/7DgeLgCgEIYkbMJHPq6L7gRqik2kYi2KhNIfT9OAHEhzma9NI/n9QrGcFkyz838tj2DEubC05s/e09GWvgt3s0x6vdN/+jHtn2x7h681S3YOX6j36AA223GKwEIqCpwskMtF/Ol6oMFoJddsAJDxpAlA4pxvCmx53jD20LVA1dhambx65Sr2RpOqIcDXuYKYj4AkgF/6pKGoOlZasrwV6FEvN5c4dUeKJqzJEECzKcw7OjewPZeNCdipkQ==; s=purelymail1; d=spwhitton.name; v=1; bh=DF9xhWS+Thj2TiQy8maecdQ2qpiH8MVfhJtrV6Zcdy4=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=eLyPSPnDEFquf9ld5PAZgjQxO7tMqrJOZfPXHeloQzuJjfBja8HIYX0YNyvtfxE+RSsBy4plPZeeKqdgpGf08yB0B0VLJgymL5LG1LxKTUoOirV8PQ/JJw6FDJ2cfjZgqKkPLX49o0MnsF2/rt4enCv8ro/dqNtubVojS2QorxvLtx5HaUCIwvGXxA9ZrVsW5hfgnrnKq7rd4SAEJELP8AsFkFwecr7FNuZKXN1sAHc23TQLTGUsCwNj1BogwGqf5t1ztUWgjSZe0vwsQKOcZ5A3VbULV9y4Nv73mXZzEW6qdqB+A2+wfPQx2oo6akho6eeDLNeB401dw11pvPauiA==; s=purelymail1; d=purelymail.com; v=1; bh=DF9xhWS+Thj2TiQy8maecdQ2qpiH8MVfhJtrV6Zcdy4=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: 73407@debbugs.gnu.org Original-Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -950218522; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 24 Sep 2024 17:56:08 +0000 (UTC) Original-Received: by zephyr.silentflame.com (Postfix, from userid 1000) id 048D6949F28; Tue, 24 Sep 2024 18:56:08 +0100 (BST) In-Reply-To: <867cb1dm3r.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 24 Sep 2024 19:59:04 +0300") 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:292356 Archived-At: Hello, On Tue 24 Sep 2024 at 07:59pm +03, Juri Linkov wrote: >>>> - (message "%d hunks failed; no buffers changed" failures))))) >>>> + (message "%d hunks failed; no buffers changed" failures) >>>> + failures)))) >>> >>> This comes from existing text, but still: what does the above say when >>> there's only 1 failure? does it say "1 hunks failed"? If so, can we >>> improve the handling of singular/plural here? >> >> I've installed a fix for that. > > Another variant would be to use 'ngettext'. TIL! >>> I'm a little concerned about the binding. >>> >>> We have 'diff-hunk-kill' on M-k (and also 'k'), and this new addition is >>> actually more destructive. I'm expecting users will trip over the difference >>> and call one of them when they wanted to call the other. >> >> Yeah, and thinking about it more, it also doesn't really match what C-c >> C-k does elsewhere in Emacs. I've made it C-c M-r in the attached v4. > > There is the existing 'C-c C-m' submap that could be used with e.g. > 'C-c RET C-k'. I considered that, but I think I'd prefer that it's shorter sequence if possible, because you might want to use it several times. By contrast, C-c C-m a is a command you probably just want once at a time. >> + (diff-reverse-direction beg end) >> + (condition-case ret >> + (diff-apply-buffer beg end) >> + ;; Reversing the hunk is an implementation detail, so ensure the >> + ;; user never sees it. >> + (error (diff-reverse-direction beg end) >> + (signal (car ret) (cdr ret))) >> + (:success (if ret >> + (diff-reverse-direction beg end) > > Instead of reversing the direction back and forth, > it would be simpler to add another optional argument > to 'diff-apply-buffer' to delegate it to the > REVERSE argument of 'diff-find-source-location'. Thanks, I'll try that. -- Sean Whitton