4 GTD: Process

Processing means going through the jobs you’ve collected and getting them into a suitable format. If the job is one which would be quicker to do right away than to process, then do it.

Rules for Processing

  • Go through your list of unprocessed tasks
  • Process the top item first
  • Process one item at a time
  • Never put anything back into “in”

The key question when processing is to think what’s the Next Action? Too many jobs don’t get done because people aren’t clear about what the Next Action is. For example, you might want to tidy your office. What’s stopping you doing that? Perhaps you’ve nowhere to put the rubbish. In that case the Next Action is “Get Bin Bags”

Perhaps you need to arrange a meeting. “Arrange a meeting” is not a suitable Next Action. To arrange a meeting you need to find out when people are free. A more suitable Next Action would be “Phone Steve”

Taking a moment to decide the Next Action removes one cause of stress. If you have a job that’s preying on your mind it’s usually because you haven’t decided what the Next Action is.

Related Links

2 Functions in Elisp

Here’s how to define a simple LISP function

1: (defun pi ()
2:   "A sample non-interactive function"
3:   3.1415
4: )

The above is a non-interactive function that simply returns 3.1415. Evaluate it (C-x C-e, remember?) and you will see the word pi appear in the echo area. Try M-x pi, though, and Emacs won’t find the function. If you want to be able to call a function using M-x, you have to make it interactive, as follows.

1: (defun print-pi()
2:     "Insert an approximation to pi"
3:     (interactive)
4:     (insert "3.1415")
5: )

So why would you want a non-interactive function? Perhaps because you want it to be called from another function, as follows:

1: (defun circumference-of-circle()
2:     (interactive)
3:     (message "The circumference of a circle diameter 3 is %f" (* pi 3))
4: )

Before evaluating the above function, make sure that you have evaluated the non-interactive function pi.

There are lots of different types of interactive functions. The next interactive function is more useful in that it prompts for the diameter to be input (the n at the start of “nInput diameter of circle:” is what tells Emacs to prompt for a number)

1: (defun circumference-of-circle(diameter)
2:     "Calculate the circumference of a circle given the diameter"
3:     (interactive "nInput diameter of circle:")
4:     (message "The circumference of a circle diameter %d is %f" diameter (* 3.1415 diameter))
5: )

Here’s the same function but this time set up to receive the parameter from the universal argument. That is to say, in the form C-u 4 M-x circumference-of-circle.

1: (defun circumference-of-circle(diameter)
2: (interactive "p")
3: (message "The circumference of a circle diameter %d is %f" diameter (* 3.1415 diameter))
4: )

Here’s an example of a function that reads strings and tests your knowledge of capital cities.

1: (defun capital-of-france(answer)
2:     "Simple quiz example."
3:     (interactive "sWhat's the Capital of France?")
4:     (if (string= answer "paris") (message "Correct!") (message "Wrong!"))
5: )

Argument codes for interactive functions can be found here http://www.gnu.org/software/emacs/manual/html_node/elisp/Interactive-Codes.html#Interactive-Codes

Next: Interactive Functions that work on Regions

1 Beginning Emacs Lisp

LISP is derived from the term LISt Processing.

A list in LISP looks like this:

(Knife Fork Spoon)

or like these two examples
(set-background-color "yellow")    <- C-x C-e
(set-background-color "white")    <- C-x C-e

If the first item in the list is a function you can evaluate the list by placing the cursor just after the bracket at the end of the list and pressing C-x C-e. Try it with the two lists above. Copy them into Emacs and then C-x C-e where indicated to turn the Emacs background yellow and then to set it white again.

If you try to evaluate the (Knife Fork Spoon) list you’ll get an error telling you that Knife is a void function.

Try evaluating the following lists in Emacs by typing C-x C-e after the closing bracket:
(linum-mode)
(message "This is the echo area")
(* 2 3)
(+ 4 5)

The last three will output their results in the echo area, the area at the bottom of Emacs.

You can also evaluate a function by typing M-x (function name). So M-x visual-line-mode will turn word wrap on and off.

Emacs supports TAB completion, so typing M-x visu and pressing TAB is enough to fill in the function name.

You set a variable as follows:

(set 'name 'John) C-x C-e to set the variable

name C-x C-e to see the contents of the variable “name”

If you press C-x C-e after (name)you’ll get an error. Remember, name is a variable, (name) is a function, and you haven’t defined a function called name.
It’s a nuisance typing in ‘ all the time, so the following is often used
(setq animal 'cat)

Evaluate the above and then evaluate animal …

C-u C-x C-e will insert any output directly in the text area, rather than in the echo area.

Here is a list of cheeses called cheese:
(setq cheese '(Stilton Wensleydale Cheddar Cheshire))

Evaluate the list.

The first item in a list is called the car, the remaining items are called the cdr (pronounced could-er) The Emacs Lisp tutorial will tell you why. Evaluate the following:

(car cheese)
(cdr cheese)

… and there you are

Next: Functions in Elisp

3 GTD: Collect

  • You can’t organize what’s incoming, you can only collect it and process it.
  • You don’t manage priorities, you have them

Collection is the key to the whole process of GTD.

Collection means writing down everything you have to do, and this means everything.

If you have a good memory, and I do, the temptation is not to bother, but this means that you’re not trusting the system. If the system doesn’t have everything you need to do in it, then you won’t trust it and you’ll go back to worrying that you’re not doing all your tasks.

You also won’t be able to plan properly.

I’m getting more and more in the habit of capturing things I need to do, even jobs I know I’ll do in a short time.

Here are some jobs I’ve captured

  • Email Harold about Films
  • Watch Epilepsy Video
  • Write UCAS reports
  • Buy birthday card
  • Organise VLE training for September
  • Investigate Trello software

I use Emacs org-mode capture to capture my tasks, but that’s just my preference. Evernote is good, but the system works perfectly adequately using pen and paper.

Related Links

2 GTD: Overview

There are five parts to GTD

  • Collect
  • Process
  • Organize
  • Reviewing
  • Do
You should only ever be doing one of these things at any one time: 95% of your time should be spent doing.

The basic principles of GTD are just common sense.

First, collect all the things you have to do and write them down.  If your tasks are all recorded you know that they won’t be forgotten. If you know you’re not going to forget things you’ve just removed one cause of stress.

Next, organize your work so that jobs get done at the right time.  This stops the feeling that you’re drowning in trivial jobs when should be doing something more important.

Having done that, do the work. If you have all your tasks organized properly you can look up a couple of five minute tasks when you have ten minutes spare, when you have a longer stretch of time you can get down to a more challenging task.

Review your system every so often.  Priorities will change, you’ll need to reorganize your work to take this into account.

GTD involves writing down all your jobs.  It doesn’t matter whether you do it on paper or use an IT solution such as Evernote or my preferred solution, Emacs.  Everything you have to do – making a phone call; sending a birthday card; starting a big project;  buying a book to read… write it down.

Related Links

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 http://orgmode.org/manual/Installation.html, 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: http://ftp.gnu.org/gnu/emacs/windows/  Emacs comes as a zip file looking something like this:  emacs-24.3-bin-i386.zip         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: http://www.filewatcher.com/m/ispell.zip.352502-0.html
  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 http://cygwin.com/ 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

Getting Things Done, or GTD, is a time-management methodology.  It’s basically just common sense, but I’ve used it for some time now to keep track of jobs and projects.

I first encountered GTD through its various implementations in Emacs org-mode, it seemed like a sensible system to adopt so I gave it a try.  Note however that GTD is not a computer based system: I use Emacs because I use Emacs.  Beginners are advised to start by using a paper based system; you can use Evernote just as well.

The following is just an overview.  To find out more, read the book: Getting Things Done by David Allen (paid link)

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 done is separated things out. You’ve separated reference materials from the actions, and eliminated the chaff.  That’s GTD, simple but effective.

Related Links

Regexp Builder

Emacs has an interactive regex mode that shows matches as you type.

To go into the mode, M-x regexp-builder.  Type C-c C-q to exit the mode.

Watch out for escape characters.  Emacs requires you to escape \, so type \b for \b

Copy the following text into emacs and then M-x regexp-builder

Lots of Grey things
50 shades of Grey
Earl Grey Tea
Lady Grey
Graybeard the pirate
Greyhound buses
"You're looking grey," he said.
"That's the greyest greyhound I ever saw," said Earl Grey.
Grey1: Dark Gray
Grey35: Mid grey
Grey44: Battleship grey
Grey100: The colour of TV tuned to a dead channel

In regexp-builder, type…

Grey to find all the Greys
Gray to find all the Grays
Gr[ae]y to find all the Greys and Grays
\\bGray\\b to find Gray on its on and not part of another word
^Gray to find lines beginning with Gray
grey$ to find lines ending in grey
grey\\(hound\\)? to find all appearances of grey and greyhound
grey[0-9] to find all the shades of grey ending with a digit
grey[0-9]\\{2\\} to find all the shades of grey with exactly two digits

Follow the link for some Regexp Exercises to try out

Read more about Regexps at the Emacs Wiki

Ctrl-Alt-Delete Task Manager

One of the things I really missed when I moved to Linux was hitting Ctrl-Alt-Delete and bringing up the Task Manager. Okay, maybe I didn’t miss it so much, programs don’t hang anywhere near as often on Linux, but when they did I found hitting Ctrl-Alt-Delete brought up the log out message on my distro.

If all you are looking for is the Task Manager, then open the System Monitor. You can end processes from there.  If you want to know a little bit more, read on…

What is a process? A process is the execution of a command by the Linux kernel. The parent process is called init. Type pstree in the terminal and you’ll see something like the following:

You’re more likely to use the ps command to see processes.

Typing ps in its own will show the processes associated with the user in the current terminal.

Here the only processes running are terminal and the ps command itself.  Notice each process has a PID or Process Identification number associated with it.

ps -e will show every process running. This will produce a long list, so you’ll probably want to use grep to find the process you’re looking for.  Suppose you were looking for nautilus –

ps -e | grep naut
2103   ?   00:00:04     nautilus

You can see from above that the nautilus PID is 2103.  Suppose you want to kill the process.  A little research might suggest that

kill 2103

will kill the process.  Actually, it won’t.  The kill command doesn’t kill a process: it sends a SIGTERM signal to the process asking it to terminate itself.  This gives the process time to clear up behind itself before it goes.

kill -9 2103
will send a SIGKILL signal, terminating the process immediately.