Org mode is slowly spreading its tentacles increasingly becoming something, I cannot live without, to manage my day.
And I’m getting pretty consistent with it too!

Like you see above, I use dates as my headlines, below which I list the various tasks for the day.1
And that’s where I run into my current itch to scratch.

I don’t want to keep typing out the date daily.
The computer can do that for me.
But how? Of the millions of ways possible, what do I want to do?
My first thought was to figure out some way to insert a date into Emacs.
And then I thought, why only emacs? I want it systemwide, across all my programs.
So I checked if Espanso, my friendly text expansion program, would do that for me.
Turns out, Espanso does!
I could just type :dtx wherever I wanted and Espanso would happily insert the date in there. And so I did that for a few days.
Problem solved? Well, that’s when the itch got stronger.



See my evening tasks above?
I use Cal Newport’s idea of a shutdown ritual, to empty my mind and plan the next day, every evening.
Which, for the past couple of weeks meant using my little expansion snippet to put in today’s date for the next day’s headline, as I began planning it. And I’d just manually change the date part to the next day’s date.2

Until today.

I typed in :dtx and I got 2022-07-31.
And then the lazy bum inside me groaned. What? I need to the change the month too?
The computer can do that for me!

So I went back to Espanso to see if it did support date expansions for tomorrow.
Turns out it does!
Only for some reason, it just wouldn’t play ball with the way I want my dates expressed, (YYYY-MM-DD). It would throw weird yaml errors.
And then I recalled Emacs just called the shell to do it.
So I went looking to see, if Espanso could call the operating system shell3 to do expansions ala Emacs.
Turns out, it can!

Finally, I looked up how the date command worked with past and future dates, and jigged up a small expansion snippet and put that into Espanso’s match/base.yaml

  - trigger: ":dttx"
    replace: "{{output}}"
    vars:
      - name: output
        type: shell
        params:
          cmd: "date  --date='tomorrow' +'%Y-%m-%d'"


Et voilà!
No more backspacing and struggling with Espanso undos and date calculations.
:dttx turns into tomorrow’s date:2022-08-01!
And the monkey brain is happy again :)

P.S. Subscribe to my mailing list!
Forward these posts and letters to your friends and get them to subscribe!
P.P.S. Feed my insatiable reading habit.


  1. Subtasks not shown. ↩︎

  2. like yesterday evening, I typed in :dtx to get 2022-07-30 for e.g. and then changed the 30 to a 31↩︎

  3. in my case, bash ↩︎