Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!ORA.ORA.COM!jerry From: jerry@ORA.ORA.COM (Jerry Peek) Newsgroups: comp.mail.mh Subject: Re: how to overide .mh_profile values (LONG) Message-ID: Date: 21 Apr 91 01:05:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 60 [This is sort of long, but it has some interesting MH philosophy and tidbits... not much about shell programming.] In message <19280.9104191603@uxb.liv.ac.uk>, Alan Thew wrote: > I was looking at Jerry Peek's recomp shell script, making a few > changes (pick up draft folder whatever its name etc) and found it > very useful. For people who don't have the script, it hardcodes the folder name at the top: draftf=+drafts and passes it into the command line that Alan mentioned: $mh/comp -use -e -draftm $msgnum -draftf $draftf The script doesn't need to set $draftf if the MH profile has an entry like: Draft-folder: drafts I've never used a "comp: -draftfolder +drafts" in my MH profile like Alan... I've always used "Draft-folder: drafts"... so I didn't catch that problem. But then Alan brings up an interesting point... some MH behavior that could be a feature or a bug, depending on how you look at it: > I assumed that use of a switch on the command line overrode the profile > value, but both appear to being used! When MH gets the user's settings, it first reads the MH profile and then reads the command line. There's usually a difference between the way MH treats switches like "-use" (which can be either "on" or "off") and folder names. The code that reads boolean switches is happy with conflicting settings -- the last switch setting it finds "wins." But in most cases, the code for folder names complains if it finds a total of more than one folder. Sometimes that's good because it catches mistakes like: % folder +a +b and for most commands, a default folder in the MH profile would be silly. But MH does allow default folders in the profile sometimes -- for example, refile: +default_folder makes +default_folder get a link to *all* messages you refile -- as in: % refile +foo the current message would be refiled into both +default_folder and +foo. You can override the following profile component: Draft-folder: drafts with a "-draftfolder +foo" in the profile or on the command line. The question is: should "comp" and other MH commands allow the command line to override profile entries like "comp: -draftfolder +foo"? Or does anybody really care?? :-) --Jerry Peek, jerry@ora.com or uunet!ora!jerry P.S. The C code for setting a draft folder is simple enough. In uip/comp.c, there's a loop that reads values from the MH profile and the command line. When it finds "-draftfolder", it checks the variable where the draft folder name is stored. If dfolder is already set, adios() screams and exits: case DFOLDSW: if (dfolder) adios (NULLCP, "only one draft folder at a time!"); if (!(cp = *argp++) || *cp == '-') adios (NULLCP, "missing argument to %s", argp[-2]); dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp, *cp != '@' ? TFOLDER : TSUBCWF); continue; This shouldn't be hard to change: just get rid of the first two lines, eh??