Pathetic Writer - Scheme

# Scheme

Pathetic Writer uses Scheme for commands. This means that the program can be easily extended with new functions. When Load is chosen from the File menu, for instance, the Lisp function (load-buffer) is called. It is thus possible to make File - Load do something completely different by writing a new load-buffer function, perhaps adding the ability to read other file formats.

### Functions available as commands

(backward-cell)
  Move point one cell to the left.
(forward-cell)
  Move point one position to the right.
(next-line)
  Move point one line down.
(previous-line)
  Move point one line up.
(beginning-of-line)
  Move point to column 1.
(end-of-line)
  Move point to the last used position in the current line.
(beginning-of-buffer)
  Move point to column 1, line 1.
(end-of-buffer)
  Move point to the last used position in the last used line.
(top-of-buffer)
  Move point to line 1 without changing the column.
(bottom-of-buffer)
  Move point to the last used line without changing the column.
(scroll-up)
  Move the window up one windowful.
(scroll-cell-up)
  Move the window up one line.
(scroll-down)
  Move the window down one windowful.
(scroll-cell-down)
  Move the window down one line.
(scroll-left)
  Move the window left one windowful.
(scroll-cell-left)
  Move the window left one column.
(scroll-right)
  Move the window right one windowful.
(scroll-cell-right)
  Move the window right one column.
(what-cursor-position)
  Prints information about the current position on the status bar.
(delete-cell)
  Delete the contents of the current position.
(insert-line)
  Insert an empty line, moving the rest of the document down.
(set-mark-command)
  Move mark to the current position.
(exchange-point-and-mark)
  Swap point and mark.
(kill-region)
  Should delete everything between point and mark for compatibility with Emacs, but currently does nothing. Block commands are available for that purpose.
(copy-block)
  Copy the block to the current position.
(delete-block)
  Deletes all the block.
(print-block)
  Dumps the block to a text file.
(set-block)
  Sets the block to be the area between mark and point.
(save-block-file)
  What does this do?
(new-pw)
  Loads a new Pathetic Writer window.
(load-buffer)
  Loads a Pathetic Writer document into a new buffer.
(save-buffer)
  Saves the current buffer as a Pathetic Writer document.
(save-buffer-as)
  Saves the current buffer using a new file name.
(print-version)
  Prints version information on the status bar.
(help-contents)
  Starts the Chimera program with pw.html as argument.
(help-search)
  Search for keyword. Currently not implemented.
(help-for-help)
  Starts the Chimera program with siaghelp.html as argument.
(recenter)
  Redraws the screen.
(execute-extended-command)
  Read and execute a Scheme command.
(keyboard-quit)
  Abort a multi-key command sequence.
(quit-pw)
  Exit from Pathetic Writer. If there are any unsaved changes, asks if they should be saved.
(no-op)
  Does nothing. Sometimes useful for debugging.

There are two ways to execute Scheme code:

1. Pressing ( and typing it in the input window
2. Loading it from a file using (load "filename")

A file can be loaded on startup by giving the option -iFilename on the command line. A useful file to load is siod.scm which adds common functions like caar, cadr and the like.

## Function Reference

### (new-buffer)

Opens a new empty Pathetic Writer window.

### (load-buffer)

Asks for a file name and opens the file with that name as a Pathetic Writer document.

### (save-buffer)

Saves the currently open document using the most recently used filename. If no name has been given to the document, the name "noname" is used.

### (save-buffer-as)

Asks for a filename and saves the currently open document using that filename.

### (preview)

Preview the contents of the current buffer.

### (make-backups 0/1)

Turn on or off the optional backups that are made of the original file when the buffer is saved. The backup has the same name as the original with .BAK appended.

### (change-margins buffer)

Set the top, bottom, left, right, header and footer margins. The header/footer margin is the distance to the edge of the sheet. If buffer is nil, the current buffer is changed. If buffer is "", the global default is set for new buffers.

### (change-paper-size buffer)

Set paper size and select portrait or landscape orientation. If buffer is nil, the current buffer is changed. If buffer is "", the global default is set for new buffers.

### (change-headfoot buffer)

Set the header and footer printed on each page. They are specified by strings in the same format as those used by strftime, with two additions: &n substitutes the buffer name and &p substitutes the page number.

If buffer is nil, the current buffer is changed. If buffer is "", the global default is set for new buffers.

### (print)

Prints the current buffer using the lpr command.

### (print-format)

Allows the user to enter the name of the print command and the previewer.

### (load-external)

Load document using external program such as wget.

### (save-external)

Save document using external program.

### (quit-program)

Quits from Pathetic Writer. If there are any unsaved changes, Pathetic Writer asks if they should be saved.

### (insert-line)

Insert a line into the document, shifting the rest of the document down.

### (set-mark-command)

Moves the mark to the current cell.

### (set-block)

Sets the block to be the rectangular area between the mark and the current cell.

### (copy-block)

Copies the contents of the block to the area to the right and below the current cell.

### (delete-block)

Deletes all the cells in the block.

### (set-line-height)

Sets the height in pixels of the current row.

### (switch-to-buffer)

Change which buffer is displayed in the current window.

### (kill-buffer)

Delete the current buffer.

### (split-window-vertically)

Split the current buffer in two.

### (delete-window)

Remove the current window and give its space to its neighbors.

### (delete-other-windows)

Remove all windows except the current one.

### (other-window)

Make the next window current.

### (help-contents)

Displays the Pathetic Writer online documentation.

### (help-search)

This command does nothing.

### (help-copyright)

Displays the GNU public licence.

### (help-for-help)

Displays help for using the online help.

### (print-version)

Displays the current version string.