Groundhog Day Resolutions 2016

Last year I decided to start the year right by organizing all of my goals and ideas onto a Trello board. It seemed like a productive thing to do at the time.

However, when December rolled around there was still much that hadn't been touched. It wasn't that I didn't want to do things, they just got lost amongst everything else.

The lesson for me here: it's not much use having things written down if you don't look at them.

This year I'm trying something different: Dave Seah's Groundhog Day resolutions. Instead of a large list of resolutions at the start of the year, it's a smaller list made every month.

Here's February's (very short) list:

Release a game for #1GAM 2016

I wrote 4 games for #1GAM back in 2014 and had a great time. 2015 was not so good, but I want to get back on the game development wagon this year.

Finish the rebuild of Sodaware

This is something I've wanted to get done for a while but just kept pushing it back. Sodaware was my first "real" website, but sadly it's been left to gather dust over the last few years.

My original plan was to use Jekyll (which is what powers this site), but I've since decided to go with Middleman. I still like Jekyll, but Middleman felt like a better fit for a none-blog site.

Write one blog post a week

Every year I tell myself I'm going to start writing more. Why should 2016 be any different?

More to come next month (March 3rd).

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.

Fullscreen writing with darkroom-mode

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
    (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"
  (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).

Disabling electric indent in 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. Placing either one of the following pieces of code in your Emacs intialization file will disable electric indentation when working with org files.

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

;; Method two.
(add-hook 'org-mode-hook
	  (lambda () (electric-indent-local-mode -1)))

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