emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 4d3a595: `load-path' should contain only direct


From: Eli Zaretskii
Subject: Re: [Emacs-diffs] master 4d3a595: `load-path' should contain only directory names
Date: Sun, 25 Oct 2015 20:38:31 +0200

> From: Stephen Leake <address@hidden>
> Cc: Stefan Monnier <address@hidden>,  address@hidden
> Date: Sat, 24 Oct 2015 16:37:43 -0500
> 
> > No, he means without the trailing slash.
> 
> Hmm. I now realize this is confused, and the doc string for `load-path'
> does not match the implementation.
> 
> Here's the `load-path' doc string (from master):
> 
>    List of directories to search for files to load.
>    Each element is a string (directory name) or nil (meaning 
> ‘default-directory’).
>    Initialized during startup as described in Info node ‘(elisp)Library 
> Search’.
> 
> That says "directory name".

> (info "(elisp) Directory Names") says:
> 
>    On GNU and Unix systems, this is simple: a directory name ends in a
>    slash, whereas the directory’s name as a file lacks that slash.
> 
> This info node does not give a canonical phrase for "the directory's name as
> a file". This is the string returned by `directory-file-name'; I guess
> "directory file name" works.

It's easy to get these two confused, especially since one is shorter.

Let's say "directory file name" in the doc string of 'load-path',
since we've been doing that since time immemoriam.

> In emacs -Q, `load-path' has no terminating slashes.

Yes, because startup.el uses directory-files to get the standard
subdirectories of lisp/, and the lisp/ directory itself starts without
the trailing slash (by magic of the processed epaths.in).

> I have the impression that some other documentation uses "directory"
> instead of "directory name", but I can't find a good example at the moment.

I don't think this distinction between "directory" the object and its
name (see Lewis Carrol's immortal text on that) is relevant to the
issue at hand.  Here we are talking about 2 possible forms of the
directory's name.

> So the doc string for `load-path' should be changed to:
> 
>    List of directories to search for files to load.
>    Each element is a string (directory file name) or nil (meaning 
> ‘default-directory’).

Yes, and also a reference to 'directory-file-name' would be useful
here.

>    Initialized during startup as described in Info node ‘(elisp)Library 
> Search’.
> 
> (just added 'file') possibly refilled.
> 
> And the info node should define "directory file name".

Yup.  Patches welcome, thanks in advance.

> However, there is one more quirk; `default-directory' does end in a
> slash, so having nil mean that in `load-path' is inconsistent. Should
> that then be:
> 
>  ... or nil (meaning (directory-file-name default-directory)).
> 
> ?

I don't think this subtlety is relevant.  The issue at hand is the
_form_, not the _semantics_.  As far as the form is concerned, nil
doesn't end in a slash, and you cannot use it in 'concat' for
generating a file name with leading directories anyway; you must use
'expand-file-name', which already does TRT.

> I don't think I've ever had nil in `load-path'; that seems like a bug,
> comparable to having "." in PATH.

No, it's a feature.  I did see that at some point, don't remember
where and why.

> And most of the path iterating code I've written would fail on nil
> (sigh).

If you use 'expand-file-name', it will "just work".




reply via email to

[Prev in Thread] Current Thread [Next in Thread]