From: Vincent Lefevre <vincent@vinc17.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, 13522@debbugs.gnu.org
Subject: bug#13522: 24.2; save-buffer removes edited file under some conditions
Date: Mon, 14 Mar 2022 18:32:37 +0100 [thread overview]
Message-ID: <20220314173237.GD2381@cventin.lip.ens-lyon.fr> (raw)
In-Reply-To: <83bky8jwmh.fsf@gnu.org>
On 2022-03-14 19:02:14 +0200, Eli Zaretskii wrote:
> > Note that in any case, C-x C-c in Emacs does not replace Ctrl-C in the
> > terminal, as with C-x C-c, Emacs quits with a zero exit status, which
> > may not be what one wants. Example: in a "svn ci", one may want to
> > abort the commit without losing the text written in Emacs. Ctrl-C in
> > the terminal (where "svn ci" has been run) allows one to do that.
>
> Emacs is not SVN, and doesn't work in transactions.
You missed my point. "svn ci" runs an editor, e.g. Emacs. If I want
to interrupt (i.e. abort) the "svn ci", I need to do Ctrl-C in the
terminal. The same is true with shell scripts that run Emacs.
> > SIGINT could be equivalent to something like C-g in Emacs + quit
> > without saving (a backup of the current buffer can be kept),
> > exiting with a non-zero exit status. Note that you do not need to
> > do everything in the signal handler. In general, what is done is
> > just to set some variable saying that SIGINT has been received.
> > The abort of the operations is done in the main code.
>
> When the program is delivered a fatal signal, the only way to get back
> to "main code" is longjmp from the signal handler, which is already
> "not recommended", to say the least.
No, SIGINT is *not* a fatal signal. What is done with it is what the
application decides. You don't need a longjmp. Setting a variable in
the signal handler and handle it in the general code should be
sufficient.
BTW, there's the same issue when requesting to close the X11 window.
I get a "Question" dialogue, asking me whether I want to save the
file. I answer "No". I get another question saying
Modified buffers exist; exit anyway?
I answer "Yes". Emacs quits, but the file is no longer there; there's
just the backup.
Handling SIGINT could be similar to this case (which should be fixed),
where the answers "No" and "Yes" are assumed.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
next prev parent reply other threads:[~2022-03-14 17:32 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-22 1:47 bug#13522: 24.2; save-buffer removes edited file under some conditions Vincent Lefevre
2013-01-24 20:28 ` Glenn Morris
2013-01-25 0:02 ` Vincent Lefevre
2013-01-25 0:48 ` Glenn Morris
2013-01-25 7:35 ` Eli Zaretskii
2013-01-25 8:07 ` Glenn Morris
2013-01-30 8:59 ` Glenn Morris
2013-01-30 19:34 ` Stefan Monnier
2013-01-31 6:36 ` Glenn Morris
2014-08-11 1:06 ` Glenn Morris
2022-03-14 11:21 ` Lars Ingebrigtsen
2022-03-14 13:37 ` Eli Zaretskii
2022-03-14 13:43 ` Lars Ingebrigtsen
2022-03-14 14:05 ` Eli Zaretskii
2022-03-14 15:20 ` Vincent Lefevre
2022-03-14 17:02 ` Eli Zaretskii
2022-03-14 17:32 ` Vincent Lefevre [this message]
2022-03-15 11:42 ` Lars Ingebrigtsen
2022-03-15 14:23 ` Eli Zaretskii
2022-03-15 14:25 ` Lars Ingebrigtsen
2022-03-15 15:55 ` Vincent Lefevre
2022-04-30 16:47 ` Lars Ingebrigtsen
2022-04-30 16:51 ` Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220314173237.GD2381@cventin.lip.ens-lyon.fr \
--to=vincent@vinc17.net \
--cc=13522@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=larsi@gnus.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).