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

Posted in: Emacs | Comments (0)

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

Posted in: Emacs | Comments (2)