From unknown Fri Jun 13 10:29:49 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#13522 <13522@debbugs.gnu.org> To: bug#13522 <13522@debbugs.gnu.org> Subject: Status: 24.2; save-buffer removes edited file under some conditions Reply-To: bug#13522 <13522@debbugs.gnu.org> Date: Fri, 13 Jun 2025 17:29:49 +0000 retitle 13522 24.2; save-buffer removes edited file under some conditions reassign 13522 emacs submitter 13522 Vincent Lefevre severity 13522 normal tag 13522 confirmed thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 21 20:48:57 2013 Received: (at submit) by debbugs.gnu.org; 22 Jan 2013 01:48:57 +0000 Received: from localhost ([127.0.0.1]:43798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxSyu-0005q5-Qq for submit@debbugs.gnu.org; Mon, 21 Jan 2013 20:48:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59390) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TxSys-0005px-Cu for submit@debbugs.gnu.org; Mon, 21 Jan 2013 20:48:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxSxm-0000bV-A4 for submit@debbugs.gnu.org; Mon, 21 Jan 2013 20:47:47 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:36604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxSxm-0000bP-6l for submit@debbugs.gnu.org; Mon, 21 Jan 2013 20:47:46 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxSxk-0001oM-JR for bug-gnu-emacs@gnu.org; Mon, 21 Jan 2013 20:47:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxSxi-0000a6-O5 for bug-gnu-emacs@gnu.org; Mon, 21 Jan 2013 20:47:44 -0500 Received: from vinc17.pck.nerim.net ([213.41.242.187]:56968 helo=smtp-xvii.vinc17.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxSxi-0000Zj-5h for bug-gnu-emacs@gnu.org; Mon, 21 Jan 2013 20:47:42 -0500 Received: by xvii.vinc17.org (Postfix, from userid 1000) id B41F231001E; Tue, 22 Jan 2013 02:47:37 +0100 (CET) From: Vincent Lefevre To: bug-gnu-emacs@gnu.org Subject: 24.2; save-buffer removes edited file under some conditions Date: Tue, 22 Jan 2013 02:47:37 +0100 Message-ID: <87622qaszq.fsf@xvii.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) 1. Create a file with: printf "\x80" > file 2. Open the file under X Window with: emacs -Q file 3. Modify the file e.g. by adding a space. 4. Type C-x C-s At this point, Emacs asks the user to select a coding system. 5. Type C-c in the terminal to kill Emacs. The result is that the file "file" is no longer there! Actually there is a backup. Here it is easy to see (file~), but if the user has defined find-backup-file-name, he may not be aware that there is a backup (as this is not the normal use of backups since the file hasn't been saved) and may think that the file has been lost (it took me some time to find out...). I think that Emacs makes the backup too soon. It should do it only just before saving. This might be a variant of the old bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=194171 In GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-09-11 on xvii, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11204000 Configured using: `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2/site-lisp:/usr/share/emacs/site-lisp' '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: POSIX value of $LC_CTYPE: en_US.UTF-8 value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: en_DK value of $LANG: POSIX value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Fundamental Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: x r e p o r t - b u Recent messages: Loading /etc/emacs/site-start.d/50html-helper-mode.el (source)...done Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)... Loading cjk-enc...done Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...done Loading /etc/emacs/site-start.d/50latex-cjk-thai.el (source)...done Loading /etc/emacs/site-start.d/50psvn.el (source)...done Loading /etc/emacs/site-start.d/50rnc-mode.el (source)...done Loading /etc/emacs/site-start.d/50thailatex.el (source)...done Loading /etc/emacs/site-start.d/50w3m-el.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: /usr/share/emacs24/site-lisp/css-mode/css-mode hides /usr/share/emacs/site-lisp/css-mode/css-mode /usr/share/emacs/24.2/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs/site-lisp/autoconf/autotest-mode hides /usr/share/emacs/site-lisp/autotest-mode /usr/share/emacs/24.2/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode /usr/share/emacs24/site-lisp/html-helper-mode/tempo hides /usr/share/emacs/24.2/lisp/tempo /usr/share/emacs24/site-lisp/flim/hex-util hides /usr/share/emacs/24.2/lisp/hex-util /usr/share/emacs24/site-lisp/flim/md4 hides /usr/share/emacs/24.2/lisp/md4 /usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.2/lisp/textmodes/flyspell /usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.2/lisp/textmodes/ispell /usr/share/emacs24/site-lisp/css-mode/css-mode hides /usr/share/emacs/24.2/lisp/textmodes/css-mode /usr/share/emacs24/site-lisp/flim/hmac-md5 hides /usr/share/emacs/24.2/lisp/net/hmac-md5 /usr/share/emacs24/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/24.2/lisp/net/sasl-ntlm /usr/share/emacs24/site-lisp/flim/sasl-cram hides /usr/share/emacs/24.2/lisp/net/sasl-cram /usr/share/emacs24/site-lisp/flim/ntlm hides /usr/share/emacs/24.2/lisp/net/ntlm /usr/share/emacs24/site-lisp/flim/sasl hides /usr/share/emacs/24.2/lisp/net/sasl /usr/share/emacs24/site-lisp/flim/hmac-def hides /usr/share/emacs/24.2/lisp/net/hmac-def /usr/share/emacs24/site-lisp/flim/sasl-digest hides /usr/share/emacs/24.2/lisp/net/sasl-digest /usr/share/emacs24/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/24.2/lisp/language/thai-word /usr/share/emacs24/site-lisp/html-helper-mode/html-helper-mode hides /usr/share/emacs/site-lisp/html-helper-mode/html-helper-mode /usr/share/emacs24/site-lisp/html-helper-mode/hhm-config hides /usr/share/emacs/site-lisp/html-helper-mode/hhm-config /usr/share/emacs24/site-lisp/html-helper-mode/tempo hides /usr/share/emacs/site-lisp/html-helper-mode/tempo /usr/share/emacs24/site-lisp/html-helper-mode/visual-basic-mode hides /usr/share/emacs/site-lisp/html-helper-mode/visual-basic-mode Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils w3m-load jabber-autoloads time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 24 15:28:44 2013 Received: (at 13522) by debbugs.gnu.org; 24 Jan 2013 20:28:45 +0000 Received: from localhost ([127.0.0.1]:48181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyTPb-0004zn-Pz for submit@debbugs.gnu.org; Thu, 24 Jan 2013 15:28:44 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:57321) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyTPV-0004zZ-4i for 13522@debbugs.gnu.org; Thu, 24 Jan 2013 15:28:38 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1TyTPP-0006VX-8E; Thu, 24 Jan 2013 15:28:27 -0500 From: Glenn Morris To: Vincent Lefevre Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> X-Spook: investigation analyzer cybercash asset mindwar Europol X-Ran: sdX?s_wKZ]@'^pgWoP)m&umipi-Laqa&ezGj8K%O\'*Tp7p&rEjgq)HkpmEfhh:1pHf^DP X-Hue: blue X-Attribution: GM Date: Thu, 24 Jan 2013 15:28:27 -0500 In-Reply-To: <87622qaszq.fsf@xvii.vinc17.org> (Vincent Lefevre's message of "Tue, 22 Jan 2013 02:47:37 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Vincent Lefevre wrote: > 1. Create a file with: printf "\x80" > file > 2. Open the file under X Window with: emacs -Q file > 3. Modify the file e.g. by adding a space. > 4. Type C-x C-s > At this point, Emacs asks the user to select a coding system. > 5. Type C-c in the terminal to kill Emacs. > > The result is that the file "file" is no longer there! I can't reproduce this with 24.2. Here I have both "file" and "#file", no "file~". > Actually there is a backup. Here it is easy to see (file~), but From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 24 19:03:06 2013 Received: (at 13522) by debbugs.gnu.org; 25 Jan 2013 00:03:06 +0000 Received: from localhost ([127.0.0.1]:48286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyWl8-0003Ph-E3 for submit@debbugs.gnu.org; Thu, 24 Jan 2013 19:03:06 -0500 Received: from vinc17.pck.nerim.net ([213.41.242.187]:56091 helo=smtp-xvii.vinc17.net) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyWl5-0003PY-3u for 13522@debbugs.gnu.org; Thu, 24 Jan 2013 19:03:04 -0500 Received: by xvii.vinc17.org (Postfix, from userid 1000) id 66445314021; Fri, 25 Jan 2013 01:02:56 +0100 (CET) Date: Fri, 25 Jan 2013 01:02:56 +0100 From: Vincent Lefevre To: Glenn Morris Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions Message-ID: <20130125000256.GC3397@xvii.vinc17.org> References: <87622qaszq.fsf@xvii.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.21-6294-vl-r57845 (2013-01-23) Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) On 2013-01-24 15:28:27 -0500, Glenn Morris wrote: > Vincent Lefevre wrote: > > 1. Create a file with: printf "\x80" > file > > 2. Open the file under X Window with: emacs -Q file > > 3. Modify the file e.g. by adding a space. > > 4. Type C-x C-s > > At this point, Emacs asks the user to select a coding system. > > 5. Type C-c in the terminal to kill Emacs. > > > > The result is that the file "file" is no longer there! Same problem with the official GNU Emacs 24.2.1 (not Debian's). > I can't reproduce this with 24.2. > Here I have both "file" and "#file", no "file~". I have "file~" and "#file#" (with 2 # characters). --=20 Vincent Lef=E8vre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 24 19:49:04 2013 Received: (at 13522) by debbugs.gnu.org; 25 Jan 2013 00:49:04 +0000 Received: from localhost ([127.0.0.1]:48296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyXTc-0004Sx-1T for submit@debbugs.gnu.org; Thu, 24 Jan 2013 19:49:04 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:32896) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyXTa-0004Sq-2c for 13522@debbugs.gnu.org; Thu, 24 Jan 2013 19:49:02 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1TyXTT-00016E-NU; Thu, 24 Jan 2013 19:48:55 -0500 From: Glenn Morris To: Vincent Lefevre Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <20130125000256.GC3397@xvii.vinc17.org> X-Spook: weapons of mass destruction Putin Aladdin South Africa X-Ran: zUE^-y55/ZS8P1|mdxis.wDiF9m6irN^%=1d!biwp*b|e4QFKDs{f9,`CZ*RI$XO.a{v=4 X-Hue: white X-Debbugs-No-Ack: yes X-Attribution: GM Date: Thu, 24 Jan 2013 19:48:55 -0500 In-Reply-To: <20130125000256.GC3397@xvii.vinc17.org> (Vincent Lefevre's message of "Fri, 25 Jan 2013 01:02:56 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) Vincent Lefevre wrote: >> I can't reproduce this with 24.2. I was using a file in /tmp, and apparently Emacs does not make backups of files in /tmp (normal-backup-enable-predicate; not sure that seems useful behaviour to me). Using a file in $HOME I can reproduce it. >> Here I have both "file" and "#file", no "file~". > > I have "file~" and "#file#" (with 2 # characters). (The "#" was just a typo on my part.) From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 24 21:42:40 2013 Received: (at control) by debbugs.gnu.org; 25 Jan 2013 02:42:40 +0000 Received: from localhost ([127.0.0.1]:48357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyZFX-00079f-QC for submit@debbugs.gnu.org; Thu, 24 Jan 2013 21:42:40 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:35628) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyZFW-00079Z-6F for control@debbugs.gnu.org; Thu, 24 Jan 2013 21:42:38 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1TyZFP-0001qS-NZ for control@debbugs.gnu.org; Thu, 24 Jan 2013 21:42:31 -0500 Date: Thu, 24 Jan 2013 21:42:31 -0500 Message-Id: Subject: control message for bug 13522 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) found 13522 23.1 found 13522 23.2 found 13522 23.3 found 13522 23.4 found 13522 24.1 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 25 02:35:11 2013 Received: (at 13522) by debbugs.gnu.org; 25 Jan 2013 07:35:11 +0000 Received: from localhost ([127.0.0.1]:48464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tydoc-0007FJ-N2 for submit@debbugs.gnu.org; Fri, 25 Jan 2013 02:35:11 -0500 Received: from mtaout21.012.net.il ([80.179.55.169]:34336) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TydoY-0007F7-JH for 13522@debbugs.gnu.org; Fri, 25 Jan 2013 02:35:08 -0500 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MH600L007OGFW00@a-mtaout21.012.net.il> for 13522@debbugs.gnu.org; Fri, 25 Jan 2013 09:34:57 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MH600LLV7Q9AF70@a-mtaout21.012.net.il>; Fri, 25 Jan 2013 09:34:57 +0200 (IST) Date: Fri, 25 Jan 2013 09:35:04 +0200 From: Eli Zaretskii Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions In-reply-to: X-012-Sender: halo1@inter.net.il To: Glenn Morris Message-id: <83libhlnpz.fsf@gnu.org> References: <87622qaszq.fsf@xvii.vinc17.org> <20130125000256.GC3397@xvii.vinc17.org> X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org, vincent@vinc17.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Glenn Morris > Date: Thu, 24 Jan 2013 19:48:55 -0500 > Cc: 13522@debbugs.gnu.org > > Vincent Lefevre wrote: > > >> I can't reproduce this with 24.2. > > I was using a file in /tmp I wasn't. > Using a file in $HOME I can reproduce it. I can't. Moreover, the recipe says "Type C-c in the terminal to kill Emacs", but C-c does not kill Emacs, only C-x C-c does. And if I type C-x C-c, I am asked whether to exit without saving etc. This doesn't seem to be the described scenario at all. What am I missing? From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 25 03:08:09 2013 Received: (at 13522) by debbugs.gnu.org; 25 Jan 2013 08:08:09 +0000 Received: from localhost ([127.0.0.1]:48522 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyeKX-00083l-2a for submit@debbugs.gnu.org; Fri, 25 Jan 2013 03:08:09 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:44084) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TyeKV-00083e-A3 for 13522@debbugs.gnu.org; Fri, 25 Jan 2013 03:08:08 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1TyeKL-0000Pl-TS; Fri, 25 Jan 2013 03:07:57 -0500 From: Glenn Morris To: Eli Zaretskii Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <20130125000256.GC3397@xvii.vinc17.org> <83libhlnpz.fsf@gnu.org> X-Spook: RSA Bellcore afsatcom security CIA Downing Street kibo X-Ran: vG\h/{o2]QyCu7k2'ED.rzAV?8JP_S'0>pb6*;=Hxt (Eli Zaretskii's message of "Fri, 25 Jan 2013 09:35:04 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org, vincent@vinc17.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) Eli Zaretskii wrote: > I can't. Moreover, the recipe says "Type C-c in the terminal to kill > Emacs", but C-c does not kill Emacs, only C-x C-c does. C-c *in the shell* from which Emacs was started in the foreground, not from in Emacs; ie interrupt it from outside. Or even: do C-x C-s, and leave the coding prompt unanswered. You will find the original file missing until you answer, or quit, the coding question! Looks like it has been this way since the unicode merge. basic-save-buffer-2 calls backup-buffer, which may rename the original file. It then calls write-region. This may call select-safe-coding-system, so there can be an arbitrarily long interval between the original file being renamed to the backup, and the new file being written. If you interrupt the coding prompt with C-g, the unwind-protect in basic-save-buffer-2 puts back the original file. I suppose the problem could maybe be papered over by adding something equivalent to kill-emacs-hook, but it's still very far from ideal. Maybe the right solution is to have the select-safe-coding-system check in basic-save-buffer-2 before backup-buffer, then pass the resulting coding system to write-region somehow so it does not need to query again. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 30 04:00:05 2013 Received: (at 13522) by debbugs.gnu.org; 30 Jan 2013 09:00:05 +0000 Received: from localhost ([127.0.0.1]:55213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0TWX-0006L0-0Q for submit@debbugs.gnu.org; Wed, 30 Jan 2013 04:00:05 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:37160) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0TWU-0006KN-KR for 13522@debbugs.gnu.org; Wed, 30 Jan 2013 04:00:04 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1U0TVu-0003CS-40; Wed, 30 Jan 2013 03:59:26 -0500 From: Glenn Morris To: Eli Zaretskii Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <20130125000256.GC3397@xvii.vinc17.org> <83libhlnpz.fsf@gnu.org> X-Spook: Downing Street World Trade Center Blowpipe Plame class X-Ran: /-Hg7m,\{zoejgS-m`{Jzz0=R9F7GOq\uud'XfZt=O-teO"8HjNmsoY[rZqSs0/mUdK+)m X-Hue: black X-Debbugs-No-Ack: yes X-Attribution: GM Date: Wed, 30 Jan 2013 03:59:25 -0500 In-Reply-To: (Glenn Morris's message of "Fri, 25 Jan 2013 03:07:57 -0500") Message-ID: <3b8v7byrki.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -7.4 (-------) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org, vincent@vinc17.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.4 (-------) Glenn Morris wrote: > Maybe the right solution is to have the select-safe-coding-system check > in basic-save-buffer-2 before backup-buffer, then pass the resulting > coding system to write-region somehow so it does not need to query > again. Very lightly tested patch: *** lisp/files.el 2013-01-10 15:50:04 +0000 --- lisp/files.el 2013-01-30 08:53:30 +0000 *************** *** 4656,4662 **** ;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like ;; backup-buffer. (defun basic-save-buffer-2 () ! (let (tempsetmodes setmodes) (if (not (file-writable-p buffer-file-name)) (let ((dir (file-name-directory buffer-file-name))) (if (not (file-directory-p dir)) --- 4656,4662 ---- ;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like ;; backup-buffer. (defun basic-save-buffer-2 () ! (let (tempsetmodes setmodes writecoding) (if (not (file-writable-p buffer-file-name)) (let ((dir (file-name-directory buffer-file-name))) (if (not (file-directory-p dir)) *************** *** 4672,4677 **** --- 4672,4680 ---- buffer-file-name))) (setq tempsetmodes t) (error "Attempt to save to a file which you aren't allowed to write")))))) + (setq writecoding + (choose-write-coding-system nil nil buffer-file-name nil t + buffer-file-truename)) (or buffer-backed-up (setq setmodes (backup-buffer))) (let* ((dir (file-name-directory buffer-file-name)) *************** *** 4753,4762 **** (logior (car setmodes) 128)))))) (let (success) (unwind-protect - (progn ;; Pass in nil&nil rather than point-min&max to indicate ;; we're saving the buffer rather than just a region. ;; write-region-annotate-functions may make us of it. (write-region nil nil buffer-file-name nil t buffer-file-truename) (setq success t)) --- 4756,4765 ---- (logior (car setmodes) 128)))))) (let (success) (unwind-protect ;; Pass in nil&nil rather than point-min&max to indicate ;; we're saving the buffer rather than just a region. ;; write-region-annotate-functions may make us of it. + (let ((write-region-coding-system writecoding)) (write-region nil nil buffer-file-name nil t buffer-file-truename) (setq success t)) === modified file 'src/fileio.c' *** src/fileio.c 2013-01-23 20:07:28 +0000 --- src/fileio.c 2013-01-30 08:55:45 +0000 *************** *** 249,254 **** --- 249,255 ---- static Lisp_Object Qset_file_acl; static Lisp_Object Qfile_newer_than_file_p; Lisp_Object Qinsert_file_contents; + Lisp_Object Qchoose_write_coding_system; Lisp_Object Qwrite_region; static Lisp_Object Qverify_visited_file_modtime; static Lisp_Object Qset_visited_file_modtime; *************** *** 4615,4628 **** /* Decide the coding-system to encode the data with. */ ! static Lisp_Object ! choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object filename, ! Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, ! struct coding_system *coding) { Lisp_Object val; Lisp_Object eol_parent = Qnil; if (auto_saving && NILP (Fstring_equal (BVAR (current_buffer, filename), BVAR (current_buffer, auto_save_file_name)))) --- 4616,4637 ---- /* Decide the coding-system to encode the data with. */ ! DEFUN ("choose-write-coding-system", Fchoose_write_coding_system, ! Schoose_write_coding_system, 3, 6, 0, ! doc: /* Choose coding system for write. ! Arguments as for `write-region'. */ ) ! (Lisp_Object start, Lisp_Object end, Lisp_Object filename, ! Lisp_Object append, Lisp_Object visit, Lisp_Object lockname) { Lisp_Object val; Lisp_Object eol_parent = Qnil; + if (NILP (start)) + { + XSETFASTINT (start, BEGV); + XSETFASTINT (end, ZV); + } + if (auto_saving && NILP (Fstring_equal (BVAR (current_buffer, filename), BVAR (current_buffer, auto_save_file_name)))) *************** *** 4715,4724 **** } val = coding_inherit_eol_type (val, eol_parent); - setup_coding_system (val, coding); - - if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display))) - coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; return val; } --- 4724,4729 ---- *************** *** 4874,4882 **** We used to make this choice before calling build_annotations, but that leads to problems when a write-annotate-function takes care of unsavable chars (as was the case with X-Symbol). */ ! Vlast_coding_system_used ! = choose_write_coding_system (start, end, filename, ! append, visit, lockname, &coding); #ifdef CLASH_DETECTION if (!auto_saving) --- 4879,4893 ---- We used to make this choice before calling build_annotations, but that leads to problems when a write-annotate-function takes care of unsavable chars (as was the case with X-Symbol). */ ! Vlast_coding_system_used = NILP (Vwrite_region_coding_system) ? ! Fchoose_write_coding_system (start, end, filename, ! append, visit, lockname) : ! Vwrite_region_coding_system; ! ! setup_coding_system (Vlast_coding_system_used, &coding); ! ! if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display))) ! coding.mode |= CODING_MODE_SELECTIVE_DISPLAY; #ifdef CLASH_DETECTION if (!auto_saving) *************** *** 5861,5866 **** --- 5872,5878 ---- DEFSYM (Qset_file_acl, "set-file-acl"); DEFSYM (Qfile_newer_than_file_p, "file-newer-than-file-p"); DEFSYM (Qinsert_file_contents, "insert-file-contents"); + DEFSYM (Qchoose_write_coding_system, "choose-write-coding-system"); DEFSYM (Qwrite_region, "write-region"); DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime"); DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime"); *************** *** 5890,5895 **** --- 5902,5912 ---- of file names regardless of the current language environment. */); Vdefault_file_name_coding_system = Qnil; + DEFVAR_LISP ("write-region-coding-system", Vwrite_region_coding_system, + doc: /* If non-nil, coding system for `write-region'. + You should only ever `let'-bind this around a `write-region' call. */); + Vwrite_region_coding_system = Qnil; + DEFSYM (Qformat_decode, "format-decode"); DEFSYM (Qformat_annotate_function, "format-annotate-function"); DEFSYM (Qafter_insert_file_set_coding, "after-insert-file-set-coding"); *************** *** 6085,6090 **** --- 6102,6108 ---- defsubr (&Sdefault_file_modes); defsubr (&Sfile_newer_than_file_p); defsubr (&Sinsert_file_contents); + defsubr (&Schoose_write_coding_system); defsubr (&Swrite_region); defsubr (&Scar_less_than_car); defsubr (&Sverify_visited_file_modtime); From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 30 14:35:52 2013 Received: (at 13522) by debbugs.gnu.org; 30 Jan 2013 19:35:53 +0000 Received: from localhost ([127.0.0.1]:56195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0dRo-0000xs-Nn for submit@debbugs.gnu.org; Wed, 30 Jan 2013 14:35:52 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:57583) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0dRn-0000xk-6G for 13522@debbugs.gnu.org; Wed, 30 Jan 2013 14:35:51 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rw3e/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOIYZwZgV6DFQ X-IPAS-Result: Av4EABK/CFG4rw3e/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYSFBgNJIgkwS2RCgOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="48456" Received: from 184-175-13-222.dsl.teksavvy.com (HELO ceviche.home) ([184.175.13.222]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 30 Jan 2013 14:35:06 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 8201166130; Wed, 30 Jan 2013 14:34:57 -0500 (EST) From: Stefan Monnier To: Glenn Morris Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions Message-ID: References: <87622qaszq.fsf@xvii.vinc17.org> <20130125000256.GC3397@xvii.vinc17.org> <83libhlnpz.fsf@gnu.org> <3b8v7byrki.fsf@fencepost.gnu.org> Date: Wed, 30 Jan 2013 14:34:57 -0500 In-Reply-To: <3b8v7byrki.fsf@fencepost.gnu.org> (Glenn Morris's message of "Wed, 30 Jan 2013 03:59:25 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13522 Cc: Eli Zaretskii , vincent@vinc17.net, 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > + (let ((write-region-coding-system writecoding)) > (write-region nil nil > buffer-file-name nil t buffer-file-truename) Rather than introduce a new var, we could let bind coding-system-for-write (and coding-system-require-warning). Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 31 01:36:57 2013 Received: (at 13522) by debbugs.gnu.org; 31 Jan 2013 06:36:57 +0000 Received: from localhost ([127.0.0.1]:56674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0nlY-00040K-NE for submit@debbugs.gnu.org; Thu, 31 Jan 2013 01:36:56 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:52211) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0nlV-00040B-5m for 13522@debbugs.gnu.org; Thu, 31 Jan 2013 01:36:54 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1U0nkn-0006Sw-N6; Thu, 31 Jan 2013 01:36:09 -0500 From: Glenn Morris To: Stefan Monnier Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <20130125000256.GC3397@xvii.vinc17.org> <83libhlnpz.fsf@gnu.org> <3b8v7byrki.fsf@fencepost.gnu.org> X-Spook: Bosnia blackjack condor PET analyzer red noise Commecen X-Ran: fe4w8dnluO4;D~Z:VU8LQKlwc+xg6CZ2\z7CY*'+JaY_3`_}Z0BZCBf4aSA,7A^3:+uWIc X-Hue: cyan X-Debbugs-No-Ack: yes X-Attribution: GM Date: Thu, 31 Jan 2013 01:36:09 -0500 In-Reply-To: (Stefan Monnier's message of "Wed, 30 Jan 2013 14:34:57 -0500") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: 13522 Cc: Eli Zaretskii , vincent@vinc17.net, 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.4 (-------) Stefan Monnier wrote: > Rather than introduce a new var, we could let bind > coding-system-for-write (and coding-system-require-warning). Sold. Done in trunk. From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 31 01:37:09 2013 Received: (at control) by debbugs.gnu.org; 31 Jan 2013 06:37:09 +0000 Received: from localhost ([127.0.0.1]:56678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0nlk-000412-5K for submit@debbugs.gnu.org; Thu, 31 Jan 2013 01:37:09 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:52214) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0nli-00040v-Dm for control@debbugs.gnu.org; Thu, 31 Jan 2013 01:37:06 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1U0nl3-00070D-Mn for control@debbugs.gnu.org; Thu, 31 Jan 2013 01:36:25 -0500 Date: Thu, 31 Jan 2013 01:36:25 -0500 Message-Id: Subject: control message for bug 13522 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) close 13522 24.4 From unknown Fri Jun 13 10:29:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 28 Feb 2013 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 10 20:54:46 2014 Received: (at control) by debbugs.gnu.org; 11 Aug 2014 00:54:46 +0000 Received: from localhost ([127.0.0.1]:38141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGdsr-0005LO-RE for submit@debbugs.gnu.org; Sun, 10 Aug 2014 20:54:46 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:33336 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGdso-0005LG-8w for control@debbugs.gnu.org; Sun, 10 Aug 2014 20:54:43 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1XGdsn-0003O5-LD for control@debbugs.gnu.org; Sun, 10 Aug 2014 20:54:41 -0400 Date: Sun, 10 Aug 2014 20:54:41 -0400 Message-Id: Subject: control message for bug 13522 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) unarchive 13522 found 13522 24.4 From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 10 21:06:51 2014 Received: (at 13522) by debbugs.gnu.org; 11 Aug 2014 01:06:51 +0000 Received: from localhost ([127.0.0.1]:38148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGe4Y-0006r4-Jd for submit@debbugs.gnu.org; Sun, 10 Aug 2014 21:06:50 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:33447 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGe4V-0006qv-Le for 13522@debbugs.gnu.org; Sun, 10 Aug 2014 21:06:48 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1XGe4V-0002fz-2v; Sun, 10 Aug 2014 21:06:47 -0400 From: Glenn Morris To: 13522@debbugs.gnu.org Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <20130125000256.GC3397@xvii.vinc17.org> <83libhlnpz.fsf@gnu.org> <3b8v7byrki.fsf@fencepost.gnu.org> X-Spook: Uzbekistan Indigo Aldergrove subversive CDC Attorney X-Ran: aFlt%E+?O)@$$H@g,)3\o5Psh.^Q56K8c|Q;!7+\oq5t2/U.,CS}7%A5M_J X-Hue: blue X-Attribution: GM Date: Sun, 10 Aug 2014 21:06:47 -0400 In-Reply-To: (Glenn Morris's message of "Thu, 31 Jan 2013 01:36:09 -0500") Message-ID: <3v8umvdec8.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 13522 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Had to revert this fix - see discussion in http://debbugs.gnu.org/18141 . From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 04 00:50:58 2017 Received: (at control) by debbugs.gnu.org; 4 Feb 2017 05:50:59 +0000 Received: from localhost ([127.0.0.1]:55463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZtFS-0007Ki-L1 for submit@debbugs.gnu.org; Sat, 04 Feb 2017 00:50:58 -0500 Received: from mail-io0-f177.google.com ([209.85.223.177]:35409) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZtFQ-0007KV-GC for control@debbugs.gnu.org; Sat, 04 Feb 2017 00:50:57 -0500 Received: by mail-io0-f177.google.com with SMTP id j18so33110123ioe.2 for ; Fri, 03 Feb 2017 21:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:mime-version; bh=TUL7iDx2OSlJqkN0R96RN3iNKJW9itye4MV7zGEyr18=; b=dvARflhmviI9ZRlGteMlGl9AAl+Q6gq4Cmh2VGpdCVRMJBtAm3Y1QDkC33j5FJGs1e jrw5BQ06IfEMOjrDsqAHYUAKPcRPPMgrC3xVi3bbiK8zqVCHf5fLDj7CH8a+oI1GJsrS +m7TOT8t2pwKME7ozxL8tOA5M9Tg1YpMlynpLkCRwnbg1xzeRM74GIf86MZ3s1+UIiz0 F/MQ1AJ73wZICGGTSjMn2fvk11O/K6GGyFjUz05ckcKYrPSwph+oQVNkN4KKIzlgCKI3 SEC7kDG8CPS1ySjl5TZu+g8qhRC3xSmK8qy6uDBYDl9zRoGgz9Ii5Tu9htv+0a8zlHox tF3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version; bh=TUL7iDx2OSlJqkN0R96RN3iNKJW9itye4MV7zGEyr18=; b=hlIeWZZ7iLqgdEoQzSpr0DFtGliVnItI2Vexhd9ZP8U+1CwHqLEkx9ILTBVnnYQTyl XFQ2dSclboZsavnFpwmH3zTLQ1bBHCUnqn7W3j25BwKWeT+tqyaVxQpGwS+WHNwFL/+N HDiQA7RGf8Uu/F2vH23C9OPgBsNsTzIKf7IoP0qNgIOuwDHfpaTAFxvfQWddequEFzXE kZd8uVshtupQg28sn6KlAuZinMmZhMFs1vhkS6/o9hD/pnFT87Q1mpH76yiymGfjNZOA j+m4aCz7mxWrOZMzMYm0Mq+Imr1Zyafray1nmCIl9UEmuRBmJvwmsWUDwW8UVTDFVR8o EL1A== X-Gm-Message-State: AIkVDXK3xa+8dCdaM+yWVgs/pxgBsHdH1mfUMhDcZPwNMTsJ5otRZfhIH6yzWZH5o7jcfw== X-Received: by 10.107.3.10 with SMTP id 10mr377148iod.231.1486187450825; Fri, 03 Feb 2017 21:50:50 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id d25sm3940149ioj.25.2017.02.03.21.50.50 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2017 21:50:50 -0800 (PST) From: npostavs@users.sourceforge.net To: control@debbugs.gnu.org Subject: control message for bug #13522 Date: Sat, 04 Feb 2017 00:52:00 -0500 Message-ID: <87a8a2pkov.fsf@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) severity 13522 normal tags 13522 confirmed found 13522 25.1 quit https://debbugs.gnu.org/cgi/bugreport.cgi?bug=18141#55 From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 07:21:46 2022 Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 11:21:46 +0000 Received: from localhost ([127.0.0.1]:44245 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTilm-0003hv-A7 for submit@debbugs.gnu.org; Mon, 14 Mar 2022 07:21:46 -0400 Received: from quimby.gnus.org ([95.216.78.240]:41836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTilk-0003hd-0f for 13522@debbugs.gnu.org; Mon, 14 Mar 2022 07:21:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9dnjG3mXpgo0l9iwRwxSz4lU5tFNUGZfqYgmJnZIUFE=; b=TunGcZzIavSqxcG9bD9gajrTup nt6X5gI5K6aCMZ3rwmqzW5rBTdkRRCS5mzddylFeBesAtiNjOftZEXt795PGutbvb/9hrxWw0s0U9 uEVe5OWT66IKn2bJ/GD4BY+EXUIKbxflewr5ydupK4MBu9jDSaU3BxESQrqm5/5i/43k=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nTila-0005rd-Ow; Mon, 14 Mar 2022 12:21:37 +0100 From: Lars Ingebrigtsen To: Vincent Lefevre Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> X-Now-Playing: 23 Skidoo's _The Culling Is Coming_: "Healing (For The Strong)" Date: Mon, 14 Mar 2022 12:21:33 +0100 In-Reply-To: <87622qaszq.fsf@xvii.vinc17.org> (Vincent Lefevre's message of "Tue, 22 Jan 2013 02:47:37 +0100") Message-ID: <8735jkye2q.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Vincent Lefevre writes: > 1. Create a file with: printf "\x80" > file > 2. Open the file under X Window with: emacs -Q file > 3. Modify the file e.g. by adding a space. > 4. Type C-x C-s > At this point, Emacs asks the user [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Vincent Lefevre writes: > 1. Create a file with: printf "\x80" > file > 2. Open the file under X Window with: emacs -Q file > 3. Modify the file e.g. by adding a space. > 4. Type C-x C-s > At this point, Emacs asks the user to select a coding system. > 5. Type C-c in the terminal to kill Emacs. > > The result is that the file "file" is no longer there! (I'm going through old bug reports that unfortunately weren't resolved at the time.) This problem is still present in Emacs 29 -- the file is moved to the backup file before doing the prompt. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 09:38:04 2022 Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 13:38:04 +0000 Received: from localhost ([127.0.0.1]:44396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTktg-000190-Fr for submit@debbugs.gnu.org; Mon, 14 Mar 2022 09:38:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTkte-00018U-5e for 13522@debbugs.gnu.org; Mon, 14 Mar 2022 09:38:03 -0400 Received: from [2001:470:142:3::e] (port=48258 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTktY-0001kg-KD; Mon, 14 Mar 2022 09:37:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=spHN371Y9lTZXdEYn9FC5Ze8UrgPUMX5vlyfyZIdQdY=; b=myHohBIj9t8M 7tgUiF3znAZzOHPG6xK5aAj/SgLtKwx8YsDRVaeuvpDZp3AjLn9fMl8Nf70yZrwwFWIVQ6WKRUGsG EBc5kdG+wMmJ/bn6WnA6iNo5nUN3cGjx/cfSMdG90jMB2DO2HcG6IT+1YQBoPDypGdNSuuguSK/CH 22btokcrCnyzoea9VrYukO/dKK6OH4pnQxuwr/oHPUnpaxhPjDlFfykH310017fOUQ09IlW290GrK VuPMzb4NsRbA+3hEGGMHla/lE9WpCTDrrrAiKRB7/X8uNkX/L7Fd2q6qbzn+bcffDCdY/TnCoxFl7 3sm/fX0iuMc/GrEKtWskaQ==; Received: from [87.69.77.57] (port=3099 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTktY-0004k9-31; Mon, 14 Mar 2022 09:37:56 -0400 Date: Mon, 14 Mar 2022 15:37:43 +0200 Message-Id: <83mthsk63c.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <8735jkye2q.fsf@gnus.org> (message from Lars Ingebrigtsen on Mon, 14 Mar 2022 12:21:33 +0100) Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org, vincent@vinc17.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Date: Mon, 14 Mar 2022 12:21:33 +0100 > Cc: 13522@debbugs.gnu.org > > Vincent Lefevre writes: > > > 1. Create a file with: printf "\x80" > file > > 2. Open the file under X Window with: emacs -Q file > > 3. Modify the file e.g. by adding a space. > > 4. Type C-x C-s > > At this point, Emacs asks the user to select a coding system. > > 5. Type C-c in the terminal to kill Emacs. > > > > The result is that the file "file" is no longer there! > > (I'm going through old bug reports that unfortunately weren't resolved > at the time.) > > This problem is still present in Emacs 29 -- the file is moved to the > backup file before doing the prompt. Is it "C-c to kill Emacs" as in "terminate Emacs with a fatal signal", or is it "C-x C-c" as in "exit Emacs in an orderly fashion"? If the former, then in general killing a program when it is in the middle of writing files isn't guaranteed to preserve those files. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 09:43:27 2022 Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 13:43:28 +0000 Received: from localhost ([127.0.0.1]:44410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTkyt-0001I6-NY for submit@debbugs.gnu.org; Mon, 14 Mar 2022 09:43:27 -0400 Received: from quimby.gnus.org ([95.216.78.240]:42772) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTkys-0001Hp-8b for 13522@debbugs.gnu.org; Mon, 14 Mar 2022 09:43:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6p5HC5S2B+9RXBRSQmLwcRLJrnrb3RVTsBmSHiXWUx4=; b=O9HN7B/rDZDDACEFehw2FEldV/ CWA413smPxyiwFPji1+9Vad9geyu8LUjEiu4PMEiJ7PZFbsx2pV90WDoeCJx0b1KRc3+8iu8qq+G2 frSlIW3sPBfqZ/mJ5z4qvpfMBFgn7c5+cs6ljSWNOSfJAQGP82KecdBJkrgf6hE2XUw8=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nTkyi-0007C9-Gt; Mon, 14 Mar 2022 14:43:19 +0100 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> <83mthsk63c.fsf@gnu.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEVCMDimTFitl4L/ ///CA72vAAAAAWJLR0QDEQxM8gAAAAd0SU1FB+YDDg0mKrsLhn0AAAG5SURBVCjPPZBBa9tAEIWf hFfYe3KCFVIdA4XUv2JS7B5yWhmNIbq11CHVr9gcDMUny0TB9kkpspD2V3bWLh1YmI95896wwNIW J3euAripI5u30rp3IHIWm01b5R7CGj02p+QCznbq8bReuhzQAqtvpYADph0+mAbm6OHRYs1kkHvr O4u4zeih6GUidfNeZYFEw6LG8+Lpc+QqJ60NDhTzRu5BJ0mHSca5BxcMo1+x4aUch87V0csPksmq gmuKUfN9xsueGXCdbj6yUdWThEzrpD5xxYVPVDYp32Ju3VAgRFKWKTs38isCTR8UThOOWyRNH504 1w4Di6QruGhi/QeOwmSvuLll3cJZmxzG6tlU+g7XX7W2yrS7Uk9lMtQ2aOojhaG3Fs+fixb6WlK1 VmZldoXVIAxVYFa7Q2FD+YN7BCbd7fGvlDHlfmX/w+73kC69wPbcyddPAg8vZxnPAhK4R4wApAKk F1kNmgALrxnLiwXSV9/44RwgS2yuMBAHKHpAlY2h8i1jYEpak8BMzZGZV6q2sYDsUJZi9pZCPRGL +wIwIqOrTCBi+mQEYpENIsJEduYkoEKmL/QX+SqirXh/okEAAAAldEVYdGRhdGU6Y3JlYXRlADIw MjItMDMtMTRUMTM6Mzg6NDIrMDA6MDBrKBqBAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIyLTAzLTE0 VDEzOjM4OjQyKzAwOjAwGnWiPQAAAABJRU5ErkJggg== X-Now-Playing: Little Annie's _Soul Possession_: "Waiting For The Fun" Date: Mon, 14 Mar 2022 14:43:14 +0100 In-Reply-To: <83mthsk63c.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 14 Mar 2022 15:37:43 +0200") Message-ID: <87sfrkwsy5.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: > Is it "C-c to kill Emacs" as in "terminate Emacs with a fatal signal", > or is it "C-x C-c" as in "exit Emacs in an orderly fashion"? > > If the former, then in general killing a program when it is [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org, vincent@vinc17.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: > Is it "C-c to kill Emacs" as in "terminate Emacs with a fatal signal", > or is it "C-x C-c" as in "exit Emacs in an orderly fashion"? > > If the former, then in general killing a program when it is in the > middle of writing files isn't guaranteed to preserve those files. It's the former (sort of). And, yes, we make no guarantees, but the present situation doesn't seem optimal. The user may well hit `C-z' at the prompt and wonder where the file disappeared to. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 10:06:02 2022 Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 14:06:03 +0000 Received: from localhost ([127.0.0.1]:45902 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTlKk-0004Um-Jg for submit@debbugs.gnu.org; Mon, 14 Mar 2022 10:06:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTlKj-0004UG-8B for 13522@debbugs.gnu.org; Mon, 14 Mar 2022 10:06:01 -0400 Received: from [2001:470:142:3::e] (port=48922 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTlKd-00072I-Nm; Mon, 14 Mar 2022 10:05:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=11jHEJ8hpFdZy3mq1/AMclhznm9UwV93d3M6BioZ+aY=; b=h3YoGOHJMbz8 r6uHHY9auihBlsCEaZAkcVg5uxUd3S0gvmtOJ1ocUjhUBIb1XvjMuT5WhKF1WYmzLZGJt0lyHFlxG QYN5bdpxaus2d3hiNDHlANKT65G6Ljl2THuCfT+SHKHu6pHg+QnblkcQsMbUL2e4cc0IjLLRR+UuL nX4QSlFZlzEuSfjMtx/ZYuyeaO9EVKIV/y+2JtQelJv16DXsjnMv80sdUzYoo7tQopYDUjNVaC4SC MOFx+wlXcjYas186K8fJ6NUIyePet3gaB4V5XMaFcfJcUUvFrim1FTGy0v4vqL5VTcUZ2NkSaWpaY 75xHcqCt57A9WgoLu0ZJdA==; Received: from [87.69.77.57] (port=4841 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTlKd-0003Uk-5w; Mon, 14 Mar 2022 10:05:55 -0400 Date: Mon, 14 Mar 2022 16:05:43 +0200 Message-Id: <83fsnkk4so.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87sfrkwsy5.fsf@gnus.org> (message from Lars Ingebrigtsen on Mon, 14 Mar 2022 14:43:14 +0100) Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> <83mthsk63c.fsf@gnu.org> <87sfrkwsy5.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org, vincent@vinc17.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Cc: vincent@vinc17.net, 13522@debbugs.gnu.org > Date: Mon, 14 Mar 2022 14:43:14 +0100 > > Eli Zaretskii writes: > > > Is it "C-c to kill Emacs" as in "terminate Emacs with a fatal signal", > > or is it "C-x C-c" as in "exit Emacs in an orderly fashion"? > > > > If the former, then in general killing a program when it is in the > > middle of writing files isn't guaranteed to preserve those files. > > It's the former (sort of). > > And, yes, we make no guarantees, but the present situation doesn't seem > optimal. The user may well hit `C-z' at the prompt and wonder where the > file disappeared to. That's in the "if it hurts, don't do that" department, IMO. SIGINT is a fatal signal, and our response to fatal signals cannot be too fancy. We just auto-save what we can and commit suicide. Even that is disliked by some, who say we cannot safely do anything non-trivial from a fatal signal handler -- and they are absolutely right, we do stuff that invokes undefined behavior. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 11:21:00 2022 Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 15:21:00 +0000 Received: from localhost ([127.0.0.1]:46004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTmVI-0006aO-AK for submit@debbugs.gnu.org; Mon, 14 Mar 2022 11:21:00 -0400 Received: from cventin.lip.ens-lyon.fr ([140.77.13.17]:35004) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTmVG-0006aG-AI for 13522@debbugs.gnu.org; Mon, 14 Mar 2022 11:20:58 -0400 Received: from vlefevre by cventin.lip.ens-lyon.fr with local (Exim 4.95) (envelope-from ) id 1nTmVB-0004Pc-7z; Mon, 14 Mar 2022 16:20:53 +0100 Date: Mon, 14 Mar 2022 16:20:53 +0100 From: Vincent Lefevre To: Eli Zaretskii Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions Message-ID: <20220314152053.GB2381@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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <83fsnkk4so.fsf@gnu.org> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.2.1+12 (1ba319cf) vl-138565 (2022-03-05) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13522 Cc: Lars Ingebrigtsen , 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2022-03-14 16:05:43 +0200, Eli Zaretskii wrote: > > From: Lars Ingebrigtsen > > Cc: vincent@vinc17.net, 13522@debbugs.gnu.org > > Date: Mon, 14 Mar 2022 14:43:14 +0100 > > > > Eli Zaretskii writes: > > > > > Is it "C-c to kill Emacs" as in "terminate Emacs with a fatal signal", > > > or is it "C-x C-c" as in "exit Emacs in an orderly fashion"? > > > > > > If the former, then in general killing a program when it is in the > > > middle of writing files isn't guaranteed to preserve those files. > > > > It's the former (sort of). > > > > And, yes, we make no guarantees, but the present situation doesn't seem > > optimal. The user may well hit `C-z' at the prompt and wonder where the > > file disappeared to. > > That's in the "if it hurts, don't do that" department, IMO. This is silly. Ctrl-C is *standard* to interrupt commands. When there is a risk to lose data or to get in an inconsistent state, commands should trap SIGINT (either to ignore it or to do some cleanup before exiting). 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. In this bug, the issue is actually more important: When one does C-x C-s, the file has been renamed, which is bad, because the user may not choose what to do immediately, and many things can happen in the period, such as a power outage, a network outage, a crash of the machine, etc. The user may not notice the issue with the file immediately, so that he may lose the contents (or the changes, e.g. if the file is handled by a VCS). The file may also be needed by other software while the user is editing it (for instance, as backup software, or some application if this is a configuration file). > SIGINT is a fatal signal, and our response to fatal signals cannot > be too fancy. We just auto-save what we can and commit suicide. Even > that is disliked by some, who say we cannot safely do anything > non-trivial from a fatal signal handler -- and they are absolutely > right, we do stuff that invokes undefined behavior. 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. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 13:02:35 2022 Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 17:02:35 +0000 Received: from localhost ([127.0.0.1]:46171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTo5a-00014M-WA for submit@debbugs.gnu.org; Mon, 14 Mar 2022 13:02:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTo5Z-000145-BT for 13522@debbugs.gnu.org; Mon, 14 Mar 2022 13:02:34 -0400 Received: from [2001:470:142:3::e] (port=46860 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTo5T-0002gw-Rp; Mon, 14 Mar 2022 13:02:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=iPN504dxWKdd01E+bjPpYyTbkc6bUQzthV6ecMevsYA=; b=ZLp75BqM9r3n nwdXc5l1q/I1ljMFgl19Ufw7MVzbmrt+Ax32cTXvpUjyJOc4Q1So9bjHAUySIPB/3tGvdTDtnh34L NyW1WlOiZI+CspCXYF8yannyQqswfbU2m/wRKXmfuCAcVtuov/T6s/tXUnCkmZ40sAverLllikz2j BUUMY0CgLMIZNTZu7/isE9tygtqk+oX0Vya7FaKLxZcP48oiNIR8HO2nlIJdTefIVn2zLak7Mdw5j 3H+xRQoF+OnrjcgEY783ZItuWoWEkEX0EMtiFmoNlx8upyjGd1IwBsP9eZSvrs0qN/cY/g7guym7+ gYScRQ1DaaYWLei4rk2KSg==; Received: from [87.69.77.57] (port=3830 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTo5T-0001ki-BN; Mon, 14 Mar 2022 13:02:27 -0400 Date: Mon, 14 Mar 2022 19:02:14 +0200 Message-Id: <83bky8jwmh.fsf@gnu.org> From: Eli Zaretskii To: Vincent Lefevre In-Reply-To: <20220314152053.GB2381@cventin.lip.ens-lyon.fr> (message from Vincent Lefevre on Mon, 14 Mar 2022 16:20:53 +0100) Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions 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> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: larsi@gnus.org, 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Mon, 14 Mar 2022 16:20:53 +0100 > From: Vincent Lefevre > Cc: Lars Ingebrigtsen , 13522@debbugs.gnu.org > > This is silly. Ctrl-C is *standard* to interrupt commands. When there > is a risk to lose data or to get in an inconsistent state, commands > should trap SIGINT (either to ignore it or to do some cleanup before > exiting). That's what Emacs does. Except that not every processing interrupted in its middle can be restarted and run to its "normal" completion. > 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. > In this bug, the issue is actually more important: When one does > C-x C-s, the file has been renamed, which is bad, because the user > may not choose what to do immediately, and many things can happen > in the period, such as a power outage, a network outage, a crash of > the machine, etc. The user may not notice the issue with the file > immediately, so that he may lose the contents (or the changes, e.g. > if the file is handled by a VCS). The file may also be needed by > other software while the user is editing it (for instance, as backup > software, or some application if this is a configuration file). There should be an auto-save file to recover your edits. > > SIGINT is a fatal signal, and our response to fatal signals cannot > > be too fancy. We just auto-save what we can and commit suicide. Even > > that is disliked by some, who say we cannot safely do anything > > non-trivial from a fatal signal handler -- and they are absolutely > > right, we do stuff that invokes undefined behavior. > > 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. Anyway, what you describe is not what actually happens, AFAIK. Handling a fatal signal and handling C-g are very different in Emacs. But maybe I'm missing something, so I will let others speak up. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 14 13:32:45 2022 Received: (at 13522) by debbugs.gnu.org; 14 Mar 2022 17:32:45 +0000 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 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 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 Date: Mon, 14 Mar 2022 18:32:37 +0100 From: Vincent Lefevre To: Eli Zaretskii Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <83bky8jwmh.fsf@gnu.org> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.2.1+12 (1ba319cf) vl-138565 (2022-03-05) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13522 Cc: larsi@gnus.org, 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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) From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 15 07:42:52 2022 Received: (at 13522) by debbugs.gnu.org; 15 Mar 2022 11:42:52 +0000 Received: from localhost ([127.0.0.1]:47755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nU5Zk-0005UI-1b for submit@debbugs.gnu.org; Tue, 15 Mar 2022 07:42:52 -0400 Received: from quimby.gnus.org ([95.216.78.240]:53224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nU5Zi-0005Tz-28 for 13522@debbugs.gnu.org; Tue, 15 Mar 2022 07:42:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ds7L9K3JV2jE5oc2W+UFQs0m7BH337Hqragt6UDrDmE=; b=SkW9MTRAMK7YeWqqOqI+jO83s2 dRjhf7u9reHoK3ubIK4Kds0bdkrKc51Sl5QL4O3UrVR0xT/xwEbQBq9qDyR8vJq4DRFPLYBHhhWyG bzzIEa9VWtIWB8EwyNBpIzO/g0E9M1Z97d8g7ZnSxdjqh+x7dJPdKCOIkUhFL0HeO8c4=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nU5ZY-0002Gh-2s; Tue, 15 Mar 2022 12:42:42 +0100 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> <83mthsk63c.fsf@gnu.org> <87sfrkwsy5.fsf@gnus.org> <83fsnkk4so.fsf@gnu.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAIVBMVEUtEAgMCAMyLCVc HA+dKhXQNBrlOhyXk4lZWVH1QyH///8/dARjAAAAAWJLR0QKaND0VgAAAAd0SU1FB+YDDwskObGy vvYAAAGRSURBVDjLjZKxbtswEIZ5kWx0vAOd7JGHdiRBJkA3GTwR8BbApPaiVl7BHdss0VggQJ+3 lBIkkkwDOVGCqE+8/+4nhUhBQMMYA8UYV4IuxKeAZJcHmxjrfCq2LgvQFnlgG+b3sqegLuNB6gww Nugyt0JYp01Oo2CnNZVNgAUo2QmQbfd4WFYVHcC6Y/uoZwA5pDaawJZ3ixVcEzrLztQLr5wmjEMc FpbsCLDrmLufcwBpgjFYbh7m4lCkp2dmvxAnle7rLnYdLLcW02het2smPhoorVl4JVBNHcXTr1P/ fPqTFJBmoKq2v7fmllAZqTCVli6BQypumnvWtF799ent7uiOYb/SgrR/uWmZxPouHPH+3ybwj+9t m0AMjd+z9r5tvd+vQnw5hrBPoNBSSQNSGVEnfVWABMBpucV4dL72T33/3N9O+xgb+1I9VdW3Cman hDITBATKgfS1hAzAwYNdBow/m0tglmsKrvUFsLkIzlPJce/kufhGqbdDMgeoqUj+njc4uFGovCVn IT6Kos+t+A/9H3V61JWcPAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wMy0xNVQxMTozNjo1Nysw MDowMCVHIdEAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDMtMTVUMTE6MzY6NTcrMDA6MDBUGplt AAAAAElFTkSuQmCC X-Now-Playing: Joe Jackson's _Body and Soul_: "Go for It" Date: Tue, 15 Mar 2022 12:42:37 +0100 In-Reply-To: <83fsnkk4so.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 14 Mar 2022 16:05:43 +0200") Message-ID: <87ee33wifm.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: >> And, yes, we make no guarantees, but the present situation doesn't seem >> optimal. The user may well hit `C-z' at the prompt and wonder where the >> file disappeared to. > > That's in the "if it h [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org, vincent@vinc17.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> And, yes, we make no guarantees, but the present situation doesn't seem >> optimal. The user may well hit `C-z' at the prompt and wonder where the >> file disappeared to. > > That's in the "if it hurts, don't do that" department, IMO. SIGINT is > a fatal signal, and our response to fatal signals cannot be too > fancy. We just auto-save what we can and commit suicide. Even that > is disliked by some, who say we cannot safely do anything non-trivial > from a fatal signal handler -- and they are absolutely right, we do > stuff that invokes undefined behavior. I agree that killing Emacs is unusual. But suspending Emacs (with `C-z') is something people do all the time, and in this case, if the user is suspending Emacs on this prompt, they might be doing that to examine the file before saving it, for instance. And then they'll be confused that it's apparently gone. So I think we should fix this, perhaps the way Glenn suggested in his patch, but it's obviously not high priority. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 15 10:23:59 2022 Received: (at 13522) by debbugs.gnu.org; 15 Mar 2022 14:24:00 +0000 Received: from localhost ([127.0.0.1]:49267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nU85f-0004K2-JO for submit@debbugs.gnu.org; Tue, 15 Mar 2022 10:23:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nU85e-0004Jo-36 for 13522@debbugs.gnu.org; Tue, 15 Mar 2022 10:23:58 -0400 Received: from [2001:470:142:3::e] (port=38760 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU85Y-00070z-IN; Tue, 15 Mar 2022 10:23:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=tAJaTGmt+wAZsbueUm654tWWDOO47Ffa7mIUL5KXfB8=; b=qasi2yk15/xk 37i+rjY+G8BmTH2YaulK33bVEwsbWi+IOa6fq6/kgNhSpR8DivZ7sU/kLGiXGihJSdyrRc5Ja6GPg ifEpSS1A1ryWRhh9LafQAPfNm/KYmRf8HL8pUiTLJXLQKTT13qQpPqzHa0eYMxxBIVw/S2lFaD2et bLKlv/P24eEq9MRKZNY2PDRnL8n+4DfYFjEL9DpZ991cM0DGCg1Z5Mb1aC5f37DX1jwtgEMDTiVN9 sKGjWGzVw4pvQOEJ1CYWOSlfGeooNQZw3iOl0zgQqTxz+DhgucFQIByDdZBQWriZ8RaKI+CevCH+t IiYEM80KwbaIedkY8wFk+w==; Received: from [87.69.77.57] (port=2621 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU85Y-0000Gj-2N; Tue, 15 Mar 2022 10:23:52 -0400 Date: Tue, 15 Mar 2022 16:23:42 +0200 Message-Id: <83tubzi9ap.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87ee33wifm.fsf@gnus.org> (message from Lars Ingebrigtsen on Tue, 15 Mar 2022 12:42:37 +0100) Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> <83mthsk63c.fsf@gnu.org> <87sfrkwsy5.fsf@gnus.org> <83fsnkk4so.fsf@gnu.org> <87ee33wifm.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org, vincent@vinc17.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Cc: vincent@vinc17.net, 13522@debbugs.gnu.org > Date: Tue, 15 Mar 2022 12:42:37 +0100 > > Eli Zaretskii writes: > > >> And, yes, we make no guarantees, but the present situation doesn't seem > >> optimal. The user may well hit `C-z' at the prompt and wonder where the > >> file disappeared to. > > > > That's in the "if it hurts, don't do that" department, IMO. SIGINT is > > a fatal signal, and our response to fatal signals cannot be too > > fancy. We just auto-save what we can and commit suicide. Even that > > is disliked by some, who say we cannot safely do anything non-trivial > > from a fatal signal handler -- and they are absolutely right, we do > > stuff that invokes undefined behavior. > > I agree that killing Emacs is unusual. But suspending Emacs (with > `C-z') is something people do all the time, and in this case, if the > user is suspending Emacs on this prompt, they might be doing that to > examine the file before saving it, for instance. And then they'll be > confused that it's apparently gone. Does the problem actually happen if you type C-z? Emacs is not dead in that case, just suspended. Type "fg RET", and you are back inside Emacs, and can pick up where you left off. Right? > So I think we should fix this, perhaps the way Glenn suggested in his > patch, but it's obviously not high priority. I'm not against making this particular scenario have a smaller window of opportunity (if the solution is clean), but it will still be possible to cause similar problems by using SIGINT or any other signal during this and other similar procedures that aren't atomic. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 15 10:25:59 2022 Received: (at 13522) by debbugs.gnu.org; 15 Mar 2022 14:25:59 +0000 Received: from localhost ([127.0.0.1]:49273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nU87b-0004NU-1u for submit@debbugs.gnu.org; Tue, 15 Mar 2022 10:25:59 -0400 Received: from quimby.gnus.org ([95.216.78.240]:54662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nU87Z-0004NF-5g for 13522@debbugs.gnu.org; Tue, 15 Mar 2022 10:25:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LCaf60TZOWCskUkeHaRWj4p7Sn2HNWydAFhisjmnxSc=; b=VLhmSg7xaeyKz6ljPIpiVw0Px/ xcD420Q8L1ftdtFVQ9URK60ARUEUFEH650+4P7ozshYThGfq7iTGqLASstz/N7V2n11byEIEQIuk+ QpILmYpaQODkpBlIFa6wWQwx3uOu0+o7oXakZF6k6c0YIrG8JIG/O2lA7NRJhYjAdEEM=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nU87P-0003pv-Fd; Tue, 15 Mar 2022 15:25:49 +0100 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> <83mthsk63c.fsf@gnu.org> <87sfrkwsy5.fsf@gnus.org> <83fsnkk4so.fsf@gnu.org> <87ee33wifm.fsf@gnus.org> <83tubzi9ap.fsf@gnu.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEVORz8eHx23nVLB 0cn///8vnA2VAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+YDDw4ZDIsi8IAAAAGHSURBVDjLdVSNucMg CASzANgFDC5gw/67vUNj8/v80kg4uUPEErG+DSH9Z1yAGSx3QK8AD+vnFSUKQIiQAOMNizNmSsw9 gmhVyswAVAqXtAMrUZFEHBGgwHp8RLpwle7btURkRMT8TK5rYCGn8b3eN5i8707GxD3dUBG3Lyb9 uAfMMwJ+a8Kii/s2vDR43EqFmFY396JYEsCy4StVBoOH6W0CFoCtotmpevW2U2WjaqEe2t7cv7u4 bFatbta1fVt6yl0cVPEItEG0uM50P/Cui5N6aHhDBUftssFpYPAGff8G0yjq5pytalCx+xo1GTuH OIb2jfeiTOADcWsjXdDN6iKHAMCQA+Bz2fMWElgwA37nIbU7FlTw1onn1roA/Abw6TffdJjMD+Do W75S3QF5XBw6uM4AH8Zo490hdAgLUyqeqPRnS9TCMNgWvQ+Y4uJgtLBTCfNXC4rzpOg12WaX8C0r J9a3dNXTHRg3SuvyCsSp8PsfAFqu3/MHQCmA7M+i0L26p2P8A3hQUvGyC4YWAAAAJXRFWHRkYXRl OmNyZWF0ZQAyMDIyLTAzLTE1VDE0OjI1OjExKzAwOjAw9UvNwQAAACV0RVh0ZGF0ZTptb2RpZnkA MjAyMi0wMy0xNVQxNDoyNToxMSswMDowMIQWdX0AAAAASUVORK5CYII= X-Now-Playing: The Art of Noise's _Who's Afraid of...!_: "A Time For Fear (Who's Afraid)" Date: Tue, 15 Mar 2022 15:25:46 +0100 In-Reply-To: <83tubzi9ap.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 15 Mar 2022 16:23:42 +0200") Message-ID: <87wngvuwb9.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: > Does the problem actually happen if you type C-z? Emacs is not dead > in that case, just suspended. Type "fg RET", and you are back inside > Emacs, and can pick up where you left off. Right? Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: 13522@debbugs.gnu.org, vincent@vinc17.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: > Does the problem actually happen if you type C-z? Emacs is not dead > in that case, just suspended. Type "fg RET", and you are back inside > Emacs, and can pick up where you left off. Right? Yes, but the file is apparently missing after `C-z'. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 15 11:55:26 2022 Received: (at 13522) by debbugs.gnu.org; 15 Mar 2022 15:55:26 +0000 Received: from localhost ([127.0.0.1]:49393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nU9WA-0002jm-H9 for submit@debbugs.gnu.org; Tue, 15 Mar 2022 11:55:26 -0400 Received: from joooj.vinc17.net ([155.133.131.76]:41016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nU9W8-0002jd-Mm for 13522@debbugs.gnu.org; Tue, 15 Mar 2022 11:55:25 -0400 Received: from smtp-zira.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128]) by joooj.vinc17.net (Postfix) with ESMTPSA id F3A3723F; Tue, 15 Mar 2022 16:55:22 +0100 (CET) Received: by zira.vinc17.org (Postfix, from userid 1000) id D7F4428001EE; Tue, 15 Mar 2022 16:55:22 +0100 (CET) Date: Tue, 15 Mar 2022 16:55:22 +0100 From: Vincent Lefevre To: Lars Ingebrigtsen Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions Message-ID: <20220315155522.GQ31771@zira.vinc17.org> References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> <83mthsk63c.fsf@gnu.org> <87sfrkwsy5.fsf@gnus.org> <83fsnkk4so.fsf@gnu.org> <87ee33wifm.fsf@gnus.org> <83tubzi9ap.fsf@gnu.org> <87wngvuwb9.fsf@gnus.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87wngvuwb9.fsf@gnus.org> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.2.1+12 (1ba319cf) vl-138565 (2022-03-05) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13522 Cc: Eli Zaretskii , 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2022-03-15 15:25:46 +0100, Lars Ingebrigtsen wrote: > Eli Zaretskii writes: > > > Does the problem actually happen if you type C-z? Emacs is not dead > > in that case, just suspended. Type "fg RET", and you are back inside > > Emacs, and can pick up where you left off. Right? > > Yes, but the file is apparently missing after `C-z'. Actually, as I've said in another mail, you do not even need to do C-z. The file is missing after C-x C-s: if I try to look at the file from a different terminal (a real terminal or with GNU Screen), this file is missing. This may also be problematic for those who have automatic backups to a remote storage area (in particular if files matching *~ are ignored for these backups). -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 30 12:47:18 2022 Received: (at 13522) by debbugs.gnu.org; 30 Apr 2022 16:47:18 +0000 Received: from localhost ([127.0.0.1]:58968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nkqFZ-0007VQ-Tb for submit@debbugs.gnu.org; Sat, 30 Apr 2022 12:47:18 -0400 Received: from quimby.gnus.org ([95.216.78.240]:50048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nkqFY-0007V9-Fa for 13522@debbugs.gnu.org; Sat, 30 Apr 2022 12:47:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+B+TXkcqNZY9BQQaAQlxx/4HlF8M+aDmBIVjfn//bS8=; b=OsyVyGYde7idrh2waj8mCEq7R2 c7yJgpKISLqpSa0xJJVCDDg+BmzallfE3I7owADUaH78KWHPRXMBSV6QiDcz7QzptvTaodRJ1rv38 jeD5BCvwaslX+wXCGjzT9n2DCtDeAqvLVOi1GBiR5xs33VEBSEcOun/S6wgGN+qEapOM=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nkqFM-0001ky-Q5; Sat, 30 Apr 2022 18:47:07 +0200 From: Lars Ingebrigtsen To: Vincent Lefevre Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> <83mthsk63c.fsf@gnu.org> <87sfrkwsy5.fsf@gnus.org> <83fsnkk4so.fsf@gnu.org> <87ee33wifm.fsf@gnus.org> <83tubzi9ap.fsf@gnu.org> <87wngvuwb9.fsf@gnus.org> <20220315155522.GQ31771@zira.vinc17.org> X-Now-Playing: Talking Heads's _The Name Of This Band Is Talking Heads_: "track" Date: Sat, 30 Apr 2022 18:47:04 +0200 In-Reply-To: <20220315155522.GQ31771@zira.vinc17.org> (Vincent Lefevre's message of "Tue, 15 Mar 2022 16:55:22 +0100") Message-ID: <87r15ey0vr.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Vincent Lefevre writes: >> Yes, but the file is apparently missing after `C-z'. > > Actually, as I've said in another mail, you do not even need to do C-z. > The file is missing after C-x C-s: if I try to look at the file fr [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: Glenn Morris , Eli Zaretskii , 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Vincent Lefevre writes: >> Yes, but the file is apparently missing after `C-z'. > > Actually, as I've said in another mail, you do not even need to do C-z. > The file is missing after C-x C-s: if I try to look at the file from > a different terminal (a real terminal or with GNU Screen), this file > is missing. This may also be problematic for those who have automatic > backups to a remote storage area (in particular if files matching *~ > are ignored for these backups). Yup; it's not ideal. Glenn applied one solution to this (binding coding-system-for-write), but that had other problems, apparently. I've now respun his original patch, and as far as I can tell, it works pretty well. However, it breaks files-tests-bug-18141. But before I try to debug this, does anybody see anything fundamentally misguided about this approach? diff --git a/lisp/files.el b/lisp/files.el index 2b0dc54db8..7e3bea614e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5649,7 +5649,7 @@ basic-save-buffer-1 ;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like ;; backup-buffer. (defun basic-save-buffer-2 () - (let (tempsetmodes setmodes) + (let (tempsetmodes setmodes writecoding) (if (not (file-writable-p buffer-file-name)) (let ((dir (file-name-directory buffer-file-name))) (if (not (file-directory-p dir)) @@ -5665,6 +5665,9 @@ basic-save-buffer-2 buffer-file-name))) (setq tempsetmodes t) (error "Attempt to save to a file that you aren't allowed to write")))))) + (setq writecoding + (choose-write-coding-system nil nil buffer-file-name nil t + buffer-file-truename)) (or buffer-backed-up (setq setmodes (backup-buffer))) (let* ((dir (file-name-directory buffer-file-name)) @@ -5697,8 +5700,9 @@ basic-save-buffer-2 ;; Pass in nil&nil rather than point-min&max ;; cause we're saving the whole buffer. ;; write-region-annotate-functions may use it. - (write-region nil nil tempname nil realname - buffer-file-truename) + (let ((write-region-coding-system writecoding)) + (write-region nil nil tempname nil realname + buffer-file-truename)) (when save-silently (message nil))) ;; If we failed, restore the buffer's modtime. (error (set-visited-file-modtime old-modtime) @@ -5743,8 +5747,9 @@ basic-save-buffer-2 ;; Pass in nil&nil rather than point-min&max to indicate ;; we're saving the buffer rather than just a region. ;; write-region-annotate-functions may make use of it. - (write-region nil nil - buffer-file-name nil t buffer-file-truename) + (let ((write-region-coding-system writecoding)) + (write-region nil nil + buffer-file-name nil t buffer-file-truename)) (when save-silently (message nil)) (setq success t)) ;; If we get an error writing the new file, and we made diff --git a/src/fileio.c b/src/fileio.c index c418036fc6..f04383252a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5012,14 +5012,22 @@ build_annotations_unwind (Lisp_Object arg) /* Decide the coding-system to encode the data with. */ -static Lisp_Object -choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object filename, - Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, - struct coding_system *coding) +DEFUN ("choose-write-coding-system", Fchoose_write_coding_system, + Schoose_write_coding_system, 3, 6, 0, + doc: /* Choose coding system for write. +Arguments as for `write-region'. */ ) + (Lisp_Object start, Lisp_Object end, Lisp_Object filename, + Lisp_Object append, Lisp_Object visit, Lisp_Object lockname) { Lisp_Object val; Lisp_Object eol_parent = Qnil; + if (NILP (start)) + { + XSETFASTINT (start, BEGV); + XSETFASTINT (end, ZV); + } + if (auto_saving && NILP (Fstring_equal (BVAR (current_buffer, filename), BVAR (current_buffer, auto_save_file_name)))) @@ -5119,10 +5127,6 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file } val = coding_inherit_eol_type (val, eol_parent); - setup_coding_system (val, coding); - - if (!STRINGP (start) && EQ (Qt, BVAR (current_buffer, selective_display))) - coding->mode |= CODING_MODE_SELECTIVE_DISPLAY; return val; } @@ -5287,9 +5291,15 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, We used to make this choice before calling build_annotations, but that leads to problems when a write-annotate-function takes care of unsavable chars (as was the case with X-Symbol). */ - Vlast_coding_system_used - = choose_write_coding_system (start, end, filename, - append, visit, lockname, &coding); + Vlast_coding_system_used = NILP (Vwrite_region_coding_system) ? + Fchoose_write_coding_system (start, end, filename, + append, visit, lockname) : + Vwrite_region_coding_system; + + setup_coding_system (Vlast_coding_system_used, &coding); + + if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display))) + coding.mode |= CODING_MODE_SELECTIVE_DISPLAY; if (open_and_close_file && !auto_saving) { @@ -6372,6 +6382,7 @@ syms_of_fileio (void) DEFSYM (Qset_file_acl, "set-file-acl"); DEFSYM (Qfile_newer_than_file_p, "file-newer-than-file-p"); DEFSYM (Qinsert_file_contents, "insert-file-contents"); + DEFSYM (Qchoose_write_coding_system, "choose-write-coding-system"); DEFSYM (Qwrite_region, "write-region"); DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime"); DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime"); @@ -6614,6 +6625,11 @@ do (file-exists-p FILENAME) and FILENAME is handled by HANDLER, then DEFSYM (Qstdout, "stdout"); DEFSYM (Qstderr, "stderr"); + DEFVAR_LISP ("write-region-coding-system", Vwrite_region_coding_system, + doc: /* If non-nil, coding system for `write-region'. + You should only ever `let'-bind this around a `write-region' call. */); + Vwrite_region_coding_system = Qnil; + defsubr (&Sfind_file_name_handler); defsubr (&Sfile_name_directory); defsubr (&Sfile_name_nondirectory); @@ -6655,6 +6671,7 @@ do (file-exists-p FILENAME) and FILENAME is handled by HANDLER, then defsubr (&Sdefault_file_modes); defsubr (&Sfile_newer_than_file_p); defsubr (&Sinsert_file_contents); + defsubr (&Schoose_write_coding_system); defsubr (&Swrite_region); defsubr (&Scar_less_than_car); defsubr (&Sverify_visited_file_modtime); -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 30 12:51:46 2022 Received: (at 13522) by debbugs.gnu.org; 30 Apr 2022 16:51:46 +0000 Received: from localhost ([127.0.0.1]:58979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nkqJt-0007ef-UA for submit@debbugs.gnu.org; Sat, 30 Apr 2022 12:51:46 -0400 Received: from quimby.gnus.org ([95.216.78.240]:50098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nkqJs-0007eQ-1t for 13522@debbugs.gnu.org; Sat, 30 Apr 2022 12:51:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=NVobXinQsvOxR/O0LwmyEB+L0k8KpgnwzBV4tfn2dr4=; b=q7wqKOvU5OtjXENCiLM3vs5Jcp 6PVbjvkPPsFzdg988RSigXRxNw+FnQtZk/MNi1zJR7IONjncEjA/mjnV6lEuZnTe/1X0etZIa6EYs avqyim3PWwyY9EE+a25yfIcLOuttOD4YI0UzaqWpVksWgcIMYN0UvOyzaNsJhgH8tLTw=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nkqJj-0001mA-NB; Sat, 30 Apr 2022 18:51:37 +0200 From: Lars Ingebrigtsen To: Vincent Lefevre Subject: Re: bug#13522: 24.2; save-buffer removes edited file under some conditions References: <87622qaszq.fsf@xvii.vinc17.org> <8735jkye2q.fsf@gnus.org> <83mthsk63c.fsf@gnu.org> <87sfrkwsy5.fsf@gnus.org> <83fsnkk4so.fsf@gnu.org> <87ee33wifm.fsf@gnus.org> <83tubzi9ap.fsf@gnu.org> <87wngvuwb9.fsf@gnus.org> <20220315155522.GQ31771@zira.vinc17.org> <87r15ey0vr.fsf@gnus.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEVPNjWZXVfEvb// //9Q/fqmAAAAAWJLR0QDEQxM8gAAAAd0SU1FB+YEHhAUF/jUJbEAAAGXSURBVCjPPZHPatwwEMZH ix3ITQV7qfeUlrQ0fYrZkO1ZBgmaPbmwXoqfwqeedahLm5MXbFPNU/YbL+nnP+hnj0bfzBBBT4d9 sLpgMgGqJwW5KuD+D6oZMF+XqVOIiyRc0iWSxGeZd60G0GXmWhbfLsPzQmPtY/rMUR5uP1CzaWN1 b7gssgInnfj9uOVHSw4WQm+mb/zoCkulD55802z6CyAA4NI8XRzBpCPL2IstJX40WAbNpf5nfSHg 1fU8hGs9CTnMpJCWqcKH4fcZKWVpdoAlaRdksLnWsoZdTiv8ce8Ao+3Ll+7rSfsEJ4fv0k04Uk+l T1m7izDx1gCyrLpbHeVquLo55a40fEt5yDPzd+9gTl0fiTwVIRxZizMSiY5DYC3ByFqD8xQ6b7SG AQ/NcgUVTS/OJBnPK6RjYSTFj4tEDbM6ia2k/hfFZ9JJvBHPW4o3TGMR6h8/2ZEzfdbQQ91/8dpJ 1T33m3YFtc5MDcBQRXmJMm1P5hAqs/YWwoLRUWfJWrhOex0Rdup8Ws4D0uavma/a/APzo7LZSoHr TgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wNC0zMFQxNjoyMDoyMyswMDowMI51Y54AAAAldEVY dGRhdGU6bW9kaWZ5ADIwMjItMDQtMzBUMTY6MjA6MjMrMDA6MDD/KNsiAAAAAElFTkSuQmCC X-Now-Playing: Talking Heads's _The Name Of This Band Is Talking Heads_: "track" Date: Sat, 30 Apr 2022 18:51:34 +0200 In-Reply-To: <87r15ey0vr.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 30 Apr 2022 18:47:04 +0200") Message-ID: <87mtg2y0o9.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Lars Ingebrigtsen writes: > Glenn applied one solution to this (binding coding-system-for-write), > but that had other problems, apparently. I've now respun his original > patch, and as far as I can tell, it works pretty well. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 13522 Cc: Glenn Morris , 13522@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Lars Ingebrigtsen writes: > Glenn applied one solution to this (binding coding-system-for-write), > but that had other problems, apparently. I've now respun his original > patch, and as far as I can tell, it works pretty well. However, it > breaks files-tests-bug-18141. > > But before I try to debug this, does anybody see anything fundamentally > misguided about this approach? Oh, I should have looked at bug#18141 first. Glenn's commit was 9dbda100755158f, and it has basically the same problems the first version of the code has. So skip my question about whether that approach has problems; it does. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no