[comp.emacs] Zippy hook

bard@THEORY.LCS.MIT.EDU (07/07/89)

> 
> so, here it is:  questions, et. al. to me: rodney@ipl.rpi.edu
> 
> (defun add-zippyism ()
>   (save-excursion
> X-Zippy:  ..  My pants just went on a wild rampage through
>  a Long Island Bowling Alley!!
>     (search-forward "--tex")
>     (beginning-of-line)
>     (insert "X-Zippy:  ")
>     (insert (yow))
>     (insert "\n")))
> 

There's a problem with this code, as your attempt to mail it demonstrates: it
may find the wrong "--tex" in the mail buffer.  There's a mail function
  (mail-position-on-field "X-Zippy") 
which looks for and if necessary creates a mail field named X-Zippy.

So here's an alternate version:

(defun add-zippyism ()
   (save-excursion
      (mail-position-on-field "X-Zippy")
      (insert (yow))))

(You could have found this out by looking at the code for sendmail.el --
probably in about the same place you found the mail-setup-hook variable.



-- Bard the emacs gargoyle

rodney@ipl.rpi.EDU (Rodney Peck II) (07/07/89)

In article mumble mumble bard@theory.lcs.mit.edu writes:
b> X-Zippy: Eisenhower!!  Your mimeograph machine upsets my stomach!!
b> X-Bard: All these functions!  What do they all mean?
b> So here's an alternate version:

b> (defun add-zippyism ()
b>    (save-excursion
b>       (mail-position-on-field "X-Zippy")
b>       (insert (yow))))

b> (You could have found this out by looking at the code for sendmail.el --
b> probably in about the same place you found the mail-setup-hook variable.

aww.  That takes all the fun out of it.

Actually, I saw the mail-setup-hook in the docs for the mail function:

mail:
Edit a message to be sent.  Argument means resume editing (don't erase).
Returns with message buffer selected; value t if message freshly initialized.
While editing message, type C-c C-c to send the message and exit.
..[about 20 lines deleted]...
If mail-setup-hook is bound, its value is called with no arguments
after the message is initialized.  It can add more default fields.
[and more stuff...]

it doesn't mention mail-position-on-field

Rodney