February 9, 2008
I use Subversion for a lot of my projects, and I’ve really enjoy the seamless integration in Emacs. Committing a file is as easy as C-x v v. However, vc-checkin is slightly broken. It needs a window in which to open the buffer *VC-log* (for you to enter the commit message in) and after you’ve entered a message and pressed C-c C-c, it closes that window. If you have only one window open in the current frame, it splits your window. Everything is fine…you get your one-window layout back. But if you have more than one window open, it steals an existing window and closes it. Quite annoying. So, I decided to fix this using vc-before-checkin-hook. The following hook opens a new window visiting the buffer *VC-log*.
(add-hook 'vc-before-checkin-hook #'(lambda () (set-window-buffer (split-window-vertically) (get-buffer-create "*VC-log*"))))
This way, the newly created window will always be selected and closed by vc-checkin, and predictability is restored.