emacs

The magic of defadvice

I recently did some house-cleaning on my emacs configuration. What used to be a huge mess of git submodules and manually added files is now very neatly managed with the help of Cask and Pallet. But that’s not what this post is about. While cleaning up all the emacs packages that I’ve accumulated over the past three years, I realized that I’d installed Helm with the express intention of fiddling around with it, but had never actually gotten around to doing so.

Vagrant mount guest samba shares

Vagrant offers an unprecedented level of ease when it comes to recreating the same development environment across different machines. I currently am stuck with windows as my main OS, both at home and at work. Most of the work I do at home revolves around Node.js (and currently a bit of ruby too, thanks to Jekyll, but that might be changing soon) whereas the work that I do at the office mostly involves C++ and cross-compilation to QNX.

Elisp code for easily creating a new blog post

Another reason why I’ve been keeping off blogging is because each post needs to be in a certain format for poet to accept it. Here’s what this post looks like so far at my end: { { { "title": "Elisp code for easily creating a new blog post", "date": "11-17-2013", "time": "23:38:53", "tags": ["emacs", "elisp", "poet"] } } } Another reason why I've been keeping off blogging is because each post needs to be in a certain format for [poet](https://github.

Clancs is finally in a usable state

It’s been three weeks since I started working on the plugin, and now it’s finally in a working state. I’ll get around to finally adding a README to the project soon, but in the meantime here’s a bunch of things in no particular order: Parsing and compiling the file takes around 1-3 seconds depending on the size of the file and the sizes of all includes, but it’s completely asynchronous and as such will later be done as part of a visit-file hook.

Making an asynchronous plugin for Emacs

With the libclang functionality working reasonably well as a python module, it was time to move on to getting it to work with Emacs. Naturally, my first instinct was to simply use Pymacs to interface with Python and then figure out a way of making it asynchronous. So I spent a couple of hours and made a functioning version with Pymacs, and then explored my options for making it asynchronous. Two solutions stood out:

Converting relative paths to absolute ones correctly

Just a quick post about an annoying quirk that Emacs has and a way around it. Similar to most interpreted languages (well, similar to python anyway, which is the other place where I recently faced this problem) elisp doesn’t really treat relative paths the way one might expect it to. Instinctively, I expect a relative path specified in a script to be relative to that script under all circumstances. However, in elisp and python both, the path is consistently relative to the CWD of the executing code.

Standalone libclang utility library available now

Emboldened by my previous success and with a better idea as to how SublimeClang fetches code completions internally, I set about trying to make the Emacs plugin a reality once more. I initially figured that I would write it entirely in C++, with Emacs communicating with the server using sockets or something like that. However, I soon realized that most of the code I wrote would be more or less identical to how SublimeClang works.

Progress with libclang! (in C++, not Python)

As you might remember, I gave up on porting SublimeClang over to Emacs. After raising two bugs on irony-mode, one of which ended up with the author (who seems to be a really nice guy, by the way) cloning my repo to see why it wasn’t working, I finally managed to get auto-completion up and running with irony-mode. And it turned out to be too slow. I mean, for me it was even slower than brianjcj’s auto-complete-clang plugin, which uses the clang binary to drive completions.

I give up on the plugin

Instead of giving me context-sensitive completions, it’s basically returning a list of every symbol it can find in every header file. I just want decent code completion in C++, I don’t want a fucking PhD in a language that has no dedicated return statement and a library whose stable release can’t compile on all “supported” platforms after being out in the wild for several years. I’ll just wait for irony-mode’s author to fix this issue and then use that thing instead.

Progress with clancs

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.

My emacs setup for C++

I tried pretty hard to get existing solutions like ecb and semantic to work, but they seem to have fallen into a state of disrepair. I’d tried both a while back so I don’t remember exactly how they weren’t working, but both were throwing errors that had something to do with the changes in Emacs 24. I also tried to get the clang plugin working, but clang itself is pretty finicky and hard (for a beginner like me) to set up in windows, so I gave up on that pretty quickly and went back to my trusted Ctags solution that worked well in my Vim days.

Getting master password for twittering-mode to work in Windows

Slightly complicated, so here’s what you do: (Note that this definitely works for Emacs23 up) 1. Download and install GnuPG for Windows (I got the Slim version) 2. Launch Emacs (existing instances won’t inherit the new value of PATH added by the installer, and twittering-mode needs (executable-find “gpg”) to succeed in order to enable the master password 3. Add the following to your .emacs/init.el: (require 'twittering-mode) (setq twittering-use-master-password t) That should do the trick.

It's been a while

Yeah. I know. So, in no particular order, here’s what’s been happening I’ve suspended working on my unrealscript plugin for eclipse and open-sourced it. The basic grammar rules for parsing and lexing are in place, but it looks like the unrealscript classes that come with the UDK have more exceptions than rules in them, and I’m tired of working on it. The original plan was to finish it and sell it to indie devs, with a free-for-non-commercial-use license, but I already have a day-job where I do boring stuff every day to pay the bills, don’t really see the point in doing the same thing in my free time I started porting (read:trying really hard to port) the newly-open-sourced Doom 3 engine to NaCl.