Emacs and system appearance

I've collected many tricks and tips about Emacs over the years. I'm starting a series of posts on how to apply Emacs for modern environments.

It is often said you can easily implement any features other editors has in Emacs. As with other bold statements promising a silver bullet, it is only a half true.

Don't get me wrong, Emacs Lisp is a very expressive language, but the text‐based interface, lack of concurrency and so on puts a limit on what you can actually achieve.

For example, let us take a simple task such as switching themes based on system's appearance. One solution known to me only works on MacOS and require patches!

Let me document it here, also to provide a living example of how this famous extensibility of Emacs is really looks like.

Consider the following (awful) piece of code.

The whole idea is to use Apple Script to determine current appearance, change theme based on it, then watch for changes every three seconds using the idle timer.

So, only a few line of code, and we have implemented a small feature making our experience of using the editor a bit more ergonimic.

I wonder if it was something that felt worth doing?