emacs-devel
[Top][All Lists]
Advanced

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

Re: load-path contains directories or directory names?


From: Stephen Leake
Subject: Re: load-path contains directories or directory names?
Date: Sat, 24 Oct 2015 16:46:19 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

"John Wiegley" <address@hidden> writes:

>>>>>> Michael Heerdegen <address@hidden> writes:
>
>> I try to avoid string operations on file names.
>> In the above case, using
>>   (expand-file-name name dir)
>> seems cleaner to me.

(info "(elisp) Directory Names" says to use:

(concat DIRNAME RELFILE)

So if I'm iterating thru a path that is defined to contain directory
names (as `load-path' is, but see other email), this code is correct:

(concat dir name)

However, if the path contains directory file names (as
`load-path' is implemented), then this code is correct:

(concat (file-name-as-directory dir) filename)


However, `file-name-as-directory' tolerates ending slashes or not in
`dir', so the latter code is robust against people putting the wrong
things in the path.

Same for `expand-file-name' of course.

-- 
-- Stephe



reply via email to

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