Category Archives: Featured

Ubuntu Emacs Org-Mode Setup

Emacs works straight out of the box on Ubuntu however, at the time of writing, Ubuntu 12.04 still only comes with org-version 6.33.  It’s worth installing the latest version.  The installation instructions are on the org-mode site, but they’re not quite complete.

 Install the latest version of Org-Mode

  1. Download the org-mode files and copy to a suitable location (I put them in the Ubuntu One folder so they’re easily shared between PCs)
  2. sudo apt-get install texinfo.  This is the missing step that ensures the next part works correctly
  3. Navigate to the org-8.x folder and sudo make autoloads and then sudo make install
  4. Finally, add (add-to-list ‘load-path “/usr/share/emacs/site-lisp/org”) to your .emacs file

Unity Keybindings

Some of the Unity keybindings overwrite those of standard org-mode.  I get particularly frustrated not being able to use S-M-<UP> to sort lines.  The following sorts this out:

  1. sudo apt-get install compizconfig-settings-manager
  2. Launch compiz-config-settings-manager
  3. Dash Home -> CompizConfig Settings Manager-> Scale(icon) under Windows Management Category -> Bindings(tab) -> Initiate Windows Picker -> change to <Shift><Super>Up or similar

Alt and Alt Gr

I don’t make use of the way Ubuntu distinguishes between these two keys, and I prefer to set the Alt Gr key to act just like the Alt.  For one thing, it makes it easier on the hands to type M-f and M-b when moving forward and backwards through words (something I do a lot when editing) .  Making this change on Ubuntu 12.04 is easy

  • Open Keyboard Layout from the dash.  Choose Options, Alt/Win Key behaviour and select Alt and Meta are on Alt Keys

Note you you can also swap the Ctrl and Caps lock this way if you prefer.

For older versions of Ubuntu, the Keyboard Layout preferences are found on a tab in Keyboard in System Settings

Related Posts

Emacs Windows Setup

Installing Emacs on Windows

  1. Download a copy of Emacs for Windows from here:  Emacs comes as a zip file looking something like this:         18-Mar-2013 22:43   47M 
  2. Unzip the folder to a suitable location, e.g. C:/Program Files
  3. That’s it.  There is no other installation required.
  4. To launch Emacs, run the runemacs.exe file in the emacs-XX.X\bin\ folder
  5. You will now have a functioning copy of Emacs.

Follow this link to my Emacs Tutorial

…You’ll probably find, however, that not all features are present.  Follow the steps below to add the remaining features.

If you’re looking for how to get Ediff or the spell checker to work in Windows, you’ve come to the right place.

Ispell (Spell Checker) on Windows Emacs

  1. Download Ispell:
  2. M-x customize-variable and enter exec-path to include the path to ispell.exe
  3. Copy english.hash to emacs home folder. (You can find the path to your home folder by pasting the following into Emacs: (getenv “HOME”)  and pressing C-x C-e after the final bracket.)

M-x flyspell to turn on flyspell mode, which underlines misspelled words. Click with the centre mouse button on the misspelled word for a menu suggested changes.

I like to add the following to my .emacs file.  It maps the menu select option to the right mouse button.

(eval-after-load “flyspell” ‘(define-key flyspell-mode-map [down-mouse-3] ‘flyspell-correct-word))

Install Cygwin

Cygwin is “a collection of tools which provide a Linux look and feel environment for Windows.”

Installing Cygwin is the easiest way to enable all those extra features in Emacs

  1. Go to and run the setup.exe file on the website
  2. Install the default set of packages
  3. If you want to be able to use org-mode to export to ODT documents in Windows, you’ll need to install zip and unzip from the archive package.
  4. On Emacs, set exec-path to c:\cygwin\bin (or to wherever you installed Cygwin) (If you don’t know how to set exec-path, the easiest way is M-x customize-variable, enter exec-path and then insert the path in one of the fields.  Don’t forget to save the changes)
  5. Add c:\cygwin\bin to your Windows path and restart the machine

Done.  Emacs should now by fully working on your Windows machine.

Related Posts

1 GTD Example: Clear your inbox

Here’s a simple introduction to the principles behind GTD.

Is your email inbox full?  If so, the reason isn’t what you might expect.  It’s not that you’re not processing and deleting them as fast as you might.  Modern email systems can hold an indefinite number of emails, there’s no reason to delete anything you don’t want to.

The real reason your inbox is full is because it’s a mixture of different sorts of emails:   emails left as a reminder you have a job to do, emails you’ve left there for reference, emails you might need in the future, emails you might read later on.  Your inbox is confused because you don’t know which email is which.

Here’s the GTD solution: create some additional folders

  • Action
  • Bacn
  • Reference
  • To Read

Go down your inbox, processing each email one at a time.  Start at the top and don’t move onto the next email until you’ve processed the current one.

Process the emails as follows

  • If you don’t need the email, delete it.
  • If it will take less than 2 minutes to deal with, deal with it.
  • If you need to keep the email for reference, put it in the email folder called Reference (or in a more suitable folder you’ve already created)
  • If it’s something you want to read at leisure. put it in the To Read folder
  • If it’s an email list you’ve subscribed to, like a pizza deal or a voucher site, put it in the Bacn folder.  Bacn is like spam, except you asked for it.  It’s nice to have, but too much is bad for you.

Work your way down the list until you have an empty inbox.  Once it’s empty, it will probably stay that way.

It might seem that all you’ve done is move your list elsewhere, but what you’ve really fine is separated things out. You’ve separated reference materials from the actions, and eliminated the chaff.  That’s GTD, simple but effective.

Related Links

Steps to Learning Programming

There are lots of programming languages designed to make learning programming easier. In my experience they are a waste of time for most students. Many of the languages will allow students to make apparent progress and to produce what appear to be impressive applications, but if students don’t understand what they’re doing, they’ll quickly lose interest.

Here are the things that students need to learn, and the rough order in which they need to learn them.

  • Imperative commands such as PRINT “hello”
  • Variables and types, particularly the difference between strings and numbers
  • Simple arithmetical operations e.g. a = 3, b =4, c = a+b
  • Branch commands such as IF answer = “Paris” THEN PRINT “Correct”
  • More complicated branch commands – IF THEN ELSE
  • For loops or equivalent
  • While loops or equivalent
  • Nested branch commands
  • Nested loop commands
  • Arrays
  • Traversing Arrays using for loops and while loops
  • Functions and Procedures, or equivalent

And that’s it. Everything else in programming can be achieved using the above. The rest is just readability, convenience and elegance

The problem with some languages, particularly the visual ones, is that students produce results without understanding the above. If students don’t understand the above, they don’t understand programming.

Python allows you to teach all of the above. And then once the student has learned, they can build on what they know, replacing the pieces of their Python toolkit with more advanced constructs as they learn. And as programmers, they’re always learning…