Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Delete trailing blank line #318

wants to merge 1 commit into from

2 participants


No description provided.


Can you give an example of the problem you're solving?
Also, if we happen to insert too many blank lines, it'd seem better to fix it at insert time, rather than deleting them afterwards.


magit-insert-section puts a trailing whitespace (except if the section is cancelled).
This allows for sections such as Staged changes, Unstaged changes, etc to be nicely separated by an empty line.
This however leaves an extra empty line after the last section.

I use the same trick in branch-manager to separate Local branches and Remote branches and then end up with two extra empty lines (one from magit-insert-section and one from me).

What we would like to do is join strings with "\n". It would be a cleaner approach for sure.
But we do not have all the strings upfront, we generate some from magit, we create some from lisp, we just wash some others.

Therefore, I think that deleting the remaining blank lines at the end of execution of body is not too bad.


I think this kind of kludge should be left over for now. I'm even wondering if we shouldn't think about rewriting all the UI layer in a cleaner way, and maybe split it into a separate package.

@sigma sigma closed this

I agree that splitting magit.el in more manageable files would be beneficial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  magit.el
1  magit.el
@@ -1324,6 +1324,7 @@ If TYPE is nil, the section won't be highlighted."
(magit-top-section ,s))
(setf (magit-section-beginning ,s) (point))
+ (delete-blank-lines)
(setf (magit-section-end ,s) (point))
(setf (magit-section-children ,s)
(nreverse (magit-section-children ,s)))
Something went wrong with that request. Please try again.