Groundhog Day Resolutions - June 2021

The intro to these posts always seems to be the same: things were busy and I didn't get as much done as I wanted. May was no different.

May's primary goals

1. Run a marathon

This was one of my largest goals for the year and I'm really pleased with how it went. It was a lot more enjoyable than my first marathon; there were people clapping and cheering for parts of the course which really helped.

And as an added bonus I took an hour off my previous time.

May's secondary goals

1. Write more

I wrote a whole two posts in May. Not good.

2. Finish my Atari ST text adventure

Another failure here. I added a couple of extras to the engine, but it's nowhere playable.

Primary goals for June

1. Complete one secondary goal

I have a nasty habit of leaving my secondary goals until autumn, so I want to try and get more done before then.

2. Complete one session of deliberate practice

I've been neglecting this goal for the last couple of months. Having an outlet to try small projects is something that I find helpful and I've missed having it.

3. Plan my three bodyweight skill goals

Now that I'm not running a bunch of miles every week I want to concentrate on my bodyweight skills. My back really ached towards the end of my marathon, so I'd like to work on strengthening that before I start training again.

Secondary goals for June

1. Write more

I'd like to publish at least 6 posts before my next GHD summary.

I did a lot of work during May but didn't complete many personal goals. Marathon training has taken up a lot of my focus so far, so now that I've completed that goal I'm hoping to spread some energy to other areas.


MicroEMACS for the Atari ST

One of my goals this year is to create some software for the Atari ST. For my first project I wanted to use an environment that was close to the one I used growing up, but with improvements where possible.

The first thing I wanted to improve was text editing. The original BASIC editor I used lacks a lot of features I'm used to: it can only edit one file at a time, doesn't have copy/paste support, and navigating with a keyboard is quite limited.

A full-blown Emacs installation is a little large for the humble ST, but there is an alternative: MicroEMACS.

Editing this post with MicroEMACS

It doesn't have the full range of Emacs features, but it does have some handy functionality:

  • Supports multiple buffers.
  • Can mark regions and cut/yank them.
  • Has tab completion for commands and filenames.
  • Has much better keyboard support for moving around a buffer.
  • Can use C-s to search and .
  • Can record keyboard macros.

It doesn't do everything that modern Emacs does, but it's certainly an improvement on the editor I originally used.

MicroEMACS for the ST can be found on atariuptodate.de.


Distraction free writing with Emacs

I use Emacs for all of my writing (including this blog). For a long time I used the default environment, but I really missed the more focused approach of applications like WriteRoom. So a few years ago I made an effort to streamline my Emacs writing environment.

With a few additional modes - and a small amount of elisp - I was able to get Emacs looking like this:

Writing this post with Emacs

(The theme is doom-nord and font is Ubuntu.)

It's a fairly simple setup with only a few different parts.

Removing distracting UI elements

I don't think a toolbar or menu is particularly distracting, but it's visual clutter that I don't use. This code comes from my minimal Emacs configuration and hides these elements:

;; Hide the menu bar, tool bar, and scroll bars.
(when (fboundp 'menu-bar-mode)   (menu-bar-mode   -1))
(when (fboundp 'tool-bar-mode)   (tool-bar-mode   -1))
(when (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

Centering and enlarging the text

The majority of my writing is done inside org-mode, but I also use org-mode to manage projects so I don't want every buffer to use these settings. For writing projects I use a .dir-locals.el file to automatically enable specific modes and to increase the font size.

((org-mode . ((eval . (progn (turn-off-auto-fill)
			     (text-scale-set 1)))
	      (fill-column              . 80)
	      (visual-fill-column-width . 80)
	      (olivetti-body-width      . 80)
	      (mode . olivetti)
	      (mode . visual-line)
	      (mode . visual-fill-column))))

The code in the eval block turns off hard-wrapping, increases the font size, and enables olivetti-mode.

I use olivetti to narrow the writing area to 80 characters which I find easier to work with. darkroom is a good alternative to olivetti; it provides similar functionality, but also more options and can even set an entirely different font face when enabled.

2021-08-11 edit - Updated .dir-locals.el with new activation as olivetti has removed the turn-on-olivetti-mode function.

~~~
If you found this helpful and would like to read more content like it, follow me on Twitter.


Groundhog Day Resolutions - May 2021

April turned out to be even busier than March, so I wasn't able to spend as much time on personal projects as I would have liked.

April's primary goals

1. Create a playable prototype of something

I have the basics of a text adventure engine working, but there's a lot more to do before I'd consider it playable.

2. Release the new version of Craft Roulette

Didn't even touch this. Not a huge loss, but I really wanted to get it done and off my list.

3. Contribute to another free software project

I contributed some changes to zetteldeft.

April's secondary goals

1. Run 115 miles

I stuck pretty close to my running plan, with only a few exceptions due to injury. I feel like I peaked a little early, but we'll see how things go on race day.

2. Plan version 1.1 of Writing PHP with Emacs

I have a list of things I want to include in version 1.1, and I've started research for this new content.

Primary goals for May

1. Run a marathon

Due to Covid-19 this was delayed by two months, so I've been training in some form or another for six months now. It's still not going to be quite what I wanted (no crowds are allowed at the finish) but at least I won't be alone this time.

Secondary goals for May

1. Write more

The last few weeks have been pretty slim on writing. I have a dozen or so post ideas, but inspiration really dried up as work got busier. I'd like to get back in a decent rhythm this month.

2. Finish my Atari ST text adventure

I have some ideas for it, and I have the basics of the engine down. There are still lots of puzzles to create - and a lot of writing to do - but it's getting there. I'd like a playable version online by June.


Automatically changing an org task's state when clocking time

In "how I get work done with Emacs and org-mode" I talked about how I manually switch a task to IN-PROGRESS when I start working on it. It's not a huge inconvenience, but I did wonder if I could configure Emacs to do it for me.

Of course there's a feature for that.

There are two variables that can be used to configure org's behaviour when clocking time:

org-clock-in-switch-to-state
The state to change a task to when clocking in.
org-clock-out-switch-to-state
The state to change to when clocking out.

Both of these variables can either be a string which will be the new state, or they can be a function. If they're a function it must accept ONE parameter - the task's current state - and return the state to switch to.

In practice it looks like this:

;; Always change the task to IN-PROGRESS.
(setq org-clock-in-switch-to-state "IN-PROGRESS")

;; Use a function to decide what to change the state to.
(setq org-clock-in-switch-to-state #'sodaware/switch-task-on-clock-start)

(defun sodaware/switch-task-on-clock-start (task-state)
  "Change a task to 'IN-PROGRESS' when TASK-STATE is 'TODO'."
  (if (string= task-state "TODO")
      "IN-PROGRESS"
      task-state))

It's a small change, but it smooths out a slight wrinkle in my workflow.