Nov 13

Test Programmer’s Notepad 2.4

I have a candidate release of Programmer’s Notepad 2.4 ready, including the following changes:

What’s new in 2.4?

  1. Fuzzy matching in “Jump to” dialog, e.g. MTM for MyTestMethod
  2. New style presets
  3. New translations
  4. Delay Windows shutdown for file save
  5. Improved find dialog resizing
  6. Python Scripting Extension (PyPN) included as optional component in installer

Bug Fixes:

  1. Fixes to XML/HTML tag completion
  2. UTF-8 Replace All and UTF-8 character code improvements for Regex search
  3. Fix for script recording due to Scintilla bug

Please help to test it, let me know if it’s ready for primetime!

Download Installer

Download Portable

Update: Users with unstable updates enabled should now see this update available.

May 11

Regular Expressions and Scripts – Worked Example

Programmer’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’t contain a pattern? This regular expression matches any line that doesn’t contain “not here”:

^((?!not here).)*$

Sometimes I find myself repeating the same set of Search/Replace operations in order to format text. If I’m going to do this more than a couple of times, I record a script using PyPN to make things easier for myself. Today I was turning text like this:

    LogStep("Do something");
    LogStep("Do another thing");

Into text like this:

Do something
Do another thing

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’s what I did:

  1. Tools > Record Script
  2. Replace All: ^((?!LogStep).)*$ with (nothing)
  3. Replace All: (\r\n){2,} with \r\n
  4. Replace All: \s*LogStep\("([^"]+)"\); with \1
  5. Tools > Stop Recording

At the end of this Programmer’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’s name and saved it to C:\Program Files\Programmer’s Notepad\Scripts. Here’s the script (which I reduced slightly for posting here):

import pn, scintilla

@script("Clean Up Log Steps", "Testing")
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
	# When recording, the result of this operation was: pn.FindNextResult(37)

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

	opt.FindText = u'\\s*LogStep\\("([^"]+)"\\);'
	opt.ReplaceText = u'\\1'
	# When recording, the result of this operation was: pn.FindNextResult(10)

If I was going to use this script a lot, I could bind it to a shortcut key in Tools > Options > Keyboard.

Sep 10

PyPN 0.12 Released

Coinciding with the new Programmer’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.

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 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.

Once you have installed PyPN 0.12, you can now use Python code in your Text Clips by enclosing it in backticks, e.g.

`print "Hello from PyPN"`

Anything you print to stdout will be included in the clip text.

Sep 10

Zen Coding in Programmer’s Notepad

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 intrigued.

Zen itself is an editor-agnostic set of scripts available in both Javascript and Python. That’s right, Python!

As testament to the good design of Zen, it was a piece of cake to integrate it with PyPN, allowing you to drop Zen for PyPN into your scripts directory and start taking advantage of this useful shorthand.

If you use PN 2.1.4 or later, you can start using Zen yourself right now:

  1. Download Zen Coding for PyPN Preview
  2. Extract the contents of the zip into your Programmer’s Notepad\Scripts directory
  3. Start PN
  4. Optionally bind the Expand Abbreviation script to a keyboard shortcut

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!

Nov 09

New Development Build

Now that the Mercurial code move is over and a whole bunch more bugs have been worked out, I’m happy to announce the first 2.1 testing release that’s being signalled for downloads. The new build is also available for download here:

Download Installer
Download Portable

In case you haven’t been keeping up with the various announced changes, 2.1 has these headline features:

  1. Full Unicode Support
  2. Support for Translations – PN in your language
  3. Prototype Command Bar feature (with PyPN)
  4. Multiple simultaneous selections, including typing into block selections
  5. Virtual space

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’s proven at least as stable as 2.0.10.

Oct 09

PN Command Bar

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 – the initial implementation adds some simple VI-style commands.

The handling for the commands is entirely implemented in PyPN, and it’s designed so it’s easy for you to extend and test your extensions immediately. Just edit and run it as a script and the command handling is updated.

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’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.

May 09

PyPN Script Repository

Like the idea of using Python scripts to enhance Programmer’s Notepad but not sure where to start? James Yoneda has created the awesome ScriptShare website for exactly this purpose:

Scriptshare in Google Chrome

Scriptshare in Google Chrome

There are a bunch of scripts already there, and hopefully you will add yours too! We’re working on getting this moved over to eventually.

My thanks to James for putting this effort in and creating such a useful site in such short time!

May 09

PyPN 0.10.973 Released

I’m happy to announce a minor bug fix release for PyPN, the Python extension for Programmer’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.


May 09

Programmer’s Notepad 2 0.9.962 Released

The latest testing release of Programmer’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.


There is also a new PyPN release fixing a couple of issues with the included scripts from the last build:

Thanks to all the users who have put time and effort into reporting and following up on bugs, testing, and contributing patches.

Feb 09

Programmer’s Notepad 2 0.9.921 Released

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:

  1. Updates to the extensions interface allowing extensions to create menu items
  2. International input fixed (I know this will please a whole bunch of users)
  3. Read only edit protection cleaned up
  4. More text transforms, also available from context menu
  5. Tab to space and vice versa conversions fixed
  6. Notepad’s .LOG feature natively supported
  7. Fix a problem using PN on the Windows 7 beta causing PN to hang on exit


There is a new PyPN release supporting the updated plugin interface:

Thanks to all the users who have put time and effort into reporting and following up on bugs, testing, and contributing patches.