From: Nicolas Richard <youngfrog@members.fsf.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 27982@debbugs.gnu.org
Subject: bug#27982: 25.1.50; expand-file-name docstring on how to traverse the filesystem
Date: Wed, 23 Aug 2017 21:18:53 +0200 [thread overview]
Message-ID: <86wp5um6ss.fsf@members.fsf.org> (raw)
In-Reply-To: <83378i9nrv.fsf@gnu.org>
Eli Zaretskii <eliz@gnu.org> writes:
> Crystal ball says that current-directory (which you probably meant to
> be default-directory instead) ends in a slash, in which case remove
> it, and the 2 results will match.
Your crystal ball is working fine. Sorry for leaving that detail out.
FWIW I have (defvaralias 'current-directory 'default-directory) because
I used to forget the name of the variable (and I still do, it seems).
Note however that default-directory ends in a slash when using "emacs
-Q" too.
Ok so now I'm saying that, with the suggestion in the docstring, output
will be different if "dirname" ends in a slash. IOW if it is a
"directory name" as opposed to "directory's file name".
(let ((dirname "/home/youngfrog/"))
(format "%s versus %s"
(directory-file-name (file-name-directory dirname))
(expand-file-name ".." dirname)))
=> output is different
(let ((dirname "/home/youngfrog"))
(format "%s versus %s"
(directory-file-name (file-name-directory dirname))
(expand-file-name ".." dirname)))
=> output the same
With the function calls swapped the output is always similar:
(let ((dirname "/home/youngfrog/"))
(format "%s versus %s"
(file-name-directory (directory-file-name dirname))
(expand-file-name ".." dirname)))
=> output is similar
(let ((dirname "/home/youngfrog"))
(format "%s versus %s"
(file-name-directory (directory-file-name dirname))
(expand-file-name ".." dirname)))
=> output is similar
Nicolas.
next prev parent reply other threads:[~2017-08-23 19:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-06 11:38 bug#27982: 25.1.50; expand-file-name docstring on how to traverse the filesystem Nicolas Richard
2017-08-06 16:53 ` Eli Zaretskii
2017-08-23 12:18 ` Nicolas Richard
2017-08-23 17:50 ` Eli Zaretskii
2017-08-23 19:18 ` Nicolas Richard [this message]
2017-08-24 17:08 ` Eli Zaretskii
2017-08-30 15:43 ` Nicolas Richard
2017-09-02 9:59 ` Eli Zaretskii
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=86wp5um6ss.fsf@members.fsf.org \
--to=youngfrog@members.fsf.org \
--cc=27982@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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.