# The jmore File Viewer

## Introduction

The `jmore` application is an X Windows version of `more`(1) - an application that lets you page through one or more specified files or standard input. It is written in `wish`, an X Windows scripting language based on the Tk toolkit and the Tcl scripting library (all three by John Ousterhout of Sun Microsystems).

A preferences panel and a separate preferences application let you configure its appearance, and you can further customise its behaviour via a startup file written in Tcl.

The `jmore` application is essentially a wrapper around the `j:more` panel defined in the jmore.tcl library. (This is responsible for some of its limitations.)

The `jmore` file viewer is distributed as part of the jstools package.

This help file describes `jmore` version 4.0/4.0.

Copyright and contact information is available in the jstools documentation.

## Invocation

`jmore` [filename]...

or

`jmore -prefs`

To view a file, type ``jmore` filename' at the Unix shell prompt, assuming `jmore` is in your path. You'll get an error message if the file doesn't exist.

You can specify several files on the command line; each will be displayed in its own window.

If you don't specify any files on the command line, `jmore` will read its standard input until endoffile, and then display it. (Thus, `jmore` can be used at the end of a pipe, or specified as a pager for other applications.)

If you invoke `jmore` with the `-prefs` flag, then instead of displaying files `jmore` will present you with a preferences panel (described below) that lets you set preferences. The preferences you choose will take effect the next time you use `jmore`.

If a filename ends in the extension .jrt, it is assumed to be a `jedit` richtext file as described in The `richtext' Mode, and it will be displayed with formatting intact. It will also be displayed as richtext if it ends in the extension .jdoc, used for `jdoc` documents - these support a superset of richtext formatting, including hypertext links, but `jmore` only supports those formatting features that are shared with `jedit`'s richtext mode.

## Viewing the Text

You can't edit the text displayed in a `jmore` window, but you can select it.

If it's longer than one screenful, you can scroll it with the scrollbar. You can also scroll from the keyboard: pressing Space, Next or PageDown, or Control-v will scroll the text down, and pressing b, Prior or PageUp, or Escape-v will scroll the text up.

## Using the Buttons

At the bottom of each `jmore` window are four buttons: `Done', `Save', `Print', and `Find...'.

### Done

This button closes the window. If it's the last (or only) `jmore` window, it also quits `jmore`. The Done button is the default button, so just pressing Return will invoke it.

### Save

This button brings up a File Selector panel that prompts you for the name of a file to save the contents of the window to.

### Print

After asking for confirmation, this button prints the contents of the window (using the Unix `lpr` command) to the printer you have selected on the Global Preferences panel. (See Preferences and Invocation on how to bring up the Global Preferences panel.)

### Find...

This button brings up a panel that lets you search for text in the window. Note that the Find panel searches from the position of an invisible `insert point' in the text window. This can be confusing. If you can't find something you think should be there, try scrolling to the top of the window and clicking the mouse at the beginning of the text.

## Preferences

### File Viewer Preferences...

When you invoke the file viewer with the `-prefs` flag, it displays a preferences panel. At the bottom of the panel are two buttons, `Save', which saves the current settings on the File Viewer Preferences panel and quits, and `Global Preferences', which brings up the jstools Global Preferences panel. The Save button is the default button, so you can just press Return to invoke it.

The three radio buttons labelled `Don't wrap lines', `Wrap lines on character boundaries', and `Wrap lines at word boundaries' control how lines which are longer than the width of the window are displayed. They should be fairly selfexplanatory. (Richtext files are always displayed with lines wrapped at word boundaries, regardless of the setting of this preference.)

The `Font:' field lets you choose what font is used to display the text you're viewing. You can type in an X font specification, or click the `Choose...' button to select a font visually using the `xfontsel`(1X11) application. (Use `xfontsel`'s menus to choose a font based on its various attributes, such as size and weight, and click `xfontsel`'s `Quit' button to enter the font you have chosen into the editor's `Font:' field.) You can click the `Default' button to set the font field to ``default`', which means to use the X default font (using the X default specification ``Tk*Font:`'), or 12point Courier if there is no X default. See the man page for the X server, often `X`(1X11), for more information about X font specifications and X defaults.

The `Width:' and `Height:' fields let you change the width (in columns) and height (in characters) of viewer windows.

File viewer preferences are stored in the file ~/.tk/jmore-defaults. (Global preferences are saved in the file ~/.tk/defaults.)

## Customising jmore

`jmore` supports the standard jstools customisation mechanisms. You should consult the document Customising jstools Applications as well as the description below.

### The ~/.tk/jmorerc.tcl startup script

The file ~/.tk/jmorerc.tcl can contain Tcl code to customise your file viewing environment. At present, it isn't very useful, because the structure of the application makes it hard to customise the user interface. I hope to add hooks in a future version to make it easier to customise `jmore`; for instance, to let you add buttons, or run filters on files before displaying them.

### Sample files

If `jmore` was installed normally at your site, the directory /usr/local/lib/jstools/samples should contain some example files which you can copy, rename appropriately, and modify to your liking. (You may also find it useful to look at the `jmore` script itself, and for information about Tcl syntax you should consult the various Tcl and Tk man pages.)

## Bugs and Misfeatures

* If there's a Find panel displayed when you close the last file viewer window, the application doesn't quit.

* The `-prefs` flag is a silly kludge. There should be a `Prefs...' button or some such.

* The behaviour of the Find panel (searching from an invisible insert point) is confusing.

## Future Directions

* There should be more preferences, for such things as colours.

* There should be a `-class` or `-mode` commandline option, so, for instance, copies of `jmore` being used as pagers for mail can be visually distinct from other invocations of `jmore`.

* A menu might be nice.

* I want to standardise bindings for noneditable text widgets and put them in the bindings libraries in some fashion.

* I want to put in hooks that the user can redefine in ~/.tk/jmorerc.tcl for things like filtering files as they're read or adding buttons (which latter will depend on adding `j:more:button` to jmore.tcl).

* When reading from standard input, `jmore` should display data as it's received, rather than just showing it all at the end. (I.e., it should do what `tail -f` does.)

* The Find panel should work differently; it should highlight all the found strings, and then let you jump back and forth among them.

``