changeset 97808:1aab9bdd9355

Resolve all byte compiler warnings and enable IMAP/movemail support.
author Paul Reilly <pmr@pajato.com>
date Fri, 29 Aug 2008 04:27:46 +0000
parents 75ebbf217ac0
children 8787632a2758
files lisp/mail/pmail.el lisp/mail/pmaildesc.el lisp/mail/pmailhdr.el lisp/mail/pmailkwd.el lisp/mail/pmailmm.el lisp/mail/pmailmsc.el lisp/mail/pmailsort.el lisp/mail/pmailsum.el
diffstat 8 files changed, 86 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/pmail.el	Fri Aug 29 01:06:42 2008 +0000
+++ b/lisp/mail/pmail.el	Fri Aug 29 04:27:46 2008 +0000
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998,
 ;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-;;   Free Software Foundation, Inc.
+;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: mail
@@ -199,6 +199,11 @@
 (declare-function mail-position-on-field "sendmail" (field &optional soft))
 (declare-function mail-text-start "sendmail" ())
 (declare-function pmail-update-summary "pmailsum" (&rest ignore))
+(declare-function unrmail "unrmail" (file to-file))
+(declare-function rmail-dont-reply-to "mail-utils" (destinations))
+(declare-function pmail-summary-goto-msg "pmailsum" (&optional n nowarn skip-pmail))
+(declare-function pmail-summary-pmail-update "pmailsum" ())
+(declare-function pmail-summary-update "pmailsum" (n))
 
 (defun pmail-probe (prog)
   "Determine what flavor of movemail PROG is.
@@ -289,20 +294,20 @@
 ;;;###autoload
 (defcustom pmail-ignored-headers
   (concat "^via:\\|^mail-from:\\|^origin:\\|^references:\\|^sender:"
-	  "\\|^status:\\|^received:\\|^content-transfer-encoding:"
-	  "\\|^x400-\\(received\\|mts-identifier\\|content-type\\|originator\\|recipients\\):"
-	  "\\|^list-\\(help\\|post\\|subscribe\\|id\\|unsubscribe\\|archive\\):"
-	  "\\|^resent-\\(face\\|x-.*\\|organization\\|openpgp\\|date\\|message-id\\):"
-	  "\\|^thread-\\(topic\\|index\\)"
-	  "\\|^summary-line:\\|^precedence:\\|^message-id:"
-	  "\\|^path:\\|^face:\\|^delivered-to:\\|^lines:"
+	  "\\|^status:\\|^received:\\|^x400-originator:\\|^x400-recipients:"
+	  "\\|^x400-received:\\|^x400-mts-identifier:\\|^x400-content-type:"
+	  "\\|^\\(resent-\\|\\)message-id:\\|^summary-line:\\|^resent-date:"
+	  "\\|^nntp-posting-host:\\|^path:\\|^x-char.*:\\|^x-face:\\|^face:"
+	  "\\|^x-mailer:\\|^delivered-to:\\|^lines:"
+	  "\\|^content-transfer-encoding:\\|^x-coding-system:"
 	  "\\|^return-path:\\|^errors-to:\\|^return-receipt-to:"
-	  "\\|^content-\\(length\\|type\\|class\\|disposition\\):"
-	  "\\|^nntp-posting-host:\\|^path:\\|^x-char.*:\\|^x-face:\\|^face:"
+	  "\\|^precedence:\\|^list-help:\\|^list-post:\\|^list-subscribe:"
+	  "\\|^list-id:\\|^list-unsubscribe:\\|^list-archive:"
+	  "\\|^content-length:\\|^nntp-posting-date:\\|^user-agent"
 	  "\\|^importance:\\|^envelope-to:\\|^delivery-date\\|^openpgp:"
-	  "\\|^mbox-line:\\|^cancel-lock:\\|^in-reply-to:\\|^comment:"
-	  "\\|^x-.*:\\|^domainkey-signature:"
-	  "\\|^original-recipient:\\|^from ")
+	  "\\|^mbox-line:\\|^cancel-lock:\\|^DomainKey-Signature:"
+	  "\\|^resent-face:\\|^resent-x.*:\\|^resent-organization:\\|^resent-openpgp:"
+	  "\\|^x-.*:\\|^domainkey-signature:\\|^original-recipient:\\|^from ")
   "*Regexp to match header fields that Pmail should normally hide.
 \(See also `pmail-nonignored-headers', which overrides this regexp.)
 This variable is used for reformatting the message header,
@@ -867,7 +872,7 @@
 	  (unwind-protect
 	      (progn
 		(write-region (point-min) (point-max) old-file)
-		(unpmail old-file new-file)
+		(unrmail old-file new-file)
 		(message "Replacing BABYL format with mbox format...")
 		(let ((inhibit-read-only t))
 		  (erase-buffer)
@@ -1609,9 +1614,9 @@
 		      (or pass supplied-password)
 		      got-password)
 	      (error "Emacs movemail does not support %s protocol" proto))
-	  (list file
+	  (list (concat proto "://" user "@" host)
 		(or (string-equal proto "pop") (string-equal proto "imap"))
-		supplied-password
+		(or supplied-password pass)
 		got-password))))
 
    ((string-match "^po:\\([^:]+\\)\\(:\\(.*\\)\\)?" file)
@@ -1655,9 +1660,9 @@
 		    ;; in case of multiple inboxes that need moving.
 		    (concat ".newmail-"
 			    (file-name-nondirectory
-			     (if (memq system-type '(windows-nt cygwin))
-				 ;; cannot have "po:" in file name
-				 (substring file 3)
+			     (if (memq system-type '(windows-nt cygwin ms-dos))
+				 ;; cannot have colons in file name
+				 (replace-regexp-in-string ":" "-" file)
 			       file)))
 		    ;; Use the directory of this pmail file
 		    ;; because it's a nuisance to use the homedir
@@ -1695,7 +1700,7 @@
 		 (buffer-disable-undo errors)
 		 (let ((args
 			(append
-			 (list pmail-movemail-program nil errors nil)
+			 (list (or pmail-movemail-program "movemail") nil errors nil)
 			 (if pmail-preserve-inbox
 			     (list "-p")
 			   nil)
@@ -2747,15 +2752,15 @@
 	 ;; Remove unwanted names from reply-to, since Mail-Followup-To
 	 ;; header causes all the names in it to wind up in reply-to, not
 	 ;; in cc.  But if what's left is an empty list, use the original.
-	 (let* ((reply-to-list (pmail-dont-reply-to reply-to)))
+	 (let* ((reply-to-list (rmail-dont-reply-to reply-to)))
 	   (if (string= reply-to-list "") reply-to reply-to-list))
          subject
          (pmail-make-in-reply-to-field from date message-id)
          (if just-sender
              nil
            ;; mail-strip-quoted-names is NOT necessary for
-           ;; pmail-dont-reply-to to do its job.
-           (let* ((cc-list (pmail-dont-reply-to
+           ;; rmail-dont-reply-to to do its job.
+           (let* ((cc-list (rmail-dont-reply-to
                             (mail-strip-quoted-names
                              (if (null cc) to (concat to ", " cc))))))
              (if (string= cc-list "") nil cc-list)))
@@ -3099,20 +3104,12 @@
     ;; Now start sending new message; default header fields from original.
     ;; Turn off the usual actions for initializing the message body
     ;; because we want to get only the text from the failure message.
-    ;;
-    ;; NOTE: the use of pmail-msgref-vector is a red flag.  I'm not
-    ;; sure (yet) what the right thing to do here is but I strongly
-    ;; suspect it needs something along the lines of:
-    ;; ...(pmail-desc-set-attribute pmail-desc-resent-index nil n)...
-    ;; The test to run to see the breakage and figure out what needs
-    ;; to be done is to cause a "resend" to happen and verify that it
-    ;; is either broken or works properly.  For now the unbound
-    ;; variable is being left intact. -pmr 8/12/2008
     (let (mail-signature mail-setup-hook)
       (if (pmail-start-mail nil nil nil nil nil pmail-this-buffer
 			    (list (list 'pmail-mark-message
 					pmail-this-buffer
-					(aref pmail-msgref-vector msgnum)
+					(with-current-buffer pmail-buffer
+					  (pmail-desc-get-start msgnum))
 					"retried")))
 	  ;; Insert original text as initial text of new draft message.
 	  ;; Bind inhibit-read-only since the header delimiter
--- a/lisp/mail/pmaildesc.el	Fri Aug 29 01:06:42 2008 +0000
+++ b/lisp/mail/pmaildesc.el	Fri Aug 29 04:27:46 2008 +0000
@@ -30,6 +30,9 @@
 
 (require 'pmailhdr)
 
+;; External function declarations
+(declare-function pmail-narrow-to-header "pmail" (msg))
+
 (defvar pmail-desc-attributes nil
   "A private variable providing temporary access to message attributes.")
 
--- a/lisp/mail/pmailhdr.el	Fri Aug 29 01:06:42 2008 +0000
+++ b/lisp/mail/pmailhdr.el	Fri Aug 29 04:27:46 2008 +0000
@@ -173,7 +173,7 @@
   "Show all headers.
 The current buffer, possibly narrowed, contains a single message."
   ;; Remove all the overlays used to control hiding headers.
-  (mapcar 'delete-overlay pmail-header-overlay-list)
+  (mapc 'delete-overlay pmail-header-overlay-list)
   (setq pmail-header-display-state nil))
 
 (defun pmail-header-toggle-visibility (&optional arg)
--- a/lisp/mail/pmailkwd.el	Fri Aug 29 01:06:42 2008 +0000
+++ b/lisp/mail/pmailkwd.el	Fri Aug 29 04:27:46 2008 +0000
@@ -41,8 +41,6 @@
 ;; completion.  It is better to use strings with the label functions
 ;; and let them worry about making the label.
 
-(provide 'pmailkwd)
-
 (eval-when-compile
   (require 'mail-utils))
 
@@ -61,6 +59,25 @@
   "Keywords used to label messages.
 These are all user-defined, unlike `pmail-attributes'.")
 
+
+;; External library declarations.
+(declare-function mail-comma-list-regexp "mail-utils" (labels))
+(declare-function mail-parse-comma-list "mail-utils" ())
+(declare-function pmail-desc-add-keyword "pmaildesc" (keyword n))
+(declare-function pmail-desc-get-end "pmaildesc" (n))
+(declare-function pmail-desc-get-keywords "pmaildesc" (n))
+(declare-function pmail-desc-get-start "pmaildesc" (n))
+(declare-function pmail-desc-remove-keyword "pmaildesc" (keyword n))
+(declare-function pmail-display-labels "pmail" ())
+(declare-function pmail-maybe-set-message-counters "pmail" ())
+(declare-function pmail-message-labels-p "pmail" (msg labels))
+(declare-function pmail-msgbeg "pmail" (n))
+(declare-function pmail-set-attribute "pmail" (attr state &optional msgnum))
+(declare-function pmail-set-message-deleted-p "pmail" (n state))
+(declare-function pmail-show-message "pmail" (&optional n no-summary))
+(declare-function pmail-summary-exists "pmail" ())
+(declare-function pmail-summary-update "pmailsum" (n))
+
 ;;;; Low-level functions.
 
 (defun pmail-attribute-p (s)
@@ -143,15 +160,6 @@
       ;; return the string, not the symbol
       result)))
 
-(declare-function pmail-maybe-set-message-counters "pmail" ())
-(declare-function pmail-display-labels "pmail" ())
-(declare-function pmail-msgbeg "pmail" (n))
-(declare-function pmail-set-message-deleted-p "pmail" (n state))
-(declare-function pmail-message-labels-p "pmail" (msg labels))
-(declare-function pmail-show-message "pmail" (&optional n no-summary))
-(declare-function mail-comma-list-regexp "mail-utils" (labels))
-(declare-function mail-parse-comma-list "mail-utils.el" ())
-
 (defun pmail-set-label (l state &optional n)
   "Add or remove label L in message N.
 The label L is added when STATE is non-nil, otherwise it is
@@ -175,7 +183,7 @@
 	    (pmail-desc-remove-keyword str n))))))
   (pmail-display-labels)
   ;; Deal with the summary buffer.
-  (when pmail-summary-buffer
+  (when (pmail-summary-exists)
     (pmail-summary-update n)))
 
 ;; Motion on messages with keywords.
@@ -223,5 +231,7 @@
       (when (> n 0)
 	(message "No following message with labels %s" labels)))))
 
+(provide 'pmailkwd)
+
 ;; arch-tag: 1149979c-8e47-4333-9629-cf3dc887a6a7
 ;;; pmailkwd.el ends here
--- a/lisp/mail/pmailmm.el	Fri Aug 29 01:06:42 2008 +0000
+++ b/lisp/mail/pmailmm.el	Fri Aug 29 04:27:46 2008 +0000
@@ -39,6 +39,9 @@
 
 ;;; Code:
 
+;; For ...
+(require 'pmail)
+
 ;;; Variables
 
 (defcustom pmail-mime-media-type-handlers-alist
@@ -190,10 +193,11 @@
   ;;    of the preceding part.
   ;; We currently don't handle that.
   (let ((boundary (cdr (assq 'boundary content-type)))
-	beg next)
+	beg end next)
     (unless boundary
-      (error "No boundary defined" content-type content-disposition
-	     content-transfer-encoding))
+      (pmail-mm-get-boundary-error-message
+       "No boundary defined" content-type content-disposition
+       content-transfer-encoding))
     (setq boundary (concat "\n--" boundary))
     ;; Hide the body before the first bodypart
     (goto-char (point-min))
@@ -216,8 +220,9 @@
 	    ((looking-at "[ \t]*\n")
 	     (setq next (copy-marker (match-end 0))))
 	    (t
-	     (error "Malformed boundary" content-type
-		    content-disposition content-transfer-encoding)))
+	     (pmail-mm-get-boundary-error-message
+	      "Malformed boundary" content-type content-disposition
+	      content-transfer-encoding)))
       (delete-region end next)
       ;; Handle the part.
       (save-match-data
@@ -396,6 +401,11 @@
       (pmail-mime-show t))
     (view-buffer buf)))
 
+(defun pmail-mm-get-boundary-error-message (message type disposition encoding)
+  "Return MESSAGE with more information on the main mime components."
+  (error "%s; type: %s; disposition: %s; encoding: %s"
+	 message type disposition encoding))
+
 (provide 'pmailmm)
 
 ;; arch-tag: 3f2c5e5d-1aef-4512-bc20-fd737c9d5dd9
--- a/lisp/mail/pmailmsc.el	Fri Aug 29 01:06:42 2008 +0000
+++ b/lisp/mail/pmailmsc.el	Fri Aug 29 04:27:46 2008 +0000
@@ -31,6 +31,7 @@
 (defvar pmail-current-message)
 (defvar pmail-inbox-list)
 
+(declare-function mail-parse-comma-list "mail-utils" ())
 (declare-function pmail-parse-file-inboxes "pmail" ())
 (declare-function pmail-show-message "pmail" (&optional n no-summary))
 
--- a/lisp/mail/pmailsort.el	Fri Aug 29 01:06:42 2008 +0000
+++ b/lisp/mail/pmailsort.el	Fri Aug 29 04:27:46 2008 +0000
@@ -33,6 +33,11 @@
 
 (autoload 'timezone-make-date-sortable "timezone")
 
+(declare-function pmail-dont-reply-to "mail-utils" (destinations))
+(declare-function pmail-desc-get-marker-end "pmailsort" (msgnum))
+(declare-function pmail-desc-get-marker-start "pmailsort" (msgnum))
+(declare-function pmail-update-summary "pmailsum" (&rest ignore))
+
 ;; Sorting messages in Pmail buffer
 
 ;;;###autoload
@@ -151,8 +156,6 @@
 
 ;; Basic functions
 
-(declare-function pmail-update-summary "pmailsum" (&rest ignore))
-
 (defun pmail-sort-messages (reverse keyfun)
   "Sort messages of current Pmail file.
 If 1st argument REVERSE is non-nil, sort them in reverse order.
--- a/lisp/mail/pmailsum.el	Fri Aug 29 01:06:42 2008 +0000
+++ b/lisp/mail/pmailsum.el	Fri Aug 29 04:27:46 2008 +0000
@@ -213,6 +213,15 @@
     map)
   "Keymap for `pmail-summary-mode'.")
 
+(declare-function pmail-abort-edit "pmailedit" ())
+(declare-function pmail-cease-edit "pmailedit"())
+(declare-function pmail-set-label "pmailkwd" (l state &optional n))
+(declare-function pmail-output-read-file-name "pmailout" ())
+(declare-function pmail-output-read-pmail-file-name  "pmailout" ())
+(declare-function mail-comma-list-regexp "mail-utils" (labels))
+(declare-function mail-send-and-exit "sendmail" (&optional arg))
+(declare-function mail-strip-quoted-names "mail-utils" (address))
+
 ;; Entry points for making a summary buffer.
 
 ;; Regenerate the contents of the summary
@@ -1053,13 +1062,6 @@
     (end-of-buffer))
   (forward-line -1))
 
-(declare-function pmail-abort-edit "pmailedit" ())
-(declare-function pmail-cease-edit "pmailedit"())
-(declare-function pmail-set-label "pmailkwd" (l state &optional n))
-(declare-function pmail-output-read-file-name "pmailout" ())
-(declare-function pmail-output-read-pmail-file-name  "pmailout" ())
-(declare-function mail-send-and-exit "sendmail" (&optional arg))
-
 (defvar pmail-summary-edit-map
   (let ((map (nconc (make-sparse-keymap) text-mode-map)))
     (define-key map "\C-c\C-c" 'pmail-cease-edit)