[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/taxy 8757b52 10/42: Add: (taxy-magit-section-format-hea
From: |
ELPA Syncer |
Subject: |
[elpa] externals/taxy 8757b52 10/42: Add: (taxy-magit-section-format-header) |
Date: |
Wed, 15 Sep 2021 12:57:27 -0400 (EDT) |
branch: externals/taxy
commit 8757b529025eb0eee876889620da36214c61b6b0
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Add: (taxy-magit-section-format-header)
---
taxy-magit-section.el | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 85af4d3..3e7c57a 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -291,6 +291,27 @@ the items' values for each column."
table)
(cons table column-sizes)))))
+(defun taxy-magit-section-format-header (column-sizes formatters)
+ "Return header string for COLUMN-SIZES and FORMATTERS.
+COLUMN-SIZES should be the CDR of the cell returned by
+`taxy-magit-section-format-items'. FORMATTERS should be the
+variable passed to that function, which see."
+ (let* ((first-column-name (caar column-sizes))
+ (first-column-alist (alist-get first-column-name formatters nil nil
#'equal))
+ (first-column-align (pcase-exhaustive (alist-get 'align
first-column-alist)
+ ((or `nil 'left) "-")
+ ('right ""))))
+ (concat (format (format " %%%s%ss"
+ first-column-align (cdar column-sizes))
+ (caar column-sizes))
+ (cl-loop for (name . size) in (cdr column-sizes)
+ for column-alist = (alist-get name formatters nil nil
#'equal)
+ for align = (pcase-exhaustive (alist-get 'align
column-alist)
+ ((or `nil 'left) "-")
+ ('right ""))
+ for spec = (format " %%%s%ss" align size)
+ concat (format spec name)))))
+
;;;; Footer
(provide 'taxy-magit-section)
- [elpa] externals/taxy 16d4e50 23/42: Fix/Tidy: (deffy-buffer), (continued)
- [elpa] externals/taxy 16d4e50 23/42: Fix/Tidy: (deffy-buffer), ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 45372f6 27/42: Fix: (taxy-magit-section-format-items) Width, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 956efdd 37/42: Comment: Update TODO, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy ade9a02 42/42: Merge branch 'wip/magit-section-column-formatting', ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 5227980 40/42: Docs: (taxy-magit-section-define-column-definer) Add docstring, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 4fd9565 30/42: Fix: (deffy) Bookmarking deffy-files, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 45cdf29 41/42: Docs: Mention deffy in changelog, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy ac9bc63 16/42: WIP: elispy changes, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy ae7456f 11/42: Add: (taxy-magit-section-define-column-definer) Indentation/align, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 01b9cac 12/42: Change/Fix: (taxy-magit-section-define-column-definer) Variables, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 8757b52 10/42: Add: (taxy-magit-section-format-header),
ELPA Syncer <=
- [elpa] externals/taxy 5589f50 03/42: Comment: Add note, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy a14fa15 04/42: Change: (taxy-magit-section) format-fn = #'prin1-to-string, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 421cfbf 26/42: Add: (deffy-project), ELPA Syncer, 2021/09/15
- [elpa] externals/taxy f8558ab 28/42: Fix: (deffy-project) Arguments, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy a1f9081 29/42: Comment: Add TODOs, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy a672c8e 32/42: Fix: (taxy-make-take-function) Allow symbol args to functions, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 5a16dd0 39/42: Comment: Add TODO, ELPA Syncer, 2021/09/15