<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Alex's Adventures on the Infobahn - extensions</title><link href="https://www.bennee.com/~alex/" rel="alternate"></link><link href="https://www.bennee.com/~alex/blog/tag/extensions/feed" rel="self"></link><id>https://www.bennee.com/~alex/</id><updated>2010-01-09T12:40:00+00:00</updated><subtitle>the wanderings of a supposed digital native</subtitle><entry><title>First elisp patch for emacs chrome</title><link href="https://www.bennee.com/~alex/blog/2010/01/09/first-elisp-patch-for-emacs-chrome/" rel="alternate"></link><published>2010-01-09T12:40:00+00:00</published><updated>2010-01-09T12:40:00+00:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2010-01-09:/~alex/blog/2010/01/09/first-elisp-patch-for-emacs-chrome/</id><summary type="html">&lt;p&gt;One of the nice things about putting your coding experiments up early and under a permissive license is people can submit patches. I'd been trying to get the native elisp &lt;a class="reference external" href="http://github.com/stsquad/emacs_chrome/blob/master/servers/edit_server.el"&gt;edit server&lt;/a&gt; working but I'd fallen back to the working python script as I've been busy at work. However along …&lt;/p&gt;</summary><content type="html">&lt;p&gt;One of the nice things about putting your coding experiments up early and under a permissive license is people can submit patches. I'd been trying to get the native elisp &lt;a class="reference external" href="http://github.com/stsquad/emacs_chrome/blob/master/servers/edit_server.el"&gt;edit server&lt;/a&gt; working but I'd fallen back to the working python script as I've been busy at work. However along comes Riccardo Murri who cleaned up the code and got it working. I've pushed the changes to the &lt;a class="reference external" href="http://github.com/stsquad/emacs_chrome"&gt;repo&lt;/a&gt; and with a little extra glue spawn it when emacs is in &lt;em&gt;--daemon&lt;/em&gt; mode:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
;; Do we want an edit-server?
(if (and (daemonp) (maybe-load-library &amp;quot;edit_server&amp;quot;))
    (edit-server-start))
&lt;/pre&gt;
&lt;p&gt;And bingo you save the cost of 2 unnecessary fork/execve's to get emacs editing your Google Chrome(ium) hosted &amp;lt;textarea&amp;gt;. It seems to have an odd interaction with longlines-mode though which I need to investigate, perhaps longlines mode does magic stuff with the buffer text on save which gets skipped when the edit server does it's thing?&lt;/p&gt;
&lt;p&gt;I've submitted the extension to the Google extension gallery although it's currently held up in actual physical paperwork. As my content script needs fairly liberal permissions to work I have to at least demonstrate I'm not an evil hacker/spammer intent on creating browser malware. I may take advantage of the delay to some clean ups to the browser feedback as we will likely be housebound sheltering from the weather. That is of course unless anyone else beats me to it :-)&lt;/p&gt;
</content><category term="general"></category><category term="chrome"></category><category term="elisp"></category><category term="emacs"></category><category term="extensions"></category></entry><entry><title>End to End Connectivity</title><link href="https://www.bennee.com/~alex/blog/2009/12/16/end-to-end-connectivity/" rel="alternate"></link><published>2009-12-16T23:22:00+00:00</published><updated>2009-12-16T23:22:00+00:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2009-12-16:/~alex/blog/2009/12/16/end-to-end-connectivity/</id><summary type="html">&lt;p&gt;We had a slight degree of excitement this evening when we got home. All the power was out and the refrigerating appliances were slowing defrosting. Due to the randomness of the breakers tripping we thought it was the boiler. As it happened it was a earth-neutral leakage that was causing …&lt;/p&gt;</summary><content type="html">&lt;p&gt;We had a slight degree of excitement this evening when we got home. All the power was out and the refrigerating appliances were slowing defrosting. Due to the randomness of the breakers tripping we thought it was the boiler. As it happened it was a earth-neutral leakage that was causing the craziness. Once that was all sorted out I sacked off doing the washing-up to do a little more tweaking.&lt;/p&gt;
&lt;p&gt;I'm almost there with the &lt;a class="reference external" href="http://github.com/stsquad/emacs_chrome"&gt;Chromium extension&lt;/a&gt;. I based it on the work done by &lt;a class="reference external" href="http://www.thegibson.org/blog/archives/689"&gt;David Hilley&lt;/a&gt; and basically further hacked it about to make it work more like &lt;a class="reference external" href="http://trac.gerf.org/itsalltext"&gt;It's All Text&lt;/a&gt; on Firefox. I'm still using David's Python 2.6 shim layer to handle the edit requests until I can get around to implementing an elisp one for Emacs. Don't let my intention to do write one stop any readers from doing so in the meantime should you wish :-).&lt;/p&gt;
&lt;p&gt;It works if you stick to one page, currently it gets confused if you have multiple pages open which have sent edit requests. This is because the xmlcomms.js function which handles farming out the edit requests has a single reply_port parameter which will point to the port of the last page to connect to the master extension. I'll need to come up with a slightly neater solution but I'm fairly crusty on Javascript.&lt;/p&gt;
&lt;p&gt;Hopefully I'll get around to packaging it up properly in the next few days. In the meantime you can run it from a git checkout by pointing the Extensions page at it via &amp;quot;Load Unpacked Extension&amp;quot;.&lt;/p&gt;
&lt;p&gt;Still it's my first Chromium extension so I feel quite proud of myself :-)&lt;/p&gt;
</content><category term="general"></category><category term="chromium"></category><category term="emacs"></category><category term="extensions"></category><category term="house"></category><category term="javascript"></category></entry><entry><title>Chrome and Emacsclient</title><link href="https://www.bennee.com/~alex/blog/2009/12/12/chrome-and-emacsclient/" rel="alternate"></link><published>2009-12-12T13:24:00+00:00</published><updated>2009-12-12T13:24:00+00:00</updated><author><name>alex</name></author><id>tag:www.bennee.com,2009-12-12:/~alex/blog/2009/12/12/chrome-and-emacsclient/</id><summary type="html">&lt;p&gt;I had a number of things planned to do today, one of which was to go pick up some parcels that the local delivery service failed to do. However some workmen started digging up the road opposite my house. As the un-controlled single lane alternating between inbound and outbound traffic …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I had a number of things planned to do today, one of which was to go pick up some parcels that the local delivery service failed to do. However some workmen started digging up the road opposite my house. As the un-controlled single lane alternating between inbound and outbound traffic is right outside my drive I decided I couldn't face the horror and stayed in to tinker.&lt;/p&gt;
&lt;p&gt;I've switched my default browser settings to Chromium on all my machines. It's just so much faster to launch and get around. I've sacrificed the security of NoScript but I'm less worried about Flash on my netbook now as each tab kills any CPU sucking plugins when deleted. The only major problem left is finding an alternative to It's All Text so I don't have to fire up Firefox every time I post something to the web (like this blog entry).&lt;/p&gt;
&lt;p&gt;I decided to have a look into what was involved in getting a Chrome extension running that can call an external editor. I checked the group before I started and stumbled on Dave Hilley's &lt;a class="reference external" href="http://www.thegibson.org/blog/archives/689"&gt;rough cut solution&lt;/a&gt;. It's almost exactly what I need so I've started toying with it.&lt;/p&gt;
&lt;p&gt;Due to the way Chrome works it doesn't seem possible to spawn additional processes from Chrome itself (unless you want to use the NSAPI sledgehammer). Dave's solution is a simple server script that the Chrome extension can make calls to using XMLHttpRequest's. The server is written in Python but my first thought is there is no reason why the local &lt;em&gt;emacs --daemon&lt;/em&gt; couldn't terminate the calls directly. Certainly the &lt;a class="reference external" href="http://www.emacswiki.org/emacs-se/EmacsEchoServer"&gt;example echo server&lt;/a&gt; on the Emacs Wiki doesn't look too complicated to hack up.&lt;/p&gt;
&lt;p&gt;The other thing that could be improved is the detection of text areas. Currently the Javascript just searches the DOM for text areas and selects the first one as a candidate for editing. I'm fairly sure it would be possible to detect either which text area currently has focus or do something more akin to It's All Text and wrap unique &amp;lt;div&amp;gt;'s around each text area and have a edit content button.&lt;/p&gt;
&lt;p&gt;Unfortunately I seem to be having trouble getting the Chrome side to work. Trying to set breakpoints in the extension scripts keeps causing the extension to &amp;quot;crash&amp;quot; so it's hard to follow the sequence and tweak it. I also have to wrap my mind around Chrome's distinction between &amp;quot;content&amp;quot; and extension scripts. Still at least it's something to work from. Of course if anyone else wants to jump in with ideas (or even better a pointer to a better piece of emacs server code for handling XMLHttpRequests) then don't let my stumbling hack attempts hold you back :-)&lt;/p&gt;
</content><category term="geek"></category><category term="chrome"></category><category term="editor"></category><category term="emacs"></category><category term="extensions"></category><category term="javascript"></category></entry></feed>