HOWTO Edit your crontab with Emacs

Another ”wee” tip. I had a hard time doing this right…

Put emacs in the EDITOR shell variable:

$ EDITOR=emacs
$ export EDITOR

and add the following to your ~/.emacs:

(set 'temporary-file-directory "/tmp")

Now, edit the crontab file via:

$ crontab -e

Edit and save the file, and you should get a response from crontab:

crontab: installing new crontab

If you get an error message, something is wrong. You can check that your edits really changed your crontab using:

$ crontab -l