Hide diffs by default.
* magit.el (magit-new-section): Type rest arg for initializing the new section structure. (magit-with-section): Generalize type argument to allow a list of keyword value pair and pass them to magit-new-section. (magit-wash-diff): Make diffs hidden by default.
This commit is contained in:
parent
2bf9c19866
commit
4f8dd6f841
1 changed files with 10 additions and 7 deletions
15
magit.el
15
magit.el
|
@ -303,10 +303,11 @@ Many Magit faces inherit from this one by default."
|
|||
|
||||
(defvar magit-old-top-section nil)
|
||||
|
||||
(defun magit-new-section (title type)
|
||||
(let* ((s (make-magit-section :parent magit-top-section
|
||||
(defun magit-new-section (title &rest args)
|
||||
(let* ((s (apply #'make-magit-section
|
||||
:parent magit-top-section
|
||||
:title title
|
||||
:type type))
|
||||
args))
|
||||
(old (and magit-old-top-section
|
||||
(magit-find-section (magit-section-path s)
|
||||
magit-old-top-section))))
|
||||
|
@ -328,10 +329,12 @@ Many Magit faces inherit from this one by default."
|
|||
(delq section (magit-section-children parent)))
|
||||
(setq magit-top-section nil))))
|
||||
|
||||
(defmacro magit-with-section (title type &rest body)
|
||||
(defmacro magit-with-section (title args &rest body)
|
||||
(declare (indent 2))
|
||||
(let ((s (gensym)))
|
||||
`(let* ((,s (magit-new-section ,title ,type))
|
||||
`(let* ((,s (magit-new-section ,title ,@(if (keywordp (car args))
|
||||
args
|
||||
`(:type ,args))))
|
||||
(magit-top-section ,s))
|
||||
(setf (magit-section-beginning ,s) (point))
|
||||
,@body
|
||||
|
@ -851,7 +854,7 @@ Please see the manual for a complete description of Magit.
|
|||
|
||||
(defun magit-wash-diff ()
|
||||
(cond ((looking-at "^diff")
|
||||
(magit-with-section (magit-current-line) 'diff
|
||||
(magit-with-section (magit-current-line) (:type 'diff :hidden t)
|
||||
(let ((file (magit-diff-line-file))
|
||||
(end (save-excursion
|
||||
(forward-line) ;; skip over "diff" line
|
||||
|
|
Loading…
Reference in a new issue