*** empty log message ***
[bpt/emacs.git] / lisp / mail / rmail.el
index ace3498..8f4bf10 100644 (file)
@@ -1,11 +1,15 @@
-;; "RMAIL" mail reader for Emacs.
-;; Copyright (C) 1985, 1986, 1987, 1988, 1991 Free Software Foundation, Inc.
+;;; rmail.el --- main code of "RMAIL" mail reader for Emacs.
+
+;; Maintainer: FSF
+;; Last-Modified: 24 Apr 1992
+
+;; Copyright (C) 1985, 1986, 1987, 1988, 1991, 1992 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 1, or (at your option)
+;; the Free Software Foundation; either version 2, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -17,6 +21,7 @@
 ;; along with GNU Emacs; see the file COPYING.  If not, write to
 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
+;;; Code:
 
 ;; Souped up by shane@mit-ajax based on ideas of rlk@athena.mit.edu
 ;;   New features include attribute and keyword support, message
@@ -98,6 +103,13 @@ Called with region narrowed to unformatted header.")
 (defvar rmail-last-multi-labels nil)
 (defvar rmail-last-file nil)
 (defvar rmail-last-rmail-file nil)
+
+;;; Regexp matching the delimiter of messages in UNIX mail format
+;;; (UNIX From lines), minus the initial ^.  Note that if you change
+;;; this expression, you must change the code in rmail-nuke-pinhead-header
+;;; that knows the exact ordering of the \\( \\) subexpressions.
+(defvar rmail-unix-mail-delimiter
+  "From \\([^ \n]*\\(\\|\".*\"[^ \n]*\\)\\)  ?\\([^ \n]*\\) \\([^ ]*\\) *\\([0-9]*\\) \\([0-9:]*\\)\\( ?[A-Z]?[A-Z][A-Z]T\\( DST\\)?\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) [0-9][0-9]\\([0-9]*\\) *\\(remote from [^\n]*\\)?\n" nil)
 \f
 ;;;; *** Rmail Mode ***
 
@@ -503,7 +515,10 @@ argument causes us to read a file name and use that file as the inbox."
     (while files
       (setq file (expand-file-name (substitute-in-file-name (car files)))
            ;;>> un*x specific <<
-           tofile (concat file "~"))
+           ;; The "+" used to be "~", which is an extremely poor choice;
+           ;; it might accidentally be deleted when space is low
+           ;; (as happened to me!).
+           tofile (concat file "+"))
       ;; If getting from mail spool directory,
       ;; use movemail to move rather than just renaming,
       ;; so as to interlock with the mailer.
@@ -634,9 +649,8 @@ argument causes us to read a file name and use that file as the inbox."
               (rmail-nuke-pinhead-header)
               (if (re-search-forward
                    (concat "^[\^_]?\\("
-                           "From [^ \n]*\\(\\|\".*\"[^ \n]*\\)  ?[^ \n]* [^ \n]* *"
-                           "[0-9]* [0-9:]*\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) " ; EDT, -0500
-                           "[0-9]+ *\\(remote from [^\n]*\\)?$\\|"
+                           rmail-unix-mail-delimiter
+                           "\\|"
                            mmdf-delim1 "\\|"
                            "^BABYL OPTIONS:\\|"
                            "\^L\n[01],\\)") nil t)
@@ -681,8 +695,7 @@ argument causes us to read a file name and use that file as the inbox."
          (setq has-date (and (search-forward "\nDate:" nil t) (point)))
          (goto-char start))
        (let ((case-fold-search nil))
-         (if (re-search-forward
-              "^From \\([^ ]*\\(\\|\".*\"[^ ]*\\)\\)  ?\\([^ ]*\\) \\([^ ]*\\) *\\([0-9]*\\) \\([0-9:]*\\)\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) [0-9][0-9]\\([0-9]*\\) *\\(remote from [^\n]*\\)?\n" nil t)
+         (if (re-search-forward (concat "^" rmail-unix-mail-delimiter) nil t)
              (replace-match
                (concat
                  "Mail-from: \\&"
@@ -692,8 +705,8 @@ argument causes us to read a file name and use that file as the inbox."
                      ""
                    ;; If no time zone specified, assume est.
                    (if (= (match-beginning 7) (match-end 7))
-                       "Date: \\3, \\5 \\4 \\8 \\6 EST\n"
-                       "Date: \\3, \\5 \\4 \\8 \\6\\7\n"))
+                       "Date: \\3, \\5 \\4 \\9 \\6 EST\n"
+                       "Date: \\3, \\5 \\4 \\9 \\6\\7\n"))
                  ;; Keep and reformat the sender if we don't
                  ;; have a From: field.
                  (if has-from
@@ -1606,3 +1619,4 @@ Leaves original message, deleted, before the undigestified messages."
 
 (provide 'rmail)
 
+;;; rmail.el ends here