Omit empty sections.

* magit.el (magit-insert-section): Insert final newline only when
inserted output is not empty.  Delete title when it is.
This commit is contained in:
Marius Vollmer 2008-08-20 23:57:07 +03:00
parent cb3b44282d
commit 822adda331
2 changed files with 8 additions and 6 deletions

View file

@ -280,15 +280,16 @@ Many Magit faces inherit from this one by default."
(if title
(insert (propertize title 'face 'magit-section-title) "\n"))
(let* ((beg (point))
(status (apply 'call-process cmd nil t nil args))
(end (point)))
(insert "\n")
(status (apply 'call-process cmd nil t nil args)))
(put-text-property section-beg (point) 'magit-section (list section))
(if washer
(save-restriction
(narrow-to-region beg (point))
(funcall washer status)
(goto-char (point-max)))))))
(goto-char (point-max))))
(if (/= beg (point))
(insert "\n")
(delete-region section-beg (point))))))
(defun magit-section-head (section n)
(if (<= (length section) n)

View file

@ -93,8 +93,9 @@ the status buffer in this way after saving a file in Emacs.
The header at the top of the status buffer shows a short summary of
the repository state: where it is located, which branch is checked
out, etc. Below the header are three or four sections that show
details about the working tree and the staging area.
out, etc. Below the header are up to four sections that show details
about the working tree and the staging area. Only sections that are
not empty are shown.
The first of these sections lists @emph{Untracked files}. These are
the files that are present in your working tree but are not known to