Emacs Customisation Notes (Part 1).

In my previous email I wrote about my love of using Emacs for all of my text editing needs, and I was driven to ensuring that I make the best possible use of this king amongst text editors.

I wanted to revisit my customisations and ensure that my Emacs was all that it could be. Here are some notes on how I have tweaked Emacs up till now. This can act as a baseline for my future shenanigans.

Customised Startup.

Emacs uses an initialisation file which can be used to control everything from keyboard layout to the myriad of plugins that are available. These plugins are, by and large written in Lisp, and on Linux machines many of the most useful ones can be installed as sets from the appropriate package manager. Once the Lisp files have been installed they can be enabled by adding incantations to the initialisation file.

Making Initialisation Universal – Or See, I Told You Dropbox Was The Nutz.

As I use Emacs on both my home laptop and on my work Linux machines I really wanted a way to be able to have a shared functionality across the systems. I did this in two stages. Firstly I created the .emacs file (the starting point for initialisatons) in a suitable folder in my Dropbox (~/Dropbox/emacslisp). I then created a symlink from the Dropbox folder to my home directory as Emacs expects the initialisation file to be there.

My .emacs file is actually pretty simple as its purpose is to call other files which have been created to contain the actual customisations.  The customisation files are named to indicate the purpose of the files themselves, and each one is included using the command:

(load “emacsExperimental”)

There are several initialisation files which are used:

  • emacsExperimental
  • emacsBuiltin
  • emacsAppearance
  • emacsHTML
  • emacsLatex
  • emacsOrgMode

These are largely self explanatory.

Fast Starting Emacs.

One of the criticisms that some people have of Emacs is that it can appear to be quite slow to start up. This is a valid when compared with something like Vi or Nano. It is less valid when compared to a more graphical text editor like Notepad++. However, there is an easy way to speed the process of launching Emacs. The process is two staged. Firstly Emacs is started at login as a daemon. This can be managed through a suitable session editor for your Window Manager.  Nothing different appears to happen at login. No windows are created, and no perceptible difference in memory usage occurs. But then, when you actually want to launch an Emacs session you use the command:

emacsclient -c

or

emacsclient -t

-c gives you a full windowed Emacs session, -t runs Emacs in the terminal that you issued the command from.

Launching of the Emacs client is very fast, and you will be deposited in the suitable window ready to start typing very quickly.

Issues With Emacs Server.

Of course the issue with the Emacs daemon is that it launches at login. If you make changes to the Emacs initialisation files then these changes aren’t automatically available in the daemon mode Emacs. This means that you have to either kill and restart the daemon or you can use the ‘normal’ Emacs as a test bed while you check that everything is working as you would like. This is a minor inconvenience in the grand scheme of things as customisation of Emacs is something you probably only do once in a while.