Where parallels cross

Interesting bits of life

Emacs as your code-compass: what files do I need to change next?

Too long; didn't read

You changed a file and now you feel something is missing? Let Emacs produce a list of files you have to change for you.

The problem

Emacs should do more work for us. This is what made me wish to build code-compass in the first place. Computers are fast. They are great at boring stuff. For example, it is boring to remember the files I still have to change, given I have changed the file at hand. So I wonder: can I make Emacs tell me what changes to do after this in a readable way?

It is a problem indeed

Sam Carpenter writes in his book Work the system that the worst problems are errors of omissions. I find this is true both for work and for private life. I miss some important step and so I damage things. If that happens, Sam suggest you lack process. A process is a stable way of doing things. And as Flaubert says: "Be regular and orderly in your life, so that you may be violent and original in your work". So even when we change files we should have a process. And a guide that indicates the road. Or a compass!

And there is a solution

I discussed in a previous post how we can use code-compass to find change-related files. That allows you to reach all the files to edit next. But what if you already changed them? That does not show you that information. But we can build over that!

Let's think a moment. We know the files linked to the current one. We can know which ones we already modified from Git history. We have a marvellous format to show us a todo list: Org Mode.

Given those ingredients, let me show you what we can do with code-compass now.

You can see that I edit a file. Then I wonder what files I need to modify next. I produce a todo list with the next files. I modify the first and when I produce the todo list again, that is marked as DONE.

How cool is that?! This is what I got so far. This still needs some testing, but I was too excited to keep it for myself.

An improvement I see is to include all the modified files in the list, not only the one you are in. In that way you would have a more complete todo list for what you changed so far.

Note that this list may not be complete. This because it makes todos based on old changes. If you are doing something new, this cannot help you.


This is cool! We are a step closer to make Emacs doing things for us. If you want to try, get code-compass, load it and run c/create-todos-from-coupled-files on a file: if it has related files it will generate your todo list!

Happy generation!