<?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>gnapse.com &#187; auto-complete</title>
	<atom:link href="http://gnapse.com/blog/tag/auto-complete/feed/" rel="self" type="application/rss+xml" />
	<link>http://gnapse.com/blog</link>
	<description>whatever comes to my mind</description>
	<lastBuildDate>Thu, 26 Aug 2010 14:25:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Emacs: my first achievements, frustrations and impressions</title>
		<link>http://gnapse.com/blog/2009/07/17/emacs-my-first-achievements-frustrations-and-impressions/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=emacs-my-first-achievements-frustrations-and-impressions</link>
		<comments>http://gnapse.com/blog/2009/07/17/emacs-my-first-achievements-frustrations-and-impressions/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 16:44:23 +0000</pubDate>
		<dc:creator>ernesto</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web programming]]></category>
		<category><![CDATA[auto-complete]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://gnapse.com/blog/?p=50</guid>
		<description><![CDATA[Wow, this was fast! I never thought writing again about Emacs just a day after my first post about it. So far (the short version) I am doing better than I thought for just about a couple of days being serious about this. There are a few things that still bother me a lot though, [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, this was fast! I never thought writing again about Emacs just a day after my first post about it.</p>
<p>So far (the short version) I am doing better than I thought for just about a couple of days being serious about this. There are a few things that still bother me a lot though, aside from the fact that I am not proficient using it yet, of course.</p>
<p><span id="more-50"></span></p>
<h3>My [mostly borrowed] customizations</h3>
<p>I&#8217;ve heavily customized Emacs to suit my needs better than it could do with its awkward defaults. Emacs key shortcuts (or is it key bindings?) are soooo unpleasant, unintuitive, lengthy and annoying that I refuse to use them at all. Happily one of Emacs&#8217; most powerful strengths, its ability to be customized, comes to the rescue. Actually this feature is what makes <a href="http://bettercoding.wordpress.com/2009/07/13/emacs-still-relevant/" target="_blank">Emacs still relevant after 30+ years</a>.</p>
<div id="attachment_52" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-52" title="customized-emacs" src="http://gnapse.com/blog/wp-content/uploads/2009/07/customized-emacs-300x225.png" alt="My Emacs after being customized" width="300" height="225" /><p class="wp-caption-text">My Emacs after being customized</p></div>
<p>Without going too much into details, I based my Emacs customizations mostly on <a href="http://github.com/rmm5t/dotfiles/tree" target="_blank">Ryan McGeary&#8217;s</a>, mostly because his setup is aimed at Ruby on Rails development and Git, which is what I want Emacs for in the first place. Overall, it&#8217;s <a title="Ruby mode for Emacs" href="http://rubyforge.org/projects/ri-emacs/" target="_blank">ri-emacs</a>, <a title="Rails support for Emacs" href="http://rinari.rubyforge.org/" target="_blank">rinari</a>, <a title="rhtml/erb mode for Emacs" href="http://github.com/eschulte/rhtml/tree" target="_blank">rhtml-mode</a>, <a title="Git support for Emacs" href="http://zagadka.vm.bytemark.co.uk/magit/" target="_blank">magit</a>, <a title="A snippets/templates system for Emacs" href="http://code.google.com/p/yasnippet/" target="_blank">yasnippets</a>, and several other non-language-specific customizations (<a title="Interactively Do Things" href="http://www.emacswiki.org/emacs/InteractivelyDoThings" target="_blank">ido</a>, <a title="Recently opened files" href="http://www.emacswiki.org/emacs/RecentFiles" target="_blank">recentf</a>, etc.)</p>
<p>On top of this setup, and after pruning stuff that I don&#8217;t need, at least for the moment (like erlang, markdown, haml, svn, carbon-emacs, etc.) I added support for some other stuff, namely <a title="RSpec support for Emacs" href="http://github.com/pezra/rspec-mode/tree">rspec</a>,  <a href="http://www.emacswiki.org/emacs/CuaMode" target="_blank">cua-mode</a> (see <a title="IBM's guidelines for user interface standards across platforms" href="http://en.wikipedia.org/wiki/IBM_Common_User_Access" target="_blank">Common User Access</a>), and other minor goodies from other sources.</p>
<p>Aside from McGeary&#8217;s setup as a base, I have to give credit to snippets of code I borrowed from elsewhere to further customize my environment. I should particularly mention <a href="http://devcraft.wordpress.com/2008/07/19/using-emacs-for-rails-development-the-perfect-setup/" target="_blank">Devcraft&#8217;s advises to customize Emacs for Rails development</a>, Dahoiv&#8217;s<a href="http://dahoiv.net/.emacs" target="_blank"> .emacs</a> file, the <a href="http://www.emacsblog.org/" target="_blank">Emacs blog</a> (where Ryan McGeary also writes) and the <a href="http://emacs-fu.blogspot.com/" target="_blank">emacs-flu blog</a>.</p>
<h3>Pros and Cons</h3>
<p><strong>On the good side</strong>, I have played for a while with the ruby on rails mode and it is good. The yasnippet extensions take a lot of credit on this, but overall it tastes very good on its own. I have yet to deal enough with the magit extension to fully evaluate my environment. I cannot afford buying a Mac+TextMate for Ruby development, and Emacs can hopefully come to the rescue for my productivity and joy while coding.</p>
<p>Also, having been able to get rid of most of the many painful key bindings in such a short time was amazing. I wonder why Emacs does not update its defaults to comply with the <a title="Common User Access" href="http://en.wikipedia.org/wiki/IBM_Common_User_Access" target="_blank">CUA standards</a>. The cua-mode is not enough.</p>
<p><strong>On the bad side</strong> (taking aside my own inexperience and lack of abilities) not everything is doing fine. Many of my key-bindings customizations break on &#8220;weird&#8221; modes, like C-w for closing the current buffer, which is not working when the current buffer is in <a title="Emacs mode to navigate and manipulate the file system" href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html" target="_blank">dired mode</a>.</p>
<p>Also, I feel disappointed with the embedded shell (<code>M-x eshell</code>). I actually expected a bash session inside an Emacs window, but aliases and tab-completion are not working as they should, which makes me suspect it is not bash but an Emacs shell program (surprise!!!). As it is right now, I prefer to <code>Alt-Tab</code> to my terminal emulator with a real bash session in it. Something similar happens with the Rails console (available via <code>C-c ; c</code>), which I really didn&#8217;t test a lot after I realized that pressing the up and down arrow keys didn&#8217;t navigate through my history of previous commands <img src='http://gnapse.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> .</p>
<h3>So, what is it then?</h3>
<p>In spite of all this, I still believe I can give Emacs a chance. Most shortcomings I&#8217;ve faced are not directly related to its function as a coding environment, but to tasks around coding, like going to the console to type rails-related commands, manipulating the file system, etc. I was doing these stuff outside my previous code editors anyway so I guess this can stay as is for some time.</p>
<p>Hopefully I&#8217;ll be able to fix some of this issues over time and always use more and more features of this wonderful editor. I could even live without using git from within it, but I have yet to test that. Meanwhile, I&#8217;ll take some time to get better at coding with what is currently working for me. It seems to me that <strong>Emacs will stay for a while on my desktop</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gnapse.com/blog/2009/07/17/emacs-my-first-achievements-frustrations-and-impressions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bookmarks&#8217; last frontier</title>
		<link>http://gnapse.com/blog/2009/06/18/bookmarks-last-frontier/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=bookmarks-last-frontier</link>
		<comments>http://gnapse.com/blog/2009/06/18/bookmarks-last-frontier/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 19:52:57 +0000</pubDate>
		<dc:creator>ernesto</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[auto-complete]]></category>
		<category><![CDATA[bookmarks]]></category>
		<category><![CDATA[command line]]></category>

		<guid isPermaLink="false">http://gnapse.com/blog/?p=18</guid>
		<description><![CDATA[Bookmarks are ubiquitous these days. You can find them in your browser, code editor, desktop manager, web applications, the internet, anywhere. But there&#8217;s a place where bookmarks haven&#8217;t arrived yet: the command line. Or so I though&#8230; until recently. It turns out that to be sure, I searched for command-line bookmarks on google and after [...]]]></description>
			<content:encoded><![CDATA[<p>Bookmarks are ubiquitous these days. You can find them in your browser, code editor, desktop manager, web applications, <a title="Delicious" href="http://delicious.com/" target="_blank">the internet</a>, anywhere. But there&#8217;s a place where bookmarks haven&#8217;t arrived yet: the command line.</p>
<p>Or so I though&#8230; until recently. It turns out that to be sure, I searched for <a href="http://www.google.com/search?q=command-line+bookmarks" target="_blank">command-line bookmarks</a> on google and after a while digging for it, I managed to find <strong>three</strong> different projects that aim at providing this feature to <a title="Bourne Again SHell" href="http://www.gnu.org/software/bash/" target="_blank">my favorite shell</a>.</p>
<p>I downloaded and installed all these packages and I am sharing my thoughts about them here.<span id="more-18"></span></p>
<div id="attachment_25" class="wp-caption alignright" style="width: 310px"><a href="http://code.google.com/p/go-tool/"><img class="size-medium wp-image-25" title="go-tool" src="http://gnapse.com/blog/wp-content/uploads/2009/06/go-tool-300x216.png" alt="go-tool project to provide bookmarks for the command line" width="300" height="216" /></a><p class="wp-caption-text">go-tool</p></div>
<h3>go-tool</h3>
<p>This was the first one I found and the one I have used the most. The project is hosted at <a href="http://code.google.com/p/go-tool/" target="_blank">http://code.google.com/p/go-tool/</a> and it is developed in Python.</p>
<p>It has a command-line automated setup process that installs the python module system-wide, and there&#8217;s also a command to automatically setup shell integration.</p>
<p>Shell integration is achieved by registering some bash functions that do the actual directory change (this is needed because spawned processes do not change the working directory of the parent process, so a python script cannot actually change the working directory of the shell session that started the script). As you can imagine, this feature is common to all the three projects.</p>
<p>Directories are aliased to a short keyword that you can later use to change your current directory. You can add a bookmark for the current directory, or for any other directory, you can delete bookmarks, etc. The details are better covered in <a href="http://code.google.com/p/go-tool/" target="_blank">the project&#8217;s homepage</a>.</p>
<p>The main downside of this solution is that once you start using it, you start missing bash completion with the TAB key. Although I guess it shouldn&#8217;t be difficult to implement it ourselves. The program stores its bookmarks in <code>~/.go/bookmarks</code>. The main advantage is that it is multi-platform, supporting Unix-like environments (including Apple&#8217;s Mac) and Windows.</p>
<div id="attachment_26" class="wp-caption alignright" style="width: 310px"><a href="http://code.google.com/p/cdbm/"><img class="size-medium wp-image-26" title="cdbm" src="http://gnapse.com/blog/wp-content/uploads/2009/06/cdbm-300x216.png" alt="CDBM project to provide bookmarks for the command line" width="300" height="216" /></a><p class="wp-caption-text">CDBM</p></div>
<h3>cdbm</h3>
<p>The name is an acronym for &#8216;cd bookmarks&#8217; and the project is hosted at google code too (<a href="http://code.google.com/p/cdbm/" target="_blank">http://code.google.com/p/cdbm/</a>) although I found more information about it from its author&#8217;s <a href="http://www.onderstekop.nl/articles/124/" target="_blank">blog</a>. It is programmed in c.</p>
<p>This is the most simple of the three projects I found. It is simple to install and simple to use, but it is also the simplest in terms of features and possibilities, although unlike the previous one, it features auto-completion.</p>
<p>Shell integration is achieved in a similar way, through bash functions that have to be programmed into our <code>~/.bashrc</code> file.</p>
<p>Its main disadvantage is that is oriented to bookmarks indexed by numbers instead of aliases or keywords. In a more recent version the author added keyword support on top of the previous design, without removing the numeric index. However, keywords support still doesn&#8217;t feel natural.</p>
<div id="attachment_27" class="wp-caption alignright" style="width: 310px"><a href="http://www.micans.org/apparix/"><img class="size-medium wp-image-27" title="apparix" src="http://gnapse.com/blog/wp-content/uploads/2009/06/apparix-300x216.png" alt="Apparix project providing bookmarks for the command line" width="300" height="216" /></a><p class="wp-caption-text">Apparix</p></div>
<h3>apparix</h3>
<p>This was the last project I found and it is the most complete in terms of features. It is hosted at <a href="http://www.micans.org/apparix/" target="_blank">http://www.micans.org/apparix/</a> and implemented in c as well.</p>
<p>It features shell integration, bash auto-completion support, and it extends bookmarks to more than just a simple super-cd utility. For instance, bookmarked directories&#8217; contents can be listed remotely, without actually changing the current directory.</p>
<p>Shell integration si great, but its configuration could be more automated into the setup process, like the go-tool project does. But the bundled auto-completion is great. You can even auto-complete further into the subdirectories of the bookmark you are using in the command.</p>
<p>Take a look at the following sequence of commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ernesto<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>
ernesto<span style="color: #000000; font-weight: bold;">@</span>ubuntu:<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache$ bm
added: cache - <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache
ernesto<span style="color: #000000; font-weight: bold;">@</span>ubuntu:<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache$ apparix
<span style="color: #660033;">---</span> portals
<span style="color: #660033;">---</span> expansions
<span style="color: #660033;">---</span> bookmarks
j cache        <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache
ernesto<span style="color: #000000; font-weight: bold;">@</span>ubuntu:<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache$ <span style="color: #7a0874; font-weight: bold;">cd</span>
ernesto<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ to cache apt<span style="color: #000000; font-weight: bold;">/</span>archives<span style="color: #000000; font-weight: bold;">/</span>partial
ernesto<span style="color: #000000; font-weight: bold;">@</span>ubuntu:<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>archives<span style="color: #000000; font-weight: bold;">/</span>partial$</pre></div></div>

<p>We change into the <code>/var/cache</code> directory, and then we register a bookmark for it with the <code>'bm'</code> command. The <code>'apparix'</code> command then lists the available bookmarks, where you can see our recent addition. Then we go back to our home directory, and use the <code>'to'</code> command to change into a subdirectory of the directory represented by the bookmark, instead of just changing into the bookmarked directory only.</p>
<h3>And the winner is&#8230;</h3>
<p>Clearly apparix is the most complete of the three alternatives I found, although I have been using the go-tool for some time already, and I was getting used to it. However, I always missed auto-completion for the go-tool, never decided to implement it my self, and now that I have found apparix with it, I guess I&#8217;ll make the switch.</p>
<p>You go and play with them and make your own choice. The command line will never be the same after you start using this.</p>
]]></content:encoded>
			<wfw:commentRss>http://gnapse.com/blog/2009/06/18/bookmarks-last-frontier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
