Diffing directories

Sometimes I would like to recursively compare the files in two directories to see if one is missing in the other. Sometimes I would even like to discover files which contents are different in two directories.
So let’s see how Emacs can support me to do the job.

By executing M-x ediff-directories and inserting the two directories in question (or 3 directories by using ediff-directories3) and an optionally regexp to only match certain files Emacs will open a new buffer that lists the top of both directories.

To recursively compare them and get the differences just press == followed by a D. This will show you all different files. Subdirectories with differences contents dont have the prefix = and can be displayed by pressing enter.

You could also mark different files and directories and get a patch file by executing P.

Another but not builtin diff tool with a nicer UI is Ztree.

After the installation run it with M-x ztree-diff. This opens a new buffer, where you can hide/show all equal files and directories by pressing h and to copy or delete differences with C or D. No need to enter subdirectories thus it will give you a tree view per default.

Encrypted work diary

About two months ago the blog abesto.net inspired me to start a work diary. Being an Emacs lover the normal way for me to do it is of course in Emacs using Org-mode. By now the work diary helped me to keep track of Python debugging sessions and to remember what the hell I am doing at work and how I fixed a damn *peep* problem three weeks ago that’s now unfortunately crying again.

Here’s how I configured Emacs to give me an encrypted diary by pressing f8.

(setq org-capture-templates (quote (
("D" "diary" entry (file "~/organize/diary.org.gpg") "* %T %?"))))
(global-set-key [f8] 'org-capture)

I define an org-capture template that inserts a new line into the file ~/organize/diary.org.gpg. The ending .gpg is enough to let Emacs know it should be encrypted with GnuPG. The %T automatically inserts the current timestamp and %? includes the message you wrote. Afterwards i binded the key f8 to the org-capture function and that’s really all it needs! 🙂