[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/taxy 5a1b055 38/39: Docs: Add magit-loggy example
From: |
ELPA Syncer |
Subject: |
[elpa] externals/taxy 5a1b055 38/39: Docs: Add magit-loggy example |
Date: |
Fri, 27 Aug 2021 10:57:37 -0400 (EDT) |
branch: externals/taxy
commit 5a1b0559b8c7d3d56d2ba15193d4f75b0c966558
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Docs: Add magit-loggy example
Really just a rough demo, but it works.
---
examples/magit-loggy.el | 80 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/examples/magit-loggy.el b/examples/magit-loggy.el
new file mode 100644
index 0000000..b0fde45
--- /dev/null
+++ b/examples/magit-loggy.el
@@ -0,0 +1,80 @@
+;;; magit-loggy.el --- Group Magit log commits by date -*- lexical-binding:
t; -*-
+
+;; Copyright (C) 2021 Adam Porter
+
+;; Author: Adam Porter <adam@alphapapa.net>
+;; Keywords: convenience
+
+;; 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:
+
+;; This works, but since magit-log uses overlays for the committer and
+;; date on each line, those are lost when we erase the buffer. Fixing
+;; that would require copying the properties of those overlays into
+;; the text properties of each line. Probably not worth it, since
+;; this is just a demo, anyway.
+
+;;; Code:
+
+;;;; Requirements
+
+(require 'magit-log)
+(require 'ov)
+
+;;;; Variables
+
+(defvar magit-loggy-taxy
+ (make-taxy :name "Commits"
+ :taxys (list
+ (make-taxy :name "By date"
+ :take (apply-partially #'taxy-take-keyed
#'cdr)))))
+
+;;;; Customization
+
+
+;;;; Commands
+
+(defun magit-loggy ()
+ (interactive)
+ (cl-assert (derived-mode-p 'magit-log-mode))
+ (save-excursion
+ (goto-char (point-min))
+ (cl-labels ((line-date
+ () (when-let ((ov (car (ov-in 'before-string 'any
(line-beginning-position) (line-end-position))))
+ (string (cadr (get-text-property 0 'display
(overlay-get ov 'before-string))))
+ (_ (string-match (rx (group (1+ digit) ; number
+ " "
+ (1+ (not blank))) ;
unit
+ (1+ blank) eos)
+ string)))
+ (match-string 1 string))))
+ (let* ((lines (cl-loop until (eobp)
+ collect (cons (buffer-substring (point-at-bol)
(point-at-eol))
+ (line-date))
+ do (forward-line 1)))
+ (taxy (taxy-fill lines (taxy-emptied magit-loggy-taxy)))
+ (inhibit-read-only t))
+ (erase-buffer)
+ (taxy-magit-section-insert taxy)))))
+
+
+;;;; Functions
+
+
+;;;; Footer
+
+(provide 'magit-loggy)
+
+;;; magit-loggy.el ends here
- [elpa] externals/taxy a17e540 35/39: Docs: Show examples, (continued)
- [elpa] externals/taxy a17e540 35/39: Docs: Show examples, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy aa0fe08 20/39: Change: taxy-copy -> taxy-emptied, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy c60a96f 12/39: Change: Rename taxy-simple, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 1699d3a 15/39: Docs: Clarify, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy fcc780f 27/39: Add: (taxy-take-keyed*), ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 4e132ab 28/39: Docs: Tidy, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 524b151 19/39: Tidy: (taxy-fill), ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 906d387 30/39: Fix: (taxy-magit-section-pp) Use magit-section-mode, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy a7ffe21 37/39: Change: (diredy) Sort taxys, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 2c044ed 39/39: Add: (taxy-take-keyed*) :then, and examples, ELPA Syncer, 2021/08/27
- [elpa] externals/taxy 5a1b055 38/39: Docs: Add magit-loggy example,
ELPA Syncer <=
- [elpa] externals/taxy 3cf0d46 25/39: Docs: Export Info manual, ELPA Syncer, 2021/08/27