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

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

[nongnu] elpa/git-commit d73a3b11db 09/12: Record child sections in reve


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit d73a3b11db 09/12: Record child sections in reverse in log buffers
Date: Sun, 6 Aug 2023 21:59:41 -0400 (EDT)

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

    Record child sections in reverse in log buffers
    
    It might be nice to just always do that, but we first have to if there
    is any code that accesses siblings during washing, which would need to
    be adjusted.
---
 lisp/magit-log.el     | 5 ++++-
 lisp/magit-section.el | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 524c1eb420..aed2479bdb 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -1116,7 +1116,8 @@ Type \\[magit-reset] to reset `HEAD' to the commit at 
point.
     (let ((delay (cl-find-if (lambda (arg)
                                (member arg '("++header" "--patch" "--stat")))
                              args)))
-      (setq magit-section-inhibit-markers (if delay 'delay t)))
+      (setq magit-section-inhibit-markers (if delay 'delay t))
+      (setq magit-section-insert-in-reverse (not delay)))
     (magit-insert-section (logbuf)
       (magit--insert-log t revs args files))))
 
@@ -1677,6 +1678,7 @@ Type \\[magit-log-select-quit] to abort without selecting 
a commit."
 
 (defun magit-log-select-refresh-buffer ()
   (setq magit-section-inhibit-markers t)
+  (setq magit-section-insert-in-reverse t)
   (magit-insert-section (logbuf)
     (magit--insert-log t magit-buffer-revisions magit-buffer-log-args)))
 
@@ -1772,6 +1774,7 @@ Type \\[magit-cherry-pick] to apply the commit at point.
 
 (defun magit-cherry-refresh-buffer ()
   (setq magit-section-inhibit-markers t)
+  (setq magit-section-insert-in-reverse t)
   (magit-insert-section (cherry)
     (magit-run-section-hook 'magit-cherry-sections-hook)))
 
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 9d0bc26d3d..e75e64eb8d 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -274,6 +274,7 @@ no effect.  This also has no effect for Emacs >= 28, where
 (defvar-local magit-section-unhighlight-sections nil)
 
 (defvar-local magit-section-inhibit-markers nil)
+(defvar-local magit-section-insert-in-reverse nil)
 
 ;;; Faces
 
@@ -1401,10 +1402,15 @@ anything this time around.
                   (oset section end   (copy-marker (oref section end) t)))))
              (let ((magit-section-cache-visibility nil))
                (magit-section-show ,s)))
+            (magit-section-insert-in-reverse
+             (push ,s (oref (oref ,s parent) children)))
             ((let ((parent (oref ,s parent)))
                (oset parent children
                      (nconc (oref parent children)
                             (list ,s)))))))
+         (when magit-section-insert-in-reverse
+           (setq magit-section-insert-in-reverse nil)
+           (oset ,s children (nreverse (oref ,s children))))
          ,s))))
 
 (defun magit-cancel-section ()



reply via email to

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