From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.help Subject: Re: Sorting buffers with ibuffer Date: Wed, 26 Nov 2008 11:28:39 +0100 Message-ID: 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=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1227695493 6421 80.91.229.12 (26 Nov 2008 10:31:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Nov 2008 10:31:33 +0000 (UTC) Cc: quiet@emacsbugs.donarmstrong.com, help-gnu-emacs@gnu.org To: z0d Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 26 11:32:35 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 1L5Hh3-0008U3-S5 for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Nov 2008 11:32:27 +0100 Original-Received: from localhost ([127.0.0.1]:48161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L5Hft-0005yZ-QD for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Nov 2008 05:31:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L5HdT-0004w5-2W for help-gnu-emacs@gnu.org; Wed, 26 Nov 2008 05:28:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L5HdR-0004uy-Dk for help-gnu-emacs@gnu.org; Wed, 26 Nov 2008 05:28:41 -0500 Original-Received: from [199.232.76.173] (port=60794 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L5HdQ-0004um-Vm for help-gnu-emacs@gnu.org; Wed, 26 Nov 2008 05:28:41 -0500 Original-Received: from yw-out-1718.google.com ([74.125.46.156]:6864) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L5HdQ-0005q9-HB for help-gnu-emacs@gnu.org; Wed, 26 Nov 2008 05:28:40 -0500 Original-Received: by yw-out-1718.google.com with SMTP id 9so195523ywk.66 for ; Wed, 26 Nov 2008 02:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=wojRoekgpgq6PX7x43C0Is9Piyj9Viu3reGEWFMlOWo=; b=UzADARILz8LN2c+JB5RHAT4NZuH9x5mrJCWRp9rIqnuKiKVG8ixQrOQ+rV1asQKIUH 4i6ck5MTDm1zxostxTQbQdxAF6sGV3RnTEf4JEBVfyfVtq+neNcVw3FOOgrh5qllixmJ 9i+6Mj8oG3AG5fGiD0hgzbw+ZfZH53zciZmT4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=tWOjE7hSzZhBYmKBot/dk6cqMkTYh9v0meESNZqFUj30Xh9xeGa2S99rsFJd5dJemE hwrjYdzRYS2m+6CEScj5ejDPvYjmGMBcmR1JDprBYrlX8E5RPpKGGE/tDgeGq74zSaJB 2irA+HtdBd78z8pCrWTBw+OORAdzMOpxUgr8c= Original-Received: by 10.100.216.12 with SMTP id o12mr2926483ang.92.1227695319614; Wed, 26 Nov 2008 02:28:39 -0800 (PST) Original-Received: by 10.100.13.13 with HTTP; Wed, 26 Nov 2008 02:28:39 -0800 (PST) In-Reply-To: Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:60123 Archived-At: Package: emacs Severity: minor X-Debbugs-CC: jpw@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: > > 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))