<?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>Duplo &#187; ruby-mode</title>
	<atom:link href="http://kill-0.com/duplo/tag/ruby-mode/feed/" rel="self" type="application/rss+xml" />
	<link>http://kill-0.com/duplo</link>
	<description>Building Blocks &#38; Learning Experiences</description>
	<lastBuildDate>Fri, 05 Aug 2011 15:30:11 +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>Emacs ruby-mode comment keybinding</title>
		<link>http://kill-0.com/duplo/2010/03/04/emacs-ruby-mode-comment-keybinding/</link>
		<comments>http://kill-0.com/duplo/2010/03/04/emacs-ruby-mode-comment-keybinding/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 16:52:57 +0000</pubDate>
		<dc:creator>ericw</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[ruby-mode]]></category>

		<guid isPermaLink="false">http://kill-0.com/duplo/?p=117</guid>
		<description><![CDATA[I&#8217;ve often been sad that there is no default keybinding for comment-region in Emacs&#8217;s ruby-mode. Eventually it annoyed me enough that I added one: (add-hook 'ruby-mode-hook (lambda () (define-key ruby-mode-map "\C-c#" 'comment-or-uncomment-region) ) ) This assigns C-c # to comment the current region, or if the current region is already commented, it will uncomment the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve often been sad that there is no default keybinding for <tt>comment-region</tt> in Emacs&#8217;s <a href=" http://www.emacswiki.org/emacs/RubyMode">ruby-mode</a>.  Eventually it annoyed me enough that I added one:<code>
<pre>(add-hook 'ruby-mode-hook
	  (lambda ()
	    (define-key ruby-mode-map "\C-c#" 'comment-or-uncomment-region)
	    )
	  )</pre>
<p></code>This assigns <tt>C-c #</tt> to comment the current region, or if the current region is already commented, it will uncomment the region.</p>
<p>But what about when there&#8217;s no region currently marked?  It would be nice if emacs would (un)comment the current line.  To do this, I took a page from <a href="http://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html">DJCB at Emacs-fu</a>.<code>
<pre>(defadvice comment-or-uncomment-region (before slick-comment activate compile)
  "When called interactively with no active region, comment a single line instead."
  (interactive
   (if mark-active (list (region-beginning) (region-end))
     (list (line-beginning-position)
	   (line-beginning-position 2)))))
</pre>
<p></code>Now with nothing marked, pressing <tt>C-c #</tt> will cause emacs to toggle commenting on the current line.</p>
<p>In case it isn&#8217;t obvious, one should add the abbove snippets to their <tt>.emacs</tt> file to gain their benefits.</p>
]]></content:encoded>
			<wfw:commentRss>http://kill-0.com/duplo/2010/03/04/emacs-ruby-mode-comment-keybinding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

