Creating HTML faster with Emmet

A picture is worth a thousand words, so here's all you need to know about Emmet.

Emacs + Emmet = HAPPINESS

Emmet is available for a number of IDE's and editors, including Emacs. If you've ever written any CSS you'll feel right at home with how selectors and identifiers work.


Distraction free writing with Emacs

Emacs darkroom-mode

Emacs is a great platform for many things, and in just a few steps it can be setup for distraction free writing.

You'll need a copy of darkroom-mode, which can either be downloaded from the darkroom-mode homepage, or installed using M-x package-install darkroom.

Once installed it's good to go, but I prefer slightly different settings to the default.

I use use-package to manage my configuration, but the setup is pretty much the same without it (just use the contents of the progn expression). The following will set the font to be larger and will limit the page to 80 columns wide:

(use-package darkroom-mode
  :commands darkroom-mode
  :init
  (progn
    (defvar darkroom-mode-face-foreground "Inconsolata")
    (defvar darkroom-mode-face-size 160)
    (defvar darkroom-mode-center-margin 80)
    (define-key global-map [f12] 'darkroom-mode)))

Once everything is configured, hitting <f12> will toggle darkroom mode.

To remove the title bar and go into full-screen mode, you'll need a little extra trickery:

(defun pn/full-screen-toggle ()
  "toggle full-screen mode"
  (interactive)
  (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
(global-set-key (kbd "<f11>")  'pn/full-screen-toggle)

The code above will bind <f11> to toggle window decorations and go full-screen (linux/mac only).


Using Electric Indent with Org Mode

Recently I've been using electric indent mode to handle automatic indentation. It's very useful when writing code, as it indents blocks automatically when the enter key is pressed. But some of that behaviour isn't desirable when using other modes, such as org mode.

One thing I like about org-mode is the keyboard shortcuts for inserting new headlines and todo items. For example, ALT+ENTER will create a new headline beneath the current line at the correct depth.

Unfortunately, when using electric indent the headlines are indented:

Emacs org-mode with electric indentation

Thankfully the solution is relatively simple. The following code in your emacs intialization will disable electric indentation when working with org files.

(add-hook 'electric-indent-functions
	  (lambda (x) (when (eq 'org-mode major-mode) 'no-indent)))

So now you'll get the expected behaviour:

Emacs org-mode with electric indentation

Beeminder for Emacs

This is one of those strange things that really came out of nothing. This morning @bmndr tweeted the following:

It really struck a chord with me. All of my income comes from freelancing, so it's pretty important for me to be as productive as possible.

Most of my work these days is done in Emacs, and I use it for managing my various projects and todo lists. I've also been using Beeminder for the last few years to keep me on the straight and narrow.

At the end Clarissa mentions that it would nice if moving a task from TODO to DONE in Emacs could notify Beeminder. This is something I've wanted for a while, but my lisp skills are limited at best.

Thankfully Sacha Chua posted a great comment with some code that started me on the right track, and after a couple of hours of research I managed to come up with something that works.

beeminder.el is a simple extension for Emacs that adds some limited Beeminder functionality, such as fetching goals or adding data. It also integrates with org-mode, and can be configured so that closing a TODO item will add a data point to a Beeminder goal.

And it all came from just one tweet. Weird.

Project page: beeminder.el


2013 Postmortem

2013 was a bit of a mixed bag for me. Overall it was very successful, but I feel it was as balanced as I would have liked. I certainly did much better from a business standpoint, but as a result my personal projects suffered.

What went right

  • Increased my earnings – Probably my biggest win of 2013. I don't really like talking about money, but my 2013 earnings were higher than 2011 and 2012 combined.

    Sadly there's no secret formula here, I just spent a lot more time working. One thing that really helped was to set a "minimum hours billed" goal on Beeminder, which kept me moving forward on days where I'd rather not work.

  • Pushed myself – I took on some more advanced projects this year, which let me really stretch myself technically. Not only did I get to create some cool stuff, but I learnt a lot of new skills along the way.
  • Rebuilt philnewton.net site – This is something I'd wanted to do for a long time, and finally got around to it in September. Along with switching the backend from WordPress to Jekyll, I added a lot more content (probably more in 4 months than the 4 previous years).

    Overall I'm quite pleased with how this went, even if the actual conversion took a lot longer than I would have liked.

What went wrong

  • Let my fitness slide – I've never been particularly sporty, but I definitely noticed a drop in my overall fitness levels in 2013.
  • Didn't make any games – I try to take part in game jams at least once a year, but 2013 just didn't go right for me. I entered Ludum Dare 27, but ended up dropping out on the Saturday as I just felt burnt out from work.
  • Didn't set any goals – I didn't set any concrete goals at the start of 2013, which is probably why I feel like the year passed without me achieving anything.
  • Spent too much time unfocused – Working from home means I don't have to worry about commuting or only having a certain amount of time to get things done. As a consequence, it means work tends to stretch out over the day, and I'll often be working on things piecemeal throughout the day.

Goals for 2014

  • Get back to time boxing – I really don't like how my work hours have spilt into the rest of the day. Time boxing is something that's helped in the past, and I'd like to start using it again in 2014.
  • Improve my fitness – This is a combination of eating less junk and doing more exercise. I generally walk the dog a few miles each day, but I'd like to improve my strength and aerobic fitness.
  • Take part in the One Game a Month challenge – Even if they're only small toys, I really want to get back to making games.
  • Spend more time on personal projects – I have a huge list of personal projects, and I'd like to at least make a dent in it this year.

Here's hoping 2014 is even better!