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

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

[nongnu] elpa/git-commit 4ec4d0272e 04/10: magit-insert-section--finish:


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 4ec4d0272e 04/10: magit-insert-section--finish: Optimize propertizing leaf sections
Date: Fri, 3 May 2024 22:00:00 -0400 (EDT)

branch: elpa/git-commit
commit 4ec4d0272e6c50f10ccc96350ed917a3e8d3313a
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-insert-section--finish: Optimize propertizing leaf sections
---
 lisp/magit-section.el | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index b0c6c4ac06..b29a65f046 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1447,19 +1447,22 @@ anything this time around.
                      (point-marker))))
         (props `( magit-section ,obj
                   ,@(and-let* ((map (symbol-value (oref obj keymap))))
-                      (list 'keymap map)))))
+                      (list 'keymap map))))
+        (children (oref obj children)))
     (unless magit-section-inhibit-markers
       (set-marker-insertion-type beg t))
-    (save-excursion
-      (goto-char beg)
-      (while (< (point) end)
-        (let ((next (or (next-single-property-change
-                         (point) 'magit-section)
-                        end)))
-          (unless (magit-section-at)
-            (add-text-properties (point) next props))
-          (magit-section-maybe-add-heading-map obj)
-          (goto-char next))))
+    (cond (children
+           (save-excursion
+             (goto-char beg)
+             (while (< (point) end)
+               (let ((next (or (next-single-property-change
+                                (point) 'magit-section)
+                               end)))
+                 (unless (magit-section-at)
+                   (add-text-properties (point) next props))
+                 (magit-section-maybe-add-heading-map obj)
+                 (goto-char next)))))
+          ((add-text-properties beg end props)))
     (cond ((eq obj magit-root-section)
            (when (eq magit-section-inhibit-markers 'delay)
              (setq magit-section-inhibit-markers nil)
@@ -1476,7 +1479,7 @@ anything this time around.
                           (list obj))))))
     (when magit-section-insert-in-reverse
       (setq magit-section-insert-in-reverse nil)
-      (oset obj children (nreverse (oref obj children))))))
+      (oset obj children (nreverse children)))))
 
 (defun magit-cancel-section (&optional if-empty)
   "Cancel inserting the section that is currently being inserted.



reply via email to

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