On Wed, Dec 06, 2023 at 03:10:11PM +0100, Vincent Lefevre wrote:
> The behavior of SIGINT (typically generated by Ctrl-C in the terminal)
> is not documented.
> 
> It currently asks whether to exit, with MUTT_YES as the default:
[...]
> Why doesn't it use "query_quadoption (OPT_QUIT," like <quit> and <exit>?

I don't think your suggestion is completely crazy, but you asked, so I
will provide the counterargument:

Mutt is a user application that already provides two methods of
exiting the program "nicely" with two different behaviors:  Save state
or don't.  CTRL-C/SIGINT allows for a third way to terminate the
program when it is behaving in an incorrect/undesirable way, when for
example you're not able to get to a menu, or Mutt is failing to
process menu selections for whatever reason.

Mutt already prompts to allow for the possibility that you've hit
CTRL-C by mistake.  When you haven't, clearly the intention is to
terminate immediately, so that is quite sensibly the default, whereas
whatever you configured for OPT_QUIT doesn't necessarily apply in this
circumstance, since the assumption there is that you are exiting under
normal and expected circumstances.  If not for this distinction, you
could simply ignore SIGINT entirely.

One could argue that your actual problem is that you aren't adequately
careful about reading and responding to prompts--particularly when you
obviously already realize this is a mistake you sometimes make--and
as I'm certain you are aware, there are already solutions possible to
help you deal with that (remapping Mutt's keys, remapping SIGINT in
your terminal, etc.).

> This would be safer in case one types Ctrl-C + <Return> by mistake.
> I often do Shift-C + <Return> (very quickly), but I sometimes mistype
> Shift-C as Ctrl-C, hence the issue.

Perhaps, but since 1995, I'm pretty sure I've personally made that
mistake exactly zero times, nor have I ever noticed anyone complaining
about this in the past, here or anywhere.  That leads me to think that
rather than changing the current behavior--which seems already
sensible--you should adapt to it yourself, as I suggested above.

> BTW, as mutt_query_exit() doesn't save, the message should be
> "Exit Mutt without saving?" like with <exit>, IMHO.

This seems perfectly sensible, though I also think that to anyone
who's familiar with what CTRL-C typically does on a Unix terminal (and
plenty of other places), this is already implied and obvious.  I would
note that if the issue is that you're hitting <enter> too quickly to
read the prompt and respond to it appropriately, the wording doesn't
matter much. =8^)

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.

Attachment: signature.asc
Description: PGP signature

Reply via email to