As I’ve now been using Emacs for quite a long time, I have picked up a few tips along the way. One thing I’ve been doing more and more is using the shell within Emacs. (For more details see here and here.)
Some of my most used shell commands are using SVN, such as add, revert etc. However, I couldn’t find anywhere to just add/revert the current file I am working on. Fortunately there is Stack Overflow! Someone with a very similar issue to me has had a couple of good answers, which I have “borrowed” and now adding files to my SVN repository is really easy.
First, add the following to your .emacs file
(define-key minibuffer-local-map [f3] (lambda() (interactive) (insert (buffer-file-name (nth 1 (buffer-list))))))
Now either open up Emacs, or reload your .emacs file:
M-x load-file RET ~/.emacs RET
Now, when you are working on a new file you can easily add it to SVN with the following command:
M-! svn add F3 RET