In the past years I fell form one rabbit's hole into another. For the first time in a rather long time, I feel I am getting out of one.
First of all let me tell you what I produced. I built the "Emacs Make Compile",
or "Emacs Master of Ceremonies", package
EMC.
Soon it will be available in melpa.
The EMC package is a wrapper around compile.el
that allows you to semi-transparently
invoke make
or cmake
from Emacs. Either on UN*X, MacOS or Windows.
Once you have loaded the emc
library in the usual ways, you can just issue the
Emacs command emc:run
(yes: Common Lisp naming conventions). The command is just
the most general one available in EMC; other ones are the more specialized
emc:make
and emc:cmake
. Emacs will then ask you for the necessary
bits and pieces to ensure that you can run, say, make
.
The README file included in the distribution explains what is available in more details.
Where did it all begin?
Why not stick with compile.el
? Because it does not have "out-of-the-box" decent
defaults under Windows. At least, that was my original excuse.
I fell into this rabbit's hole coming from another one of course.
Some time ago, I started fiddling around with Emacs Dynamic Modules.
I wanted to compile them directly from Emacs in order to "simplify" their deployment. Therefore, I
set out to write a make
function that would hide the compile
setup.
Alas, I found out that, because of the necessary setup, invoking the
Microsoft Visual Studio toolchain
is not easy before you can get to cl
and nmake
. That was not all that difficult as a problem to solve, but then I
made the mistake of learning to cmake
. You know; to ensure that the building
process was "more portable". The basic machinery for make
and nmake
worked to also get cmake
up and running. But then I made another mistake: I
started to want to get EMC to be usable in the "Emacs" way: at a minimum getting
interactive commands working. That got me deeper and deeper in the rabbit's hole.
At the bottom of the hole (yep: I got there!)
I found out many things on my way to the bottom. That is, I learned many things about the Emacs Lisp ecosystem and wasted a lot of time in the process. I never was a fast learner. All in all, I think I can now say two things.
- Making a command, i.e., an
interactive
function is not trivial, especially if your function has many arguments. Bottom line: your Emacs commands should have *few* arguments. I should have known better. - The Emacs
widget
library is woefully underdocumented (which, of course, brings up the question: why did you want to use it?)
In any case, what I was able to concot is that hitting M-x emc:make
does what you
expect, assuming you have a Makefile
in the directory; if not you will be asked for
a "makefile", say stuff.mk
to be used as in
make -f stuff.mk
- or
nmake /F stuff.mk
Issuing C-u M-x emc:make
will ask you for the "makefile", the "source directory",
the "build directory", "macros", and "targets".
In what other ways could I have wasted some time? By coming up with a widget-based UI! (See my previous
post about DeepSeek and the widget library).
The result can be invoked by using the command emc:emc
, which pops up the
window below.
Getting out of the rabbit hole by popping the stack
I kind of consider EMC finished.
I am pleased by the result; it was fun to solve
all the problems I encountered, although the code is not exaclty nice or nicely organized.
Is EMC useful? Probabiy not so much, but I have the luxury
of wasting hacking time. I just hope somebody will like it: please try it out and report bugs and
suggestions (the minor mode and associated menu need work for sure, as well as emc:emc
).
Having said so, I can now go back to play with Emacs Dynamic Modules, which is where I was coming
from. After being satisfied with that, I will be able to climb back up a bit more from the rabbit's
hole; that is, I will be able to go back to the magiciel
library (which kind of works already). You may ask why
I am writing magiciel
, but you will have to reach down several levels in the rabbit's hole.
In any case, I finished one thing. It's progress.
'(cheers)