[comp.emacs] Editing letters in text-mode with emacs under the elm mailer

larsen@imada.dk (Larsen Soren) (02/19/89)

Problem: when invoking emacs from within elm I would like it to
automatically edit the temporary letter file in text-mode.  Normally,
typing the command:
           emacs letterfile -f text-mode
will have the desired effect when editing ``letterfile''; but the order
of the arguments is significant.  Unfortunately, it seems that elm just
appends the name of the temporary file to the string given in the
``editor'' field of the elmrc file. Thus setting
           editor = emacs -f text-mode
results in the scratch buffer being edited in text-mode while the letter
itself is still in fundamental mode.
I have attempted to emulate the syntax of the ``print'' field by
setting:
           editor = emacs %s -f text-mode
and end up with a buffer called ``%s'' in text-mode and the letter in
fundamental mode.
Any suggestions (other than typing ``M-x text-mode'' every time I edit a
letter)?
-- 
Soren Larsen / larsen@imada.dk  (..uunet!mcvax!dkuug!imada!larsen)
Dept. of Math. & Computer Science, Odense University
Campusvej 55, DK-5230 Odense M, Denmark
phone: +45 9 15 86 00, ext. 2312 / telefax: +45 9 15 81 62

bard@THEORY.LCS.MIT.EDU (02/20/89)

> Problem: when invoking emacs from within elm I would like it to
> automatically edit the temporary letter file in text-mode.  Normally,
> typing the command:

If you have a pattern matching elm's temporary file names, you can use
auto-mode-alist -- something like:

  (setq auto-mode-alist 
    (cons '("letterfile$" . text-mode)
          auto-mode-alist))

which will turn on text mode whenever you edit a file whose name ends with
the string "letterfile".  

-- Bard the emacs gargoyle

Ram-Ashwin@cs.yale.edu (Ashwin Ram) (02/20/89)

In article <156@imada.dk>, larsen@imada.dk (Larsen Soren) writes:
> Problem: when invoking emacs from within elm I would like it to
> automatically edit the temporary letter file in text-mode.

I don't know what elm files look like, but 

  - if they always have similar names, you can add a pattern to the variable
    auto-mode-alist that will invoke text-mode on those files.  E.g., if elm
    files are always called something like /tmp/elm.45 (I'm making this up),
    you can add the pair ("/tmp/elm" . text-mode) to auto-mode-alist.

  - if they always have similar contents, you can use the infer-mode.el
    program that was posted earlier and add a pattern to the variable
    infer-mode-alist that will invoke text-mode on those files.  E.g., if elm
    files always contain a "Subject:" line (I'm making this up), you can add
    the pair ("^Subject:" . text-mode) to infer-mode-alist.  [I can send you
    infer-mode.el if you don't have it.]

Hope this helps,

-- Ashwin.

ARPA:    Ram-Ashwin@cs.yale.edu
UUCP:    {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin
BITNET:  Ram@yalecs