Progress with clancs

Feb 19, 2013

Clancs being the name of the repo I’ve created on Github to track my efforts at porting SublimeClang to Emacs, as documented in a previous post.

So far I’ve removed (almost) everything ST2-specific (and Python 3-specific, just to make it easier to narrow in on what’s not working) from the plugin, I’ve also taken care to ensure that anything Emacs-specific is being done only from a handful of functions in one module. This has enabled me to quickly test what’s not working and what isn’t without having to quit emacs and relaunch it (or reload the python module via pymacs, but that doesn’t seem to work for from module import function statements). As a result of this, I now have the plugin working for a simple pair of header and source files, wherein I have everything (meaning the file’s name, position of cursor in the file, and arguments used by libclang) hard-coded right into the plugin.

The way it works is, with a bit of magic Pymacs somehow “creates” functions for python when hooked up with emacs. Every lisp function is converted into a python-equivalent at (presumably) call-time, so if you run dir(lisp), you won’t find any of them. I have no idea how it accomplishes this, but that’s something to explore at another type. For the time being, I have a global variable called “debug”, which I check before importing lisp from Pymacs. If debug is set to true, I create a skeleton class that returns an object with all the getters and setters I’m currently using from lisp, all of which update and return hard-coded values, making testing really easy. And it is with this setup that I managed to get the plugin working.

Next up is getting it working from Emacs, and then seeing if I can add more threads to it and reenable the background warmup of completion cache.