From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vincent Lefevre Newsgroups: gmane.emacs.bugs Subject: bug#13522: 24.2; save-buffer removes edited file under some conditions Date: Mon, 14 Mar 2022 18:32:37 +0100 Message-ID: <20220314173237.GD2381@cventin.lip.ens-lyon.fr> References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> <83mthsk63c.fsf@gnu.org> <87sfrkwsy5.fsf@gnus.org> <83fsnkk4so.fsf@gnu.org> <20220314152053.GB2381@cventin.lip.ens-lyon.fr> <83bky8jwmh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3779"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.2.1+12 (1ba319cf) vl-138565 (2022-03-05) Cc: larsi@gnus.org, 13522@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 14 18:33:16 2022 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 1nToZI-0000jZ-4M for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Mar 2022 18:33:16 +0100 Original-Received: from localhost ([::1]:48002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nToZG-00056D-JW for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Mar 2022 13:33:14 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nToZ5-00053H-CG for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 13:33:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52317) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nToZ5-0007LV-3h for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 13:33:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nToZ4-0001wl-IC for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 13:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vincent Lefevre Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Mar 2022 17:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13522 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 13522-submit@debbugs.gnu.org id=B13522.16472791657443 (code B ref 13522); Mon, 14 Mar 2022 17:33:02 +0000 Original-Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 17:32:45 +0000 Original-Received: from localhost ([127.0.0.1]:46211 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nToYn-0001vz-5k for submit@debbugs.gnu.org; Mon, 14 Mar 2022 13:32:45 -0400 Original-Received: from cventin.lip.ens-lyon.fr ([140.77.13.17]:35018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nToYk-0001vq-WD for 13522@debbugs.gnu.org; Mon, 14 Mar 2022 13:32:43 -0400 Original-Received: from vlefevre by cventin.lip.ens-lyon.fr with local (Exim 4.95) (envelope-from ) id 1nToYf-0005dE-RX; Mon, 14 Mar 2022 18:32:37 +0100 Content-Disposition: inline In-Reply-To: <83bky8jwmh.fsf@gnu.org> X-Mailer-Info: https://www.vinc17.net/mutt/ 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" Xref: news.gmane.io gmane.emacs.bugs:228386 Archived-At: 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 - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)