From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: z0d Newsgroups: gmane.emacs.help Subject: Re: Sorting buffers with ibuffer Date: Wed, 26 Nov 2008 10:21:39 -0800 (PST) Organization: http://groups.google.com Message-ID: <88ebce16-686d-40c0-a2e3-f16896b8d2ed@f13g2000yqj.googlegroups.com> References: <868f7753-ea47-4f70-9152-ae1a4ee62a6a@r40g2000yqj.googlegroups.com> <80823b7e-19ca-4522-a20a-de9db9cbc3c8@j38g2000yqa.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1227740466 3045 80.91.229.12 (26 Nov 2008 23:01:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Nov 2008 23:01:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 27 00:02:09 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L5TOZ-00040x-Er for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Nov 2008 00:02:07 +0100 Original-Received: from localhost ([127.0.0.1]:49834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L5TNP-0004U7-W7 for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Nov 2008 18:00:56 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!f13g2000yqj.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 86 Original-NNTP-Posting-Host: 94.44.0.153 Original-X-Trace: posting.google.com 1227723700 24499 127.0.0.1 (26 Nov 2008 18:21:40 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 26 Nov 2008 18:21:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f13g2000yqj.googlegroups.com; posting-host=94.44.0.153; posting-account=_VxlBgoAAADZXnZrUdjWInzVVok9gw28 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008111318 Ubuntu/8.10 (intrepid) Firefox/3.0.4, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:164812 X-Mailman-Approved-At: Wed, 26 Nov 2008 18:00:29 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60143 Archived-At: On Nov 26, 11:28=A0am, "Juanma Barranquero" wrote: Thank you for your help. > Package: emacs > Severity: minor > X-Debbugs-CC: j...@gnu.org > > > > On Wed, Nov 26, 2008 at 04:29, z0d wrote: > > shell: emacs -q .emacs .ssh/config .Emacs-lisp/init-lisp.el > > > M-: (setq-default ibuffer-default-sorting-mode 'major-mode) > > M-x ibuffer > > > produces: > > > =A0MR Name =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Size Mode =A0 =A0 =A0= =A0 =A0 =A0 Filename/Process > > =A0-- ---- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0---- ---- =A0 =A0 =A0= =A0 =A0 =A0 ---------------- > > [ Default ] > > =A0 =A0asdf-skeleton.el =A0 =A0 =A0 =A01052 Emacs-Lisp =A0 =A0 =A0 ~/.E= macs-Lisp/asdf- > > skeleton.el > > =A0 =A0config =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 488 Conf[Space] =A0 = =A0 =A0~/.ssh/config > > =A0 =A0.emacs =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 13170 Emacs-Lisp =A0 =A0 = =A0 ~/.emacs > > =A0 =A0*scratch* =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0191 Lisp Interaction > > =A0* =A0*Messages* =A0 =A0 =A0 =A0 =A0 =A0 =A0 142 Fundamental > > =A0% *GNU Emacs* =A0 =A0 =A0 =A0 =A0 =A0 =A0744 Fundamental > > > =A0 =A06 buffers =A0 =A0 =A0 =A0 =A0 =A0 =A015787 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A03 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 examp= le: > > =A0 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 > > =A0 (set (make-local-variable 'ibuffer-sorting-mode) > =A0 =A0 =A0 =A0ibuffer-default-sorting-mode) > =A0 (unless (eq ibuffer-sorting-mode 'recency) > =A0 =A0 (require 'ibuf-ext)) > > Are you OK with one of these changes? > > =A0 Juanma > > Index: lisp/ibuffer.el > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /sources/emacs/emacs/lisp/ibuffer.el,v > retrieving revision 1.110 > diff -u -2 -r1.110 ibuffer.el > --- lisp/ibuffer.el =A0 =A0 8 Oct 2008 05:02:09 -0000 =A0 =A0 =A0 1.110 > +++ lisp/ibuffer.el =A0 =A0 26 Nov 2008 09:56:30 -0000 > @@ -2192,4 +2192,6 @@ > > =A0(defun ibuffer-sort-bufferlist (bmarklist) > + =A0(unless ibuffer-sorting-functions-alist > + =A0 =A0(require 'ibuf-ext)) > =A0 =A0(let* ((sortdat (assq ibuffer-sorting-mode > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ibuffer-sorting-functions= -alist))