[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 9d8d5e5603: When toggling sections don't always
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 9d8d5e5603: When toggling sections don't always go to section beginning |
Date: |
Fri, 11 Mar 2022 05:58:06 -0500 (EST) |
branch: elpa/git-commit
commit 9d8d5e560394c001b866c00200ccea65b7d94a04
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
When toggling sections don't always go to section beginning
In the case of `magit-section-toggle' the old behavior goes all the
way back to [1: c31519163]. In other words, it survived a few more
big rewrites, but now its time is finally over. ;P
1: 2008-09-07 c315191639f27ba6237d7adff5777a6e6271d8d2
Big rewrite of the 'section' and 'item' machinery.
---
lisp/magit-section.el | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index fcaae1d979..526a4b2ab8 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -621,6 +621,8 @@ With a prefix argument also expand it." heading)
(oset section hidden t)
(when-let ((beg (oref section content)))
(let ((end (oref section end)))
+ (when (< beg (point) end)
+ (goto-char (oref section start)))
(remove-overlays beg end 'invisible t)
(let ((o (make-overlay beg end)))
(overlay-put o 'evaporate t)
@@ -631,17 +633,15 @@ With a prefix argument also expand it." heading)
(defun magit-section-toggle (section)
"Toggle visibility of the body of the current section."
(interactive (list (magit-current-section)))
- (if (eq section magit-root-section)
- (user-error "Cannot hide root section")
- (goto-char (oref section start))
- (if (oref section hidden)
- (magit-section-show section)
- (magit-section-hide section))))
+ (cond ((eq section magit-root-section)
+ (user-error "Cannot hide root section"))
+ ((oref section hidden)
+ (magit-section-show section))
+ (t (magit-section-hide section))))
(defun magit-section-toggle-children (section)
"Toggle visibility of bodies of children of the current section."
(interactive (list (magit-current-section)))
- (goto-char (oref section start))
(let* ((children (oref section children))
(show (--any-p (oref it hidden) children)))
(dolist (c children)
@@ -688,7 +688,6 @@ hidden."
(defun magit-section-cycle (section)
"Cycle visibility of current section and its children."
(interactive (list (magit-current-section)))
- (goto-char (oref section start))
(if (oref section hidden)
(progn (magit-section-show section)
(magit-section-hide-children section))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/git-commit 9d8d5e5603: When toggling sections don't always go to section beginning,
ELPA Syncer <=