Introducing elcontext

February 04, 2018

I have just finished my first elisp package elcontext. It introduces context based actions for Emacs.

img

Context based actions

A context-based action is an Emacs command called under certain conditions. These conditions can include the current time (similar to a cron job), the current folder and the current GPS location (available only for macOS).

My use case

The original reason to create elcontext was to setup my development environment depending on my current location (e.g. workplace, home). I use prodigy to define services I need and elcontext starts them.

Technical details

A new context is created interactively by using abo-abo’s fantastic hydra package:

img

If a part of a context is omitted this part is always valid e.g. no location means anywhere, no time means anytime. Each command is triggered once a day.

I used Emacs’ Tabulated List mode to get an overview of all created contexts. Triggered contexts are highlighted in green:

img

All context data is stored in hash tables which can be created or accessed conveniently with ht and the GPS coordinates are retrieved via osx-location.

Conclusion

I am proud I finished my first Emacs package and happy to share it with you. If you consider elcontext helpful I would be pleased to hear about your use cases.