<?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>The efnx code blog. &#187; auto-comment</title>
	<atom:link href="http://efnx.com/tag/auto-comment/feed/" rel="self" type="application/rss+xml" />
	<link>http://efnx.com</link>
	<description>code. blog.</description>
	<lastBuildDate>Tue, 15 May 2012 17:46:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Auto Comment Block In TextMate</title>
		<link>http://efnx.com/auto-comment-block-in-textmate/</link>
		<comments>http://efnx.com/auto-comment-block-in-textmate/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 09:34:14 +0000</pubDate>
		<dc:creator>Schell</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[auto-comment]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://blog.efnx.com/?p=43</guid>
		<description><![CDATA[If you haven&#8217;t heard of TextMate go check it out it&#8217;s sweet. It allows a helluva lot of automation and is damn near the only thing you need for development of any language [minus compilers]. I&#8217;m about ready to throw away my Flash CS3 IDE I got for free from my day job and shell [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t heard of TextMate go check it out <a href="http://macromates.com/">it&#8217;s sweet</a>. It allows a helluva lot of automation and is damn near the only thing you need for development of any language [minus compilers]. I&#8217;m about ready to throw away my Flash CS3 IDE I got for free from my day job and shell out the 39 pounds to buy it [those of you who know me personally know I don't ever buy software]. </p>
<p>So, here&#8217;s a little command I wrote in the form of a bash script [I think all textmate commands are bash scripts or cocoadialog thangs]. The script takes selected input and pads it with &#8220;/* */&#8221; if it isn&#8217;t already, effectively commenting the text or it strips the comment block. I don&#8217;t write shell scripts often, so I like it when I get one that&#8217;s really useful.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<br />
<span style="color: #666666; font-style: italic;">#-------------------------------------------------------------------------</span><br />
<span style="color: #666666; font-style: italic;"># Make comment / Undo comment</span><br />
<span style="color: #666666; font-style: italic;"># by Schell Scivally</span><br />
<span style="color: #666666; font-style: italic;"># @ efnx.com</span><br />
<span style="color: #666666; font-style: italic;">#-------------------------------------------------------------------------</span><br />
<br />
<span style="color: #007800;">opening</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TM_SELECTED_TEXT</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'BEGIN {nlines=0} /\/\*/ {nlines++} END {print nlines}'</span><span style="color: #000000; font-weight: bold;">`</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$opening</span>&quot;</span> == <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;/*<span style="color: #007800;">$TM_SELECTED_TEXT</span>*/&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">output</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TM_SELECTED_TEXT</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/\*\///g'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/\/\*//g'</span><span style="color: #000000; font-weight: bold;">`</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$output</span>&quot;</span><br />
<span style="color: #000000; font-weight: bold;">fi</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://efnx.com/auto-comment-block-in-textmate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

