all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Sean Whitton <spwhitton@spwhitton.name>
Cc: 73387@debbugs.gnu.org, monnier@iro.umontreal.ca,
	Juri Linkov <juri@linkov.net>
Subject: bug#73387: 30.0.90; C-x v v in diff-mode doesn't work after C-c C-n
Date: Fri, 27 Sep 2024 22:13:56 +0300	[thread overview]
Message-ID: <5e956e3b-5891-401a-a898-e339f52ea307@yandex.ru> (raw)
In-Reply-To: <87y13dfgzz.fsf@melete.silentflame.com>

On 27/09/2024 14:55, Sean Whitton wrote:
> Hello,
> 
> On Thu 26 Sep 2024 at 02:46am +03, Dmitry Gutov wrote:
> 
>> 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?
> 
> It would work for me, and has a few advantages:
> 
> - it means you just hit 'g' afterwards, not C-x n w and then 'g'

Yep.

Or you could use 'undo' to get back to a previous state of the buffer.

> - it fits better with our general paradigm of killing what you don't
>    want to include and then committing.
> 
> On the other hand, it doesn't seem ideal that after C-c C-n you can, for
> example, use C-c C-a or C-c M-k, but not C-x v v.  That could break you
> out of your mental flow.

Fair point, and maybe we could support both.

> What do you think about this:
> 
> - add a command which does the kill-all-but-this-hunk (or hunks in
>    region if mark active) thing -- it's generally useful.
> 
> - make C-x v v on a narrowed buffer, by default, issue a message saying
>    "Cannot commit patch when narrowed, consider <binding of new command>"

Or it would implement that previous alternative - using the modified 
buffer string that's limited to the current narrowing.

I'm somewhat concerned about supporting both approaches (how different 
are the code paths going to be?), but if that's needed for usability, 
perhaps it's okay.

> - add a user option that when non-nil means C-x v v on a narrowed buffer
>    automatically widens, invokes the new command, and then commits.

And/or Emacs could by default prompt whether it should do that. And that 
prompting behavior could indeed be decided by a user option.

> My thinking is that the latter behaviour is complex and so shouldn't be
> the default, but once you understand what's going on then there is a
> good chance you want to enable it.

Maybe if the prompt is easy enough to understand, that will be fine...





  reply	other threads:[~2024-09-27 19:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20 16:08 bug#73387: 30.0.90; C-x v v in diff-mode doesn't work after C-c C-n Sean Whitton
2024-09-22 12:46 ` Sean Whitton
2024-09-23 22:41   ` Dmitry Gutov
2024-09-23 22:41 ` Dmitry Gutov
2024-09-24  6:32   ` Juri Linkov
2024-09-24 15:54     ` Sean Whitton
2024-09-24 17:36       ` Dmitry Gutov
2024-09-25  6:34         ` Sean Whitton
2024-09-25 23:46           ` Dmitry Gutov
2024-09-27 11:55             ` Sean Whitton
2024-09-27 19:13               ` Dmitry Gutov [this message]
2024-09-29 23:46                 ` Sean Whitton
2024-09-30  0:27                   ` Dmitry Gutov
2024-09-30  9:38                     ` Sean Whitton
2024-09-30 10:11                       ` Dmitry Gutov
2024-09-30 13:10                         ` Sean Whitton
2024-09-30 13:25                           ` Sean Whitton
2024-09-30 14:15                           ` Eli Zaretskii
2024-10-01  0:50                             ` Sean Whitton
2024-10-01  0:27                           ` Dmitry Gutov
2024-10-01  0:57                             ` Sean Whitton
2024-10-01  0:39                           ` Dmitry Gutov
2024-10-01  1:01                             ` Sean Whitton
2024-10-01  1:15                               ` Dmitry Gutov
2024-10-01  1:40                                 ` Sean Whitton
2024-10-01  1:57                                   ` Dmitry Gutov
2024-10-01  2:41                                     ` Sean Whitton
2024-10-01 13:55                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e956e3b-5891-401a-a898-e339f52ea307@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=73387@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=spwhitton@spwhitton.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.