Version control is good, but there are two possible pitfalls for me:
- In the morning, it can happen that I start working without updating my project. If this is a project I worked on, on another computer the day before, as soon as I want to commit the new changes, I will have to merge all the changes in one file. Not a big issue, but unnessary work.
- Before I leave the office, I unfortunately often forget to commit.
I wrote a commit batch file that runs every two hours, but the problem was that I manually had to define in which directories the batch file should look and, if there was nothing to commit, I still had to click the commit window away (if you have about 30 open projects, that isn’t much fun).
I decided to improve my batch file: It should automatically generate a list of all the root directories of projects under version control and then check if there is something to commit. If there is nothing to commit, the batch file should just continue without showing me the commit window.
One hour of surfing and my rudimentary powershell knowledge resulted in two small scripts that check for projects should be committed and should be updated. In order to run these scripts, you need a Windows computer and the command line utilities for Subversion (they are usually installed if you use TortoiseSVN). I think that a script like this can also be written in other scripting languages and for other operating systems.
If you want to run it on your computer, you will have to adjust the abolute paths in the scripts to your settings.
The commit script (svncommit.ps1):
- Line 1: Changing to the root directory of my data drive with all my projects
- Line 2: Here we look for .svn folders (subversion puts them in the root directory of a project. Powershell looks in all folders if there is a subfolder with this name (it continues if it encounters system directories) and saves the path of these directories in the file svn.txt.
- Line 5-14: In the for loop, I loop through every project root directory, check the subversion status, write the result once again to a file (status.txt) and check if it is not empty: if it is not empty, it does a commit.
- I save the files svn.txt and status.txt in a directory that is not under version control, so it is not around when I check for changes in the project directory.
- This script runs every two hours on my computers.
The update script (svnupdate.ps1) is also short and simple
It hast the same first two lines as the commit script. With the subversion update option /closeonend:2, only projects that are not up-to-date will be updated.
Just create a file emacs.reg with the following text and adjust the path to your settings.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\Open In Emacs\Command]
@=”\”C:\\bin\\Emacs-23.1\\bin\\emacsclientw.exe\” -a \”C:\\bin\\Emacs-23.1\\bin\\runemacs.exe\” \”%1\””
Before you double click on this file, save your registry (you never know…). After double clicking you will have a extra option in your right-click menu in your explorer, which starts Emacs, if Emacs is not running and start the client if it is already running.
Dropbox is a nice tool for synchronizing files over different computers. One problem is that you have to put your files in the Dropbox folder. I often make small changes to my settings in Emacs, so I used to have my home directory for Emacs in my Dropbox folder.
You can choose where to put your Dropbox folder on your machine, however, you can only have one Dropbox folder. What to do, if you want to synchronize your whole Emacs program directory (or any other directory you don’t want to move to your Dropbox folder)?
There is a nice open source utility called dropboxifier (http://dropboxifier.codeplex.com/
) that allows you to put a symbolic link in your Dropbox folder. The folder remains in the original position but Dropbox treats it as if it is in the Dropbox folder. This utility can also be used for Skydrive or Google Drive.
Examples of my use of dropboxifier:
- As you probably know, you can easily copy your Emacs directory to another computer. If the home directory on the other computer is properly set, you can start directly working with it. Using dropboxifier I nowadays sync the whole Emacs directory and don’t have to bother, when I update or add packages on one computer. They are automatically installed on the other computer.
- I have a directory called “Inbox”. I use if for all the files I download (and don’t want to put in a project or other directory) and for “scratch” files, small files I use for testing stuff (for example, if I answer a question in a mailing list, I, if necessary, usually test my answer with a small file). I use dropboxifier for this folder too (of course, I could have put the whole directory in my Dropbox folder, but than it is hidden deep down in my folder hierarchy). Note, that in the figure above, I still have to add the symbolic link on my other computer. I use my inbox folder also for all my downloads (you can change the download folder in your browser easily).
Note that I don’t use this for my project directories and files, because for this task I use my version control system.
Windows Explorer is good, but it does not have many features that makes my computer life easier. One thing I don’t like is that you can’t filter your view in an efficient way. Take for example this directory with my LaTeX files for one of my lectures:
If I want to open one of my tex-files, I have to search for it, or sort the folder. Directory Opus (DOpus), my windows explorer replacement, handles this very nicely. Here is the same folder using DOpus:
Now, that is a difference! I have a global filter, that hides all the other stuff. Just change your preferences as follows:
Another nice feature is the filter bar:
When I choose “.tex” my folder looks like this:
But this is not all. You can highlight, change the background, etc. using your own filters. For example, I want to have all recently changed files to be highlighted. This allows me to see with one quick glance, which files changed, and should be committed to my subversion repository (Of course, if you use TortoiseSvn like I do, you see the red exclamation mark, but new files aren’t marked). In DOpus this would look like this:
DOpus is not free, but it is not very expensive. Furthermore, DOpus is already 22 years on the market. Recently, they started offering a light version that only costs about 30$ (but doesn’t have all the nice features of the Pro version).
It might be worth considering this explorer replacement…