bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35049: 25.1; ibuffer-do-sort-by-filename does not sort all buffers


From: Axel Svensson
Subject: bug#35049: 25.1; ibuffer-do-sort-by-filename does not sort all buffers
Date: Sat, 30 Mar 2019 16:01:00 +0000

On Sat, Mar 30, 2019 at 3:00 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Axel Svensson <mail@axelsvensson.com>
> > Date: Sat, 30 Mar 2019 13:36:08 +0000
> >
> > To reproduce:
> >  1) In a shell, run: mkdir ~/dir-a ~/dir-b ~/dir-c
> >  2) In a shell, run: touch ~/dir-a/filea1 ~/dir-c/filec1 ~/dir-c/filc2
> >  3) find-file ~/a and enter 20 characters in this buffer.
> >  4) find-file ~/c and enter 30 characters in this buffer.
> >  5) find-file ~/b and enter 10 characters in this buffer.
> >  6) find-file ~/dir-a
> >  7) find-file ~/dir-c
> >  8) find-file ~/dir-b
> >  9) M-x ibuffer. You should see three Fundamental buffers named a, b,
> >     and c, as well as three "Dired by name" buffers named dir-a, dir-b
> >     and dir-c.
> > 10) Press s s
> > 11) The modeline says "IBuffer by size", and the buffers are ordered by
> >     size, i.e. b,a,c,dir-b,dir-a,dir-c.
> > 12) Press s f
> > 13) The modeline says "IBuffer by filename/process", but not all the
> >     buffers are ordered. The Fundamental buffers are ordered a,b,c
> >     correctly, but the Dired buffers are ordered dir-b,dir-a,dir-c as
> >     before pressing s f.
>
> Dired buffers have the buffer-file-name as nil, which is why their
> order is not changed by "s f".

Thank you, that is a good explanation as to how the current behaviour
came about. I suppose this then becomes a feature request to change the
sorting behaviour to take dired directory into account. Motivation:
A) After pressing s f, the modeline reads "IBuffer by filename/process",
   which the user will undoubtedly interpret as a reference to the
   "Filename/Process" column.
B) The column named Filename/Process is defined in terms of
   ibuffer-buffer-file-name which handles dired buffers as a special
   case, see definition below:
     (defun ibuffer-buffer-file-name ()
       (cond
        ((buffer-file-name))
        ((bound-and-true-p list-buffers-directory))
        ((let ((dirname (and (boundp 'dired-directory)
                             (if (stringp dired-directory)
                                 dired-directory
                               (car dired-directory)))))
             (and dirname (expand-file-name dirname))))))
C) Beyond concerns of consistency and expectation, taking dired
   directories into account when sorting would be quite useful.
   Directories would appear adjacent to files contained within them and
   sorting would depend less on the previous ordering.
D) I would expect this change to be unlikely to break any existent
   workflow.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]