[PATCH 2/2] Add command magit-toggle-file-section.

5 views
Skip to first unread message

Hannu Koivisto

unread,
Oct 23, 2009, 8:33:26 PM10/23/09
to ma...@googlegroups.com
For those who never want to toggle at hunk granularity.
---
Hi,

This requires the previous patch, i.e. magit-goto-parent-section

//Hannu

magit.el | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/magit.el b/magit.el
index 8cf86e9..a319dba 100644
--- a/magit.el
+++ b/magit.el
@@ -818,6 +818,13 @@ Many Magit faces inherit from this one by default."
(interactive)
(magit-section-hideshow #'magit-section-expand))

+(defun magit-toggle-file-section ()
+ "Like `magit-toggle-section' but toggles at file granularity."
+ (interactive)
+ (when (eq 'hunk (first (magit-section-context-type (magit-current-section))))
+ (magit-goto-parent-section))
+ (magit-toggle-section))
+
(defun magit-toggle-section ()
(interactive)
(magit-section-hideshow
--
1.6.4.GIT


Reply all
Reply to author
Forward
0 new messages