Wednesday, May 30, 2012

Autocommit II

 And yet, sometimes one *doesn't* want every last keystroke autocommitted.  Like when one is accessing repositories at work via tramp.  For those cases, I've tweaked my after-save-hook as follows:


(add-hook 'after-save-hook '(lambda ()
  (if (vc-git-registered (buffer-file-name))
    (if (file-exists-p (concat (vc-git-root (buffer-file-name)) "/.autocommit"))
      (vc-git-checkin (buffer-file-name) nil (format-time-string "Autocommit %F %T"))))))

Much better.