[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ELPA] Want to submit two packages "ilist" and "blist"
From: |
Adam Porter |
Subject: |
Re: [ELPA] Want to submit two packages "ilist" and "blist" |
Date: |
Sun, 19 Sep 2021 11:33:01 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Durand <mmemmew@gmail.com> writes:
> I have written two Emacs pacakges, called "ilist" and "blist" (the
> former is the "engine", and hence a dependency, of the latter). Now I
> am thinking about submitting the packages to GNU ELPA.
>
> The package "blist" is to display the list of bookmarks, in the sense of
> "bookmark.el", in a similar way as Ibuffer.
I see in your readme that you mention grouping. Rather than
reimplementing that, you may be interested in what I've done in
taxy.el. For example, it makes it trivial to define a custom grouping
DSL and a custom column-based view using magit-section.el. See the
example "bookmarky" application:
https://github.com/alphapapa/taxy.el/blob/master/examples/bookmarky.el
It ends up looking like this:
https://raw.githubusercontent.com/alphapapa/taxy.el/master/images/bookmarky.png
Grouping keys and display columns are defined with simple top-level
forms, and these keys and columns can be customized by users by using
the same top-level forms in their configs. For example:
(bookmarky-define-key filename (&key name regexp)
"Return NAME if bookmark ITEM's filename matches REGEXP, or without REGEXP,
the filename."
(when-let (filename (bookmark-prop-get item 'filename))
(pcase regexp
(`nil filename)
(_ (when (string-match-p regexp filename)
name)))))
(bookmarky-define-column "File" (:max-width nil :face font-lock-doc-face)
(bookmark-prop-get item 'filename))
Then a grouping "program" written in the DSL looks like:
(defvar bookmarky-default-keys
'(
((handler '(burly-bookmark-handler) :name "Burly"))
((directory "~/src/emacs/" :name "Emacs" :descendant-p t)))
"Default keys.")
Turning the resulting hierarchy into the magit-section-based view is
done with a few functions in a standard way, so there's very little
bespoke code to write.
I'll probably publish taxy-magit-section.el on ELPA as a separate
package after it matures a bit more.