3 March 2014

PyRoom and search

PyRoom is my favourite distraction-free editor, described here. Despite what I wrote back then, I do rather miss a search function. One was slated at LaunchPad, but that was in October 2009.

PyRoom produces plain text files, and these of course can be manipulated with any other text editor. I like jEdit, which I use with its XML plug-in to turn my texts into HTML and thence into ebooks.

Here’s the thing. If a file is open simultaneously in jEdit and another application, and the other application changes and saves it, jEdit can automatically detect the change.

PyRoom runs principally on Linux. A Mac version is here; installation is not for the novice. jEdit is available for the Macintosh as well.

Like the Mac’s OS X, Linux supports multiple “workspaces”. You can switch between them in various ways, including a keystroke combination, which is handy because PyRoom takes up the whole screen. If you have PyRoom open in Workspace 1, say, and jEdit open in Workspace 2 it is easy and quick to swap from one to the other.

To use PyRoom and jEdit simultaneouly, save your PyRoom file with Ctrl-S. (Saving to the desktop is easiest here.) Switch to Workspace 2. Click on the file’s icon: if jEdit is configured as your default text editor, the file opens at once. (Otherwise, right-click and choose jEdit in the “Open With” dialog.) Hit Ctrl-F and you’re ready to search. If you make no change to the file, simply go back to PyRoom and continue drafting. If you have changed something with jEdit, save the altered file, and then, in PyRoom, empty its buffer with Ctrl-W. Hit Ctrl-O and reopen the file. This takes no more than a couple of seconds. On opening a file, PyRoom puts the cursor at the end, so you should try to keep the “coal face” there: in other words, if you have odd and sods of text that you want to retain in that file, store them at the beginning. The alternative is to page-up back to your place, which is tiresome because ... there’s no search function :-)

When you need to go back to jEdit, save the file again with PyRoom and you’ll find a jEdit dialog telling you that changes have been detected.

When your session comes to an end, save the file using PyRoom (I also “Save As” on a USB stick in case the hard disk blows up). In jEdit, hit Ctrl-W (close file) and Ctrl-Q (quit) and you’re done.

This is a work-around, I know, but it does work, and needs only a few more keystrokes than a built-in search function.

To conclude, here are some PyRoom tips.

The choice of font is important. Depending how big a font is “on the body”, the text will appear more or less dense. As I noted in my other post, you can increase the line-spacing (i.e. the leading) in the Preferences, but this introduces unsightly gaps between paragraphs. It is best to keep the extra line-spacing to no more than 2 or 3 pixels.

I have tested a lot of fonts. The best professional-quality, seriffed font I have found for use with PyRoom, having an acceptable amount of built-in “leading”, is Bitstream Charter. The best professional-quality, sanserif font I have found is Droid Sans (Droid Sans Fallback looks identical to me). Both Bitstream Charter and Droid Sans [Fallback] will be found in a typical Linux distribution.

PyRoom does not support italics, bold, or smart quotes. Nor will it automatically convert ellipses, short or long dashes, etc. You can add these by hand, but that’s fiddly and time-consuming. It’s easier to keep to plain text until your draft is complete.

I use a simple set of characters for markup, as follows:

= open and close =italics= (I find this easier on the eye than the underscore character)

* open and close *bold*

" double-quotes (both opening and closing)

' apostrophe, close-single-quotes and elision marks (e.g. fish ’n’ chips)

` (U+0060) open-single-quotes (there is usually a key for this on PC keyboards)

-- en-dash

--- em-dash

... three full-stops for an ellipse

Angle brackets enclose headings and chapter breaks, e.g. < PART ONE >, < chapter break >

Curly brackets enclose other things I may need to attend to individually, such as:

{pb} pagebreak

{fl} flush this line left

{fc} centre this one

{fr} flush this one right

{e/} accented character, é in this case; others are {a"}, {c cedilla}, etc.

The regular-expressions option in jEdit’s search-and-replace dialog will swiftly help you to convert these into HTML tags and entities. The rule when “smartifying” double quotes is that each " preceded by a newline or space becomes an open-double-quote. Change these first, then the rest will be close-double-quotes. I haven’t got round to learning how to write a jEdit macro to automate the S-&-R, but it’s on the to-do list ...

No comments: