Emacs as commit message editor

Jonathan Lange jml at mumak.net
Mon Apr 30 03:13:07 BST 2007


Hello all,

I use emacs to write my commit messages, and thought I'd share a small
hack I came up with over the weekend.

The big problem with using emacs as a commit editor (apart from the
memory footprint) is that it leaves bzr_log.FOO~ files lying around
after the commit. If this bugs you, you can add the following code to
your .emacs file:

(defun starts-with-p (string1 string2)
  (string= (substring string1 0 (min (length string1) (length
string2))) string2))

(defun dont-backup-commit-files-p (filename)
  (let ((filename-part (file-name-nondirectory filename)))
    (if (or (starts-with-p filename-part "svn-commit")
            (starts-with-p filename-part "bzr_log"))
        nil
      (normal-backup-enable-predicate filename))))

(setq backup-enable-predicate 'dont-backup-commit-files-p)


I'm definitely not an elisp ninja, so there's probably a better way to
do it. Thanks to the wonderful-yet-strange people on #emacs on
Freenode for helping me out.

cheers,
jml



More information about the bazaar mailing list