[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/taxy 6bac820 2/4: Example: Add taxy-package-report
From: |
ELPA Syncer |
Subject: |
[elpa] externals/taxy 6bac820 2/4: Example: Add taxy-package-report |
Date: |
Mon, 6 Sep 2021 11:57:20 -0400 (EDT) |
branch: externals/taxy
commit 6bac82080a9bc2f4e1abf88e93ae2628ed59baf2
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Example: Add taxy-package-report
---
README.org | 1 +
examples/taxy-package-report.el | 53 +++++++++++++++++++++++++++++++++++++++++
taxy.info | 29 +++++++++++-----------
3 files changed, 69 insertions(+), 14 deletions(-)
diff --git a/README.org b/README.org
index ee5c594..823a6a7 100644
--- a/README.org
+++ b/README.org
@@ -782,6 +782,7 @@ Note that while =taxy-magit-section.el= is installed with
the =taxy= package, th
- ~:initial-depth~ sets the level at which the first level of hierarchy
is considered to be at, for purposes of indentation. Setting it to a negative
number prevents indentation of so many levels (i.e. setting it to -1 causes the
first two levels to be unindented, since the first level will be considered to
be at depth -1, and the second at depth 0).
- ~:blank-between-depth~ sets the level up to which blank lines are
inserted between sections (i.e. setting it to 1 causes blank lines to be
inserted between sections up to depth 1, but not between sections deeper than
that).
+ Struct ~taxy-magit-section~ has a new ~heading-face~ slot, a function which
takes a depth level argument and returns the face with which to propertize that
section's heading.
++ New example ~taxy-package-report~.
*** Fixes
diff --git a/examples/taxy-package-report.el b/examples/taxy-package-report.el
new file mode 100644
index 0000000..5c251ce
--- /dev/null
+++ b/examples/taxy-package-report.el
@@ -0,0 +1,53 @@
+;; taxy-package-report.el -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Adam Porter <adam@alphapapa.net>
+;; Maintainer: Adam Porter <adam@alphapapa.net>n
+
+;; 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:
+
+;; Inspired by Manuel Uberti's blog post:
+;; <https://www.manueluberti.eu//emacs/2021/09/01/package-report/>.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'package)
+
+(require 'taxy-magit-section)
+
+(defun taxy-package-report ()
+ "List installed packages by archive in a `magit-section' buffer."
+ (interactive)
+ (cl-labels ((package-archive
+ (package) (if-let* ((package-struct (car (alist-get (car
package) package-archive-contents)))
+ (archive (package-desc-archive
package-struct)))
+ archive
+ "no archive"))
+ (format-package
+ (package) (symbol-name (car package))))
+ (let ((taxy (make-taxy-magit-section
+ :name "Packages by archive"
+ :take (lambda (item taxy)
+ (taxy-take-keyed (list #'package-archive) item taxy))
+ :make (lambda (&rest args)
+ (apply #'make-taxy-magit-section :format-fn
#'format-package :indent 0 args))
+ :format-fn #'format-package
+ :indent 0)))
+ (taxy-magit-section-pp (taxy-fill package-alist taxy)))))
+
+;;; taxy-package-report.el ends here
diff --git a/taxy.info b/taxy.info
index c45a432..e757955 100644
--- a/taxy.info
+++ b/taxy.info
@@ -945,6 +945,7 @@ File: README.info, Node: Additions, Next: Fixes, Up:
05-pre
• Struct ‘taxy-magit-section’ has a new ‘heading-face’ slot, a
function which takes a depth level argument and returns the face
with which to propertize that section’s heading.
+ • New example ‘taxy-package-report’.
File: README.info, Node: Fixes, Prev: Additions, Up: 05-pre
@@ -1119,20 +1120,20 @@ Node: Magit section32726
Node: Changelog33384
Node: 05-pre33570
Node: Additions33692
-Node: Fixes34752
-Node: 0434906
-Node: 0335132
-Node: Changes35259
-Node: Fixesx35608
-Node: 0236040
-Node: Changesx36204
-Node: Additionsx36490
-Node: Fixesxx37405
-Node: 0137654
-Node: Development37753
-Node: Copyright assignment37959
-Node: Credits38546
-Node: License38736
+Node: Fixes34798
+Node: 0434952
+Node: 0335178
+Node: Changes35305
+Node: Fixesx35654
+Node: 0236086
+Node: Changesx36250
+Node: Additionsx36536
+Node: Fixesxx37451
+Node: 0137700
+Node: Development37799
+Node: Copyright assignment38005
+Node: Credits38592
+Node: License38782
End Tag Table