<?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>untidy blog &#187; PyPN</title>
	<atom:link href="http://untidy.net/blog/category/pn/pypn/feed/" rel="self" type="application/rss+xml" />
	<link>http://untidy.net/blog</link>
	<description>simon steele writes about stuff...</description>
	<lastBuildDate>Sat, 26 Nov 2011 17:09:07 +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>Regular Expressions and Scripts &#8211; Worked Example</title>
		<link>http://untidy.net/blog/2011/05/18/regular-expressions-and-scripts-worked-example/</link>
		<comments>http://untidy.net/blog/2011/05/18/regular-expressions-and-scripts-worked-example/#comments</comments>
		<pubDate>Wed, 18 May 2011 12:10:21 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/?p=447</guid>
		<description><![CDATA[Programmer&#8217;s Notepad has great support for Regular Expressions baked in, supporting much more than the restricted syntax that many Scintilla-based editors provide. For example, did you know that you can use negative lookarounds to find text that doesn&#8217;t contain a pattern? This regular expression matches any line that doesn&#8217;t contain &#8220;not here&#8221;: ^((?!not here).)*$ Sometimes [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pnotepad.org/">Programmer&#8217;s Notepad</a> has great support for <a href="http://en.wikipedia.org/wiki/Regular_Expressions">Regular Expressions</a> baked in, supporting much more than the restricted syntax that many Scintilla-based editors provide. For example, did you know that you can use negative lookarounds to find text that <em>doesn&#8217;t</em> contain a pattern? This regular expression matches any line that doesn&#8217;t contain &#8220;not here&#8221;:</p>
<p><code>^((?!not here).)*$</code></p>
<p>Sometimes I find myself repeating the same set of Search/Replace operations in order to format text. If I&#8217;m going to do this more than a couple of times, I record a script using <a href="http://www.pnotepad.org/add-ons/">PyPN</a> to make things easier for myself. Today I was turning text like this:</p>
<pre class="brush: java;">
    LogStep(&quot;Do something&quot;);
    MyClass.DoReallyCleverStuff();
    MyClass.VerifySomethingAwesome();

    LogStep(&quot;Do another thing&quot;);
    MyClass.DoSomethingLessClever();
    MyClass.VerifySomethingBad();
</pre>
<p>Into text like this:</p>
<p><code><br />
Do something<br />
Do another thing<br />
</code></p>
<p>There are many ways to do something like this, and I could have written a PyPN script by hand to do it. However, combining Regular Expressions and Script Recording means I can do this without a lot of manual code effort. Here&#8217;s what I did:</p>
<ol>
<li>Tools > Record Script</li>
<li>Replace All: <code>^((?!LogStep).)*$</code> with (nothing)</li>
<li>Replace All: <code>(\r\n){2,}</code> with <code>\r\n</code></li>
<li>Replace All: <code>\s*LogStep\("([^"]+)"\);</code> with <code>\1</code></li>
<li>Tools > Stop Recording</li>
</ol>
<p>At the end of this Programmer&#8217;s Notepad added a script to the Scripts window (Recorded\New Script) and placed the code for that script in a new editor window. Because I wanted to keep the script for future use, I changed it&#8217;s name and saved it to C:\Program Files\Programmer&#8217;s Notepad\Scripts. Here&#8217;s the script (which I reduced slightly for posting here):</p>
<pre class="brush: python;">
import pn, scintilla

@script(&quot;Clean Up Log Steps&quot;, &quot;Testing&quot;)
def CleanUpLogSteps():
	doc = pn.CurrentDoc()
	sci = scintilla.Scintilla(doc)
	opt = pn.GetUserSearchOptions()
	opt.FindText = u'^((?!LogStep).)*$'
	opt.MatchWholeWord = False
	opt.MatchCase = False
	opt.UseRegExp = True
	opt.SearchBackwards = False
	opt.LoopOK = True
	opt.UseSlashes = False
	opt.ReplaceText = u''
	opt.ReplaceInSelection = False
	doc.ReplaceAll(opt)
	# When recording, the result of this operation was: pn.FindNextResult(37)

	opt.FindText = u'(\\r\\n\\r\\n){2,}'
	opt.ReplaceText = u'\\r\\n'
	doc.ReplaceAll(opt)
	# When recording, the result of this operation was: pn.FindNextResult(16)

	opt.FindText = u'\\s*LogStep\\(&quot;([^&quot;]+)&quot;\\);'
	opt.ReplaceText = u'\\1'
	doc.ReplaceAll(opt)
	# When recording, the result of this operation was: pn.FindNextResult(10)
</pre>
<p>If I was going to use this script a lot, I could bind it to a shortcut key in Tools > Options > Keyboard.</p>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2011/05/18/regular-expressions-and-scripts-worked-example/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PyPN 0.12 Released</title>
		<link>http://untidy.net/blog/2010/09/27/pypn-0-12-released/</link>
		<comments>http://untidy.net/blog/2010/09/27/pypn-0-12-released/#comments</comments>
		<pubDate>Mon, 27 Sep 2010 21:29:23 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/?p=429</guid>
		<description><![CDATA[Coinciding with the new Programmer&#8217;s Notepad 2.1.5 release, PyPN 0.12 is a minor update fixing a few bugs and adding support for some new small but important scenarios. Download: PyPN 0.12 for Python 2.6 As of this release, I have dropped support for Python 2.4 and 2.5, as there seems to be little benefit in [...]]]></description>
			<content:encoded><![CDATA[<p>Coinciding with the new <a href="http://www.pnotepad.org/">Programmer&#8217;s Notepad</a> 2.1.5 release, PyPN 0.12 is a minor update fixing a few bugs and adding support for some new small but important scenarios.</p>
<p><b>Download:</b><br />
<a href="http://pnotepad.googlecode.com/files/pypn-0.12.2222-py26.zip">PyPN 0.12 for Python 2.6</a></p>
<p>As of this release, I have dropped support for Python 2.4 and 2.5, as there seems to be little benefit in maintaining multiple versions especially as these releases are so old. I am considering trying to bundle a specific version of Python with future releases, to avoid the need for separate installs.</p>
<p>Once you have installed PyPN 0.12, you can now use Python code in your Text Clips by enclosing it in backticks, e.g.</p>
<p><code><br />
`print "Hello from PyPN"`<br />
</code></p>
<p>Anything you print to stdout will be included in the clip text.</p>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2010/09/27/pypn-0-12-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Zen Coding in Programmer&#8217;s Notepad</title>
		<link>http://untidy.net/blog/2010/09/02/zen-coding-in-programmers-notepad/</link>
		<comments>http://untidy.net/blog/2010/09/02/zen-coding-in-programmers-notepad/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 20:42:09 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/2010/09/02/zen-coding-in-programmers-notepad/</guid>
		<description><![CDATA[A user requested support for Zen Coding on the bug tracker. Zen Coding is a system for writing HTML and CSS in text editors, expanding shorthand notation to full code. I hadn’t used Zen myself, but a quick read of the excellent Smashing Magazine Introduction and a watch of the above video and I was [...]]]></description>
			<content:encoded><![CDATA[<p>A user requested support for Zen Coding on the <a href="http://code.google.com/p/pnotepad/issues/list">bug tracker</a>. </p>
<p>Zen Coding is a system for writing HTML and CSS in text editors, expanding shorthand notation to full code.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=7405114&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="500" height="344" src="http://vimeo.com/moogaloop.swf?clip_id=7405114&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I hadn’t used Zen myself, but a quick read of the excellent <a href="http://www.smashingmagazine.com/2009/11/21/zen-coding-a-new-way-to-write-html-code/">Smashing Magazine Introduction</a> and a watch of the above video and I was intrigued. </p>
<p>Zen itself is an editor-agnostic set of scripts available in both Javascript and Python. That’s right, Python!</p>
<p>As testament to the good design of Zen, it was a piece of cake to integrate it with <a href="http://pnotepad.org/docs/pypn_overview">PyPN</a>, allowing you to drop Zen for PyPN into your scripts directory and start taking advantage of this useful shorthand.</p>
<p>If you use PN 2.1.4 or later, you can start using Zen yourself right now:</p>
<ol>
<li>Download <a href="http://pnotepad.googlecode.com/files/zencoding-preview.zip">Zen Coding for PyPN Preview</a> </li>
<li>Extract the contents of the zip into your Programmer’s Notepad\Scripts directory </li>
<li>Start PN </li>
<li>Optionally bind the Expand Abbreviation script to a keyboard shortcut </li>
</ol>
<p>Future enhancements to this implementation (and PN 2.1.5) will bring tab stops so that you can tab through the generated code, and probably other Zen Coding commands. For now, let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2010/09/02/zen-coding-in-programmers-notepad/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Development Build</title>
		<link>http://untidy.net/blog/2009/11/19/new-development-build/</link>
		<comments>http://untidy.net/blog/2009/11/19/new-development-build/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 22:54:35 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/?p=377</guid>
		<description><![CDATA[Now that the Mercurial code move is over and a whole bunch more bugs have been worked out, I&#8217;m happy to announce the first 2.1 testing release that&#8217;s being signalled for downloads. The new build is also available for download here: Download 2.1.1.2047 Installer Download 2.1.1.2047 Portable In case you haven&#8217;t been keeping up with [...]]]></description>
			<content:encoded><![CDATA[<p>Now that the Mercurial code move is over and a whole bunch more bugs have been worked out, I&#8217;m happy to announce the first 2.1 testing release that&#8217;s being signalled for downloads. The new build is also available for download here:</p>
<p><a href="http://pnotepad.googlecode.com/files/pn2112047.exe">Download 2.1.1.2047 Installer</a><br />
<a href="http://pnotepad.googlecode.com/files/portable-pn2112047.zip">Download 2.1.1.2047 Portable</a></p>
<p>In case you haven&#8217;t been keeping up with the various <a href="http://untidy.net/blog/2009/08/18/new-testing-release-incoming/">announced changes</a>, 2.1 has these headline features:</p>
<ol>
<li>Full Unicode Support</li>
<li>Support for Translations &#8211; <a href="http://www.pnotepad.org/docs/howto/translate_programmer_s_notepad">PN in your language</a></li>
<li>Prototype <a href="http://untidy.net/blog/2009/10/13/pn-command-bar/">Command Bar</a> feature (with PyPN)</li>
<li>Multiple simultaneous selections, including typing into block selections</li>
<li>Virtual space</li>
</ol>
<p>There are also a lot of bug fixes, smaller improvements and extensions interface improvements. This release of 2.1 is close to what I want to release as the new stable build as soon as it&#8217;s proven at least as stable as 2.0.10.</p>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2009/11/19/new-development-build/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>PN Command Bar</title>
		<link>http://untidy.net/blog/2009/10/13/pn-command-bar/</link>
		<comments>http://untidy.net/blog/2009/10/13/pn-command-bar/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 22:06:49 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/?p=364</guid>
		<description><![CDATA[Version 2.1 introduces a new prototype feature called the Command Bar. The Command Bar enables modal editing control, allowing advanced keyboard control of the editor &#8211; the initial implementation adds some simple VI-style commands. The handling for the commands is entirely implemented in PyPN, and it&#8217;s designed so it&#8217;s easy for you to extend and [...]]]></description>
			<content:encoded><![CDATA[<p>Version 2.1 introduces a new prototype feature called the Command Bar. The Command Bar enables modal editing control, allowing advanced keyboard control of the editor &#8211; the initial implementation adds some simple VI-style commands.</p>
<p><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/dgdaKPG-26c&#038;hl=en&#038;fs=1&#038;rel=0&#038;color1=0x3a3a3a&#038;color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/dgdaKPG-26c&#038;hl=en&#038;fs=1&#038;rel=0&#038;color1=0x3a3a3a&#038;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></p>
<p>The handling for the commands is entirely implemented in PyPN, and it&#8217;s designed so it&#8217;s easy for you to extend and test your extensions immediately. Just edit commands.py and run it as a script and the command handling is updated.</p>
<p>The look and feel will obviously be worked on over time, but this version will be in the forthcoming testing release and can be enabled from the options if you have PyPN installed. This quick video doesn&#8217;t show you all of the features already supported (skipping search and some other combination commands) but gives you a feel for what can be done.</p>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2009/10/13/pn-command-bar/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PyPN Script Repository</title>
		<link>http://untidy.net/blog/2009/05/13/pypn-script-repository/</link>
		<comments>http://untidy.net/blog/2009/05/13/pypn-script-repository/#comments</comments>
		<pubDate>Wed, 13 May 2009 09:07:00 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/?p=343</guid>
		<description><![CDATA[Like the idea of using Python scripts to enhance Programmer&#8217;s Notepad but not sure where to start? James Yoneda has created the awesome ScriptShare website for exactly this purpose: There are a bunch of scripts already there, and hopefully you will add yours too! We&#8217;re working on getting this moved over to pnotepad.org eventually. My [...]]]></description>
			<content:encoded><![CDATA[<p>Like the idea of using Python scripts to enhance <a href="http://pnotepad.org/">Programmer&#8217;s Notepad</a> but not sure where to start? <a href="http://rocketmonkeys.com/">James Yoneda</a> has created the awesome <a href="http://scriptshare.rocketmonkeys.com/">ScriptShare</a> website for exactly this purpose:<br />
<div id="attachment_344" class="wp-caption alignnone" style="width: 445px"><a href="http://scriptshare.rocketmonkeys.com/"><img src="http://untidy.net/blog/wp-content/uploads/2009/05/scriptshare-google-chrome-3.png" alt="Scriptshare in Google Chrome" title="Scriptshare" width="435" height="344" class="size-medium wp-image-344" /></a><p class="wp-caption-text">Scriptshare in Google Chrome</p></div></p>
<p>There are a bunch of scripts already there, and hopefully you will add yours too! We&#8217;re working on getting this moved over to pnotepad.org eventually.</p>
<p>My thanks to James for putting this effort in and creating such a useful site in such short time!</p>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2009/05/13/pypn-script-repository/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PyPN 0.10.973 Released</title>
		<link>http://untidy.net/blog/2009/05/13/pypn-010973-released/</link>
		<comments>http://untidy.net/blog/2009/05/13/pypn-010973-released/#comments</comments>
		<pubDate>Wed, 13 May 2009 08:58:42 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/?p=340</guid>
		<description><![CDATA[I&#8217;m happy to announce a minor bug fix release for PyPN, the Python extension for Programmer&#8217;s Notepad. This release fixes a PN crash if you tried to create a Scintilla object with no active document, and also the exception syntax problem preventing PyPN from working in Python 2.4-2.5. Downloads PyPN 0.10.973 for Python 2.6 PyPN [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m happy to announce a minor bug fix release for PyPN, the <a href="http://python.org/">Python</a> extension for <a href="http://pnotepad.org/">Programmer&#8217;s Notepad</a>. This release fixes a PN crash if you tried to create a Scintilla object with no active document, and also the exception syntax problem preventing PyPN from working in Python 2.4-2.5.</p>
<p><b>Downloads</b></p>
<ul>
<li><a href="http://pnotepad.googlecode.com/files/pypn-0.10.973-py26.zip">PyPN 0.10.973 for Python 2.6</a></li>
<li><a href="http://pnotepad.googlecode.com/files/pypn-0.10.973-py25.zip">PyPN 0.10.973 for Python 2.5</a></li>
<li><a href="http://pnotepad.googlecode.com/files/pypn-0.10.973-py24.zip">PyPN 0.10.973 for Python 2.4</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2009/05/13/pypn-010973-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Programmer&#8217;s Notepad 2 0.9.962 Released</title>
		<link>http://untidy.net/blog/2009/05/02/programmers-notepad-2-09962-released/</link>
		<comments>http://untidy.net/blog/2009/05/02/programmers-notepad-2-09962-released/#comments</comments>
		<pubDate>Sat, 02 May 2009 22:00:06 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/?p=335</guid>
		<description><![CDATA[The latest testing release of Programmer&#8217;s Notepad is out. This release brings a whole bunch of great changes: Script (macro) recording when using PyPN, a customizable toolbar, firefox-style tab ordering and smart highlight. There are also a load of bug fixes too. Downloads 0.9.962 Installer 0.9.962 Portable There is also a new PyPN release fixing [...]]]></description>
			<content:encoded><![CDATA[<p>The latest testing release of Programmer&#8217;s Notepad is out. This release brings a whole bunch of great changes: Script (macro) recording when using PyPN, a customizable toolbar, firefox-style tab ordering and smart highlight. There are also a load of bug fixes too.</p>
<p><strong>Downloads</strong></p>
<ul>
<li><a href="http://pnotepad.googlecode.com/files/pn209962.exe">0.9.962 Installer</a></li>
<li><a href="http://pnotepad.googlecode.com/files/portable-pn209962.zip">0.9.962 Portable</a></li>
</ul>
<p>There is also a new PyPN release fixing a couple of issues with the included scripts from the last build:</p>
<ul>
<li><a href="http://pnotepad.googlecode.com/files/pypn-0.13.962-py26.zip">PyPN 0.13.962 for Python 2.6</a></li>
<li><a href="http://pnotepad.googlecode.com/files/pypn-0.13.962-py25.zip">PyPN 0.13.962 for Python 2.5</a></li>
<li><a href="http://pnotepad.googlecode.com/files/pypn-0.13.962-py24.zip">PyPN 0.13.962 for Python 2.4</a></li>
</ul>
<p>Thanks to all the users who have put time and effort into reporting and following up on bugs, testing, and contributing patches.</p>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2009/05/02/programmers-notepad-2-09962-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmer’s Notepad 2 0.9.921 Released</title>
		<link>http://untidy.net/blog/2009/02/11/programmer%e2%80%99s-notepad-2-09921-released/</link>
		<comments>http://untidy.net/blog/2009/02/11/programmer%e2%80%99s-notepad-2-09921-released/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 21:48:25 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/?p=271</guid>
		<description><![CDATA[The latest testing release of Programmer’s Notepad 2 is finally out. There are plenty of fixes in this release, and a few minor new features too. Of particular note are the following: Updates to the extensions interface allowing extensions to create menu items International input fixed (I know this will please a whole bunch of [...]]]></description>
			<content:encoded><![CDATA[<p>The latest testing release of Programmer’s Notepad 2 is finally out. There are plenty of fixes in this release, and a few minor new features too. Of particular note are the following:</p>
<ol>
<li>Updates to the extensions interface allowing extensions to create menu items</li>
<li>International input fixed (I know this will please a whole bunch of users)</li>
<li>Read only edit protection cleaned up</li>
<li>More text transforms, also available from context menu</li>
<li>Tab to space and vice versa conversions fixed</li>
<li>Notepad’s .LOG feature natively supported</li>
<li>Fix a problem using PN on the Windows 7 beta causing PN to hang on exit</li>
</ol>
<p><strong>Downloads</strong></p>
<ul>
<li><a href="http://pnotepad.googlecode.com/files/pn209921.exe">0.9.921 Installer</a></li>
<li><a href="http://pnotepad.googlecode.com/files/portable-pn209921.zip">0.9.921 Portable</a></li>
</ul>
<p>There is a new PyPN release supporting the updated plugin interface:</p>
<ul>
<li><a href="http://pnotepad.googlecode.com/files/pypn-0.11.921-py24.zip">PyPN 0.11.921 for Python 2.4</a></li>
<li><a href="http://pnotepad.googlecode.com/files/pypn-0.11.921-py25.zip">PyPN 0.11.921 for Python 2.5</a></li>
<li><a href="http://pnotepad.googlecode.com/files/pypn-0.11.921-py26.zip">PyPN 0.11.921 for Python 2.6</a></li>
</ul>
<p>Thanks to all the users who have put time and effort into reporting and following up on bugs, testing, and contributing patches.</p>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2009/02/11/programmer%e2%80%99s-notepad-2-09921-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Search within comments</title>
		<link>http://untidy.net/blog/2008/11/05/search-within-comments/</link>
		<comments>http://untidy.net/blog/2008/11/05/search-within-comments/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 09:59:26 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Programmer's Notepad]]></category>
		<category><![CDATA[PyPN]]></category>

		<guid isPermaLink="false">http://untidy.net/blog/?p=243</guid>
		<description><![CDATA[There was a question on the programming reddit today about finding text within comments only. There’s no way to do this from the UI in Programmer’s Notepad, but it’s easy in PyPN: d = pn.CurrentDoc() s = scintilla.Scintilla(d) searchopts = pn.GetUserSearchOptions() while not pn.CurrentDoc().FindNext(searchopts) == -1: # s.GetStyleAt(s.TargetStart) will work in the next PyPN release [...]]]></description>
			<content:encoded><![CDATA[<p>There was a question on the programming reddit today about finding text within comments only. There’s no way to do this from the UI in Programmer’s Notepad, but it’s easy in PyPN:</p>
<pre class="brush: python;">d = pn.CurrentDoc()
s = scintilla.Scintilla(d)

searchopts = pn.GetUserSearchOptions()

while not pn.CurrentDoc().FindNext(searchopts) == -1:
    # s.GetStyleAt(s.TargetStart) will work in the next PyPN release
    style = d.SendMessage(2010, s.TargetStart, 0)
    # pn.AddOutput(str(style)) - find the current style
    if d.SendMessage(2010, s.TargetStart, 0) == 2:
    break</pre>
<p>That small bit of code will find whatever is in the current user’s search options only where the style is 2 – that’s the C++ comment style number. Sadly these numbers are not uniform across schemes, so we’d need to do a bit more work to do this properly across anything. To turn that small snippet of code into a script that can be run from a keyboard shortcut is also easy:</p>
<pre class="brush: python;">import pn, scintilla

@script(&quot;Find In C++ Comments&quot;)
def FindInCComments():
    d = pn.CurrentDoc()
    s = scintilla.Scintilla(d)

    searchopts = pn.GetUserSearchOptions()

    while not pn.CurrentDoc().FindNext(searchopts) == -1:
        style = d.SendMessage(2010, s.TargetStart, 0)
        if d.SendMessage(2010, s.TargetStart, 0) == 2:
        break</pre>
<p>Just save that into your scripts directory and you’re good to go!</p>
]]></content:encoded>
			<wfw:commentRss>http://untidy.net/blog/2008/11/05/search-within-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

