;; 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
(defvar pmail-encoded-remote-password nil)
+(defvar pmail-expunge-counter 0
+ "A counter used to keep track of the number of expunged
+messages with a lower message number than the current message
+index.")
+
(defcustom pmail-preserve-inbox nil
"*Non-nil means leave incoming mail in the user's inbox--don't delete it."
:type 'boolean
(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.
;;;###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:"
- "\\|^return-path:\\|^errors-to:\\|^return-receipt-to:"
- "\\|^content-\\(length\\|type\\|class\\|disposition\\):"
+ "\\|^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:"
+ "\\|^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,
(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)
(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)
;; 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
(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)
(let ((attr-index (pmail-desc-get-attr-index attr)))
(set-buffer pmail-buffer)
(or msgnum (setq msgnum pmail-current-message))
- (pmail-desc-set-attribute attr-index state msgnum)
+ (pmail-desc-set-attribute msgnum attr-index state)
;; Deal with the summary buffer.
(when pmail-summary-buffer
(pmail-summary-update msgnum))))))
;; Clear the "unseen" attribute when we show a message, unless
;; it is already cleared.
(when (pmail-desc-attr-p pmail-desc-unseen-index n)
- (pmail-desc-set-attribute pmail-desc-unseen-index nil n))
+ (pmail-desc-set-attribute n pmail-desc-unseen-index nil))
(pmail-display-labels)
;; Deal with MIME
(if (eq pmail-enable-mime t)
(defun pmail-delete-message ()
"Delete this message and stay on it."
(interactive)
- (pmail-desc-set-attribute pmail-desc-deleted-index t pmail-current-message)
+ (pmail-desc-set-attribute pmail-current-message pmail-desc-deleted-index t)
(run-hooks 'pmail-delete-message-hook)
(pmail-show-message pmail-current-message))
(setq msg (1- msg)))
(if (= msg 0)
(error "No previous deleted message")
- (pmail-desc-set-attribute pmail-desc-deleted-index nil msg)
+ (pmail-desc-set-attribute msg pmail-desc-deleted-index nil)
(pmail-show-message msg)
(if (pmail-summary-exists)
(save-excursion
Returns t if a new message is displayed after the delete, or nil otherwise."
(interactive "P")
- (pmail-desc-set-attribute pmail-desc-deleted-index t pmail-current-message)
+ (pmail-desc-set-attribute pmail-current-message pmail-desc-deleted-index t)
(run-hooks 'pmail-delete-message-hook)
(let ((del-msg pmail-current-message))
(if (pmail-summary-exists)
(or (eq buffer-undo-list t) (setq buffer-undo-list nil))
;; Remove the messages from the buffer and from the Pmail message
;; descriptor vector.
+ (setq pmail-expunge-counter 0)
(pmail-desc-prune-deleted-messages 'pmail-expunge-callback)
- ;; Update the Pmail message counter, deal with the summary buffer,
- ;; show the current message and update the User status.
- (setq pmail-total-messages (pmail-desc-get-count))
- (pmail-show-message pmail-current-message t)
+ (setq pmail-current-message (- pmail-current-message pmail-expunge-counter))
+ ;; Deal with the summary buffer and update
+ ;; the User status.
(let* ((omax (- (buffer-size) (point-max)))
(omin (- (buffer-size) (point-min)))
(opoint (if (and (> pmail-current-message 0)
(defun pmail-expunge-callback (n)
"Called after message N has been pruned to update the current Pmail
message counter."
- (if (< n pmail-current-message)
- (setq pmail-current-message (1- pmail-current-message))))
+ ;; Process the various possible states to set the current message
+ ;; counter.
+ (setq pmail-total-messages (1- pmail-total-messages))
+ (if (>= pmail-current-message n)
+ (setq pmail-expunge-counter (1+ pmail-expunge-counter))))
;;; mbox: ready
(defun pmail-expunge ()
;; 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)))
BUFFER, possibly narrowed, contains an mbox mail message."
(save-excursion
(set-buffer buffer)
- (pmail-set-attribute attr state n)))
+ (pmail-set-attribute attr state n)
+ (pmail-show-message)))
(defun pmail-mark-message (msgnum-list attr-index)
"Set attribute ATTRIBUTE-INDEX in the message of the car of MSGNUM-LIST.
(let ((n (car msgnum-list)))
(set-buffer pmail-buffer)
(pmail-narrow-to-message n)
- (pmail-desc-set-attribute attr-index t n))))
+ (pmail-desc-set-attribute n attr-index t))))
(defun pmail-narrow-to-message (n)
"Narrow the current (pmail) buffer to bracket message N."
;; 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
(provide 'pmail)
-;; arch-tag: cff0a950-57fe-4f73-a86e-91ff75afd06c
+;; arch-tag: 65d257d3-c281-4a65-9c38-e61af95af2f0
;;; pmail.el ends here