all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: Juri Linkov <juri@linkov.net>
Cc: 69305@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
	Ihor Radchenko <yantar92@posteo.net>
Subject: bug#69305: outline-minor-mode for tabulated-list-mode
Date: Sun, 25 Feb 2024 21:31:37 -0600	[thread overview]
Message-ID: <0bba7ff4-2dac-4f30-b68d-409f1078d069@alphapapa.net> (raw)
In-Reply-To: <86msrov3bl.fsf@mail.linkov.net>

[-- Attachment #1: Type: text/plain, Size: 2010 bytes --]

Hi Juri,

On 2/25/24 11:36, Juri Linkov wrote:
>> So if you were to use one of these as inspiration (or as a library
>> directly), I'd strongly recommend using `taxy', as that's what it's
>> designed for.
>> [...]
>> Let me know if I can help facilitate a solution using it, or help anyone
>> work with the API.
> 
> Thanks for proposing help, but for inspiration I'm using
> my own package https://github.com/link0ff/emacs-ee
> It's much more powerful than anything I have seen so far.
> But on the other hand, it became so unmanageable
> that I semi-abandoned it due to its overly complexity.

Taxy might be able to help with that, because it's designed to simply 
abstract the matter of classifying data into hierarchies.  It's only 381 
lines of code, which includes macros that allow applications to define 
their own, user-extensible grouping languages with top-level forms.

UI frontends to render the data structures are separated from the 
concern of grouping.  A simple "pretty print" one is provided, but the 
main implementation so far is the associated library, taxy-magit-section.

> Is your package more light-weight than mine?  I doubt it ;-)

Well, judge for yourself.  :)  Attached is a file that provides a simple 
buffer-grouping command based on Taxy.  It's what I would call a "level 
one" implementation, without defining a DSL or user-customizeable 
grouping.  Adding those features would only take a few more lines of 
code, but I'm keeping this example as simple as possible.  This only 
takes 41 lines of code.  It produces a view as seen in the attached 
screenshot.  And it only took about 5 minutes to write by modifying a 
similar example that works on another kind of object.

Anyway, I'm not necessarily pushing a solution here, only trying to 
share what's available.  I did spend a lot of time on this project, and 
IMHO it solves the problem elegantly and powerfully, so I would like to 
see it applied more widely, but things included with Emacs itself are 
another matter.

[-- Attachment #2: buffery.el --]
[-- Type: text/x-emacs-lisp, Size: 2305 bytes --]

;;; buffery.el --- Buffer view with Taxy grouping    -*- lexical-binding: t; -*-

;; Keywords: 

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; 

;;; Code:

(require 'cl-lib)
(require 'project)
(require 'taxy)
(require 'taxy-magit-section)

(defvar buffery-taxy
  (cl-labels ((directory (buffer)
                (buffer-local-value 'default-directory buffer))
              (mode (buffer)
                (prin1-to-string (buffer-local-value 'major-mode buffer)))
              (project (buffer)
                (with-current-buffer buffer
                  (when-let ((project (project-current)))
                    (project-root project))))
              (specialp (buffer)
                (when (not (buffer-file-name buffer))
                  "*special*"))
              (make-fn (&rest args)
                (apply #'make-taxy-magit-section
                       :make #'make-fn
                       :format-fn #'buffer-name
                       args)))
    (make-fn
     :name "Buffers"
     :take (apply-partially #'taxy-take-keyed
                            (list (list #'project)
                                  (list #'specialp)
                                  #'directory #'mode)))))

(defun buffery ()
  (interactive)
  (let* ((buffers (buffer-list))
         (buffer (get-buffer-create "*Buffery*"))
         (inhibit-read-only t))
    (with-current-buffer buffer
      (erase-buffer)
      (thread-last buffery-taxy
                   taxy-emptied
                   (taxy-fill buffers)
                   (taxy-sort* #'string< #'taxy-name)
                   taxy-magit-section-insert))
    (pop-to-buffer buffer)))

(provide 'buffery)
;;; buffery.el ends here

[-- Attachment #3: example.png --]
[-- Type: image/png, Size: 63425 bytes --]

  reply	other threads:[~2024-02-26  3:31 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 17:34 bug#69305: outline-minor-mode for tabulated-list-mode Juri Linkov
2024-02-21 19:12 ` Eli Zaretskii
2024-02-22  7:44   ` Juri Linkov
2024-02-22  8:20     ` Eli Zaretskii
2024-02-22 17:30       ` Juri Linkov
2024-02-22 19:10         ` Eli Zaretskii
2024-02-23  7:09           ` Juri Linkov
2024-02-23  8:13             ` Eli Zaretskii
2024-02-24 17:43               ` Juri Linkov
2024-02-24 18:09                 ` Eli Zaretskii
2024-02-24 18:13                 ` Eli Zaretskii
2024-02-25  8:00                   ` Adam Porter
2024-02-25 17:25                   ` Juri Linkov
2024-02-25 19:17                     ` Eli Zaretskii
2024-02-27  7:30                       ` Juri Linkov
2024-02-27  8:31                         ` Eli Zaretskii
2024-02-27 17:40                           ` Juri Linkov
2024-02-27 18:44                             ` Eli Zaretskii
2024-02-28  7:36                               ` Juri Linkov
2024-02-28 12:16                                 ` Eli Zaretskii
2024-02-29  7:45                                   ` Juri Linkov
2024-02-29 16:33                                     ` Eli Zaretskii
2024-02-29 17:50                                       ` Juri Linkov
2024-03-03  6:53                                         ` Jean Louis
2024-03-03  7:52                                           ` Juri Linkov
2024-02-24 18:06     ` Ihor Radchenko
2024-02-24 18:16       ` Eli Zaretskii
2024-02-24 18:36         ` Ihor Radchenko
2024-02-24 18:49           ` Eli Zaretskii
2024-02-25  7:45             ` Adam Porter
2024-02-25 17:36               ` Juri Linkov
2024-02-26  3:31                 ` Adam Porter [this message]
2024-03-06 17:37                   ` Juri Linkov
2024-03-08 23:13                     ` Adam Porter
2024-02-25  7:53             ` Adam Porter
2024-02-25  8:26               ` Eli Zaretskii
2024-02-25 17:20       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0bba7ff4-2dac-4f30-b68d-409f1078d069@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=69305@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.