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.help Subject: Re: Why does (file-exists-p "") return t? Date: Sat, 11 Feb 2023 12:39:04 +0200 Message-ID: <83fsbcjxkn.fsf@gnu.org> References: <834jrvm04q.fsf@gnu.org> <87wn4q1r6w.fsf@posteo.net> 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="38094"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 11 11:40:07 2023 Return-path: Envelope-to: geh-help-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 1pQnIc-0009hx-F5 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 11 Feb 2023 11:40:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQnI7-0005SU-Cm; Sat, 11 Feb 2023 05:39:35 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQnI6-0005S7-3j for help-gnu-emacs@gnu.org; Sat, 11 Feb 2023 05:39:34 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pQnI5-0006H9-Qu for help-gnu-emacs@gnu.org; Sat, 11 Feb 2023 05:39:33 -0500 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=tVg0K9kRB7iOtcrYHDqhQ8j/a0fN4FfhDU/U2XKY60w=; b=LLBBPC11ehwgmJzhINFr WDcu00LFeRzHRYpmyYaz1wQgsYGy+/+fqu0A1ScP7STmsSXiYWxjZBiLuraoeNll2V6limvPmtXeR 8TMO4OBILw9MaOZvPzID7GnidHL3FAmnvnNfKsrDGQPgbCNqFph4lnWqChlwOSfUIxWH4TM73QMWb DPSyQEKtPY7kDFKrNYnfV3KMRkkFs3qgYeGFXwqGILxHnFy5yp1K6ZbmRChLtzLWTEQ/QmSiT3HPy qJItan+kmJUpH/8uFRasdahVBOfY9CQEOLPMt963zc6zna+0IzGP2zAZ/5yo89VA2unJFdpmPsYB/ YC4N92JqxDcqDw==; Original-Received: from [87.69.77.57] (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 1pQnI5-00069e-D6 for help-gnu-emacs@gnu.org; Sat, 11 Feb 2023 05:39:33 -0500 In-Reply-To: (message from Jean Louis on Fri, 10 Feb 2023 07:20:01 +0300) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142700 Archived-At: > Date: Fri, 10 Feb 2023 07:20:01 +0300 > From: Jean Louis > Cc: eliz@gnu.org, help-gnu-emacs@gnu.org > > * Edgar Vincent [2023-02-10 00:11]: > > I didn’t know that file-exists-p used expand-file-name, but it does seem obvious. > > To avoid the problem maybe you should use `expand-file-name' before > you check it with `file-exists-p' But there's no problem here. All Emacs functions that accept file names use expand-file-name internally before passing the file name to system APIs, because every file name in Emacs can be relative to the current buffer's default-directory. IOW, Emacs pretends to change its current directory to the buffer's default-directory when you switch buffers.