Bugs in the Skies

I was wondering how hard it would be to make the Emacs interface to the Emacs bug tracker offline capable. And it turns out it’s not very hard at all to create a half-assed solution here.

Basically you just have to download the bug list, and then all the bugs (which are just mbox files), and then there you are.  All control messages go via email, and Gnus is already offline capable, so here I am sitting on the plane from Sydney doing some bug triage:

IMG_20160301_1718273Unfortunately, food arrived after I’d done five bugs, and I had some wine, and then I fell asleep.

Darn!

A Big Patch For Emacs, A Small Step For eww

During my summer holiday I’ve mainly been working on making the Emacs networking layer more asynchronous.

To set up a connection, you first have to do DNS resolution, then the TCP three way handshake to set up a socket, and then (if you’re setting up a TLS connection) do the TLS negotiation.  Then you can start talking to the server.  Up until now, only the middle bit (setting up the socket) has been non-blocking, while the two bits at either end have blocked the main Emacs execution thread.

This means that when eww, the Emacs web browser, wants to download and insert an image into the buffer, the user experience got kinda choppy.  The DNS resolution might take a while, and when talking to far away servers, the TLS negotiation certainly took some time.

By adding code based on the glibc getaddrinfo_a library function, the first problem was solved.  By calling the gnutls negotiation code from the Emacs event loop, the final problem was solved.

Behold!  I’m here reloading a Norwegian web page where most of the images are fetched via https (i.e., TLS):

I’m in Australia, so the networking all the way to Norway is s-l-o-w.  Especially since these are TLS connections.  Lots of chatter back and forth.  As you can see from the cursor movement, there’s no noticable choppiness.  Trying the same on this web page before the async patch went it is pretty horrible.

Yay.  And it was only a 3200 line diff. Ok, ok, most of that was chopping up lots of 700 line functions into slightly less ridiculously long functions, but eek.