Subject: How to use any spell-checker you like

From: [email-masked] (Trey Harris)
Date: 7 May 1995 22:27:37 GMT

Assuming you have access to a shell prompt and the
'enable-alternate-editor-cmd' and 'editor' Pine config variables
aren't fixed at your site, using any old spell check program you damn
well please isn't a problem.

The reason is that spell-checkers qualify as "editors", in that they
take the file whose name they were given on the command line and
change it, then save it back in place.  Spell checkers like Ispell are
simply specialized editors.  There are many other examples of such
things; PGP encryption can also be used in such a fashion.

So, you can make use of this fact to allow you to use any spell
checker, editor, encryptor, etc.--without having to constantly change
your Pine configuration.

What you do is this:

1. Do you have a "bin" directory in your home directory? If not,
   create one (cd ; mkdir bin). Add it to your PATH or path
   environment variable:

   a. Edit .cshrc, .profile, .bashrc, or .zshenv (which one you edit
      depends on your shell; probably whichever you see when you do an
      "ls -a" is the right one).  Look for a line, very early on in
      the file, that has "path" or "PATH" in it.  It may look
      something like this:

      setenv PATH /bin:/usr/bin:/usr/ucb:/usr/local/bin

      or like this:

      PATH=/bin:/usr/sbin:/usr/opt/bin:/usr/local/bin

      or even like this:

      path=( /bin /usr/local/bin /sbin . )

      If the line has a PATH in all caps, then there will be colons
      in between the values, if lowercase path then spaces.  Make sure
      to leave colons or spaces between each value, and stay inside
      the parentheses if they're there.

   b. When you've found a line like the above, go to the end (if there
      is a dot [.] right at the end, insert right before that dot) and
      add $HOME/bin (if you're editing a .profile) or ~/bin (if you're
      editing anything else).  Make sure to add a colon if necessary!

   c. Save your file and log out and back in to let the changes take
      effect.

2. Now, go into your bin directory (cd bin), and create a new file.  I
   call mine editi, you can call yours whatever you like.  Put the
   following lines in the file:

#!/bin/ksh
read editor?"Editor?>> "
exec $editor $*

   Make sure that the #! line is the *first* line of the file! (If
   you don't have the KornShell available on your site, you can try
   the following Perl script instead:

#!/usr/bin/perl
print "Editor?>> ";
chop(($editor=<STDIN>));
exec "$editor", @ARGV;

   which should work just as well.  If you have neither, then I feel
   sorry for you. :) [Actually, you can do this in any language.]

3. Save the file.  Then type

chmod 755 <filename>

   to give the file executable, i.e. "program", status.

4. Go into pine.  In Setup/Configuration options, find
   "enable-alternate-editor-cmd" and check it if it isn't already.
   Then, right down near the bottom of the options, there's one called
   "editor".  Change its value to be "editi" (or whatever you called
   the thing you just created).

5. Now, when you need to use any sort of "editor" other than Pico,
   just press control-underscore while composing.  You'll get the
   "Editor?>>" prompt, and you can type the name of any editor you
   want, including ispell, emacs, or whatever.  You can give it
   arguments as you please, i.e. "ispell -t". The only restriction is
   that the editor must take the file it is editing as its last
   argument.

Have fun!
-- 
Trey Harris                              http://sunsite.unc.edu/harris
  System Administrator, Project Isis, Office of Information Technology
                       The University of North Carolina at Chapel Hill