From: Drew Adams <drew.adams@oracle.com>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: 27801@debbugs.gnu.org
Subject: bug#27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons
Date: Sun, 23 Jul 2017 22:05:47 -0700 (PDT) [thread overview]
Message-ID: <9bf9cd47-8075-4e66-a9b1-d1aa6518e5a7@default> (raw)
In-Reply-To: <alpine.DEB.2.20.1707241304410.28309@calancha-pc>
> >> ;; Following form shows the full file name in the Dired buffer.
> >> (let* ((dir source-directory)
> >> (file1 (expand-file-name "lisp/subr.el" dir))
> >> (file2 (expand-file-name "src/data.c" dir)))
> >> (dired (list dir file1 file2)))
> >>
> >> ;; Usually, Dired just shows the relative file name to
> >> ;; 'default-directory'. That is more clear, specially for
> >> ;; long file names.
> >
> > Sorry, but I've only read this bug report quickly - no time
> > now. If you are suggesting that when DIR-OR-LIST is a cons
> > the file names shown should be relative then I think I
> > disagree strongly.
> >
> > The typical use case for a cons DIR-OR-LIST is a list
> > of files from anywhere, in which case absolute file
> > names are appropriate.
>
> I am OK with adding a new variable `foo' so that i can get
> this behavior if i locally bind `foo' to a non-nil value.
I don't see why you need that.
> This idea comes while i am trying to implement Bug#27631; to
> have this feature working with 'ls-lisp' my implementation
> do something like:
>
> 1) Collect all matches with `find-lisp' in a variable FILES.
(What is `find-lisp'? I don't see it in Emacs 25.2 or earlier.
But I see 4 functions whose names start with `find-lisp-'.)
> (This is just a first approach to the problem; for large
> number of matches would be better to not store the matches
> in a list).
>
> 2) [Suppose DIR is the default-directory i the Dired buffer]
> Then call: (dired (list DIR FILES))
>
> My implementation works as with GNU ls; the only difference is
> that 2) shows full file names in the Dired buffer. I rather
> prefer is the output has same format regarless on if the user
> use `ls-lisp' or not.
>
> With the var `foo' mentioned above, we could change 2) with:
> 3) (let ((foo t)) (dired (list DIR FILES)))
Again, sorry, but I don't really have time to look into this
now. Two quick comments though, which might be misguided:
1. IIUC, bug #27631 is not a bug. It is an enhancement request,
for a new feature. That's not a reason to change a longstanding,
essentially unrelated, behavior that is very general and very
useful.
2. If you call (dired (list DIR FILES)) and you want FILES
to be relative rather than absolute, why can't you just
(for your particular use case) use something like
(dired (list DIR (mapcar #'dired-make-relative FILES)))?
What am I missing?
Possibly you would want to pass DIR or some other directory to
`dired-make-relative' ; dunno. Or maybe `file-relative-name'
would be more appropriate for your use case; dunno.
I don't understand why you would propose changing `dired'
so that a cons argument is interpreted in some new, more
restrictive way.
I say "more restrictive" because currently you can get
absolute or relative file names, just by passing the
forms of names that you want. You can even get a mix
of absolute and relative names - that's sometimes handy.
Dired should be able to list file names in either or
both forms. I see no reason that it shouldn't.
I don't see why you would need to add a variable, as
you describe, instead of just passing the file names
you want in the form(s) that you want. But I'm probably
missing something in what you're suggesting.
next prev parent reply other threads:[~2017-07-24 5:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-24 3:29 bug#27801: 26.0.50; Dired: Use relative file names when DIR-OR-LIST is a cons Tino Calancha
2017-07-24 3:47 ` Drew Adams
2017-07-24 4:16 ` Tino Calancha
2017-07-24 5:05 ` Drew Adams [this message]
2017-07-24 5:37 ` Tino Calancha
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=9bf9cd47-8075-4e66-a9b1-d1aa6518e5a7@default \
--to=drew.adams@oracle.com \
--cc=27801@debbugs.gnu.org \
--cc=tino.calancha@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.