Versions of repl

[previous] [next] [table of contents] [index]

Here are some new versions of the repl command. One lets you include the original message in your reply. Another shows how to send a standard answer without typing any text. A third lets you follow up to a message you've already sent. The fourth is for replies to messages that were sent to me at another address.

Including Original Message in Reply: replx

You may want to include the text from the original message in your reply. I have a version of repl called replx. It acts like repl, but extracts the original text and puts a right angle bracket (>) and space before every line, like this:
% replx
To: joeb@xyz.edu (Joe Blom)
Cc: mh-users@ics.uci.edu
Subject: Re: whatever
In-reply-to: <9501090757.AA02588@xyz.edu>
-------
On Tue, 10 Jan 1995 09:51:06 EST  Joe Blom wrote:
> Blah blah blah
> Blah blah blah

Joe, I think that's right.  But...

NOTE: replx may not work on early versions of MH.

To install replx, use these steps:

  1. To make replx as a version of repl, see the Section Making a New Command Version. To make a repl alias or function named replx, see the Section Writing Command Versions as Aliases or Functions.

    Add the following entry to your MH profile, or add the arguments to your alias or function. The -editor vi and -query are optional:

    replx: -filter replxfilt -form replxcomps -editor vi -query
    
  2. Put a repl filter file named replxfilt in your MH directory. The first line, a comment, starts with a semicolon:
    ; filter file for replx command
    body:component="> "
    
  3. This step simplifies the In-reply-to: field and adds the message date and originator, as shown at the start of this section. If you don't want this change, skip this step and leave the -form replxcomps out of your MH profile entry.

    Put a draft template file named replxcomps in the MH directory. To make it, copy the default system replcomps file. Then delete the the last four lines, shown below (which may be a little different on your version):

    %<{date}In-reply-to: Your message of "\
    %<(nodate{date})%{date}%|%(pretty{date})%>."%<{message-id}\
                 %{message-id}%>\n%>\
    --------
    
    and replace them by these three lines:
    %<{message-id}In-reply-to: %{message-id}\n%>\
    --------\n\
    On %{date} %(friendly{from}) wrote:
    
    the Chapter MH Formatting explains how to modify this.
When you want to include the original message, use replx; for a standard reply, use repl instead. If you don't want to include all of the original message, just fix the reply body with an editor like vi.

Standard Replies: thanks

Sometimes, instead of typing a full reply, you just want to thank a person for something. Or you'd like to send some quick messages that say "OK," or "Request Approved," and so on. You can make versions of repl that send standard replies. For example, one called thanks looks like this. It fills in everything -- you just answer y or n and type s at the What now? prompt:
% show
    ...Message appears...
% thanks
Reply to cathyw? y
Reply to bigboss? n
To: cathyw
Subject: Re: Your report is ready at the copy center
In-reply-to: ...
--------
Thanks!

--Jerry

What now? s
%
The following steps explain how to set up repl versions to send standard replies:
  1. Make a file in your MH directory named thankscomps (the name is your choice, but this is a typical MH name). To make it, start with a copy of the usual replcomps file. Make the end of the file look like this (you can use any text, of course):
        ...These lines omitted...
    -------
    Thanks!
    
    --Jerry
    
  2. To make thanks (or okay or approved...) as a version of repl, see the Section Making a New Command Version. To make an alias or function, see the Section Writing Command Versions as Aliases or Functions.

    Add this entry to your MH profile, or add the arguments to your alias or function:

    thanks: -form thankscomps -editor cat -query
    
    (If you write the push version, you can add -whatnowproc push to that entry, too. Then, you won't need to wait for the What now? prompt either. That's fast!)
The -editor cat shows you the draft, but doesn't prompt you to enter any text (if you want to, you can start an editor from the What now? prompt). The -query may be a good idea because you generally won't want to send a copy of your thank you to everyone who got the original message -- or, if you never want other people to get copies, you might want to use -nocc all instead of -query.

If you'd like to include a copy of the original message, use a standard -form replcomps (instead of thankscomps) in your MH profile entry. Add a -filter thanksfilt (or appfilt, okfilt, ...). Here's an appfilt file that approves a message. It includes the message and adds more details:

:The following request has been approved for current fiscal year funding:
:
body:component="> "
:
:1) Fill out form K-9 in triplicate.
:2) Print your last name first and your first name last.
:3) Send form to Dee Roff in the Formatting Department.
:
:-- Hiram Q. Bigbottom, President

Followup Mail Messages: foll, follx

After you send a mail message do you ever wish that you'd said one more thing? Here are two versions of repl to make that easier. The foll command sends a followup mail message with the same message header in your followup as in the original message -- plus an X-followup-to: field that references the original. follx works like foll, but it also uses a filter file that extracts (reads in) a copy of your original message and starts a text editor for you. (Of course, you must have a copy of your original message -- for instance, if your original had an Fcc: field in it, or if you cc:'ed yourself.)

For example:

% comp
To: belle@vogue.com
cc: charles@ritz.fr
Fcc: outbox
Subject: I loved that show!
------
It was simply maaaahvelous.
You MUST invite me again.

CTRL-D

What now? send
% follx last +outbox
To: belle@vogue.com
cc: charles@ritz.fr
Subject: Re: I loved that show!
X-followup-to: My message of "Tue, 10 Jan 1995 02:07:09 -0500."
             <9501090707.AA28207@mysun.xxx.yyy.zzz>
------
In my message, I wrote:
   It was simply maaaahvelous.
   You MUST invite me again.

I forgot to mention the lovely caviar!
Blah, blah, blah...

CTRL-D

What now? send
%
If you don't want to include all of the original text, just edit the followup at the What now? prompt (with vi, etc.) before you send it.

Here's how to add foll and follx:

  1. Make a file named follcomps in your MH directory:
    %(lit)%(formataddr{to})%<(nonnull)%(void(width))%(putaddr To: )\n%>\
    %(lit)%(formataddr{cc})%<(nonnull)%(void(width))%(putaddr cc: )\n%>\
    %<{fcc}Fcc: %{fcc}\n%>\
    Fcc:
    %<{subject}Subject: Re: %{subject}\n%>\
    %<{date}X-followup-to: My message of "\
    %<(nodate{date})%{date}%|%(tws{date})%>."%<{message-id}
                 %{message-id}%>\n%>\
    --------
    
    If you never use folder copies, get rid of the Fcc: field. If you'd rather, you can send a cc: to yourself automatically by adding %(formataddr(me)) next to the %(formataddr{cc}).
  2. Put a file named follxfilt in your MH directory. Here are two choices. This first one is basic; it's what you see in the previous example:
    ; filter file for follx
    :In my message, I wrote:
    body:nocomponent,offset=3
    
    This second one puts the date of the original message in the heading (for help with it, see the Chapter MH Formatting):
    ; filter file for follx
    date:nocomponent,formatfield="On %{text} I wrote:"
    body:component="< ",overflowtext="< "
    
  3. To make foll and follx as versions of repl, see the Section Making a New Command Version. Or, to make an alias or function, see the Section Writing Command Versions as Aliases or Functions.

    Add these entries to your MH profile, or add the arguments to your alias or function:

    foll: -form follcomps
    follx: -form follcomps -filter follxfilt -editor vi
    
By the way, you can do the same thing in a simpler way with a command like:
% comp +inbox 12
where +inbox 12 is the message you want to follow up on. The comp command will make a new draft with a copy of that message. Then you can edit the draft copy and send it.

That's not as handy as the foll command version, though, because the draft header will have fields (like Date:, Received:, Message-Id:, and so on) that you'll have to delete before you send the draft.

Reply from Another Address: replb

As explained in the Section Signature and From:, I get mail from a few system aliases. When I do, and I want to reply, I'd like to use the alias address in the reply's From: field. I usually also include some of the text from the original message in my reply. I have a version of repl called replb. Like replx, replb includes text from the original message. It also changes the From: address in the header to match the alias. After I finish answering repl -query about the header, it puts me into the vidraft script to edit the message. vidraft, shown below, starts vi with the cursor at the first line of the message body. Of course, you can use any editor you want with replb.

NOTE: replb may not work on early versions of MH.

Here are the steps for installing replb:

  1. To make replb as a version of repl, see the Section Making a New Command Version. To make it as an alias or function, see the Section Writing Command Versions as Aliases or Functions.

    Add the following entry to your MH profile, or add the arguments to your alias or function. The -ed vidraft and -query are optional:

    replb: -filter replbfilt -query -nocc me -ed vidraft -form replbcomps
    
  2. If you want to use the vidraft editor, put a copy of the file below in your bin directory. (You can get it in this book's online archive.) There are directions in the Section Writing Shell Scripts for MH.
    #! /bin/sh
    # $Id: vidraft,v 1.1 92/07/19 09:36:09 jerry Exp $
    ### vidraft -- edit draft message starting at top of body
    
    # ex command goes to top, then row of dashes; then next (if can):
    exec /usr/ucb/vi +'1;/^--*$/;+' $*
    
  3. Put a repl filter file named replbfilt in your MH directory. The body: line includes the body of the message you're replying to. You'll want to change my signature; it's made by the lines that start with colons (:):
    ; filter file for replb command
    body:component="> "
    :
    :Jerry Peek -- Manager, Online Information Services
    :O'Reilly & Associates, Inc.; 103A Morris St.; Sebastopol, CA 95472 USA
    :ORA info: gopher.ora.com, email to nuts@ora.com, or just phone us.
    :Me: jpeek@jpeek.com; (800)998-9938, +1 707-829-0515, fax +1 707-829-0104
    
    Here's a MIME version that makes a multipart message with descriptions:
    ; filter file for replb command
    :#<text/plain [Your original message]
    body:component="> "
    :#<text/plain [Signature]
    :Jerry Peek -- WebMaster, GopherMaster, ListMaster, etc.
    :phone US/Canada toll-free, (800)998-9938;
    :international: +1 707 829-0515; FAX: +1 707 829-0104
    :Information or questions about orders: nuts@ora.com
    
  4. This step adds the From: field and a cc: bookquestions, too, as shown at the start of this section. Of course, you'll want to change this in your version. The From: address might have a different syntax. You might use an Fcc: instead of a cc:.

    Put a draft template file named replbcomps in the MH directory. To make it, copy the default system replcomps file. Add the following two lines to the top of the file:

    From: "Your Name" <aliasname@host.xxx.yyy>
    cc: aliasname
    
When you want to reply to a message from the alias, use replb; for a standard reply, use repl instead.

[Table of Contents] [Index] [Previous: Writing Command Versions as Aliases or Functions] [Next: Make Message Bookmarks with mark]


Last change $Date: 1996/06/06 15:14:58 $

This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.

Suggestions are welcome: Jerry Peek <jpeek@jpeek.com>