From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: file-exists-p on empty string Date: Wed, 27 Feb 2019 11:15:44 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="220431"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 27 17:16:30 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gz1sj-000vDZ-MT for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 17:16:29 +0100 Original-Received: from localhost ([127.0.0.1]:46782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz1si-00008S-G6 for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 11:16:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz1sc-000086-A2 for emacs-devel@gnu.org; Wed, 27 Feb 2019 11:16:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gz1sV-0006FN-TZ for emacs-devel@gnu.org; Wed, 27 Feb 2019 11:16:20 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:53885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz1sS-00062e-3A for emacs-devel@gnu.org; Wed, 27 Feb 2019 11:16:13 -0500 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id x1RGFj1L027189; Wed, 27 Feb 2019 11:15:45 -0500 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id D3DC2AE0E9; Wed, 27 Feb 2019 11:15:44 -0500 (EST) In-Reply-To: (Robert Pluim's message of "Wed, 27 Feb 2019 17:00:45 +0100") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6492=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6492> : inlines <7024> : streams <1814265> : uri <2803151> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233657 Archived-At: >> I don't think we can change the above behavior without introducing other >> odd behaviors. E.g. currently (file-name-nondirectory "/a/b/") return "= ", >> which is consistent with the above behavior. > > ? file-name-nondirectory doesn=CA=BCt use expand-file-name anywhere, and = we > can fix file-exists-p without changing expand-file-name, so I don=CA=BCt > follow you here. It considers "" as the name of the directory, just like `file-exists-p` and `expand-file-name` (and pretty much all other operations that take a file name). This is really not specific to `file-exists-p`: it's a general design of Elisp's handling of file names. If we consider "" as an invalid file name, then I think (file-name-nondirectory "/a/b/") should be changed to return ".", and I'd be surprised if it's the only change we'd need to do. Stefan