<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Deadpan Sincerity &#187; Javascript</title>
	<atom:link href="http://blog.deadpansincerity.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.deadpansincerity.com</link>
	<description>a weblog by david miller</description>
	<lastBuildDate>Fri, 09 Dec 2011 12:03:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Colonize &#8211; eol fun for emacs</title>
		<link>http://blog.deadpansincerity.com/2011/06/colonize-eol-fun-for-emacs/</link>
		<comments>http://blog.deadpansincerity.com/2011/06/colonize-eol-fun-for-emacs/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 20:20:48 +0000</pubDate>
		<dc:creator>david miller</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.deadpansincerity.com/?p=491</guid>
		<description><![CDATA[Doing a lot of work with interpreters that need semi-colons to tell them when a line ends recently &#8211; and making flymake be quiet about it involves a whole sequence of C-e &#8230; ; &#8230; what was I thinking about again? So thanks to this, C-M-; now colonizes the line and leaves me happily where [...]]]></description>
			<content:encoded><![CDATA[<p>Doing a lot of work with interpreters that need semi-colons to tell them when a line ends recently &#8211; and making <a href="http://www.emacswiki.org/emacs/FlyMake">flymake</a> be quiet about it involves a whole sequence of C-e &#8230; ; &#8230; what was I thinking about again?</p>
<p>So thanks to this, C-M-; now colonizes the line and leaves me happily where I was</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;">&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> colonize <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;For languages that insist on putting a colon at the end of a line,
do that. But stay where you're thinking is at.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>interactive<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>save-excursion
    <span style="color: #66cc66;">&#40;</span>move-end-of-line <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>insert <span style="color: #ff0000;">&quot;;&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>global-set-key <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;C-M-;&quot;</span><span style="color: #66cc66;">&#41;</span> 'colonize<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Love regards etc</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadpansincerity.com/2011/06/colonize-eol-fun-for-emacs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up Emacs as a Javascript editing environment for Fun or Profit</title>
		<link>http://blog.deadpansincerity.com/2011/05/setting-up-emacs-as-a-javascript-editing-environment-for-fun-and-profit/</link>
		<comments>http://blog.deadpansincerity.com/2011/05/setting-up-emacs-as-a-javascript-editing-environment-for-fun-and-profit/#comments</comments>
		<pubDate>Sun, 29 May 2011 17:21:16 +0000</pubDate>
		<dc:creator>david miller</dc:creator>
				<category><![CDATA[favourite things]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[editing]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[flymake]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[jslint]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[yasnippet]]></category>

		<guid isPermaLink="false">http://blog.deadpansincerity.com/?p=454</guid>
		<description><![CDATA[I&#8217;ve been doing a lot of Javascript lately, which has naturally led to a whole lot of trips down the .emacs rabbit-hole So, here are the steps you need to turn OOTB Emacs into the perfect environment for working on Javascript: Auto-completion First up, you&#8217;re going to want decent auto-completion, so install the straightforwardly named [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a lot of Javascript lately, which has naturally led to a whole lot of trips down the .emacs rabbit-hole</p>
<p>So, here are the steps you need to turn OOTB Emacs into the perfect environment for working on Javascript:</p>
<h2>Auto-completion</h2>
<div id="attachment_479" class="wp-caption aligncenter" style="width: 386px"><a href="http://blog.deadpansincerity.com/wp-content/uploads/2011/05/ac.png"><img src="http://blog.deadpansincerity.com/wp-content/uploads/2011/05/ac.png" alt="" title="Emacs Auto completing" width="376" height="224" class="size-full wp-image-479" /></a><p class="wp-caption-text">Fizzing!</p></div><br />
<br \></p>
<p>First up, you&#8217;re going to want decent auto-completion, so install the straightforwardly named <a href="http://cx4a.org/software/auto-complete/">auto-complete-mode</a>. Due to some mode-name aliasing that goes on in the Emacs23 javascript mode, You&#8217;ll need to make sure it can find the relevant Javascript dictionary so</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>auto-complete<span style="color: #000000; font-weight: bold;">/</span>dict
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> javascript-mode js-mode</pre></div></div>

<p>and then add to your .emacs:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'load-path <span style="color: #ff0000;">&quot;~/path-to/auto-complete&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">; Load the default configuration</span>
<span style="color: #66cc66;">&#40;</span>require 'auto-complete-config<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">; Make sure we can find the dictionaries</span>
<span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'ac-dictionary-directories <span style="color: #ff0000;">&quot;~/emacs/auto-complete/dict&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">; Use dictionaries by default</span>
<span style="color: #66cc66;">&#40;</span>setq-default ac-sources <span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'ac-sources 'ac-source-dictionary<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>global-auto-complete-mode t<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">; Start auto-completion after 2 characters of a word</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> ac-auto-start <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">; case sensitivity is important when finding matches</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> ac-ignore-<span style="color: #b1b100;">case</span> <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>You now have auto-completion for all variable names in all open Javascript buffers, as well as for standard syntax words (setTimeout, parseInt, onFocus etc).</p>
<h2>Snippeting</h2>
<p>Not content with that, we&#8217;ll also want some kind of intelligent snippet package right &#8211; how many times do you really want to type all those semicolons and curly braces? Once is good for me.</p>
<p>The excellent <a href="http://code.google.com/p/yasnippet/">Yasnippet</a> provides this (check out the <a href="http://www.youtube.com/watch%3Fv%3D76Ygeg9miao">youtube demo</a> if you&#8217;ve not come across it before)</p>
<p>Once you&#8217;ve got that downloaded and installed, you&#8217;ll want some Javascript snippets to load in, the ones I use, for standard Javascript and jQuery can be downloaded from <a href="https://github.com/davidmiller/yasnips/raw/master/jsnips.tgz">here</a>, and then the directory provided by that tarfile needs to go in yasnippet/snippets/text-mode</p>
<p>So for our .emacs:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'load-path <span style="color: #ff0000;">&quot;~/path/to/yasnippet&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;; Load the library</span>
<span style="color: #66cc66;">&#40;</span>require 'yasnippet<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>yas/initialize<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;; Load the snippet files themselves</span>
<span style="color: #66cc66;">&#40;</span>yas/load-directory <span style="color: #ff0000;">&quot;~/path/to/yasnippet/snippets/text-mode&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;; Let's have snippets in the auto-complete dropdown</span>
<span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'ac-sources 'ac-source-yasnippet<span style="color: #66cc66;">&#41;</span></pre></div></div>

<h2>Syntax Checking</h2>
<p><div id="attachment_484" class="wp-caption alignright" style="width: 136px"><a href="http://blog.deadpansincerity.com/wp-content/uploads/2011/05/syntax.png"><img src="http://blog.deadpansincerity.com/wp-content/uploads/2011/05/syntax.png" alt="" title="whoops..." width="126" height="79" class="size-full wp-image-484" /></a><p class="wp-caption-text">Whoops...</p></div>
<p>One of the problems with Javascript programming is that the feedback loop for syntax errors is *slow* &#8211; if you&#8217;re working with the web you have to wait for a whole pageload. So we&#8217;ll want on-the-fly error checking.</p>
<p><a href="http://keturn.net/">Kevin Turner</a> originally wrote <a href="https://github.com/keturn/lintnode#readme">Lintnode</a>, which runs a lighthweight node.js server that passes your file to <a href="http://www.crockford.com/">Douglas Crockford&#8217;s</a> <a href="http://www.jslint.com/">JSLint</a> to integrate with <a href="http://www.emacswiki.org/emacs/FlyMake">Flymake</a> &#8211; the Emacs solution for on-the-fly syntax checking. The fork I&#8217;m currently maintaining at <a href="https://github.com/davidmiller/lintnode">Github</a> contains some enhancements such as automatic initialization and JSLint options passed from Emacs that the original has yet to merge in. Given that JSLint frequently complains about things that you might like it to er, not complain about, the ability to change the options with the lintnode-jslint-excludes variable makes this far more useable.</p>
<p>So:</p>
<p>Install <a href="http://nodejs.org/">node.js</a> and <a href="http://npmjs.org/">npm</a> (The package manager for node)</p>
<p>Get lintnode and the dependencies</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">git</span> clone https:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>davidmiller<span style="color: #000000; font-weight: bold;">/</span>lintnode.git
<span style="color: #7a0874; font-weight: bold;">cd</span> lintnode
npm <span style="color: #c20cb9; font-weight: bold;">install</span> express connect-form haml underscore</pre></div></div>

<p>Then we need this in our .emacs:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'load-path <span style="color: #ff0000;">&quot;~/path/to/lintnode&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>require 'flymake-jslint<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;; Make sure we can find the lintnode executable</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> lintnode-location <span style="color: #ff0000;">&quot;~/path/to/lintnode&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;; JSLint can be... opinionated</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> lintnode-jslint-excludes <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">list</span> 'nomen 'undef 'plusplus 'onevar 'white<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;; Start the server when we first open a js file and start checking</span>
<span style="color: #66cc66;">&#40;</span>add-hook 'js-mode-hook
          <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span>lintnode-hook<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Syntax errors will now be given a red background without having to leave the comfort of Emacs.</p>
<p>Even better, if we install the <a href="http://www.emacswiki.org/emacs/FlymakeCursor">Flymake Cursor</a> package, we get the error message in the minibuffer when the cursor is on a line with an error.</p>
<div id="attachment_485" class="wp-caption aligncenter" style="width: 351px"><a href="http://blog.deadpansincerity.com/wp-content/uploads/2011/05/modeline.png"><img src="http://blog.deadpansincerity.com/wp-content/uploads/2011/05/modeline.png" alt="" title="modeline" width="341" height="153" class="size-full wp-image-485" /></a><p class="wp-caption-text">Easy Mistake!</p></div>
<p>Get the source from http://www.emacswiki.org/emacs/flymake-cursor.el and then add to your .emacs:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'load-path <span style="color: #ff0000;">&quot;~/emacs/minor-modes&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;; Nice Flymake minibuffer messages</span>
<span style="color: #66cc66;">&#40;</span>require 'flymake-cursor<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p><b>Edit:</b></p>
<p>As Jesse and Magnar point out in the comments, it&#8217;s probably a better idea to not exclude &#8216;undef from the jslint errors, but rather to declare global variables at the top of your .js file</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"> <span style="color: #006600; font-style: italic;">/*global $ */</span></pre></div></div>

<p>This way you can let jslint know about other libraries you are using, but still get the checks for undefined variables in your own code.</p>
<h2>Code folding</h2>
<div id="attachment_486" class="wp-caption aligncenter" style="width: 484px"><a href="http://blog.deadpansincerity.com/wp-content/uploads/2011/05/hideshow.png"><img src="http://blog.deadpansincerity.com/wp-content/uploads/2011/05/hideshow.png" alt="" title="hideshow" width="474" height="144" class="size-full wp-image-486" /></a><p class="wp-caption-text">Underscore outline</p></div>
<p>Especially if you&#8217;re dealing with large projects, the ability to hide portions of code can be great for maintaining focus. Emacs comes with this built in, but you have to enable it, so returning to our .emacs:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>add-hook 'js-mode-hook
          <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #808080; font-style: italic;">;; Scan the file for nested code blocks</span>
            <span style="color: #66cc66;">&#40;</span>imenu-add-menubar-index<span style="color: #66cc66;">&#41;</span>
            <span style="color: #808080; font-style: italic;">;; Activate the folding mode</span>
            <span style="color: #66cc66;">&#40;</span>hs-minor-mode t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>This means that when your cursor is in the function&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> Foo <span style="color: #339933;">=</span> <span style="color: #CC0000;">42</span><span style="color: #339933;">;</span>
addFoo <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// Let's add the meaning of life to</span>
    <span style="color: #006600; font-style: italic;">// our `num` - it'll be fun!</span>
    <span style="color: #003366; font-weight: bold;">var</span> meaningful<span style="color: #339933;">;</span>
    meaningful <span style="color: #339933;">=</span> num <span style="color: #339933;">+</span> Foo<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>&#8230; and you M-x hs-hide-block, the function turns into:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">Var</span> Foo <span style="color: #339933;">=</span> <span style="color: #CC0000;">42</span><span style="color: #339933;">;</span>
addFoo <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>...<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To my taste the default keybinding of C-c @ C-h to hide blocks is somewhat perverse, so I&#8217;d recommend this in your .emacs:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;; Show-hide</span>
<span style="color: #66cc66;">&#40;</span>global-set-key <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> 'hs-show-block<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>global-set-key <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> 'hs-show-all<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>global-set-key <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> 'hs-hide-block<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>global-set-key <span style="color: #66cc66;">&#40;</span>kbd <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span> 'hs-hide-all<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>YMMV.</p>
<h2>Javascript Console</h2>
<p>Having a REPL for the language you&#8217;re working with close to hand is basically required for me to enjoy working with it. Now that we&#8217;ve installed node.js, though, we can have us a Javascript console inside Emacs with <a href="http://js-comint-el.sourceforge.net/">js-comint</a>&#8230;</p>
<p>Once you&#8217;ve grabbed the file, your .emacs should have:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'load-path <span style="color: #ff0000;">&quot;~/path/to/js-comint&quot;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>require 'js-comint<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;; Use node as our repl</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> inferior-js-program-command <span style="color: #ff0000;">&quot;node&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> inferior-js-mode-hook
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #808080; font-style: italic;">;; We like nice colors</span>
        <span style="color: #66cc66;">&#40;</span>ansi-color-for-comint-mode-on<span style="color: #66cc66;">&#41;</span>
        <span style="color: #808080; font-style: italic;">;; Deal with some prompt nonsense</span>
        <span style="color: #66cc66;">&#40;</span>add-to-<span style="color: #b1b100;">list</span> 'comint-preoutput-filter-functions
                     <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">lambda</span> <span style="color: #66cc66;">&#40;</span>output<span style="color: #66cc66;">&#41;</span>
                       <span style="color: #66cc66;">&#40;</span>replace-regexp-in-string <span style="color: #ff0000;">&quot;.*1G<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\.</span>.*5G&quot;</span> <span style="color: #ff0000;">&quot;...&quot;</span>
                     <span style="color: #66cc66;">&#40;</span>replace-regexp-in-string <span style="color: #ff0000;">&quot;.*1G.*3G&quot;</span> <span style="color: #ff0000;">&quot;&amp;gt;&quot;</span> output<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>You can then run a Javascript REPL with M-x run-js and also send portions of files by selecting them and then running M-x send-region. Neat.</p>
<h2>By way of conclusion</h2>
<p>There are a few other tweaks that make my Javascripting just that little bit nicer, but they&#8217;re more personal Emacs setup than anything specific to Javascript. So, there you have it, the perfect Javascript editing environment.</p>
<p>Love regards etc</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadpansincerity.com/2011/05/setting-up-emacs-as-a-javascript-editing-environment-for-fun-and-profit/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Adding Reader and Analytics to Google Apps</title>
		<link>http://blog.deadpansincerity.com/2009/10/adding-reader-and-analytics-to-google-apps/</link>
		<comments>http://blog.deadpansincerity.com/2009/10/adding-reader-and-analytics-to-google-apps/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 19:08:38 +0000</pubDate>
		<dc:creator>david miller</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[the internet]]></category>
		<category><![CDATA[Analytics]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[gmail greasemonkey api]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Google Docs]]></category>
		<category><![CDATA[Google Reader]]></category>
		<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blog.deadpansincerity.com/?p=262</guid>
		<description><![CDATA[Google Apps for your domain bring you all the functionality of Gmail, Google Docs, Calendar and talk to your own domain. Which, for those of us who like Gmail et al, is a very nice thing to have. What Google Apps doesn&#8217;t give you however, is the integrated google account that gives you access to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.deadpansincerity.com/wp-content/uploads/2009/10/appsexpanded-300x223.jpg" alt="appsexpanded" title="appsexpanded" width="300" height="223" class="alignleft size-medium wp-image-272" /></p>
<p>Google Apps for your domain bring you all the functionality of Gmail, Google Docs, Calendar and talk to your own domain. Which, for those of us who like Gmail et al, is a very nice thing to have. </p>
<p>What Google Apps doesn&#8217;t give you however, is the integrated google account that gives you access to all their other services like Google Reader and Analytics.</p>
<p>So after a while switching between my shiny new apps account &#038; my plain old google account, I decided to write a little greasemonkey script to add them to Google Apps. </p>
<p>Basically it inserts links to Google Reader and Analytics into the top left navigation of Gmail, Google Docs &#038; Calendar, and redirects the navigation in Google Reader to point to your Apps account rather than the &#8216;Google Account&#8217; you&#8217;re using for Reader &#038; analytics.</p>
<p>You can generate the script for your site by typing the domain in here and then following the link:</p>
<p><label id="domain_label">e.g. deadpansincerity.com </label></p>
<input type="text" id="domain_input">
<p id="domain_link_p" style="display:none"><a href=""id="domain_link"></a></p>
<p>Alternatively you can take a look at the Source on <a href="http://github.com/davidmiller/apps.expanded.user">github</a>, or clone the repo with </p>
<blockquote><p>git clone git://github.com/davidmiller/apps.expanded.user.git</p></blockquote>
<p>Hope you find it useful somehow.</p>
<p>Love regards etc</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadpansincerity.com/2009/10/adding-reader-and-analytics-to-google-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

