Fixing vc-checkin

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.

About these ads

One Response to “Fixing vc-checkin”

  1. Harpo Says:

    Outstanding, thanks. The default behaviour has been bugging me forever, now I have zen-like vc-mode.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: