Subject: bug#52384: [External] : bug#52384: 26.3; dired buffer navigation tweak

From: Arthur Miller <[email-masked]>
Date: Sun, 12 Dec 2021 20:15:44 +0100

Juri Linkov <[email-masked]> writes:

>>> >> > (The Dired+ versions of these commands wrap
>>> >> > around, if option `diredp-wrap-around-flag'
>>> >> > has its default value of `t'.)
>>> >>
>>> >> Yet another feature I had already implemented
>>> >> since Emacs 21.1 and sent to you for review in 2007.
>>> >
>>> > Interesting.  Or is that tongue in cheek?
>>> >
>>> > I just searched all messages I've received from
>>> > you, including those in 2007, from mailing lists
>>> > and direct mails, and I don't find any such
>>> > suggestion or review request.  Could you point
>>> > to it - I'm curious.  I expect that if that were
>>> > the case I would most likely have added it to
>>> > Dired+ long before I did (which was not until
>>> > July 12, 2013).
>>> 
>>> I don't remember exactly, but the closest is in the
>>> thread "TAB for non-editing modes" on emacs-devel
>>> with the discussion about using TAB in dired
>>> to move between directories.  When TAB/S-TAB will go
>>> to the next/previous directory, then `<' and `>'
>>> will be free to use for going to the first/last file.
>>
>> This is that thread:
>>
>> https://lists.gnu.org/archive/html/emacs-devel/2007-09/msg01976.html
>>
>> I see nothing there that resembles anything like an 
>> implementation of wraparound navigation for Dired,
>> let alone a request by you to review that.  I don't
>> even find any suggestion that such wraparound be
>> added to Dired.  I see nothing even vaguely related
>> to a suggestion about wraparound navigation.
>>
>> Checking your and my posts (and others) in that
>> thread, I find nothing about any of this.  Could
>> you point to the message(s) you're referring to?
>> A URL would be good.
>
> Strange, I have a message in the archive from 24 Sep,
> but it doesn't exist on the thread that you posted.
>
>> More importantly, `<' and `>' going to the first
>> and last file, respectively, has nothing to do with
>> wraparound.  So if that's what you suggested or
>> implemented, it's something else entirely.
>
> I suggested to use TAB that goes to the next file
> and wraps around at boundaries.  Then '>' could be
> reused to go to the last file.
>
>>> >> But I don't use it too much because it's not
>>> >> so useful with --group-directories-first
>>> >> that really should be the default.
>>> >
>>> > I have that as default for my own use.  But I
>>> > often change sort orders, especially for date.
>>> 
>>> When you change sort orders, directories still
>>> remain at the top?  So first are directories
>>> sorted by date, then below files sorted by date?
>>
>> For my own use, I use non-nil `ls-lisp-dirs-first',
>> so directories remain listed first.  (But I use
>> `emacs -Q` for some testing and some bug filing.)
>>
>> When `ls-lisp-dirs-first' is non-nil, dirs are
>> listed first.  And yes, their order changes when
>> sorting is by date vs name, or some other order.
>> But as a group, yes, they remain listed first,
>> before ordinary files, within any given dir
>> listing.
>>
>> The point is that it can be useful to sometimes
>> see some or all dir lines interspersed with
>> ordinary-file lines.
>>
>> Again, a classic example is when subdir listings
>> are inserted: Directory lines in those listings
>> are separated from those of the main listing and
>> from those of other subdir listings.  `>' and
>> `<' let you move among consecutive dir lines
>> throughout the buffer.
>>
>> `<' and `>' have their own raisons d'etre.  They
>> are not the same as `p' and `n'.  (And yes, it
>> makes sense for both >/< and n/p to optionally
>> wrap around.)
>
> Maybe then like there is a user option `ls-lisp-dirs-first'
> for ls-lisp.el, a similar option should be added to dired as well,
> so users won't need to manually add "--group-directories-first"
> to `dired-listing-switches'.  Do you agree?

After I posted my comment to Drew, I realized later, that
'--group-directories-first' does not exist in all 'ls' implementations. Bsd ls
does not seem to have it, correct me if I am wrong, so I am not sure it can be a
default for Emacs. Unless Emacs defaults to ls-lisp.el on all platforms but
gnu/Linux?