all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#6273: dired-current-directory with `t' arg returns empty string in top-level mount-point "/"
@ 2010-05-25 21:18 MON KEY
  2016-01-06 12:48 ` Alexis
  0 siblings, 1 reply; 3+ messages in thread
From: MON KEY @ 2010-05-25 21:18 UTC (permalink / raw)
  To: 6273

(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\





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#6273: dired-current-directory with `t' arg returns empty string in top-level mount-point "/"
  2010-05-25 21:18 bug#6273: dired-current-directory with `t' arg returns empty string in top-level mount-point "/" MON KEY
@ 2016-01-06 12:48 ` Alexis
  2016-01-08 10:43   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Alexis @ 2016-01-06 12:48 UTC (permalink / raw)
  To: MON KEY; +Cc: 6273


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'.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#6273: dired-current-directory with `t' arg returns empty string in top-level mount-point "/"
  2016-01-06 12:48 ` Alexis
@ 2016-01-08 10:43   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2016-01-08 10:43 UTC (permalink / raw)
  To: Alexis; +Cc: 6273-done, monkey

> From: Alexis <flexibeast@gmail.com>
> Date: Wed, 06 Jan 2016 23:48:09 +1100
> Cc: 6273@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.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-08 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 21:18 bug#6273: dired-current-directory with `t' arg returns empty string in top-level mount-point "/" MON KEY
2016-01-06 12:48 ` Alexis
2016-01-08 10:43   ` Eli Zaretskii

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.