From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Axel Svensson Newsgroups: gmane.emacs.bugs Subject: bug#35049: 25.1; ibuffer-do-sort-by-filename does not sort all buffers Date: Sat, 30 Mar 2019 16:01:00 +0000 Message-ID: References: <83d0m8if0c.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="133858"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35049@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 30 17:05:48 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAGUJ-000Ybf-Bv for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Mar 2019 17:05:44 +0100 Original-Received: from localhost ([127.0.0.1]:48129 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAGUI-0006gN-By for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Mar 2019 12:05:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAGQx-0003n4-5d for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2019 12:02:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAGQo-0002qB-SO for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2019 12:02:09 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52220) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hAGQk-0002oM-1e for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2019 12:02:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hAGQj-00056V-Sx for bug-gnu-emacs@gnu.org; Sat, 30 Mar 2019 12:02:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Axel Svensson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Mar 2019 16:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35049 X-GNU-PR-Package: emacs Original-Received: via spool by 35049-submit@debbugs.gnu.org id=B35049.155396168019575 (code B ref 35049); Sat, 30 Mar 2019 16:02:01 +0000 Original-Received: (at 35049) by debbugs.gnu.org; 30 Mar 2019 16:01:20 +0000 Original-Received: from localhost ([127.0.0.1]:37531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAGQ4-00055e-1g for submit@debbugs.gnu.org; Sat, 30 Mar 2019 12:01:20 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:52301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAGQ1-00055R-Ui for 35049@debbugs.gnu.org; Sat, 30 Mar 2019 12:01:18 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id ADCC421B4F for <35049@debbugs.gnu.org>; Sat, 30 Mar 2019 12:01:12 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Sat, 30 Mar 2019 12:01:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= axelsvensson.com; h=mime-version:references:in-reply-to:from :date:message-id:subject:to:cc:content-type; s=fm1; bh=/fPwXWEBA bkBfugCpZugM37oQwqP1ucWwrMo/uiGiTk=; b=ZuAEgSVtjO4ANDIt2mJnKSDtz SArxkKEXTA1jo4qdobqhcxLpr+gyT6lWFqylxvt6XbiAswyfqCWOexooNiwKg5YG WFrU7teGST3WawoEH9gyXL4Cf0O3E4v+Bhl3yxMrDh08QMEd+bxJF6yWY8MvrPTw zV0CT5cnDTnpA9DBK7/8nngdmju8dRNl2NbolXGNc7q25QVj0ZBbyd3V4VehkkxA 4Yfgix2f6xu0KYy3D/peiUSpN92CVW+mvecJgExiadOBiUv7O7J6tI/MIKpdKfp8 n3zCznokt0YgZbkPG7QQ3aiVbHVXbPPrG3UK1W7qYpNQFXlIELAOvzsuqfKgw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=/fPwXW EBAbkBfugCpZugM37oQwqP1ucWwrMo/uiGiTk=; b=bGF1XwEL2dssUtW5uMY9db NNWlNsWpLKDKD2jOxX0Vu5y198Bj2R6UI3Wh5YalTk70cwb5Pnk8AJOUm1I7AtK4 KVfQGAdXhENFuud4Eqjy1772KULcSFfchNiEirtPus+tnbGur49BJ/+SKXR57piy /mg4EUTA/l2iSLllGESx64gsGKaoLc2hJh5DRPIH319+NZ3PTuIDt0GgHUXOTVHK DyLsw9uykNOIH83BPodn4v3a+2NVTMbNjeNc0sl5GecMVcxAIJkz5ronUQs7A8mm 6CaPuGN5Q/wBTQ7wppn6fqp7USaEeDjV4R0IuKOKiMfoyA4vIDd3bfZC3corDkhQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrkeelgdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeggfhgjhfffkffuvfgtsehttdertddttdejnecuhfhrohhmpeetgigvlhcuufhv vghnshhsohhnuceomhgrihhlsegrgigvlhhsvhgvnhhsshhonhdrtghomheqnecukfhppe dvtdelrdekhedrudeijedrudektdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrihhl segrgigvlhhsvhgvnhhsshhonhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Original-Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by mail.messagingengine.com (Postfix) with ESMTPA id 37FDAE464B for <35049@debbugs.gnu.org>; Sat, 30 Mar 2019 12:01:12 -0400 (EDT) Original-Received: by mail-oi1-f180.google.com with SMTP id e5so4047518oii.0 for <35049@debbugs.gnu.org>; Sat, 30 Mar 2019 09:01:12 -0700 (PDT) X-Gm-Message-State: APjAAAXLxVFlZweazbR4oYPW4Ui2U6+96XKnFVdE57Grc8sob3YwVTrH zrZX4pM5XEa7yLNWg7Q89wjCo4tteluh9GP3CEI= X-Google-Smtp-Source: APXvYqzb9bhtJolf9or72Q9iRpMFgq43NSa4H6jeb2hEWfntww19drADNNc8kAK5wGUqXcyj9BfmvaLLjokOU+4z0h8= X-Received: by 2002:aca:ed88:: with SMTP id l130mr7106158oih.70.1553961671729; Sat, 30 Mar 2019 09:01:11 -0700 (PDT) In-Reply-To: <83d0m8if0c.fsf@gnu.org> X-Gmail-Original-Message-ID: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156952 Archived-At: On Sat, Mar 30, 2019 at 3:00 PM Eli Zaretskii wrote: > > > From: Axel Svensson > > 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.