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 2.1.1.2047 Installer Download 2.1.1.2047 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.

Announcing pnotepad-plugins and TextUtil 0.1

I’d like to introduce you to a new Google Code project, pnotepad-plugins. If you can’t tell from the name, this is a contributors-welcome project for Programmer’s Notepad plugins. Everything you need to make plugins using Visual Studio (Express should be fine) in one repository. The repository is stored in Mercurial so you don’t even need to be a project member to use/fork/branch the code.

The first plugin in pnotepad-plugins is TextUtil, it serves not only as an example but also hopefully as a useful plugin too. The first release of TextUtil is now available, and comes with the following commands:

  • Sort Lines

  • Copy Marked Lines

  • Cut Marked Lines

  • Bookmark Marked Lines

  • Marked Ranges to Selections

  • Selections to Marked Ranges

  • Smart Highlight to Selections

  • Smart Highlight to Marked Ranges

  • Reverse Selection(s)

I’d love to see people store their plugin code in this project, and move things forward.

Download TextUtil 0.1 for PN 2.1 now.

To get started just drop textutil.dll in your Programmer’s Notepad directory, and run pn --findexts.

Replacing Notepad with PN via Image File Execution Options

A user opened a bug asking me to look into a new way of replacing notepad.exe with PN. Previous methods have involved a small program that pretends to be notepad.exe but actually launches PN. This has a number of problems:

  1. Replacing system files like notepad.exe on modern Windows is much harder due to System File Protection

  2. Many tools expect notepad.exe to hang around until you save the file, meaning they can pick up the changes when you’re done. The notepad.exe replacement exited having launched PN so didn’t work well with this.

The new technique involves using something called Image File Execution Options. This is a set of registry settings used to make Windows run a debugger automatically when a program is launched. We can piggyback on this to run PN instead of notepad when it’s launched.

Steps

  1. Create this Registry Key:

    HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ Image File Execution Options\notepad.exe

  2. Add a string value called “Debugger”, set the value to:

    c:\Program Files\Programmer’s Notepad\pn.exe –allowmulti -z

The –allowmulti deals with the second problem listed above, making sure that even if PN is already running a new instance is started – this means that the calling process can wait for PN to exit. The –z tells PN to ignore the next parameter, which when using Image File Execution Options is the process name that we’re replacing – the full path to notepad.exe in this case.

This is only available in the lastest 2.1 testing release for now (1117), but should be ready to try. Let me know how you get on.

Note that if you’re on 64-bit Windows you’ll need the following Registry Key instead:

HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\
CurrentVersion\Image File Execution Options

Switching to Mercurial

This is probably only of interest to those who use the PN source code, if you don’t then feel free to move right along!

Now that Google Code supports Mercurial for source control I’m considering whether to move PN to this. Mercurial provides a much better model for managing Open Source project source control as it allows each user to maintain a local set of changes with full change history without needing project approval for commits. Any changes that the project is interested in taking can then be pulled into the main project tree.

Unless there are any major objections to the move I’ll start working on the import soon. The source at it’s final subversion revision will remain available in subversion indefinitely, but new commits will only go to the mercurial repository.

More on Mercurial:

All feedback welcome, here or in the forums.

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