Emacs notes

I spent some time today cleanup up my Emacs configuration directory. The files are now up in a new repository on Github: emacs-conf.

Emacs in action, including a compilation buffer, debugging (GDB) buffer, Org buffer with the README for the emacs-conf repository, IRC for #blendercoders, and a shell.

Most of the stuff in there should be quite easy to copy and paste into your own configuration if you don’t want the whole thing. If you do want to try all of it, simply replace your .emacs.el with this:

(add-to-list 'load-path "/path/to/emacs-conf/")
(load "top")

I also append this to my .emacs.el.

(cd "/d/src/blender/git-trunk")
(shell)

Of course, you will want to replace the path with something more useful on your own system.

General advice, some of it Emacs-specific:

  • Rebind your capslock key to a control key. I do this system wide. In Ubuntu it can be done easily from System Settings (Keyboard Layout > Options > Ctrl key position > Caps Lock as Ctrl. It can also be done with XModMap. In Windows you’ll need to make a small registry edit. See also this overview of various techniques.
  • Related to the control key, be careful with your hands. If you find some action is causing your hands/wrists/arms to hurt, find a different way to do it. Or take more breaks. Or buy a different keyboard. Basically, don’t let programming damage your hands!
  • Make sure your Alt (Meta) key isn’t tied up with something annoying. In Ubuntu you probably want to disable or rebind the HUD.
  • Look at how other people do things. For example, some of my configuration (like C-x C-m as a replacement for M-x) comes from Steve Yegge. Emacs has been around for a long time, so it’s quite likely that someone else has already found a solution for most problems you encounter.
  • Use a big screen, or multiple screens. I use an HP ZR30w (30 inches, IPS panel.) Especially when refactoring a large piece of source, being able to see a lot of things at once is very helpful.
  • Related to the above, if you split your Emacs window into a lot of smaller sections (in Emacs terminology that’s splitting a frame into lots of windows), it’s important to be able to switch between them rapidly. I use C-M-j and C-M-k for this (that’s Ctrl+Alt+J and Ctrl+Alt+k).
  • Keep everything inside Emacs, where possible. You don’t need to run a separate terminal for compilation, debugging, or general shell commands. These can be done inside Emacs with commands like “compile”, “gud-gdb”, and “shell”.
  • Identify patterns in your own work and automate them with a key binding. In Emacs, everything can be scripted.

4 thoughts on “Emacs notes”

    1. It’s actually just a full-screen emacs. The window (or frame in emacs terminology) can be split into columns and rows (confusingly these areas are called windows in emacs terminology).

      To answer your question though, I use GNOME shell. Not a well-loved desktop environment I guess, but it has a good keyboard interface: simply press the key and start typing the name of whatever application you want.

Leave a Reply

Your email address will not be published. Required fields are marked *