From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs,gmane.comp.lib.gnulib.bugs Subject: bug#57129: 29.0.50; Improve behavior of conditionals in Eshell Date: Tue, 16 Aug 2022 20:52:57 +0300 Message-ID: <83mtc4dqiu.fsf@gnu.org> References: <4165399.mogB4TqSGs@nimes> <83wnb8dukz.fsf@gnu.org> <2594092.Isy0gbHreE@nimes> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40956"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jporterbugs@gmail.com, larsi@gnus.org, eggert@cs.ucla.edu, bug-gnulib@gnu.org, 57129@debbugs.gnu.org To: Bruno Haible Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 16 20:12:28 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oO13D-000APf-VM for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Aug 2022 20:12:28 +0200 Original-Received: from localhost ([::1]:55526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oO13C-0003WF-Qb for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Aug 2022 14:12:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oO0lO-0003J6-Au for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 13:54:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58491) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oO0lO-00054c-2B for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 13:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oO0lN-0004jk-SS for bug-gnu-emacs@gnu.org; Tue, 16 Aug 2022 13:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Aug 2022 17:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57129 X-GNU-PR-Package: emacs Original-Received: via spool by 57129-submit@debbugs.gnu.org id=B57129.166067239818144 (code B ref 57129); Tue, 16 Aug 2022 17:54:01 +0000 Original-Received: (at 57129) by debbugs.gnu.org; 16 Aug 2022 17:53:18 +0000 Original-Received: from localhost ([127.0.0.1]:48240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oO0kf-0004ia-LP for submit@debbugs.gnu.org; Tue, 16 Aug 2022 13:53:18 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oO0kd-0004iM-72 for 57129@debbugs.gnu.org; Tue, 16 Aug 2022 13:53:15 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43970) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oO0kX-00051J-Pa; Tue, 16 Aug 2022 13:53:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=xcCimE2hkja97WjL3ZYTM2NM4o03g/deLJ/MYyO7SAg=; b=J5VHmqc2Wo1N4fKgY/IK SEKeQ5Qv5mPi9baoyhj9wg6hmHf0vyuZY1BA07RbSWLZVhncbY1b/CD9Mxu4zPI5n22B5x9/EVjML nwxW/u/j6mlAz2feg+WayYN59w+fpdbAXFTLyV2MR7RGACOUEqMc56bQ3J1s2VL8wdTCkzn/KVxzL 9u2XPcwtQCaZA+P9Nyj5MH2a8SveLMV5yLX4ygki1MNW46yA9k+vyj1v2TfKtsmUflX384UcJn3Wr w7QxwLKYWYIgsZ92CiSn8seVKQjU5Pjb7vbhlLwjpt0h2yXVIh+QwLOVMFrY1u0e41zhShuw7FIs5 hlVBqUnnKGcIhg==; Original-Received: from [87.69.77.57] (port=3136 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 1oO0kX-0008O1-8t; Tue, 16 Aug 2022 13:53:09 -0400 In-Reply-To: <2594092.Isy0gbHreE@nimes> (message from Bruno Haible on Tue, 16 Aug 2022 19:29:33 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:239987 gmane.comp.lib.gnulib.bugs:46149 Archived-At: > From: Bruno Haible > Cc: eggert@cs.ucla.edu, bug-gnulib@gnu.org, larsi@gnus.org, 57129@debbugs.gnu.org, jporterbugs@gmail.com > Date: Tue, 16 Aug 2022 19:29:33 +0200 > > > The buffer which visited that file still exists, and still records the > > name of the file, yes. And then, when the program writes to another > > file created by another call to make-temp-file, it actually writes to > > a file that some buffer still visits, and in Emacs that triggers a > > prompt to the user to refresh the buffer. > > That is a reasonable behaviour for a text editor — but only for file > names that are explicitly controlled by some program or by the user, > not for temporary files. Why not for temporary files? Emacs has a with-temp-file macro, which generates a temporary file name, executes the body of the macro with a variable bound to the file name, then deletes the file. Very handy for writing test suites. We don't usually bother deleting the buffers where the file was processed in those tests, because the test suite runs in batch mode, and Emacs exits after running the tests, thus cleaning up. Having to carefully make sure no such buffers were left from the previous test is a nuisance. > > The programmer didn't > > expect that because it is natural to expect each call to a function > > that creates a temporary file to create a file under a new name, not > > reuse the same name. > > This is an incorrect assumption. Just like socket numbers are randomly > generated in some situations, temp file names are random, and you can't > make assumptions about the resulting file name. People get their ideas from other similar APIs, and functions like tmpfile in C do generate a different name each call. > How about storing, as an attribute of the buffer, a boolean that tells > whether the underlying file name is randomly generated (i.e. a temp file), > and query this boolean before prompting to the user to refresh the buffer? That's a terrible complications, especially since the solution is so close at hand, and it makes gen_tempname behave on Windows as it does on GNU/Linux, and as it behaved just a year or two ago.