GNU bug report logs - #6273
dired-current-directory with `t' arg returns empty string in top-level mount-point "/"

Previous Next

Package: emacs;

Reported by: MON KEY <monkey <at> sandpframing.com>

Date: Tue, 25 May 2010 21:19:02 UTC

Severity: minor

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6273 in the body.
You can then email your comments to 6273 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6273; Package emacs. (Tue, 25 May 2010 21:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to MON KEY <monkey <at> sandpframing.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 25 May 2010 21:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: MON KEY <monkey <at> sandpframing.com>
To: bug-gnu-emacs <at> gnu.org
Subject: dired-current-directory with `t' arg returns empty string in 
	top-level mount-point "/"
Date: Tue, 25 May 2010 17:18:40 -0400
(dired-current-directory t) returns the empty string
when in a `top-level' mount point, e.g. "/"

(progn
  (dired "/" )
  (dired-current-directory t))
 => ""

,---- (documentation 'dired-current-directory)
| {...}
| This returns a string with trailing slash, like `default-directory'.
| Optional argument means return a file name relative to `default-directory'.
`----

In the case at hand it does not return a string with trailing slash...
and appears in contrast to the return value of following forms:

(progn
  (dired "/")
  (file-relative-name default-directory))
 => "./"

(progn
  (dired "/")
  (file-relative-name (dired-default-directory)))
 => "./"

which are likewise at odds with each of the following:

(progn
  (dired "/")
  (dired-make-relative (dired-default-directory)))
  => ""

(progn
  (dired "/")
  (dired-make-relative (dired-make-absolute default-directory)))
 => "/"

So which is the correct return value? Relatively speaking...

GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-05-10

--
/s_P\




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6273; Package emacs. (Wed, 06 Jan 2016 12:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 6273 <at> debbugs.gnu.org (full text, mbox):

From: Alexis <flexibeast <at> gmail.com>
To: MON KEY <monkey <at> sandpframing.com>
Cc: 6273 <at> debbugs.gnu.org
Subject: Re: bug#6273: dired-current-directory with `t' arg returns empty
 string in top-level mount-point "/"
Date: Wed, 06 Jan 2016 23:48:09 +1100
Since the documentation for `dired-current-directory' states:

"Optional argument means return a file name relative to
`default-directory'"

and there is no file name to return in the case that
`dired-current-directory' and `default-directory' are the same,
an empty string seems to be a reasonable return value here.

More generally, regarding the various values returned in each of the
examples provided, my feeling is that unless Emacs contains code in
which these various return values directly interact with each other to
produce obviously incorrect results, this bug should either be closed or
tagged 'wishlist'.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Fri, 08 Jan 2016 10:45:02 GMT) Full text and rfc822 format available.

Notification sent to MON KEY <monkey <at> sandpframing.com>:
bug acknowledged by developer. (Fri, 08 Jan 2016 10:45:02 GMT) Full text and rfc822 format available.

Message #13 received at 6273-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alexis <flexibeast <at> gmail.com>
Cc: 6273-done <at> debbugs.gnu.org, monkey <at> sandpframing.com
Subject: Re: bug#6273: dired-current-directory with `t' arg returns empty
 string in top-level mount-point "/"
Date: Fri, 08 Jan 2016 12:43:50 +0200
> From: Alexis <flexibeast <at> gmail.com>
> Date: Wed, 06 Jan 2016 23:48:09 +1100
> Cc: 6273 <at> debbugs.gnu.org
> 
> Since the documentation for `dired-current-directory' states:
> 
> "Optional argument means return a file name relative to
> `default-directory'"
> 
> and there is no file name to return in the case that
> `dired-current-directory' and `default-directory' are the same,
> an empty string seems to be a reasonable return value here.

Actually, the value returned by dired-current-directory is always an
empty string of default-directory is the same one as the directory
where the file on the current line lives.  IOW, the issue is not
limited to "/" as the current directory of the Dired buffer.

I think this is just something that needs to be clarified in the doc
string, so I just pushed such a change, and I'm marking this bug done.

Thanks for looking into it.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 05 Feb 2016 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 134 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.