[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/taxy f2b02b2 1/3: Fix: (taxy-magit-section-insert) Make
From: |
ELPA Syncer |
Subject: |
[elpa] externals/taxy f2b02b2 1/3: Fix: (taxy-magit-section-insert) Make indentation inherit text properties |
Date: |
Mon, 30 Aug 2021 01:57:18 -0400 (EDT) |
branch: externals/taxy
commit f2b02b2b2474d7dbe63c7b1ae2578122220558e4
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Fix: (taxy-magit-section-insert) Make indentation inherit text properties
I tried to use insert-and-inherit, which should be more efficient and
simpler, but that required inserting the newline separately and then
moving point past it, and no matter what I tried, magit-section would
not navigate sections properly anymore, so this will have to do.
---
README.org | 1 +
taxy-magit-section.el | 16 +++++++++++++---
taxy.info | 21 ++++++++++++---------
3 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/README.org b/README.org
index 1dcdb01..b65c75c 100644
--- a/README.org
+++ b/README.org
@@ -783,6 +783,7 @@ Note that while =taxy-magit-section.el= is installed with
the =taxy= package, th
*** Fixes
+ Function ~taxy-fill~ always calls a taxy's ~:take~ function if present.
(Fixing "chains" of dynamic taxys.)
++ Function ~taxy-magit-section-insert~ applies text properties from the
inserted string to the indentation string (so commands that rely on text
properties at the beginning of a line will work).
** 0.2
diff --git a/taxy-magit-section.el b/taxy-magit-section.el
index 6203ced..9076fb7 100644
--- a/taxy-magit-section.el
+++ b/taxy-magit-section.el
@@ -63,9 +63,19 @@ descendant taxys; if `last', insert them after descendants."
(item format-fn indent)
(magit-insert-section (magit-section item)
(magit-insert-section-body
- (insert (make-string (+ 2 (* depth indent)) ? )
- (funcall format-fn item)
- "\n"))))
+ ;; This is a tedious way to give the indent
+ ;; string the same text properties as the start
+ ;; of the formatted string, but no matter where I
+ ;; left point after using `insert-and-inherit',
+ ;; something was wrong about the properties, and
+ ;; `magit-section' didn't navigate the sections
+ ;; properly anymore.
+ (let* ((formatted (funcall format-fn item))
+ (indent (make-string (+ 2 (* depth indent)) ? )))
+ (add-text-properties 0 (length indent)
+ (text-properties-at 0 formatted)
+ indent)
+ (insert indent formatted "\n")))))
(insert-taxy
(taxy) (let ((magit-section-set-visibility-hook
magit-section-set-visibility-hook)
(format-fn (cl-typecase taxy
diff --git a/taxy.info b/taxy.info
index e00d0ee..f1b66b2 100644
--- a/taxy.info
+++ b/taxy.info
@@ -932,6 +932,9 @@ File: README.info, Node: Fixes, Prev: Changes, Up: 03-pre
• Function ‘taxy-fill’ always calls a taxy’s ‘:take’ function if
present. (Fixing "chains" of dynamic taxys.)
+ • Function ‘taxy-magit-section-insert’ applies text properties from
+ the inserted string to the indentation string (so commands that
+ rely on text properties at the beginning of a line will work).
File: README.info, Node: 02, Next: 01, Prev: 03-pre, Up: Changelog
@@ -1056,15 +1059,15 @@ Node: Changelog33306
Node: 03-pre33468
Node: Changes33588
Node: Fixes33944
-Node: 0234165
-Node: Changesx34320
-Node: Additions34605
-Node: Fixesx35518
-Node: 0135765
-Node: Development35864
-Node: Copyright assignment36070
-Node: Credits36657
-Node: License36847
+Node: 0234379
+Node: Changesx34534
+Node: Additions34819
+Node: Fixesx35732
+Node: 0135979
+Node: Development36078
+Node: Copyright assignment36284
+Node: Credits36871
+Node: License37061
End Tag Table