[comp.mail.mh] Beginner questions

maddog@eniac.seas.upenn.edu (maddog) (06/21/91)

I have a couple questions about mh:

1) When starting up mh-e using the command: `emacs -f mh-mail', how can I get
   it to rescan the folder automatically so that all my mail is shown and not
   just the newly incorporated pieces?

2) We have an account which is used for receiving and replying to users'
   questions.  Is it possible (using my account) to read and reply to the
   mail from the other account such that the header information (i.e. From:)
   is that of the other account and not mine?

3) I would appreciate any (detailed) examples of .maildelivery, *comps, 
   .mh_profile, etc. from which I could learn.

   Thanks!


         -maddog 
-------------------------------------------------------------------------------
maddog@eniac.seas.upenn.edu            Project: To get all of Penn to use
University of Pennsylvania                      MH :)
CSE, class of '92

gildea@EXPO.LCS.MIT.EDU (Stephen Gildea) (06/21/91)

    I have a couple questions about mh:
    
    1) When starting up mh-e using the command: `emacs -f mh-mail',
       how can I get it to rescan the folder automatically so that all
       my mail is shown and not just the newly incorporated pieces?

    ...


Well, you can't.  That is, you can't until you apply this one-line
patch to mh-e:

*** mh-e.el~	Fri May 17 17:26:28 1991
--- mh-e.el	Fri Jun 21 10:59:34 1991
***************
*** 910,914 ****
  
  
! (defun mh-rescan-folder (range)
    "Rescan a folder after optionally processing the outstanding commands.
  If (optional) prefix argument is provided, prompt for the range of
--- 910,914 ----
  
  
! (defun mh-rescan-folder (&optional range)
    "Rescan a folder after optionally processing the outstanding commands.
  If (optional) prefix argument is provided, prompt for the range of



Now you can say "emacs -f mh-rmail -f mh-rescan-folder"
Note that's "mh-rmail" not "mh-mail."  And don't try running
mh-rescan-folder without mh-rmail first to load and initialize mh-e.

 < Stephen
   MIT X Consortium

marvit@HPLPM.HPL.HP.COM (Peter Marvit) (06/21/91)

> I have a couple questions about mh:
> 
> 1) When starting up mh-e using the command: `emacs -f mh-mail', how can I get
>    it to rescan the folder automatically so that all my mail is shown and not
>    just the newly incorporated pieces?

Here's a version of what I use in my standard .emacs. Note that I rarely
leave the Emacs evironment.  Modify as you see fit.

    (progn (load "mh-e" MISSING-NOT-OK NOMESSAGE)
	   (mh-rmail)  ; enter mailer....
	   (mh-rescan-folder (list "all")) ; show old messages as well...


> 2) We have an account which is used for receiving and replying to users'
>    questions.  Is it possible (using my account) to read and reply to the
>    mail from the other account such that the header information (i.e. From:)
>    is that of the other account and not mine?

Any of the *comps* can be modified by hand and used by the standard MH
progs. Copy them from /usr/local/lib/mh (or wherever they reside) to
~/Mail, and edit as you wish. replcomps will be the trickiest, but see
the man page for mh-format(5) for help. Simply modify your .mh_profile or
use command line options to use the modified *comps*.

> 3) I would appreciate any (detailed) examples of .maildelivery, *comps, 
>    .mh_profile, etc. from which I could learn.

I'll leave that to others, though I seem to remember JLR's stuff in the
source distribution somewhere.

BTW, maddog, I'll be on UPenn campus next fall if you need personal
assistance. 

	-Peter "HP's MH guy" Marvit


: Peter Marvit   Hewlett-Packard Labs in Palo Alto, CA   (415) 857-6646    :
: Internet: <marvit@hplabs.hpl.hp.com>  uucp: {any backbone}!hplabs!marvit :

jerry@ora.com (Jerry Peek) (06/23/91)

In <44917@netnews.upenn.edu> maddog@eniac.seas.upenn.edu (maddog) writes:
> 3) I would appreciate any (detailed) examples of .maildelivery, *comps, 
>    .mh_profile, etc. from which I could learn.

Well, maddog, if you're a student you might not have any spare $$ :-)
to get a copy of the "MH & xmh" Nutshell Handbook.  And I haven't seen
many MH profiles posted to this newsgroup.  So, here's a section from 
the book with a sample file.  Some of the explanation is in other parts
of the book, but this section should help a lot.  I hope this is
useful to lots of people and not too long for the rest of you...

--Jerry Peek, O'Reilly & Associates, jerry@ora.com or uunet!ora!jerry

---------------------------------------------------------------------------

There are several kinds of components in your MH profile:

- Components for individual MH commands, such as repl and inc.
  These lines start with the name of the command and a colon.
  The other part of each component is one or more command line parameters that
  you'd like that command to use by default.
  For example, this line tells repl to ask you who should
  get copies of your reply, then to start the emacs editor:

	repl: -query -editor emacs

  You use the same syntax for other MH commands, including the command
  versions explained in Chapter 9.  Lines 19-30 and lines 31-56 of the file
  below are this kind.

- Other components apply to (in general) more than one MH command.
  For example, this component tells MH commands that you want to use the vi
  editor wherever possible:

	Editor: vi

  The mh-profile(5) reference page in Appendix G has a list of these.
  See lines 1-18 of the file below.

  In most cases, this type of setting is overriden by settings you make for
  individual MH commands.  For instance,

	repl: -editor emacs

  would override a setting like

	Editor: vi

- You can make comments in the MH profile by typing an "impossible"
  command name, followed by a colon.  For instance, if you don't have an MH
  command named "comment" (which you won't, unless you followed the steps in
  Chapter 9)--you can use that as a label for comments.  You can also add
  other characters, like XXX, to "comment out" an existing component.
  Here's one way you might make a comment, and comment out a line:

	comment: this isn't working now; figure out why!
	XXXrepl: -querry

  Lines 1-3, 24, and others in the file below show another way to make comments.

- Don't leave blank (empty) lines in the MH profile.

The file below is an example of the MH profile from a real MH hacker.
The line numbers to the left of each line (like 23>) are not part of the
file; they are for reference only.

 1>  #:
 2>  #: First section: Overall setup for MH
 3>  #:
 4>  Aliasfile: aliases
 5>  Alternate-Mailboxes: ehuser@*.xxx.yyy.zzz, emma@animals*,
 6>      ehuser@quack.phl.ph.com, *uucpit!ehuser
 7>  Draft-Folder: drafts
 8>  Folder-protect: 750
 9>  Msg-protect: 640
10>  Path: .Mail
11>  Previous-Sequence: pseq
12>  prompter-next: vi
13>  rmmproc: /home/ehuser/.bin/rmmer
14>  Sequence-Negation: not
15>  showproc: mhl
16>  Signature: "Emma H. User"
17>  Unseen-Sequence: unseen
18>  vi-next: spel
19>  #:
20>  #: Lines for specific standard MH programs:
21>  #:
22>  anno: -inplace
23>  dist: -annotate -inplace -editor distprompter
24>  #: -nodashmunging only works if you give -filter or -format:
25>  forw: -anno -inpl -form components -format -nodashmunging
26>  inc: -form scan.time
27>  mhl: -nobell
28>  pick: -seq picked -list
29>  repl: -query -nocc me -annotate -inplace -editor prompter.nopre
30>  rmf: -interactive
31>  #:
32>  #: Stuff for new versions of MH programs and shell scripts:
33>  #:
34>  auto_forw_send: -draftfolder +drafts
35>  bomb: -form bombcomps -anno -inpl -editor head -query -nocc me -nocc cc
36>  checkm: -file /usr/spool/mail/ehuser -form scan.checkm -width 150
37>  cur: cur -form scan.more -width 235
38>  curlast: cur-last
39>  fo: -fast
40>  foll: -form follcomps
41>  follx: -form follcomps -filter follxfilt -editor vi
42>  l10: last:10
43>  l20: last:20
44>  l5: last:5
45>  l: last
46>  msgnums: -format %(msg)
47>  prompter.nopre: -noprepend -rapid
48>  push: -push -draftfolder +drafts -forward -verbose
49>  rapid: -rapid -prepend
50>  replx: -filter replxfilt -query -nocc me -anno -inpl -editor prompter.nopre
51>  resend: -editor resend.fixmsg
52>  #: for 'rn' replies... there's gotta be a better way!:
53>  rn-ans: -editor rn-ans.fixmsg
54>  showpr: -format 'Message %(msg)' -mhl
55>  showv: -showproc more
56>  thanks: -form thankscomps -anno -inpl -editor cat -nocc all -whatnow push

Let's take a look at some of the lines in that example.

The file is divided arbitrarily into three parts.
(See the list above for the two general kinds of lines.)

- Lines 5-6 list other addresses where this user, ehuser, gets mail. 
  It lets MH find all messages which are actually from the user.
  See Section 8.6, "Defining Alternate Mailboxes."

- Lines 8-9 set the default UNIX filesystem protections that MH will
  use for new folders and messages.  This particular protection scheme sets
  folders (mode 750) so that people in ehuser's group can scan them.
  All the messages (mode 640) will also be readable by her group.
  See Section 8.7, "Sharing Other User's Folders."

- The signature in line 16 doesn't go at the end of mail messages;
  it's put in the From: component.  See Section 6.4.2, "Signature."

- Line 24 is a comment for the line below it, a reminder of why the line
  is written the way it is.  This is a good thing to do, especially in long
  MH profile files.

- Line 35 is a version of repl that sends a picture of a bomb with its fuse
  burning.  (Chapter 9, New Versions of MH Commands, explains how to make
  command versions.)  The idea and the bombcomps component file came from the
  mtrenv directory in the MH distribution.  The -editor head doesn't actually
  edit the message; it uses the UNIX head(1) command to show the first ten
  lines of the draft on the screen.  After that comes a What now? prompt,
  where you can choose a real editor if you want to.

- Lines 37-38 and lines 42-46 are all versions of scan that scan different
  ranges of messages.  For example, l10: scans the last 10 messages, and
  l20: scans the last 20.  See Section 9.7, "Versions of scan."

- Line 47 is a workaround for a common MH problem: needing to give
  different switches to prompter for different mail-composing commands.
  It's used in line 29 and line 50.  See section 9.5, "Version of
  prompter: prompter.nopre."

- The rmmproc: entry in line 13 uses the full pathname of a shell
  script that's used for removing messages.  You don't always need to give
  full pathnames to commands--for instance, line 51 calls a program named
  resend.fixmsg with only its name; in this case, MH will search your shell's
  search path for the command you specify.

- Line 54 is for a shell script (program).  Your shell scripts
  can read the MH profile.  Section 12.5, "Get Information from MH Profile
  with mhprofile," shows how.