From: sbyrnes@rice.edu (Steven Byrnes)
Subject: GNU Emacs FAQ (5/5, 152-177): Mail and News
Followup-To: poster
Summary: READ BEFORE POSTING.  A regularly posted list of answers to frequently
         asked questions (FAQs) about GNU Emacs and many Emacs Lisp programs.
         Contains pointers to other resources.  Follow "References:" link for
         more metainfo.
Originator: sbyrnes@is.rice.edu
Keywords: gnu emacs faq answers frequently asked questions periodic
Supersedes: <GNU-Emacs-FAQ-5.1992.09.22.011020@bigbird.bu.edu>
Reply-To: gnu-emacs-faq-maintainers@bigbird.bu.edu
Organization: GNU's Not UNIX
Date: Tue, 5 Jan 1993 17:19:33 GMT
Expires: Sat, 6 Mar 1993 17:19:33 GMT

Archive-Name: GNU-Emacs-FAQ/part5
Last-Modified: Sun, 3 Jan 1993 04:52:57 GMT
Last-Posted: Tue, 5 Jan 1993 17:19:33 GMT

                       GNU Emacs FAQ: Mail and News

This portion of the GNU Emacs FAQ list is cross-posted to `gnu.emacs.gnus'
because many of the questions herein deal with GNUS.  See `gnu.emacs.help' for
the rest of the FAQ list.

If you are viewing this text in a GNU Emacs Buffer, you can type "M-2 C-x $" to
get an overview of just the questions.  Then, when you want to look at the text
of the answers, just type "C-x $".

To search for a question numbered XXX, type "M-C-s ^XXX:", followed by a C-r if
that doesn't work, then type ESC to end the search.

A `+' in the 78th column means something was inserted on the line.  A `-' means
something was deleted and a `!' means some combination of insertions and
deletions occurred.

Full instructions for getting the latest FAQ are in question 22.  Also see the
`Introduction to news.answers' posting in the `news.answers' newsgroup, or send
e-mail to `mail-server@rtfm.mit.edu' with `help' on a body line, or use FTP,
WAIS, or Prospero to rtfm.mit.edu.



Mail and News

152: How do I change the included text prefix in mail/news followups?
  
  Many people want Emacs to prefix included text with something like ` > '
  instead of with three spaces.  One way is to change the code of the
  function `mail-yank-original' in lisp/sendmail.el that prefixes with
  spaces.  A more flexible solution is to use Supercite, which provides wide
  configurability in how you format included text in replies.  See question
  107.  Both of these solutions work for RMAIL and GNUS.
  
  A related problem is how to prevent Emacs from including various headers
  of the replied-to message.  For this, you should set the value of
  mail-yank-ignored-headers, which takes a regexp value.
  
153: How do I save a copy of outgoing mail?
  
  Two methods:
  
  1. (setq mail-self-blind t) will result in a `BCC:' header line with your
     address being added to mail composition buffers.  This will cause the
     mail system to send a copy of the mail back to you.
  
  2. (setq mail-archive-file-name (expand-file-name "~/outgoing")) will
     result in an `FCC:' header line with the pathname of ~/outgoing being
     added to mail composition buffers.  When you send the mail, Emacs will
     save a copy of the mail in the file ~/outgoing and then strip off the
     `FCC:' line before actually sending.
  
     WARNING: There is a bug in Emacs 18.58 that prevents mail readers such
     as RMAIL from reading the saved mail messages individually.  See
     question 155.
  
     WARNING: If you are visiting the file ~/outgoing at the time you send
     the mail, this can cause a variety of horrible problems.  Jamie
     Zawinski has written a solution for this.
  
  It does not work to put `set record filename' in the .mailrc file.
  
154: Why doesn't Emacs expand my aliases when sending mail?
  
  * You must separate multiple addresses in the headers of the mail buffer
    with commas.  This is because Emacs supports RFC822 standard addresses
    like this one:
  
      To: Willy Smith <wks@xpnsv.lwyrs.com>
  
    However, you do not need to separate addresses with commas in your
    .mailrc file.
  
    WARNING: Emacs breaks up aliases in the .mailrc file into multiple
    addresses both on commas and on whitespace, regardless of any use of
    quotes.  This is probably a bug.  You can get around this by directly
    setting the value of mail-aliases.
  
  * Emacs normally only reads the `.mailrc' file once per session, when you
    start to compose your first mail message.  If you edit .mailrc, you can
    type "M-ESC (build-mail-aliases) RET" to make Emacs reread .mailrc.
    (You have to include the parentheses where they are shown!)
  
  * Emacs does not interpret vendor-specific additions to the format of the
    .mailrc file such as the `source' command.  It also ignores any `set'
    commands.  The only commands it looks at are `alias' and `group'
    commands.
  
155: Why does RMAIL think all my saved messages are one big message?
  
  There is a bug for FCC-ed messages in Emacs 18.58 where it adds a timezone
  on the "From " line after the year instead of before the year.  (Before it
  didn't add the timezone at all.)  This is incompatible with the standard
  format for the "From " line, and RMAIL in particular can no longer
  distinguish between the messages.  Karl Berry <karl@cs.umb.edu>, Felix Lee
  <flee@cs.psu.edu>, Nick Gianniotis <nico@japan.sbi.com> and many
  others have all posted patches for this.  Karl's is the simplest and just
  stops Emacs from adding the timezone:
  
    >*** ./ORIG/sendmail.el	Tue Jan 28 16:22:56 1992
    >--- ./sendmail.el	Thu May 14 18:23:48 1992
    >***************
    >*** 285,287 ****
    >        (insert "\nFrom " (user-login-name) " "
    >! 	      (current-time-string) " " timezone "\n")
    >        (insert-buffer-substring rmailbuf)
    >--- 285,287 ----
    >        (insert "\nFrom " (user-login-name) " "
    >! 	      (current-time-string) "\n")
    >        (insert-buffer-substring rmailbuf)
  
156: How can I sort the messages in my RMAIL folder?
  
  Use rmailsort.el by Masanobu Umeda.
  
157: Why does RMAIL need to write to /usr/spool/mail?
  
  This is the behavior of the `movemail' program which RMAIL uses.  This
  indicates that movemail is configured to use lock files.
  
  RMS writes:
  
    Certain systems require lock files to interlock access to mail files.
    On these systems, movemail must write lock files, or you risk losing
    mail.  You simply must arrange to let movemail write them.
  
    Other systems use the flock system call to interlock access.  On these
    systems, you should configure movemail to use flock.
  
158: How do I recover my mail files after RMAIL munges their format?
  
  Users who just want to try RMAIL out to see how it works end up trapped
  using it because saved mail in their `mbox' file has been converted into
  an incompatible format (BABYL) that only RMAIL understands.  RMAIL
  provides no obvious way to reverse this transformation.  Kyle Jones has
  aptly named this "the great Emacs Mail Eating Monster".  To convert a mail
  file back to standard Unix format, there are several methods:
  
  * Use the rmail-output ("C-o") command within RMAIL on each message in the
    file.  First use M-x rmail or M-x rmail-input to visit the RMAIL file in
    Rmail mode.  Type "1 j" to go to the first message.  Use the C-o command
    to output the message to a Unix format file.  Type "n" to go to the next
    message.  Repeat.
  
  * If the file contains hundreds of messages, you may not want to repeat
    this for all of them.  Instead of the above, after getting to the first
    message type this (where "mbox" is the file you want to put the messages
    in):
  
      C-x ( C-o mbox RET M-s ^From: RET M-0 C-x )
  
    (The rmail-search command ("M-s") is used instead of just "n" because it
    is the only command which will cause an error when it reaches the last
    message in the file, which is necessary to terminate the keyboard macro.
    This will fail if there are messages in the file that don't have a
    `From:' header.  This assumes rmail-delete-after-output is nil.)
  
    It is wise to save a copy of the RMAIL file first, in case you make a
    mistake.
  
  * There are software packages available for converting files or even
    entire directories of BABYL files to standard Unix format.  These are
    helpful in this situation, but are intended mainly for people who have
    used RMAIL for a long time and are converting to some other mail reader.
    Lookup `rmail', `vm', and `babyl' in the Emacs Lisp Archive (see
    question 89).
  
  You may wish to disable RMAIL to avoid accidentally destroying your mbox
  file (I have this in my .emacs):
  
    (put 'rmail 'disabled t)		; avoid mbox destruction
  
159: How do I make Emacs automatically start my mail/news reader?
  
  Example:
  
    emacs -f gnus
  
  Also:
  
    alias gnus 'emacs -f gnus'
  
  It is probably unwise to automatically start your mail or news reader from
  your .emacs file.  This would cause problems if you needed to run two
  copies of Emacs at one time.  Also, this would make it difficult for you
  to start Emacs quickly when you needed to.
  
160: How do I read news under Emacs?
  
  There are at least three news reading packages that operate inside Emacs.
  `rnews' comes with Emacs.  GNUS and Gnews come separately.  rnews will
  be replaced by GNUS in Emacs 19.
  
  rnews works only with a local news spool directory.  Both GNUS and Gnews
  handle reading news remotely via NNTP in addition to reading from a local
  news spool.  GNUS supports reading mail stored in MH folders or articles
  saved by GNUS.
  
  Gnews is styled after `rn' and seems to work like RMAIL.  GNUS feels more
  like VM.  People have complained that GNUS uses a lot of CPU time (it
  does).  Some people have complained that Gnews is slower than GNUS.
  
  For more information about GNUS, see question 108.
  
  Gnews was written by Matthew P. Wiener <weemba@libra.wistar.upenn.edu>.
  The latest version seems to be 2.0, posted October 3, 1988.  Matthew
  posted some fixes on October 26, 1988.  Gnews does not appear to have been
  supported after this date.  In particular, it has been reported that Gnews
  does not work with Emacs 18.57.  There is a newsgroup for Gnews called
  gnu.emacs.gnews.
  
161: Why does `rnews' say "No News is good news" when there is news?
  
  rnews doesn't speak NNTP.  You may need to use GNUS or Gnews.
  
162: Why doesn't GNUS work anymore via NNTP?
  
  There is a bug in NNTP version 1.5.10, such that when multiple requests
  are sent to the NNTP server, the server only handles the first one before
  blocking waiting for more input which never comes.  NNTP version 1.5.11
  claims to fix this.
  
  You can work around the bug inside Emacs like this:
  
    (setq nntp-maximum-request 1)
  
  I also have a patch for NNTP 1.5.10 by Mike Pelletier
  <stealth@engin.umich.edu> that is based on the timeout code that was in
  1.5.9.  However, please try to upgrade to 1.5.11 first.
  
  You can find out what version of NNTP your news server is running by
  telnetting to the NNTP port (usually 119) on the news server machine (ie.,
  `telnet server-machine 119').  The server should give its version number
  in the welcome message.  Type `quit' to get out.
  
163: How do I view text with embedded underlining (eg., ClariNews)?
  
  Underlining appears like this:
  
    _^Hu_^Hn_^Hd_^He_^Hr_^Hl_^Hi_^Hn_^Hi_^Hn_^Hg
  
  You can destructively remove underlining with M-x ununderline-region.
  
  For ClariNews articles, clari-clean.el by David N. Blank-Edelman
  <dnb@meshugge.media.mit.edu> will remove both underlining and overstriking
  automatically.
  
164: When I try to post a long article in GNUS (about 10K or longer), I get
 the error, "Writing to process: no more processes, nntpd"
  
  Upgrade to Emacs 18.58 or higher.                                          +
  
165: How do I save all the items of a multi-part posting in GNUS?
  
  Use gnus-mark.el by Jamie Zawinski <jwz@lucid.com>.
  
166: Why does GNUS put the subjects in replies beyond the 80th column?
  
  This is a feature.  If you set gnus-thread-hide-subject to non-nil, GNUS
  will only display the subject of the first posting in a thread, even if
  some of the replies use different subjects.  It hides the subjects by
  putting them past the edge of the window and setting truncate lines to t.
  
  If your screen looks messed up, then for some reason truncate-lines in
  your `*Subject*' buffer has been set to nil.  It should be set to t.
  
  (I have an enhancement to GNUS 3.13 that will make it only hide the subject
  of a posting when it is unchanged from the followed-up-to posting.  Thus,
  you can use the subject hiding feature and still know when someone changes
  the subject.  (I have forgotten who originally gave me the idea for this.))
  
167: Why is GNUS so slow to start up?
  
  GNUS does several things that take quadratic time of the number of
  newsgroups that are listed in .newsrc.  The quick fix for this is to
  remove all the newsgroups in which you have no interest from your .newrc
  file by using GNUS's C-k command in the `*Newsgroup*' buffer after
  displaying all newsgroups with the L command.  If you were to directly
  edit your .newsrc to remove the newsgroups, GNUS would add them back.
  
  GNUS uses a quadratic algorithm to check for duplicates when the .newsrc
  file is newer than the .newsrc.el file (ie., you edited your .newsrc).
  GNUS uses a quadratic algorithm to check for new newsgroups every time it
  connects to the news server.  {There may be other quadratic algorithms
  that I am not aware of.}
  
  You can speed up GNUS by using the C-k command in the *Newsgroup* buffer
  to remove newsgroups from your .newsrc file.
  
  Of course, GNUS will run faster if you make sure it is byte-compiled.
  
  Felix Lee wrote some enhancements called `gnus-speedups.el' that fix some
  of the problems.  See the Emacs Lisp Archive.
  
168: How do I catch up all newsgroups in GNUS?
  
  In the `*Newsgroup*' buffer, type the following magical incantation:
  
    M-< C-x ( C-@ c y C-u C-@ C-e C-f C-f M-0 C-x )
  
  Leave off the "M-<" if you only want to catch up from point to the end of
  the `*Newsgroup' buffer.
  
169: Why can't I kill in GNUS on the Newsgroups/Keywords/Control line?
  
  GNUS 3.14.1 will complain that the `Newsgroups:', `Keywords:', and
  `Control:' headers are `Unknown header field's.
  
  For the `Newsgroups:' header, there is an easy workaround: kill on the
  `Xref' header instead, which will be present on any cross-posted article.
  
  If you really want to kill on one of these headers, you can do it like
  this:
  
    (gnus-kill nil "^Newsgroups: .*\\(bad\\.group\\|worse\\.group\\)")
  
  Various people (eg., Greg Holley <holley@acuson.com>) have posted
  solutions to allow more efficient killing on these headers than the
  preceding solution.  Masanobu Umeda plans to fix this problem.
  
170: How do I get rid of flashing messages in GNUS for slow connections?
  
  GNUS outputs "NNTP: Reading..." message and then clears them, over and
  over.  In version 3.14.1 there is a variable named nntp-debug-read that
  can help.  Johan Vromans <jv@mh.nl> wrote a fix.  Others have also written
  fixes.
  
171: Why is catch up slow in Gnews/GNUS?
  
  Because GNUS is marking crosspostings read.  {I think it should do this at
  the time the article is read to spread out the load.  Maybe someone will
  write the code to do this.}
  
172: Why does GNUS hang for a long time when posting?
  
  David Lawrence <tale@uunet.uu.net> explains:
  
    The problem is almost always interaction between NNTP and C News.  NNTP
    POST asks C News's inews to not background itself but rather hang around
    and give its exit status so it knows whether the post was successful.
    (That wait will on some systems not return the exit status of the
    waited for job is a different sort of problem.)  It ends up taking a
    long time because inews is calling relaynews, which often waits for
    another relaynews to free the lock on the news system so it can file the
    article.
  
    My preferred solution is to change inews to not call relaynews, but
    rather use newsspool.  This loses some error-catching functionality, but
    is for the most part safe as inews will detect a lot of the errors on
    its own.  The C News folks have sped up inews, too, so speed should look
    better to most folks as that update propagates around.
  
173: Why don't my news postings in GNUS get past the local machine?
  
  Three possible reasons: local distribution, C News date problem (see
  question 174, and the path problem.  This piece of code may fix the path
  problem for you:
  
    (setq gnus-use-generic-path t)
  
174: Why is the GNUS-generated `Date:' header invalid?
  
  GNUS generates `Date:' headers without time zones.  C-News's `inews'
  doesn't replace it with a valid header, but will generate it if not
  already there.  If it is invalid, the article will not be forwarded
  properly.  Quick fix:
  
    (defun gnus-inews-date () nil)
  
  This is not fixed as of GNUS 3.14.1.                                       !
  
175: Why doesn't GNUS generate the `Lines:' header?
  
  GNUS was written for B news, which would generate the `Lines:' header.  C
  news doesn't.  There is a comment in C news's `inews' that you can
  uncomment to enable this functionality.  Or you can have GNUS generate the
  header, for example:
  
    ;; idea by jbryans@beach.csulb.edu (Jack Bryans)
    (defun add-lines-header ()
      ;; Count the number of lines in the current posting and insert the
      ;; header line Lines into the message.
      (save-excursion
        (goto-char (point-min))
        (if (search-forward "\n\n") ;; ***** I suspect this is wrong *****
          (let ((lines (count-lines (point) (point-max))))
            (forward-line -1)
            (insert-string "Lines: " lines "\n")))))
  
  Mike Williams <mike-w@cs.aukuni.ac.nz> has written something similar.
  
  Ronald Florence <ron@mlfarm.com> has a patch for GNUS that makes it
  calculate the `Lines:' header for incoming articles when necessary that
  works for sites with local news spools.
  
  David Lawrence <tale@uunet.uu.net> says that GNUS 3.14.1 generates Lines
  if gnus-news-system is Cnews.
  
176: Why do I get "Cannot open load file" "nntp" when compiling GNUS?
  
  Specifically, the error message is this:
  
    Error occurred processing gnus.el: File error (("Cannot open load file" "nntp"))
  
  This means that nntp.el is not in Emacs's load-path, which is easy to
  happen when compiling using the Makefile.
  
  Easiest solution: set EMACSLOADPATH in Makefile (idea from Glenn Gribble
  <glenn@netcom.com>):
  
    EMACSLOADPATH=/usr/local/emacs/lisp:.
    ELC= env EMACSLOADPATH=$(EMACSLOADPATH) emacs -batch -f batch-byte-compile
  
  Another solution, in hack.el put this:
  
    (defun gross-hack () (setq load-path (cons "/directory" load-path)))
  
  Then in Makefile:
  
    ELC= emacs -batch -l hack.el -f gross-hack -f batch-byte-compile
  
177: How do I kill all articles in GNUS but those matching a pattern?
  
  Example:
  
    ;; kill everything
    (gnus-kill "subject" "" nil nil)
    ;; then restore stuff by our favorite poster
    (gnus-kill "from" "good-guy"
               (function
                (lambda ()
                  (if (eq ?X (char-after (save-excursion
                                           (beginning-of-line 1)
                                           (point))))
                      (gnus-Subject-clear-mark-forward 1))))
               t)
  


----------------------------------------------------------------------       +
Copyright (C) 1990, 1991, 1992 Joseph Brian Wells                            +
Copyright (C) 1992, 1993 Steven Byrnes                                       +
                                                                             +
This list of frequently asked questions about GNU Emacs with answers         +
("FAQ") may be translated into other languages, transformed into other       +
formats (e.g. Texinfo, Info, WWW, WAIS, etc.), and updated with new          +
information.  The same conditions apply to any derivative of the FAQ as      +
apply to the FAQ itself.  Every copy of the FAQ must include this notice     +
or an approved translation, information on who is currently maintaining      +
the FAQ and how to contact them (including their e-mail address), and        +
information on where the latest version of the FAQ is archived (including    +
FTP information).  The FAQ may be copied and redistributed under these       +
conditions, except that the FAQ may not be embedded in a larger literary     +
work unless that work itself allows free copying and redistribution.         +
Newsgroups: gnu.emacs.help