From: Eli Zaretskii <eliz@gnu.org>
To: Leo <sdl.web@gmail.com>
Cc: 12517@debbugs.gnu.org
Subject: bug#12517: 24.2; (file-name-directory "~") returns nil
Date: Wed, 26 Sep 2012 09:24:29 +0200 [thread overview]
Message-ID: <83k3vhgsb6.fsf@gnu.org> (raw)
In-Reply-To: <m1fw65a4v5.fsf@gmail.com>
> From: Leo <sdl.web@gmail.com>
> Date: Wed, 26 Sep 2012 10:35:10 +0800
>
> I was bitten by this corner case that (file-name-directory "~") returns
> nil.
As does (file-name-directory "a").
> I wonder if this is a bug/oversight?
I think it is neither. file-name-directory works on the syntax of its
argument, not on its semantics. The ELisp manual says:
-- Function: file-name-directory filename
This function returns the directory part of FILENAME, as a
directory name (*note Directory Names::), or `nil' if FILENAME
does not include a directory part.
"FILENAME does not include a directory part" means literally that: the
string FILENAME must _include_ a directory part for
file-name-directory to return a non-nil result.
If you want the directory of its argument, even if the argument is
given as any kind of shorthand, run that argument through
expand-file-name first.
next prev parent reply other threads:[~2012-09-26 7:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 2:35 bug#12517: 24.2; (file-name-directory "~") returns nil Leo
2012-09-26 7:14 ` Andreas Schwab
2012-09-26 13:05 ` Stefan Monnier
2012-09-26 7:24 ` Eli Zaretskii [this message]
2012-09-26 16:26 ` Leo
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=83k3vhgsb6.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=12517@debbugs.gnu.org \
--cc=sdl.web@gmail.com \
/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.