Subject: bug#20739: 25.0.50; Dired switches have no effect when explicit list of files provided

From: Drew Adams <[email-masked]>
Date: Sun, 7 Jun 2015 18:58:42 -0700 (PDT)

> > > Not in my Emacs, built from the latest development sources.
> >
> > Interesting.  I definitely see the list reversed correctly, even
> > in this very recent build:
> >
> > In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
> >  of 2015-05-29 on LEG570
> 
> I tried on 3 different systems, one of them GNU/Linux -- none of
> them exhibits the behavior you describe.

You can try the same build I used, by downloading it from Dani's site:
http://sourceforge.net/projects/emacs-bin/.  That will take about 3
minutes altogether.  Or you can take my word for it.  The example I
gave, and any number like it, are reproducible:

(dired ("foo" "/path/to/bbbbb" "/path/to/foo.el" "/path/to/bar.el")
       "-alFr")

(You can use just "-r" as well.)

> > > Why do you think that what is controlled by the ls-lisp.el
> > > code has nothing to do with this bug report?
>
> 'dired' on MS-Windows _calls_ functions in ls-lisp.el, but is not
> implemented there.

No one said the ls-lisp.el implements Dired entirely.  It is,
however, mostly responsible for the Dired listing that is produced.
And that is the question here - what listing gets produced.

> And the behavior you described, which handles
> the case of a list as the 1st arg, is not implemented in ls-lisp.el,
> it is implemented in subroutines of 'dired' defined on dired.el.

I don't agree.  When DIRNAME is a cons, `dired-insert-directory' is
called with the buffer name as 1st arg, the switches as 2nd arg,
and the list of files to be listed as the 3rd arg.  That passes each
of the files in the list, in turn, to `insert-directory', which
passes each of them to `ls-lisp-insert-directory'.

It is very much `ls-lisp-insert-directory' which is involved in
the behavior we are discussing.  It is that function that handles
switch -B in the bugged way I reported.  And it is that function
that inserts the file and dir lines in the Dired buffer, correctly
or not.

Furthermore, in the case of a cons DIRNAME, `ls-lisp-insert-directory'
is passed nil as its FULL-DIRECTORY-P arg, even for a directory in
the list.  (When DIRNAME is a directory, `t' is passed as arg
FULL-DIRECTORY-P, and the behavior and code path is quite different.)

In sum, `ls-lisp-insert-directory' handles the listing of the
individual files & dirs contained in the cons DIRNAME arg to `dired'.
 
> Now, can we please stop splitting hair?

Who's splitting hairs, Eli?  You seem to want to say that the
bug is fixed because you have stated in the doc (admittedly I
have not seen the actual text) that switches that involve sort
order have no effect when DIRNAME is a cons.  Or perhaps you
said something less committal, such as that some switches are
not supported.

My point is that the bug is about fixing the *behavior*, not just
copping out in the doc.  Most switches can be made to DTRT when
DIRNAME is a cons.  And switch -B for ls-lisp can at least be
fixed in the way I indicated, to prevent a wrong-type-arg error.

The bug subject line, and my detailed description of the bug,
are about the fact that "Dired switches have no effect" when
DIRNAME is a cons.  It is not that the doc for this use case
is incorrect or insufficient.  It's great to improve the doc
also, but that doesn't fix the problem I reported.  That's all.
That's not splitting hairs, in my book.