[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/taxy 2f4d9c3 05/42: Add: (taxy-magit-section-insert-ind
From: |
ELPA Syncer |
Subject: |
[elpa] externals/taxy 2f4d9c3 05/42: Add: (taxy-magit-section-insert-indent-items) |
Date: |
Wed, 15 Sep 2021 12:57:26 -0400 (EDT) |
branch: externals/taxy
commit 2f4d9c3cc1140c2077d2a06e9cd5daf1e31a48d1
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Add: (taxy-magit-section-insert-indent-items)
---
taxy-magit-section.el | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index b592ecb..f25f5af 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -41,6 +41,14 @@
(defvar taxy-magit-section-depth nil
"Bound to current depth around calls to a taxy's format-fn.")
+(defvar taxy-magit-section-insert-indent-items t
+ ;; NOTE: I hate to use a variable to control this, but it seems like
+ ;; the cleanest way for now.
+ "Whether to indent items in `taxy-magit-section-insert'.
+May be disabled when `taxy-magit-section-insert' should not
+indent items itself, e.g. if items are pre-indented. Note that
+this does not disable indentation of section headings.")
+
;;;; Customization
@@ -85,7 +93,7 @@ which blank lines are inserted between sections at that
level."
(let* ((magit-section-set-visibility-hook
(cons #'taxy-magit-section-visibility
magit-section-set-visibility-hook)))
(cl-labels ((insert-item
- (item format-fn depth)
+ (item taxy format-fn depth)
(magit-insert-section (magit-section item)
(magit-insert-section-body
;; This is a tedious way to give the indent
@@ -95,11 +103,13 @@ which blank lines are inserted between sections at that
level."
;; something was wrong about the properties, and
;; `magit-section' didn't navigate the sections
;; properly anymore.
- (let* ((taxy-magit-section-depth depth)
+ (let* (
(formatted (funcall format-fn item))
- (indent-size (pcase depth
- ((pred (> 0)) 0)
- (_ (* depth
taxy-magit-section-item-indent))))
+ (indent-size (if (or (not
taxy-magit-section-insert-indent-items)
+ (< depth 0))
+ 0
+ (+ (* depth
(taxy-magit-section-heading-indent taxy))
+ (taxy-magit-section-item-indent
taxy))))
(indent-string (make-string indent-size ? )))
(add-text-properties 0 (length indent-string)
(text-properties-at 0 formatted)
@@ -119,10 +129,9 @@ which blank lines are inserted between sections at that
level."
(push (taxy-magit-section-visibility-fn
taxy) magit-section-set-visibility-hook))))
(magit-insert-section (magit-section taxy)
(magit-insert-heading
- (make-string (* (pcase depth
- ((pred (> 0)) 0)
- (_ depth))
-
(taxy-magit-section-heading-indent taxy)) ? )
+ (make-string (* (if (< depth 0) 0 depth)
+
(taxy-magit-section-heading-indent taxy))
+ ? )
(propertize (taxy-name taxy)
'face (funcall
(taxy-magit-section-heading-face-fn taxy) depth))
(format " (%s%s)"
@@ -133,12 +142,12 @@ which blank lines are inserted between sections at that
level."
(magit-insert-section-body
(when (eq 'first items)
(dolist (item (taxy-items taxy))
- (insert-item item format-fn (1+
depth))))
+ (insert-item item taxy format-fn
depth)))
(dolist (taxy (taxy-taxys taxy))
(insert-taxy taxy (1+ depth)))
(when (eq 'last items)
(dolist (item (taxy-items taxy))
- (insert-item item format-fn (1+
depth)))))
+ (insert-item item taxy format-fn
depth))))
(when (<= depth blank-between-depth)
(insert "\n"))))))
(magit-insert-section (magit-section)
- [elpa] externals/taxy 6703d8b 21/42: WIP: Use deffy-def in -RET, (continued)
- [elpa] externals/taxy 6703d8b 21/42: WIP: Use deffy-def in -RET, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy e92ef13 22/42: Comment: Add FIXME, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 0cda29a 38/42: Add: (taxy-magit-section-define-column-definer) Custom-type, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy a7ff557 33/42: Docs: Document new things, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 5020b43 31/42: Change: (deffy-goto-form) Bug #50576 is fixed., ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 0826a47 02/42: WIP: taxy-magit-section column/table formatting, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy d456f88 24/42: Add: (deffy-side-window-action), ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 3787f4f 25/42: Fix: (deffy-buffer) Ensure file name, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 7ecc461 15/42: Fix: (taxy-magit-section-define-column-definer) Use defcustoms, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 8b7a95a 35/42: Docs: Clarify, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 2f4d9c3 05/42: Add: (taxy-magit-section-insert-indent-items),
ELPA Syncer <=
- [elpa] externals/taxy 9f9cfef 34/42: Docs: Reorder sections, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 7a63677 08/42: Add: (taxy-define-key-definer), ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 69872e4 06/42: Docs: Update readme, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy d682c37 13/42: Add: (taxy-make-take-function), ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 8d108ef 18/42: WIP: Rename elispy to deffy, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 468e9b9 01/42: Meta: Add .dir-locals.el, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 2430282 20/42: Tidy: Indentation, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy b37dd39 17/42: WIP: Tidy, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 43b8504 36/42: Docs: Update changelog, ELPA Syncer, 2021/09/15
- [elpa] externals/taxy 16d4e50 23/42: Fix/Tidy: (deffy-buffer), ELPA Syncer, 2021/09/15