From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69305: outline-minor-mode for tabulated-list-mode Date: Thu, 22 Feb 2024 10:20:44 +0200 Message-ID: <861q94nc4j.fsf@gnu.org> References: <86msrtvi06.fsf@mail.linkov.net> <86frxlmy1d.fsf@gnu.org> <86cyspt02f.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13729"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69305@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 22 10:11:24 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rd56w-0003JG-KB for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Feb 2024 10:11:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rd56M-0000hJ-Nd; Thu, 22 Feb 2024 04:10:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rd56H-0000g0-7g for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2024 04:10:41 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rd56G-0000Fl-J3 for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2024 04:10:40 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rd56d-0008S2-Ar for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2024 04:11:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Feb 2024 09:11:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69305 X-GNU-PR-Package: emacs Original-Received: via spool by 69305-submit@debbugs.gnu.org id=B69305.170859302232359 (code B ref 69305); Thu, 22 Feb 2024 09:11:03 +0000 Original-Received: (at 69305) by debbugs.gnu.org; 22 Feb 2024 09:10:22 +0000 Original-Received: from localhost ([127.0.0.1]:38063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rd55x-0008Ph-TQ for submit@debbugs.gnu.org; Thu, 22 Feb 2024 04:10:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rd4tT-00056L-39 for 69305@debbugs.gnu.org; Thu, 22 Feb 2024 03:57:28 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rd4Jz-0000aQ-So; Thu, 22 Feb 2024 03:20:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=5ARP4J2nWHt1ASVKOMtbmQ8/XCXNGsX0KBCgkBEUvsk=; b=IaZkDqmHsbLD CRACDeyFM14kAXEW6/rtt4kQRRk0gM50RtKCdHylXFGSEKcULSi10Uqp1mIZ3UaFSRWAuV31aQgIk Fpjp7qUXLkhoRQfJL0ynUB3VASI57GOqNQRiiNxtnUsCEHCsEPsoK0gsVdN/quRuaZo8UX+jzz6Xi xUZ46k6xUkiuwyMT/zQr0qDDLpErwcbvIWV2m+9t44J8lI0wloExtiavEe8tnyVroIB4ZUCmcYlYG AdaeZZK4uT02Jiu8E7MBSKELsg3QOPvTjQMOZlotRUUK/kufniPWWV+w88ekw5WT2075GkMsOQoyQ EdkZ5RRkW/gzqIw/z5mT0g==; In-Reply-To: <86cyspt02f.fsf@mail.linkov.net> (message from Juri Linkov on Thu, 22 Feb 2024 09:44:40 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280441 Archived-At: > From: Juri Linkov > Cc: 69305@debbugs.gnu.org > Date: Thu, 22 Feb 2024 09:44:40 +0200 > > > Thanks, but I wonder if we can be a tad more user-friendly? The user > > option exists, and it can accept simple enough data structures for > > customizations, but the default is nil, and there's no example or > > pre-cooked list of ready-to-use values anywhere in sight, not even in > > the doc string. Users will have to work hard to produce a grouping of > > their liking. E.g., suppose I want to group buffers by mode -- how > > would I go about it? Or what about grouping buffers by their leading > > directories -- how can that be done? Etc. etc. -- this could be a > > very powerful feature, but we should make its use easier. And, after > > reading the documentation of tabulated-list-groups and that of > > tabulated-list-entries several times, I have no idea how to specify > > simple groupings such as those described above. Which makes examples > > or pre-cooked values even more important, IMO. > > Ok, then this patch adds two pre-cooked functions as a starting point > for users to understand the principle. Then users will propose > more functions and we will choose the most useful candidates > for including to the set of default functions later. Thanks. > +@defvar tabulated-list-groups > +This buffer-local variable specifies the groups of entries displayed in > +the Tabulated List buffer. Its value should be either a list, or a > +function. > + > +If the value is a list, each list element corresponds to one group, and > +should have the form @w{@code{(@var{group-name} @var{entries})}}, where > +@var{group-name} is a string inserted before all group entries, and > +@var{entries} have the same format as @code{tabulated-list-entries} > +(see above). > + > +Otherwise, the value should be a function which returns a list of the > +above form when called with no arguments. > +@end defvar I think the way to specify ENTRIES for this customization should be described in more detail. Reading the above description, even the idea of using ENTRIES for specifying grouping is unclear, since tabulated-list-entries is basically just a list of column descriptors. > +(defcustom Buffer-menu-group-by nil > + "If non-nil, buffers are grouped by function. > +This function takes one argument: a list of entries in the same format > +as in `tabulated-list-entries', and should return a list in the format > +suitable for `tabulated-list-groups'. Also when this variable is non-nil, > +then `outline-minor-mode' is enabled in the Buffer Menu. Then with the > +default value of `outline-regexp' you can use Outline minor mode commands > +to show/hide groups of buffers. > +The default options can group by a mode, and by a root directory of > +a project or just `default-directory'." > + :type '(choice (const :tag "No grouping" nil) > + (function-item :tag "Group by mode" > + Buffer-menu-group-by-mode) > + (function-item :tag "Group by root" > + Buffer-menu-group-by-root) I think the description text should be "Group by project" or "Group by project root directory" or maybe "Group by project or directory". Just "by root" is too vague. > +If `tabulated-list-groups' is non-nil, each group of entries > +is sorted separately after printing the group header line. The part following "after printing" is IMO more confusing than helpful. What will be lost if you remove it? > +(ert-deftest tabulated-list-groups () > + (with-temp-buffer > + (tabulated-list-mode) > + (setq tabulated-list-groups > + (reverse > + (seq-group-by (lambda (b) (concat "* " (aref (cadr b) 3))) > + tabulated-list--test-entries))) > + (setq tabulated-list-format tabulated-list--test-format) > + (setq tabulated-list-padding 7) > + (tabulated-list-init-header) > + (tabulated-list-print) This seems to test only the function value of tabulated-list-groups? What about the other form of the value?