all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: file-exists-p on empty string
Date: Wed, 06 Mar 2019 10:51:02 +0100	[thread overview]
Message-ID: <8736o05o1l.fsf@gmx.de> (raw)
In-Reply-To: <jwvo96xvspd.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 27 Feb 2019 16:18:48 -0500")

[-- Attachment #1: Type: text/plain, Size: 926 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> So the (not (string-empty-p fn)) test just reflects the tool's semantics
>>> and is not an artifact of some suboptimal behavior of file-exists-p.
>> I gree, but there is not a line about empty strings in doc-string.
>> It is great that this is mentioned in documentation, but anyway
>> behaviour was quite unexpected
>
> The problem is that docstrings describe the behavior of a specific
> function, so they usually don't mention the more general aspects that
> affect all functions of a given subsystem, such as here the general
> treatment of the empty string when used as a file name.
>
> Otherwise, every file-name-manipulating function would have to repeat
> this information in its docstring.

What about the appended patch? It does not touch the docstrings, but it
explains the situation more verbose in the Lisp manual.

>         Stefan

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 1601 bytes --]

*** /tmp/ediffq2yDYg	2019-03-06 10:49:17.961600214 +0100
--- /home/albinus/src/emacs-26/doc/lispref/files.texi	2019-03-06 10:39:51.804376822 +0100
***************
*** 16,22 ****
  names.  A file name is a string.  Most of these functions expand file
  name arguments using the function @code{expand-file-name}, so that
  @file{~} is handled correctly, as are relative file names (including
! @file{../}).  @xref{File Name Expansion}.
  
    In addition, certain @dfn{magic} file names are handled specially.
  For example, when a remote file name is specified, Emacs accesses the
--- 16,22 ----
  names.  A file name is a string.  Most of these functions expand file
  name arguments using the function @code{expand-file-name}, so that
  @file{~} is handled correctly, as are relative file names (including
! @file{../} and the empty string).  @xref{File Name Expansion}.
  
    In addition, certain @dfn{magic} file names are handled specially.
  For example, when a remote file name is specified, Emacs accesses the
***************
*** 2409,2414 ****
--- 2409,2425 ----
  superroot above the root directory @file{/}.  On other filesystems,
  @file{/../} is interpreted exactly the same as @file{/}.
  
+ Expanding @file{.} or the empty string returns the default directory:
+ 
+ @example
+ @group
+ (expand-file-name "." "/usr/spool/")
+      @result{} "/usr/spool"
+ (expand-file-name "" "/usr/spool/")
+      @result{} "/usr/spool"
+ @end group
+ @end example
+ 
  Note that @code{expand-file-name} does @emph{not} expand environment
  variables; only @code{substitute-in-file-name} does that:
  

  parent reply	other threads:[~2019-03-06  9:51 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 20:07 file-exists-p on empty string lg.zevlg
2019-02-27 21:18 ` Stefan Monnier
2019-02-27 22:01   ` Drew Adams
2019-02-28  3:24     ` Stefan Monnier
2019-03-06  9:51   ` Michael Albinus [this message]
2019-03-08  6:11     ` Stefan Monnier
2019-03-09  8:48       ` Michael Albinus
  -- strict thread matches above, loose matches on Subject: below --
2019-02-27 22:09 lg.zevlg
2019-02-27 22:23 ` Drew Adams
2019-02-27 22:41   ` Evgeny Zajcev
2019-02-27 23:23     ` Drew Adams
2019-02-28  0:08       ` Evgeny Zajcev
2019-02-28  1:16     ` Stefan Monnier
2019-02-27 12:29 Evgeny Zajcev
2019-02-27 14:15 ` Michael Albinus
2019-02-27 15:29   ` Troy Hinckley
2019-02-27 15:43   ` Robert Pluim
2019-02-27 16:01     ` Michael Albinus
2019-02-27 16:55       ` Eli Zaretskii
2019-02-27 18:09         ` Michael Albinus
2019-02-27 16:11     ` Eli Zaretskii
2019-02-27 16:16       ` Robert Pluim
2019-02-27 16:30     ` Andreas Schwab
2019-02-27 19:40     ` lg.zevlg
2019-02-27 15:53 ` Stefan Monnier
2019-02-27 16:00   ` Robert Pluim
2019-02-27 16:15     ` Stefan Monnier
2019-02-27 16:09 ` Eli Zaretskii
2019-02-27 18:42   ` lg.zevlg
2019-02-27 18:46     ` Eli Zaretskii
2019-02-27 19:04       ` lg.zevlg
2019-02-27 19:16         ` Eli Zaretskii
2019-02-27 19:29           ` lg.zevlg
2019-02-27 19:30         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736o05o1l.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.