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

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

[nongnu] elpa/git-commit efb6c0df17: magit-region-sections: Cosmetics


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit efb6c0df17: magit-region-sections: Cosmetics
Date: Mon, 15 Jan 2024 16:04:27 -0500 (EST)

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

    magit-region-sections: Cosmetics
---
 lisp/magit-section.el | 42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 83888be9e0..f9d28dd4a3 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -2032,27 +2032,29 @@ If optional CONDITION is non-nil, then the selection 
not only
 has to be valid; all selected sections additionally have to match
 CONDITION, or nil is returned.  See `magit-section-match' for the
 forms CONDITION can take."
-  (when (region-active-p)
-    (let* ((rbeg (region-beginning))
-           (rend (region-end))
-           (sbeg (magit-section-at rbeg))
-           (send (magit-section-at rend)))
-      (when (and send
-                 (not (eq send magit-root-section))
-                 (not (and multiple (eq send sbeg))))
-        (let ((siblings (cons sbeg (magit-section-siblings sbeg 'next)))
-              sections)
-          (when (and (memq send siblings)
+  (and (region-active-p)
+       (let* ((rbeg (region-beginning))
+              (rend (region-end))
+              (sbeg (magit-section-at rbeg))
+              (send (magit-section-at rend)))
+         (and send
+              (not (eq send magit-root-section))
+              (not (and multiple (eq send sbeg)))
+              (let ((siblings (cons sbeg (magit-section-siblings sbeg 'next)))
+                    (sections ()))
+                (and (memq send siblings)
                      (magit-section-position-in-heading-p sbeg rbeg)
-                     (magit-section-position-in-heading-p send rend))
-            (while siblings
-              (push (car siblings) sections)
-              (when (eq (pop siblings) send)
-                (setq siblings nil)))
-            (setq sections (nreverse sections))
-            (when (or (not condition)
-                      (--all-p (magit-section-match condition it) sections))
-              sections)))))))
+                     (magit-section-position-in-heading-p send rend)
+                     (progn
+                       (while siblings
+                         (push (car siblings) sections)
+                         (when (eq (pop siblings) send)
+                           (setq siblings nil)))
+                       (setq sections (nreverse sections))
+                       (and (or (not condition)
+                                (--all-p (magit-section-match condition it)
+                                         sections))
+                            sections))))))))
 
 (defun magit-map-sections (function &optional section)
   "Apply FUNCTION to all sections for side effects only, depth first.



reply via email to

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