GNU bug report logs - #1432
Sorting buffers with ibuffer

Previous Next

Package: emacs;

Reported by: "Juanma Barranquero" <lekktu <at> gmail.com>

Date: Wed, 26 Nov 2008 10:35:03 UTC

Severity: minor

Done: "Juanma Barranquero" <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1432 in the body.
You can then email your comments to 1432 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to jpw <at> gnu.org:
bug#1432; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
New bug report received and filed, but not forwarded. Copy sent to jpw <at> gnu.org. Full text and rfc822 format available.

Message #5 received at quiet <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: z0d <peter.barabas <at> gmail.com>
Cc: help-gnu-emacs <at> gnu.org, quiet <at> debbugs.gnu.org
Subject: Re: Sorting buffers with ibuffer
Date: Wed, 26 Nov 2008 11:28:39 +0100
Package: emacs
Severity: minor
X-Debbugs-CC: jpw <at> gnu.org


On Wed, Nov 26, 2008 at 04:29, z0d <peter.barabas <at> gmail.com> wrote:

> shell: emacs -q .emacs .ssh/config .Emacs-lisp/init-lisp.el
>
> M-: (setq-default ibuffer-default-sorting-mode 'major-mode) <RET>
> M-x ibuffer <RET>
>
> produces:
>
>  MR Name                    Size Mode             Filename/Process
>  -- ----                    ---- ----             ----------------
> [ Default ]
>    asdf-skeleton.el        1052 Emacs-Lisp       ~/.Emacs-Lisp/asdf-
> skeleton.el
>    config                   488 Conf[Space]      ~/.ssh/config
>    .emacs                 13170 Emacs-Lisp       ~/.emacs
>    *scratch*                191 Lisp Interaction
>  *  *Messages*               142 Fundamental
>  % *GNU Emacs*              744 Fundamental
>
>    6 buffers              15787                  3 files, no
> processes

You're right.

What's happening is that, in fact, ibuffer is not sorting at all,
because there's a variable ibuffer-sorting-functions-alist that is
null at that point. That variable is initialized by code in
ibuf-ext.el; defaulting to 'recency works because that sorting order
is special-cased in ibuffer.el.

You can workaround the issue by making sure ibuf-ext is loaded, for example:

  emacs -q -l ibuf-ext .emacs .ssh/config .Emacs-lisp/init-lisp.el

but I think ibuffer should take care that the sorting functions' alist
is properly stuffed.


John, I've considered the attached patch, which checks in
ibuffer-sort-bufferlist. The alternative I see is to require 'ibuf-ext
in `ibuffer-mode' if the user modified `ibuffer-default-sorting-mode',
like

  (set (make-local-variable 'ibuffer-sorting-mode)
       ibuffer-default-sorting-mode)
  (unless (eq ibuffer-sorting-mode 'recency)
    (require 'ibuf-ext))

Are you OK with one of these changes?

  Juanma




Index: lisp/ibuffer.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/ibuffer.el,v
retrieving revision 1.110
diff -u -2 -r1.110 ibuffer.el
--- lisp/ibuffer.el	8 Oct 2008 05:02:09 -0000	1.110
+++ lisp/ibuffer.el	26 Nov 2008 09:56:30 -0000
@@ -2192,4 +2192,6 @@

 (defun ibuffer-sort-bufferlist (bmarklist)
+  (unless ibuffer-sorting-functions-alist
+    (require 'ibuf-ext))
   (let* ((sortdat (assq ibuffer-sorting-mode
 			ibuffer-sorting-functions-alist))




Reply sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #10 received at 1432-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: 1432-done <at> debbugs.gnu.org
Date: Fri, 5 Dec 2008 01:03:07 +0100
Fixed.

http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ibuffer.el?cvsroot=emacs&r1=1.110&r2=1.111




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Fri, 02 Jan 2009 15:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 233 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.