emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/taxy-magit-section f43bbf602e 3/3: Add: (taxy-magit-sec


From: ELPA Syncer
Subject: [elpa] externals/taxy-magit-section f43bbf602e 3/3: Add: (taxy-magit-section-insert) :section-class argument
Date: Tue, 23 Jan 2024 06:58:45 -0500 (EST)

branch: externals/taxy-magit-section
commit f43bbf602ee4cc47c3a6596b5e1e69acb021b226
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Add: (taxy-magit-section-insert) :section-class argument
---
 README.org              |  4 +++-
 taxy-magit-section.el   | 15 ++++++++++-----
 taxy-magit-section.info | 28 +++++++++++++++++-----------
 3 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/README.org b/README.org
index 5f93882279..9ae111f58d 100644
--- a/README.org
+++ b/README.org
@@ -34,7 +34,9 @@ This library renders 
[[https://github.com/alphapapa/taxy.el][Taxy]] structs with
 
 ** 0.13-pre
 
-Nothing new yet.
+*Additions*
+
++ Function ~taxy-magit-section-insert~ takes a ~:section-class~ argument, 
which is passed to ~magit-insert-section~ as its ~class~ argument.  This allows 
a custom subclass of ~magit-section~ to be passed, which, with a custom method 
on ~magit-section-ident-value~, allows section visibility to be cached 
concisely.
 
 ** 0.12.2
 
diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 8be1d0162b..c02a7c335b 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -105,18 +105,23 @@ this does not disable indentation of section headings.")
 ;;;; Functions
 
 (cl-defun taxy-magit-section-insert
-    (taxy &key (items 'first) (initial-depth 0) (blank-between-depth 1))
+    (taxy &key (items 'first) (initial-depth 0) (blank-between-depth 1)
+          (section-class 'taxy-magit-section-section))
   "Insert a `magit-section' for TAXY into current buffer.
 If ITEMS is `first', insert a taxy's items before its descendant
 taxys; if `last', insert them after descendants.  INITIAL-DEPTH
 is the initial indentation depth; it may be, e.g. -1 to make the
 second level unindented.  BLANK-BETWEEN-DEPTH is the level up to
-which blank lines are inserted between sections at that level."
+which blank lines are inserted between sections at that level.
+SECTION-CLASS is passed to `magit-insert-section', which
+see (this may be set to a custom subclass of `magit-section' in
+order to define a custom `magit-section-ident-value' method so
+that section visibility may be cached concisely)."
   (declare (indent defun))
   (let* ((magit-section-set-visibility-hook
           (cons #'taxy-magit-section-visibility 
magit-section-set-visibility-hook)))
     (cl-labels ((insert-item (item taxy depth)
-                  (magit-insert-section (magit-section item)
+                  (magit-insert-section ((eval section-class) item)
                     (magit-insert-section-body
                       ;; This is a tedious way to give the indent
                       ;; string the same text properties as the start
@@ -154,7 +159,7 @@ which blank lines are inserted between sections at that 
level."
                     ;; `magit-section--maybe-wash' from trying to wash the 
section when its
                     ;; visibility is toggled back on.  I'm not sure why this 
is necessary
                     ;; (maybe an issue in magit-section?).
-                    (oset (magit-insert-section (taxy-magit-section-section 
taxy)
+                    (oset (magit-insert-section ((eval section-class) taxy)
                             (magit-insert-heading
                               (make-string (* (if (< depth 0) 0 depth)
                                               (taxy-magit-section-level-indent 
taxy))
@@ -178,7 +183,7 @@ which blank lines are inserted between sections at that 
level."
                               (insert "\n")))
                           washer nil))))
       ;; HACK: See earlier note about washer.
-      (oset (magit-insert-section (taxy-magit-section-section)
+      (oset (magit-insert-section ((eval section-class))
               (insert-taxy taxy initial-depth))
             washer nil))))
 
diff --git a/taxy-magit-section.info b/taxy-magit-section.info
index d181ca43bc..75bac3d5e9 100644
--- a/taxy-magit-section.info
+++ b/taxy-magit-section.info
@@ -73,7 +73,13 @@ File: README.info,  Node: 013-pre,  Next: 0122,  Up: 
Changelog
 2.1 0.13-pre
 ============
 
-Nothing new yet.
+*Additions*
+
+   • Function ‘taxy-magit-section-insert’ takes a ‘:section-class’
+     argument, which is passed to ‘magit-insert-section’ as its ‘class’
+     argument.  This allows a custom subclass of ‘magit-section’ to be
+     passed, which, with a custom method on ‘magit-section-ident-value’,
+     allows section visibility to be cached concisely.
 
 
 File: README.info,  Node: 0122,  Next: 0121,  Prev: 013-pre,  Up: Changelog
@@ -176,16 +182,16 @@ Node: Top221
 Node: Installation821
 Node: Changelog1175
 Node: 013-pre1417
-Node: 01221528
-Node: 01211664
-Node: 0121797
-Node: 0111934
-Node: 0102135
-Node: 0912290
-Node: 092682
-Node: Development2872
-Node: Credits3099
-Node: License3289
+Node: 01221888
+Node: 01212024
+Node: 0122157
+Node: 0112294
+Node: 0102495
+Node: 0912650
+Node: 093042
+Node: Development3232
+Node: Credits3459
+Node: License3649
 
 End Tag Table
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]