Commits

Anonymous committed 15b917d

emacsbug update

Comments (0)

Files changed (4)

+1998-07-01  SL Baur  <steve@altair.xemacs.org>
+
+	* feedmail.el: synched with version 8.
+
 1998-05-18  Damon Lipparelli  <lipp@primus.com>
 
 	* metamail.el: (metamail-region): replace bogus use of `concat'.
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.06
+VERSION = 1.08
 AUTHOR_VERSION =
 MAINTAINER = XEmacs Development Team <xemacs-beta@xemacs.org>
 PACKAGE = net-utils
 ;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list.
 
-;; Copyright (C) 1985, 1994 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1994, 1997, 1998 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: FSF
-;; Keywords: maint
+;; Maintainer: XEmacs Development Team
+;; Keywords: maint mail
 
 ;; Not fully installed because it can work only on Internet hosts.
 ;; This file is part of XEmacs.
 
-;; XEmacs is free software; you can redistribute it and/or modify it
-;; under the terms of the GNU General Public License as published by
+;; XEmacs 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 2, or (at your option)
 ;; any later version.
 
-;; XEmacs is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;; General Public License for more details.
+;; XEmacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with XEmacs; see the file COPYING.  If not, write to the Free
-;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-;; 02111-1307, USA.
+;; along with XEmacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
-;;; Synched up with: FSF 19.34.
- 
+;;; Synched up with: FSF 20.2.
+
 ;;; Commentary:
 
 ;; `M-x report-emacs-bug ' starts an email note to the Emacs maintainers
 
 (require 'sendmail)
 
-;; XEmacs:  Screen for whether a beta version is running and redirect
-;; reports to the beta list instead of the newsgroup.
-(defvar report-emacs-bug-pretest-address "xemacs-beta@xemacs.org"
-  "Address of mailing list for XEmacs beta bugs.")
+(defgroup emacsbug nil
+  "Sending Emacs bug reports."
+  :group 'maint
+  :group 'mail)
 
-(defvar bug-gnu-emacs "xemacs@xemacs.org"
-  "Address of site maintaining mailing list for XEmacs bugs.")
+;; XEmacs: changed address
+(defcustom report-emacs-bug-address "xemacs@xemacs.org"
+  "*Address of mailing list for XEmacs bugs."
+  :group 'emacsbug
+  :type 'string)
+
+;; XEmacs: changed variable name
+(defcustom report-emacs-bug-beta-address "xemacs-beta@xemacs.org"
+  "*Address of mailing list for XEmacs beta bugs."
+  :group 'emacsbug
+  :type 'string)
 
 (defvar report-emacs-bug-orig-text nil
   "The automatically-created initial text of bug report.")
 
+(defcustom report-emacs-bug-no-confirmation nil
+  "*If non-nil, suppress the confirmations asked for the sake of novice users."
+  :group 'emacsbug
+  :type 'boolean)
+
+(defcustom report-emacs-bug-no-explanations nil
+  "*If non-nil, suppress the explanations given for the sake of novice users."
+  :group 'emacsbug
+  :type 'boolean)
+
+;; Lots of changes for XEmacs.
+
 ;;;###autoload
-(defun report-xemacs-bug (topic)
+(defun report-emacs-bug (topic &optional recent-keys)
   "Report a bug in XEmacs.
 Prompts for bug subject.  Leaves you in a mail buffer."
-  (interactive "sBug Subject: ")
-  (if (mail nil
-	    (if (string-match "\(beta[0-9]+\)" emacs-version)
-		;; If there are four numbers in emacs-version,
-		;; this is a pretest version.
-		report-emacs-bug-pretest-address
-	      bug-gnu-emacs)
-	    topic)
-      (let (user-point)
-	;; The rest of this does not execute
-	;; if the user was asked to confirm and said no.
-	(goto-char (point-min))
-	(re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n"))
-	(insert "In " (emacs-version) "\n")
-	(if (and system-configuration-options
-		 (not (equal system-configuration-options "")))
-	    (insert "configured using `configure "
-		    system-configuration-options "'\n"))
-	(insert "\n")
-	(insert "Please describe exactly what actions triggered the bug\n"
-		"and the precise symptoms of the bug:\n\n") 
-	(setq user-point (point))
-	(insert "\n\n\n"
-		"Recent input:\n")
-	(let ((before-keys (point)))
-	  ;; XEmacs:
-	  (insert (key-description (recent-keys)))
-;	  (insert (mapconcat (lambda (key)
-;			       (if (or (integerp key)
-;				       (symbolp key)
-;				       (listp key))
-;				   (single-key-description key)
-;				 (prin1-to-string key nil)))
-;			     (recent-keys)
-;			     " "))
-	  (save-restriction
-	    (narrow-to-region before-keys (point))
-	    (goto-char before-keys)
-	    (while (progn (move-to-column 50) (not (eobp)))
-	      (search-forward " " nil t)
-	      (insert "\n"))))
-	(let ((message-buf (get-buffer-create " *Message-Log*")))
-	  (if message-buf
-	      (progn
-		(insert "\n\nRecent messages:\n")
-		(insert-buffer-substring message-buf
-					 (save-excursion
-					   (set-buffer message-buf)
-					   (goto-char (point-max))
-					   (forward-line -10)
-					   (point))
-					 (save-excursion
-					   (set-buffer message-buf)
-					   (point-max))))))
-	;; This is so the user has to type something
-	;; in order to send easily.
-	;; XEmacs:  FSF non-abstraction of data?
-	;; (use-local-map (nconc (make-sparse-keymap) (current-local-map)))
-	;; Ghod intended it this way:
-	(use-local-map (let ((map (make-sparse-keymap)))
-			 (set-keymap-parents map (list (current-local-map)))
-			 map))
-	(define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info)
-	(with-output-to-temp-buffer "*Bug Help*"
-	  (princ (substitute-command-keys
-		  "Type \\[mail-send-and-exit] to send the bug report.\n"))
-	  (princ (substitute-command-keys
-		  "Type \\[kill-buffer] RET to cancel (don't send it).\n"))
-	  (terpri)
-	  (princ (substitute-command-keys "\
-Type \\[report-emacs-bug-info] to visit in Info the Emacs Manual section
-about when and how to write a bug report, and what information to supply
-so that the bug can be fixed.
-Type `\\[delete-other-windows]' to remove this window.")))
-	;; Make it less likely people will send empty messages.
-	(make-local-variable 'mail-send-hook)
-	(add-hook 'mail-send-hook 'report-emacs-bug-hook)
-	(save-excursion
-	  (goto-char (point-max))
-	  (skip-chars-backward " \t\n")
-	  (make-local-variable 'report-emacs-bug-orig-text)
-	  (setq report-emacs-bug-orig-text
-		(buffer-substring (point-min) (point))))
-	(goto-char user-point))))
+  ;; This strange form ensures that (recent-keys) is the value before
+  ;; the bug subject string is read.
+  (interactive (reverse (list (recent-keys) (read-string "Bug Subject: "))))
+  (let (user-point)
+    (compose-mail (if (string-match "(beta[0-9]+)" emacs-version)
+		      report-emacs-bug-beta-address
+		    report-emacs-bug-address)
+		  topic)
+    ;; The rest of this does not execute
+    ;; if the user was asked to confirm and said no.
+    ;; #### FSF
+    ;(rfc822-goto-eoh)
+    (goto-char (point-min))
+    (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
+    (forward-line 1)
 
-;; ;;;###autoload
-;; (defalias 'report-emacs-bug 'report-xemacs-bug)
+    ;; FSF has weird code to delete the user's signature, and reinsert
+    ;; it without multibyte characters, to "discourage users to write
+    ;; non-English text."  I don't want to use that.
+    (unless report-emacs-bug-no-explanations
+      ;; Insert warnings for novice users.
+      (insert "This bug report will be sent to the XEmacs Development Team,\n")
+      (insert-face " not to your local site managers!!" 'italic)
+      (insert "\nPlease write in ")
+      (insert-face "English" 'italic)
+      (insert ", because the XEmacs maintainers do not have
+translators to read other languages for them.\n\n"))
+
+    (insert "In " (emacs-version) "\n")
+    (if (and system-configuration-options
+	     (not (equal system-configuration-options "")))
+	(insert "configured using `configure "
+		system-configuration-options "'\n"))
+    (insert "\n")
+    (insert "Please describe exactly what actions triggered the bug\n"
+	    "and the precise symptoms of the bug:\n\n") 
+    (setq user-point (point))
+    (insert "\n\n\n"
+	    "Recent keystrokes:\n\n")
+    (let ((before-keys (point)))
+      (insert (key-description recent-keys))
+      (save-restriction
+	(narrow-to-region before-keys (point))
+	(goto-char before-keys)
+	(while (progn (move-to-column 50) (not (eobp)))
+	  (search-forward " " nil t)
+	  (insert "\n"))))
+    (insert "\n\n\nRecent messages (most recent first):\n\n")
+    (let ((standard-output (current-buffer)))
+      (print-recent-messages 10))
+    ;; This is so the user has to type something
+    ;; in order to send easily.
+    (use-local-map (let ((map (make-sparse-keymap)))
+		     (set-keymap-parents map (current-local-map))
+		     map))
+    (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info)
+    (unless report-emacs-bug-no-explanations
+      (with-output-to-temp-buffer "*Bug Help*"
+	(if (eq mail-user-agent 'sendmail-user-agent)
+	    (princ (substitute-command-keys
+		    "Type \\[mail-send-and-exit] to send the bug report.\n")))
+	(princ (substitute-command-keys
+		"Type \\[kill-buffer] RET to cancel (don't send it).\n"))
+	(terpri)
+	(princ (substitute-command-keys
+		"\
+Type \\[report-emacs-bug-info] to visit in Info the XEmacs Manual section
+about when and how to write a bug report,
+and what information to supply so that the bug can be fixed.
+Type SPC to scroll through this section and its subsections."))))
+    ;; Make it less likely people will send empty messages.
+    (make-local-variable 'mail-send-hook)
+    (add-hook 'mail-send-hook 'report-emacs-bug-hook)
+    (save-excursion
+      (goto-char (point-max))
+      (skip-chars-backward " \t\n")
+      (make-local-variable 'report-emacs-bug-orig-text)
+      (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point))))
+    (goto-char user-point)))
+
+;; XEmacs: for backwards compatibility
+(defalias 'report-xemacs-bug 'report-emacs-bug)
 
 (defun report-emacs-bug-info ()
   "Go to the Info node on reporting Emacs bugs."
   (interactive)
-  (info)
-  (Info-directory)
-  (Info-menu "xemacs")
-  (Info-goto-node "Bugs"))
+  (Info-goto-node "(xemacs)Top"))
 
 (defun report-emacs-bug-hook ()
   (save-excursion
 		(length report-emacs-bug-orig-text))
 	     (equal (buffer-substring (point-min) (point))
 		    report-emacs-bug-orig-text))
-	(error "No text entered in bug report"))))
+	(error "No text entered in bug report"))
+
+    ;; Check the buffer contents and reject non-English letters.
+    (save-excursion
+      (goto-char (point-min))
+      (skip-chars-forward "\0-\177")
+      (if (not (eobp))
+	  (if (or report-emacs-bug-no-confirmation
+		  (y-or-n-p "Convert non-ASCII letters to hexadecimal? "))
+	      (while (progn (skip-chars-forward "\0-\177")
+			    (not (eobp)))
+		(let ((ch (following-char)))
+		  (delete-char 1)
+		  (insert (format "=%02x" ch)))))))
+
+    ;; The last warning for novice users.
+    (if (or report-emacs-bug-no-confirmation
+	    (yes-or-no-p
+	     "Send this bug report to the Emacs maintainers? "))
+	;; Just send the current mail.
+	nil
+      (goto-char (point-min))
+      (if (search-forward "To: ")
+	  (let ((pos (point)))
+	    (end-of-line)
+	    (delete-region pos (point))))
+      (kill-local-variable 'mail-send-hook)
+      (with-output-to-temp-buffer "*Bug Help*"
+	(princ (substitute-command-keys "\
+You invoked the command M-x report-emacs-bug,
+but you decided not to mail the bug report to the Emacs maintainers.
+
+If you want to mail it to someone else instead,
+please insert the proper e-mail address after \"To: \",
+and send the mail again using \\[mail-send-and-exit].")))
+      (error "M-x report-emacs-bug was cancelled, please read *Bug Help* buffer"))
+    ))
 
 (provide 'emacsbug)
 
-;;; feedmail.el --- assist other email packages to massage outgoing messages
+;;; feedmail.el --- assist other email packages to massage outgoing messages 
 ;;; A replacement for parts of GNUemacs' sendmail.el (specifically,
-;;; it's what handles your outgoing mail after you hit C-c C-c in
-;;; mail mode).  It works with recent versions of GNUemacs (mostly
-;;; tested against 19.34) and XEmacs (some testing with 19.15 and
-;;; 20.2).
+;;; it's what handles your outgoing mail after you hit C-c C-c in mail
+;;; mode).  See below for a list of additional features, including the
+;;; ability to queue messages for later sending.  If you are using
+;;; fakemail as a subprocess, you can switch to feedmail and eliminate
+;;; the use of fakemail.  feedmail works with recent versions of
+;;; GNUemacs (mostly, but not exclusively, tested against 19.34 on
+;;; Win95; some testing on 20.x) and XEmacs (tested with 20.4 and
+;;; later betas).  It probably no longer works with GNUemacs v18,
+;;; though I haven't tried that in a long time.  Sorry, no manual yet
+;;; in this release.  Look for one with the next release.
 
 ;; As far as I'm concerned, anyone can do anything they want with
 ;; this specific piece of code.  No warranty or promise of support is
 ;; offered.  This code is hereby released into the public domain.
 
-;; Author: Bill Carpenter <bill@bubblegum.net>
-;; Version: 7
-;; Keywords: email, queue, mail, sendmail, message
+;; Author: Bill Carpenter <bill@bubblegum.net>, <bill@carpenter.ORG>
+;; Version: 8
+;; Keywords: email, queue, mail, sendmail, message, spray, smtp, draft
+;; Where: <URL:http://www.carpenter.org/feedmail/feedmail.html>
 ;; Thanks: My thanks to the many people who have sent me suggestions
 ;;    and fixes over time, as well as those who have tested many beta
 ;;    iterations.  Some are cited in comments in code fragments below,
 ;; note along the lines of "I use feedmail and find it useful" or "I
 ;; tried feedmail and didn't find it useful, so I stopped using it".
 ;;
+;; It is most useful, when sending a bug report, if you tell me what
+;; version of emacs you are using, what version of feedmail you are
+;; using, and what versions of other email-related elisp packages you
+;; are using.  If in doubt about any of that, send the bug report
+;; anyhow.
+;; 
 ;; =====
 ;; A NOTE TO THOSE WHO WOULD CHANGE THIS CODE...  Since it is PD,
 ;; you're within your rights to do whatever you want.  If you do
 ;; (I can't always consistently follow the relevant usenet groups),
 ;; and (4) use a version number that is based on the version you're
 ;; changing along with something that indicates you changed it.  For
-;; example, 
+;; example,
 ;;
 ;;        (defconst feedmail-patch-level "123")
 ;;        (defconst feedmail-patch-level "123-XYZ-mods")
 ;; "defvar", and ignore everthing else.  For info about custom, see
 ;; <URL:http://www.dina.kvl.dk/~abraham/custom/>.
 ;;
-;; This code does in elisp the stuff that used to be done
+;; This code does in elisp a superset of the stuff that used to be done
 ;; by the separate program "fakemail" for processing outbound email.
 ;; In other words, it takes over after you hit "C-c C-c" in mail mode.
 ;; By appropriate setting of options, you can still use "fakemail",
 ;; or you can even revert to sendmail (which is not too popular
 ;; locally).  See the variables at the top of the elisp for how to
-;; achieve these effects:
+;; achieve these effects (there are more features than in this bullet
+;; list, so trolling through the variable and function doc strings may
+;; be worth your while):
+;;
+;;    --- you can park outgoing messages into a disk-based queue and
+;;        stimulate sending them all later (handy for laptop users);
+;;        there is also a queue for draft messages
 ;;
 ;;    --- you can get one last look at the prepped outbound message and
 ;;        be prompted for confirmation
 ;;    --- you can specify something other than /bin/mail for the
 ;;        subprocess
 ;;
-;;    --- you can park outgoing messages into a disk-based queue and
-;;        stimulate sending them all later (handy for laptop users);
-;;        there is also a queue for draft messages
+;;    --- you can generate/modify an X-MAILER: message header
 ;;
-;;    --- you can generate an X-MAILER: message header
-;;
-;; After a few options below, you will find the function
-;; feedmail-send-it. There are two ways you can use the stuff in this
+;; After a long list of options below, you will find the function
+;; feedmail-send-it. Hers's the best way to use the stuff in this
 ;; file:
 ;;
-;; (1)  Put the contents of this file into sendmail.el and change the
-;; name of feedmail-send-it to sendmail-send-it, replacing that
-;; function in sendmail.el.  (I strongly recommend against this.)
-;;
-;;                              or
-;;
-;; (2)  Save this file as feedmail.el somewhere on your elisp
+;; Save this file as feedmail.el somewhere on your elisp
 ;; loadpath; byte-compile it.  Put the following lines somewhere in
 ;; your ~/.emacs stuff:
 ;;
 ;;     (setq send-mail-function 'feedmail-send-it)
 ;;     (autoload 'feedmail-send-it "feedmail")
 ;;
-;; If you plan to use the queue stuff:
+;; If you plan to use the queue stuff, also use this:
 ;;
+;;     (setq feedmail-enable-queue t)
 ;;     (autoload 'feedmail-run-the-queue "feedmail")
 ;;     (autoload 'feedmail-run-the-queue-no-prompts "feedmail")
 ;;     (setq auto-mode-alist (cons '("\\.fqm$" . mail-mode) auto-mode-alist))
 ;;
+;; If you are using the desktop.el library to restore your sessions, you might 
+;; like to add the suffix ".fqm" to the list of non-saved things via the variable
+;; desktop-files-not-to-save.
+;;
+;; If you are planning to call feedmail-queue-reminder from your .emacs or
+;; something similar, you might need this:
+;;
+;;     (autoload 'feedmail-queue-reminder "feedmail")
+;;
+;; If you ever use rmail-resend and queue messages, you should do this:
+;;
+;;     (setq feedmail-queue-alternative-mail-header-separator "")
+;;
+;; If you want to automatically spell-check messages, but not when sending
+;; them from the queue, you could do something like this:
+;;
+;;     (autoload 'feedmail-mail-send-hook-splitter "feedmail")
+;;     (add-hook 'mail-send-hook 'feedmail-mail-send-hook-splitter)
+;;     (add-hook 'feedmail-mail-send-hook 'ispell-message)
+;;
+;; If you are using message-mode to compose and send mail, feedmail will
+;; probably work fine with that (someone else tested it and told me it worked).
+;; Follow the directions above, but make these adjustments instead:
+;;
+;;     (setq message-send-mail-function 'feedmail-send-it)
+;;     (add-hook 'message-mail-send-hook 'feedmail-mail-send-hook-splitter)
+;;
 ;; I think the LCD is no longer being updated, but if it were, this
 ;; would be a proper LCD record.  There is an old version of
 ;; feedmail.el in the LCD archive.  It works but is missing a lot of
 ;; features.
 ;;
 ;; LCD record:
-;; feedmail|Bill Carpenter|bill@bubblegum.net|Outbound mail handling|97-05-20|7|feedmail.el
+;; feedmail|Bill Carpenter|bill@bubblegum.net,bill@carpenter.ORG|Outbound mail queue handling|98-06-15|8|feedmail.el
 ;;
 ;; Change log:
 ;; original,      31 March 1991
 ;;         limited support for a "drafts" directory
 ;;         user-configurable default message action
 ;;         allow timeout for confirmation prompt (where available)
-;;         move FCC handling to as late as possible to get max 
+;;         move FCC handling to as late as possible to get max
 ;;            header munging in the saved file
 ;;         work around sendmail.el's prompts when working from queue
 ;;         more reliably detect voluntary user bailouts
 ;;         offer to delete queue files when sending immediately
 ;;         queue filename convention preserves queue order
 ;;         default queue and draft directory names that work on VMS
-;;         deduced address list now really a list, not a
-;;            string (API change)
+;;         deduced address list now really a list, not a string (API change)
 ;;         no more address buffer
 ;;         when sending immediately, brief reminder of queue/draft counts
 ;;         copy trace of smtpmail stuff to feedmail error buffer on no-go
 ;;            queue/draft directories
 ;;         feedmail-force-expand-mail-aliases in case you can't figure
 ;;            any other way
-;;         cleanup some sloppiness about case-fold-search (a strange
+;;         cleanup some of my sloppiness about case-fold-search (a strange
 ;;            variable)
 ;;         best effort following coding conventions from GNUemacs
 ;;            elisp manual appendix
 ;;            feedmail-run-the-queue[-no-prompts] to properly be called
 ;;            non-interactively
 ;;         eliminate reliance on directory-sep-char and feedmail-sep-thing
-;;         tweak smart filling (reminded of comma problem by
-;;           levitte@lp.se)
+;;         tweak smart filling (reminded of comma problem by levitte@lp.se)
 ;;         option to control writing in text vs binary mode
+;; patchlevel 8, 15 June 1998
+;;         reliable re-editing of text-mode (vs binary) queued messages
+;;         user option to keep BCC: in FCC: copy (keep by default)
+;;         user option to delete body from FCC: copy (keep by default)
+;;         feedmail-deduce-bcc-where for envelope (API change for
+;;           feedmail-deduce-address list)
+;;         feedmail-queue-alternative-mail-header-separator
+;;         at message action prompt, "I"/"S" bypass message confirmation prompt
+;;         feedmail-mail-send-hook-splitter, feedmail-mail-send-hook,
+;;           feedmail-mail-send-hook-queued
+;;         user can supply stuff for message action prompt
+;;         variable feedmail-queue-runner-confirm-global, function feedmail-run-the-queue-global-prompt
+;;         bugfix: absolute argument to directory-files (tracked down for me
+;;           by gray@austin.apc.slb.com (Douglas Gray Stephens)); relative
+;;           pathnames can tickle stuff in ange-ftp remote directories
+;;           (perhaps because feedmail is careless about its working
+;;           directory)
+;;         feedmail-deduce-envelope-from
+;;         always supply envelope "from" (user-mail-address) to sendmail
+;;         feedmail-message-id-suffix
+;;         feedmail-queue-reminder, feedmail-queue-reminder-alist (after suggestions
+;;           and/or code fragments from tonyl@Eng.Sun.COM (Tony Lam) and
+;;           burge@newvision.com (Shane Burgess); bumped up the default value of
+;;           feedmail-queue-chatty-sit-for since info is more complex sometimes
+;;         feedmail-enable-spray (individual transmissions, crude mailmerge)
+;;         blank SUBJECT: no longer a special case; see feedmail-nuke-empty-headers
+;;         fiddle-plexes data structure used lots of places; see feedmail-fiddle-plex-blurb
+;;         feedmail-fiddle-plex-user-list
+;;         feedmail-is-a-resend
+;;         honor mail-from-style in constructing default for feedmail-from-line
+;;         re-implement feedmail-from-line and feedmail-sender-line with
+;;           fiddle-plexes; slightly modified semantics for feedmail-sender-line
+;;         feedmail-queue-default-file-slug; tidy up some other slug details
+;;         feedmail-queue-auto-file-nuke
+;;         feedmail-queue-express-to-queue and feedmail-queue-express-to-draft
+;;         strong versions of "q"ueue and "d"raft answers (always make a new file)
+;;
+;; todo (probably in patchlevel 9):
+;;         write texinfo manual
+;;         maybe partition into multiple files, including files of examples
+;;
 ;;; Code:
 
-(defconst feedmail-patch-level "7")
+(defconst feedmail-patch-level "8")
 
 
 ;; from <URL:http://www.dina.kvl.dk/~abraham/custom/>:
     ;; We have the old custom-library, hack around it!
     (defmacro defgroup (&rest args)
       nil)
-    (defmacro defcustom (var value doc &rest args) 
+    (defmacro defcustom (var value doc &rest args)
       (` (defvar (, var) (, value) (, doc))))))
 
 
 
 
 (defcustom feedmail-confirm-outgoing nil
-  "*If non-nil, give a y-or-n confirmation prompt before sending mail.  
+  "*If non-nil, give a y-or-n confirmation prompt before sending mail.
 This is done after the message is completely prepped, and you'll be
 looking at the top of the message in a buffer when you get the prompt.
 If set to the symbol 'queued, give the confirmation prompt only while
 )
 
 
+(defcustom feedmail-deduce-bcc-where nil
+  "*Where should BCC:/RESENT-BCC: addresses appear in the envelope list?
+Addresses for the message envelope are deduced by examining
+appropriate address headers in the message.  Generally, they will show
+up in the list of deduced addresses in the order that the headers
+happen to appear (duplicate addresses are eliminated in any case).
+This variable can be set to the symbol 'first, in which case the
+BCC:/RESENT-BCC: addresses will appear at the beginning in the list;
+or, it can be set to the symbol 'last, in which case they will appear
+at the end of the list.
+
+Why should you care?  Well, maybe you don't, and certainly the same
+things could be accomplished by affecting the order of message headers
+in the outgoing message.  Some people use BCC: as a way of getting
+their own \"come back\" copy of each message they send.  If BCC:
+addresses are not handled first, there can be substantial delays in
+seeing the message again.  Some configurations of sendmail, for example,
+seem to try to deliver to each addressee at least once, immediately
+and serially, so slow SMTP conversations can add up to a delay.  There
+is an option for either 'first or 'last because you might have a
+delivery agent that processes the addresses backwards."
+  :group 'feedmail-headers
+  :type 'boolean
+)
+
+
 (defcustom feedmail-fill-to-cc t
   "*If non-nil do smart filling of addressee header lines.
 Smart filling means breaking long lines at appropriate points and
 )
 
 
+(defcustom feedmail-nuke-bcc-in-fcc nil
+  "*If non-nil remove [RESENT-]BCC: lines in message copies saved via FCC:.
+This is independent of whether the BCC: header lines are actually sent
+with the message (see feedmail-nuke-bcc).  Though not implied in the name,
+the same FCC: treatment applies to both BCC: and RESENT-BCC: lines."
+  :group 'feedmail-headers
+  :type 'boolean
+)
+
+
+(defcustom feedmail-nuke-body-in-fcc nil
+  "*If non-nil remove body of message in copies saved via FCC:.
+If an positive integer value, leave (up to) that many lines of the
+beginning of the body intact.  The result is that the FCC: copy will
+consist only of the message headers, serving as a sort of an outgoing
+message log."
+  :group 'feedmail-headers
+  :type '(choice (const nil) (const t) integer)
+;;  :type 'boolean
+)
+
+
 (defcustom feedmail-force-expand-mail-aliases nil
   "*If non-nil force the calling of expand-mail-aliases.
 Normally, feedmail tries to figure out if you're using mailalias or
 ;; RFC-822 and RFC-1123, but are you *really* one of those cases
 ;; they're talking about?  I doubt it.)
 (defcustom feedmail-sender-line nil
-  "*If non-nil and there is a FROM: header, force a SENDER: header.
-Use the value of this variable as its contents.  You can probably
-leave this nil, but if you feel like using it, a good value would be a
-fully-qualified domain name form of your address.  For example,
-bill@bubblegum.net.  Don't include a trailing newline or the keyword
-SENDER:.  They're automatically provided."
+  "*If non-nil and the email has no SENDER: header, use this value.
+May be nil, in which case nothing in particular is done with respect
+to SENDER: lines.  By design, will not replace an existing SENDER:
+line, but you can achieve that with a fiddle-plex 'replace action.
+NB: it makes no sense to use the value t since there is no sensible
+default for SENDER:.
+
+If not nil, it may be a string, a fiddle-plex, or a function which
+returns either nil, t, a string, or a fiddle-plex (or, in fact,
+another function, but let's not be ridiculous).  If a string, it
+should be just the contents of the header, not the name of the header
+itself nor the trailing newline.  If a function, it will be called
+with no arguments.  For an explanation of fiddle-plexes, see the
+documentation for the variable feedmail-fiddle-plex-blurb.  In all
+cases the name element of the fiddle-plex is ignored and is hardwired
+by feedmail to either \"X-Sender\" or \"X-Resent-Sender\".
+
+You can probably leave this nil, but if you feel like using it, a good
+value would be a string of a fully-qualified domain name form of your
+address.  For example, \"bill@bubblegum.net (WJCarpenter)\".  The SENDER:
+header is fiddled after the FROM: header is fiddled."
   :group 'feedmail-headers
   :type '(choice (const nil) string)
 )
   :type 'boolean
 )
 
-;; user-full-name suggested by kpc@ptolemy.arc.nasa.gov (=Kimball Collins)
-;; improvement using user-mail-address suggested by 
-;;   gray@austin.apc.slb.com (Douglas Gray Stephens)
-(defcustom feedmail-from-line
-  (concat (if user-mail-address
-			  user-mail-address
-			(concat (user-login-name) "@" (system-name)))
-		  " (" (user-full-name) ")")
+
+(defcustom feedmail-from-line t
   "*If non-nil and the email has no FROM: header, use this value.
-A good value would be a fully-qualified domain name form of your
-address.  For example, bill@bubblegum.net.  The default value of this
-variable uses the standard elisp variable user-mail-address which
-should be set on every system but has a decent chance of being wrong.
-Better to set this variable explicitly to the string you want or find
-some other way to arrange for the message to get a FROM: line.  Don't
-include a trailing newline or the keyword FROM:.  They're
-automatically provided."
+May be t, in which case a default is computed (and you probably won't
+be happy with it).  May be nil, in which case nothing in particular is
+done with respect to FROM: lines.  By design, will not replace an
+existing FROM: line, but you can achieve that with a fiddle-plex 'replace
+action.
+
+If neither nil nor t, it may be a string, a fiddle-plex, or a function
+which returns either nil, t, a string, or a fiddle-plex (or, in fact,
+another function, but let's not be ridiculous).  If a string, it
+should be just the contents of the header, not the name of the header
+itself nor the trailing newline.  If a function, it will be called
+with no arguments.  For an explanation of fiddle-plexes, see the
+documentation for the variable feedmail-fiddle-plex-blurb.  In all
+cases the name element of the fiddle-plex is ignored and is hardwired
+by feedmail to either \"X-From\" or \"X-Resent-From\".
+
+A good value would be a string fully-qualified domain name form of
+your address.  For example, \"bill@bubblegum.net (WJCarpenter)\".  The
+default value of this variable uses the standard elisp variable
+user-mail-address which should be set on every system but has a decent
+chance of being wrong.  It also honors mail-from-style.  Better to set
+this variable explicitly to the string you want or find some other way
+to arrange for the message to get a FROM: line."
   :group 'feedmail-headers
   :type '(choice (const nil) string)
 )
 
 
+(defcustom feedmail-deduce-envelope-from t
+  "*If non-nil, deduce message envelope \"from\" from header FROM: or SENDER:.
+In other words, if there is a SENDER: header in the message, temporarily
+change the value of user-mail-address to be the same while the message
+is being sent.  If there is no SENDER: header, use the FROM: header,
+if any.  Address values are taken from the actual message just before
+it is sent, and the process is independent of the values of
+feedmail-from-line and/or feedmail-sender-line.
+
+There are many and good reasons for having the message header
+FROM:/SENDER: be different from the message envelope \"from\"
+information.  However, for most people and for most circumstances, it
+is usual for them to be the same (this is probably especially true for
+the case where the user doesn't understand the difference between the
+two in the first place).
+
+The idea behind this feature is that you can have everything set up
+some normal way for yourself.  If for some reason you want to send a
+message with another FROM: line, you can just type it at the top of
+the message, and feedmail will take care of \"fixing up\" the envelope
+\"from\".  This only works for mail senders which make use of
+user-mail-address as the envelope \"from\" value.  For some mail
+senders (e.g., feedmail-buffer-to-bin-mail), there is no simple way to
+influence what they will use as the envelope."
+  :group 'feedmail-headers
+  :type 'boolean
+)
+
+
 (defcustom feedmail-x-mailer-line-user-appendage nil
   "*See feedmail-x-mailer-line."
   :group 'feedmail-headers
 )
 
 
-
-;; an example of something to call from mail-setup-hook or a similar
-;; place to wipe out someone else's idea of X-MAILER: (this is not
-;; robust, but it works for me and probably works for you)
-;;
-;; (defun wjc:nuke-x-mailer ()
-;;   "zap X-Mailer: header 'cuz I prefer mine"
-;;   (let ((xm))
-;; 	(save-excursion
-;; 	  (mail-position-on-field "X-MAILER")
-;; 	  (forward-line 0)  ;;go to beginning of line
-;; 	  (setq xm (point))
-;; 	  (forward-line 1)  ;;beginning of next line
-;; 	  (delete-region xm (point))
-;; 	)))
-;; 
 (defcustom feedmail-x-mailer-line t
   "*Control the form of an X-MAILER: header in an outgoing message.
 Moderately useful for debugging, keeping track of your correspondents'
-mailer preferences, or just wearing your MUA on your sleeve.
-If nil, no X-MAILER: header is produced.  If t, an X-MAILER: header of
-a predetermined format is produced.  If neither nil nor t, should be
-a string which is just the contents of the header, not the header itself
-or the trailing newline.  If you want to take the default construct
-and just add a little blob of your own at the end, define the variable
-feedmail-x-mailer-line-user-appendage as that blob string.  If the
-message already has a X-MAILER: line, it is left as-is, so if you want
-to use this one instead, you'll have to arrange to get rid of the
-other one.  You should probably know that some people are fairly
-emotional about the presence of X-MAILER: lines in email."
+mailer preferences, or just wearing your MUA on your sleeve.  You
+should probably know that some people are fairly emotional about the
+presence of X-MAILER: lines in email.
+
+If nil, nothing is done about X-MAILER:.
+
+If t, an X-MAILER: header of a predetermined format is produced,
+combining its efforts with any existing X-MAILER: header.  If you want
+to take the default construct and just add a little blob of your own
+at the end, define the variable feedmail-x-mailer-line-user-appendage
+as that blob string.  A value of t is equivalent to using the function 
+feedmail-default-x-mailer-generator.
+
+If neither nil nor t, it may be a string, a fiddle-plex, or a function
+which returns either nil, t, a string, or a fiddle-plex (or, in fact,
+another function, but let's not be ridiculous).  If a string, it
+should be just the contents of the header, not the name of the header
+itself nor the trailing newline.  If a function, it will be called
+with no arguments.  For an explanation of fiddle-plexes, see the
+documentation for the variable feedmail-fiddle-plex-blurb.  In all
+cases the name element of the fiddle-plex is ignored and is hardwired
+by feedmail to either \"X-Mailer\" or \"X-Resent-Mailer\"."
   :group 'feedmail-headers
-  :type '(choice (const t) (const nil) string)
+  :type '(choice (const t) (const nil) string function)
 )
 
 
-(defcustom feedmail-message-id-generator 'feedmail-default-message-id-generator
-  "*If non-nil, should be a function which creates a MESSAGE-ID: value.
-It will be called with one argument, the associated filename for the
-message, which might be nil.  The message ID should be the return
-value of the function.  Don't include trailing newline, leading space,
-or the keyword MESSAGE-ID.  They're automatically provided.  Do
-include surrounding <> brackets.  When called, the current buffer is
-the prepped outgoing mail buffer.  The function may inspect it, but
-shouldn't modify it.  If the returned value doesn't contain any
-non-whitespace characters, no message ID header is generated, so you
-could generate them conditionally, based on the contents of the
-mail.  You should let feedmail generate a MESSAGE-ID: for you unless
-you are sure that whatever you give your messages to will do it for
-you (e.g., most configurations of sendmail).  Even if the latter case
-is true, it probably won't hurt you to generate your own, and it will
-then show up in the saved message if you use FCC:."
-  :group 'feedmail-headers
-  :type '(choice (const nil) function)
-)
+(defcustom feedmail-message-id-generator t
+  "*Specifies the creation of a MESSAGE-ID: header field.
 
+If nil, nothing is done about MESSAGE-ID:.
 
-;; this was suggested in various forms by several people; first was
-;; Tony DeSimone in Oct 1992; sorry to be so tardy
-(defcustom feedmail-date-generator 'feedmail-default-date-generator
-  "*If non-nil, should be a function which creates a DATE: value.
-The function must generate an RFC-822 compliant date which will be
-inserted on a DATE: header.  The date should be the return value of
-the function.  Don't include trailing newline, leading space, or the
-keyword DATE.  They're automatically provided.  When called, the
-current buffer is the prepped outgoing mail buffer.  The function may
-inspect it, but shouldn't modify it.  If the returned value doesn't
-contain any non-whitespace characters, no DATE: header is generated,
-so you could generate them conditionally, based on the contents of the
-mail.  You should let feedmail generate a DATE: for you unless you are
-sure that whatever you give your messages to will do it for you (e.g.,
-most configurations of sendmail).  Even if the latter case is true, it
+If t, a MESSAGE-ID: header of a predetermined format is produced, but
+only if there is not already a MESSAGE-ID: in the message.  A value of
+t is equivalent to using the function feedmail-default-message-id-generator.
+
+If neither nil nor t, it may be a string, a fiddle-plex, or a function
+which returns either nil, t, a string, or a fiddle-plex (or, in fact,
+another function, but let's not be ridiculous).  If a string, it
+should be just the contents of the header, not the name of the header
+itself nor the trailing newline.  If a function, it will be called
+with one argument: the possibly-nil name of the file associated with
+the message buffer.  For an explanation of fiddle-plexes, see the
+documentation for the variable feedmail-fiddle-plex-blurb.  In all
+cases the name element of the fiddle-plex is ignored and is hardwired
+by feedmail to either \"Message-ID\" or \"Resent-Message-ID\".
+
+You should let feedmail generate a MESSAGE-ID: for you unless you are sure
+that whatever you give your messages to will do it for you (e.g., most
+configurations of sendmail).  Even if the latter case is true, it
 probably won't hurt you to generate your own, and it will then show up
 in the saved message if you use FCC:."
   :group 'feedmail-headers
 )
 
 
+(defcustom feedmail-message-id-suffix nil
+  "*If non-nil, used as a suffix in generated MESSAGE-ID: headers for uniqueness.
+The function feedmail-default-message-id-generator creates its work based
+on a formatted date-time string, a random number, and a domain-looking suffix.
+You can control the suffix used by assigning a string value to this variable.  If
+you don't supply one, the value of the variable user-mail-address will be used.
+If the value of feedmail-message-id-suffix contains an \"@\" character, the string
+will be used verbatim, else an \"@\" character will be prepended automatically."
+  :group 'feedmail-headers
+  :type 'string
+)
+
+;; this was suggested in various forms by several people; first was
+;; Tony DeSimone in Oct 1992; sorry to be so tardy
+(defcustom feedmail-date-generator t
+  "*Specifies the creation of a DATE: header field.
+
+If nil, nothing is done about DATE:.
+
+If t, a DATE: header of a predetermined format is produced, but only
+if there is not already a DATE: in the message.  A value of t is
+equivalent to using the function feedmail-default-date-generator.
+
+If neither nil nor t, it may be a string, a fiddle-plex, or a function
+which returns either nil, t, a string, or a fiddle-plex (or, in fact,
+another function, but let's not be ridiculous).  If a string, it
+should be just the contents of the header, not the name of the header
+itself nor the trailing newline.  If a function, it will be called
+with one argument: the possibly-nil name of the file associated with
+the message buffer.  For an explanation of fiddle-plexes, see the
+documentation for the variable feedmail-fiddle-plex-blurb.  In all
+cases the name element of the fiddle-plex is ignored and is hardwired
+by feedmail to either \"Date\" or \"Resent-Date\".
+
+If you decide to format your own date field, do us all a favor and know
+what you're doing.  Study the relevant parts of RFC-822 and RFC-1123.
+Don't make me come up there!
+
+You should let feedmail generate a DATE: for you unless you are sure
+that whatever you give your messages to will do it for you (e.g., most
+configurations of sendmail).  Even if the latter case is true, it
+probably won't hurt you to generate your own, and it will then show up
+in the saved message if you use FCC:."
+  :group 'feedmail-headers
+  :type '(choice (const nil) function)
+)
+
+
+(defcustom feedmail-fiddle-headers-upwardly t
+  "*Non-nil means fiddled header fields should be inserted at the top of the header.
+Nil means insert them at the bottom.  This is mostly a novelty issue since
+the standards define the ordering of header fields to be immaterial and it's
+fairly likely that some MTA along the way will have its own idea of what the
+order should be, regardless of what you specify."
+  :group 'feedmail-header
+  :type 'boolean
+  )
+
+
+(defcustom feedmail-fiddle-plex-user-list nil
+  "If non-nil, should be a list of one or more fiddle-plexes.
+Each element of the list can also be a function which returns a
+fiddle-plex.
+
+feedmail will use this list of fiddle-plexes to manipulate user-specified
+message header fields.  It does this after it has completed all normal
+message header field manipulation and before calling feedmail-last-chance-hook.
+
+For an explanation of fiddle-plexes, see the documentation for the
+variable feedmail-fiddle-plex-blurb.  In contrast to some other fiddle-plex
+manipulation functions, in this context, it makes no sense to have an element
+which is nil, t, or a simple string."
+  :group 'feedmail-header
+  :type 'list
+  )
+
+
+(defcustom feedmail-enable-spray nil
+  "If non-nil, transmit message separately to each addressee.
+feedmail normally accumulates a list of addressees and passes the message
+along with that list to a buffer-eating function which expects any number
+of addressees.  If this variable is non-nil, however, feedmail will
+repeatedly call the same buffer-eating function.  Each time, the list of
+addressees will be just one item from the original list.  This only affects
+the message envelope addresses and doesn't affect what appears in the 
+message headers except as noted.
+
+Spray mode is usually pointless, and if you can't think of a good reason for
+it, you should avoid it since it is inherently less efficient than normal 
+multiple delivery.  One reason to use it is to overcome mis-featured mail
+transports which betray your trust by revealing BCC: addressees in the
+headers of a message.  Another use is to do a crude form of mailmerge, for
+which see feedmail-spray-address-fiddle-plex-list.
+
+If one of the calls to the buffer-eating function results in an error,
+what happens next is carelessly defined, so beware."
+  :group 'feedmail-spray
+  :type 'boolean
+  )
+
+(defvar feedmail-spray-this-address nil
+  "Do not set or change this variable.  See feedmail-spray-address-fiddle-plex-list.")
+
+(defcustom feedmail-spray-address-fiddle-plex-list nil
+  "User-supplied specification for a crude form of mailmerge capability.
+When spraying is enabled, feedmail composes a list of envelope addresses.
+In turn, feedmail-spray-this-address is temporarily set to each address
+(stripped of any comments and angle brackets) and calls a function which 
+fiddles message headers according to this variable.  For an overview of
+fiddle-plex data structures, see the documentation for feedmail-fiddle-plex-blurb.
+
+May be nil, in which case nothing in particular is done about message
+headers for specific addresses.
+
+May be t, in which case a \"TO:\" header is added to the message with
+the stripped address as the header contents.  The fiddle-plex operator
+is 'supplement.
+
+May be a string, in which case the string is assumed to be the name of
+a message header field with the stripped address serving as the value.
+The fiddle-plex operator is 'supplement.
+
+May be a function, in which case it is called with no arguments and is
+expected to return nil, t, a string, another function, or a fiddle-plex.
+The result is used recursively.
+
+May be a list of any combination of the foregoing and fiddle-plexes.  (A
+value for this variable which consists of a single fiddle-plex must be
+nested inside another list to avoid ambiguity.)  If a list, each item
+is acted on in turn as described above.
+
+For example,
+
+  (setq feedmail-spray-address-fiddle-plex-list 'my-address-embellisher)
+
+The idea of the example is that, during spray mode, as each message is
+about to be transmitted to an individual address, the function will be
+called and will consult feedmail-spray-this-address to find the
+stripped envelope email address (no comments or angle brackets).  The
+function should return an embellished form of the address.
+
+The recipe for sending form letters is:  (1) create a message with all
+addressees on BCC: headers; (2) tell feedmail to remove BCC: headers
+before sending the message; (3) create a function which will embellish 
+stripped addresses, if desired; (4) define feedmail-spray-address-fiddle-plex-list
+appropriately; (5) send the message with feedmail-enable-spray set
+non-nil; (6) stand back and watch co-workers wonder at how efficient
+you are at accomplishing inherently inefficient things."
+  :group 'feedmail-spray
+  :type 'list
+  )
+
+
 (defcustom feedmail-enable-queue nil
   "*If non-nil, provide for stashing outgoing messages in a queue.
 This is the master on/off switch for feedmail message queuing.
 )
 
 
+(defcustom feedmail-queue-runner-confirm-global nil
+  "*If non-nil, give a y-or-n confirmation prompt before running the queue.
+Prompt even if the queue is about to be processed as a result of a call to
+feedmail-run-the-queue-no-prompts.  This gives you a way to bail out
+without having to answer no to the individual message prompts."
+  :group 'feedmail-queue
+  :type 'boolean)
+
+
 ;; I provided a default for VMS because someone asked for it (the
 ;; normal default doesn't work there), but, puh-lease!, it is a user
 ;; definable option, so if you don't like the default, change it to
 
 (defcustom feedmail-ask-before-queue t
   "*If non-nil, feedmail will ask what you want to do with the message.
-Choices for the message action prompt will include sending it
+Default choices for the message action prompt will include sending it
 immediately, putting it in the main queue, putting it in the draft
-queue, or returning to the buffer to continue editing.  Only matter is
+queue, or returning to the buffer to continue editing.  Only matters if
 queuing is enabled.  If nil, the message is placed in the main queue
 without a prompt."
   :group 'feedmail-queue
 )
 
 
+(defcustom feedmail-ask-before-queue-prompt "FQM: Message action (q, i, d, e, ?)? [%s]: "
+  "*A string which will be used for the message action prompt.
+If it contains a \"%s\", that will be replaced with the value of
+feedmail-ask-before-queue-default."
+  :group 'feedmail-queue
+  :type 'string
+)
+
+
+(defcustom feedmail-ask-before-queue-reprompt "FQM: Please type q, i, d, or e; or ? for help [%s]: "
+  "*A string which will be used for repompting after invalid input.
+If it contains a \"%s\", that will be replaced with the value of
+feedmail-ask-before-queue-default."
+  :group 'feedmail-queue
+  :type 'string
+)
+
+
 (defcustom feedmail-ask-before-queue-default "queue"
   "*Meaning if user hits return in response to the message action prompt.
 Should be a character or a string; if a string, only the first
 )
 
 
+(defvar feedmail-prompt-before-queue-standard-alist
+  '((?q . feedmail-message-action-queue)
+	(?Q . feedmail-message-action-queue-strong)
+
+	(?d . feedmail-message-action-draft)
+	(?r . feedmail-message-action-draft)
+	(?D . feedmail-message-action-draft-strong)
+	(?R . feedmail-message-action-draft-strong)
+
+	(?e . feedmail-message-action-edit)
+	(?E . feedmail-message-action-edit)
+	(?\C-g . feedmail-message-action-edit)
+	(?n . feedmail-message-action-edit)
+	(?N . feedmail-message-action-edit)
+
+	(?i . feedmail-message-action-send)
+	(?I . feedmail-message-action-send-strong)
+	(?s . feedmail-message-action-send)
+	(?S . feedmail-message-action-send-strong)
+
+	(?* . feedmail-message-action-toggle-spray)
+
+	(?\C-v . feedmail-message-action-help)
+	(?? . feedmail-message-action-help))
+  "An alist of choices for the message action prompt.
+All of the values are function names, except help, which is a special
+symbol that calls up help for the prompt (the help describes the
+actions from the standard alist).  To customize your own choices,
+define a similar alist called feedmail-prompt-before-queue-user-alist.
+The actual alist used for message action will be the standard alist
+overlaid with the user-alist.  To neutralize an item in the standard
+alist without providing a replacement, define an appropriate element
+in the user alist with a value of nil." )
+
+
+(defcustom feedmail-prompt-before-queue-user-alist nil
+  "See feedmail-prompt-before-queue-standard-alist."
+  :group 'feedmail-queue
+  :type 'alist
+  )
+
+
+(defcustom feedmail-prompt-before-queue-help-supplement nil
+  "User-provided supplementary help string for the message action prompt.
+When the message action prompt is shown, the user can as for verbose help,
+at which point a buffer pops up describing the meaning of possible
+responses to the prompt.  Through various customizations (see, for
+example, feedmail-prompt-before-queue-user-alist), the available responses
+and the prompt itself can be changed.  If this variable is set to a string
+value, that string is written to the help buffer after the standard info.
+It may contain embedded line breaks.  It will be printed via princ."
+  :group 'feedmail-queue
+  :type 'string
+  )
+
+
+(defcustom feedmail-queue-reminder-alist
+  '((after-immediate . feedmail-queue-reminder-brief)
+	(after-queue . feedmail-queue-reminder-medium)
+	(after-draft . feedmail-queue-reminder-medium)
+	(after-run . feedmail-queue-reminder-brief)
+	(on-demand . feedmail-run-the-queue-global-prompt))
+  "See feedmail-queue-reminder."
+  :group 'feedmail-queue
+  :type 'alist
+  )
+
+
 (defcustom feedmail-queue-chatty t
   "*If non-nil, blat a few status messages and such in the mini-buffer.
 If nil, just do the work and don't pester people about what's going on.
 )
 
 
-(defcustom feedmail-queue-chatty-sit-for 1
+(defcustom feedmail-queue-chatty-sit-for 2
   "*Duration of pause after most queue-related messages.
 After some messages are divulged, it is prudent to pause before
 something else obliterates them.  This value controls the duration of
 (defcustom feedmail-ask-for-queue-slug nil
   "*If non-nil, prompt user for part of the queue file name.
 The file will automatically get the FQM suffix and an embedded
-sequence number for uniqueness, so don't specify that.  But, you are
-responsible for making sure the resulting filename is legit for the
-operating system you are using.  If this variable is nil or if you
-just hit return in response to the prompt, feedmail queuing will take
-care of things properly.  At the prompt, completion is available if
-you want to see what filenames are already in use.  You probably don't
-want to be bothered with this prompting since feedmail by default uses
-queue file names based on the subjects of the messages."
+sequence number for uniqueness, so don't specify that.  feedmail will
+get rid of all characters other than alphanumeric and hyphen in the
+results.  If this variable is nil or if you just hit return in
+response to the prompt, feedmail queuing will take care of things
+properly.  At the prompt, completion is available if you want to see
+what filenames are already in use, though, as noted, you will not be
+typing a complete file name.  You probably don't want to be bothered
+with this prompting since feedmail, by default, uses queue file names
+based on the subjects of the messages."
   :group 'feedmail-queue
   :type 'boolean
 )
 
 (defcustom feedmail-queue-slug-maker 'feedmail-queue-subject-slug-maker
   "*If non-nil, a function which creates part of the queued file name.
-The returned string should be just the non-directory filename part,
-without FQM suffix or uniquifying sequence numbers.  The current
-buffer holds the raw message.  The default function creates the slug
-based on the message subject."
+Takes a single argument giving the name of the directory into
+which the message will be queued.  The returned string should be just
+the non-directory filename part, without FQM suffix or uniquifying
+sequence numbers.  The current buffer holds the raw message.  The
+default function creates the slug based on the message subject, if
+any."
   :group 'feedmail-queue
   :type '(choice (const nil) function)
 )
 
+
+(defcustom feedmail-queue-default-file-slug t
+  "*Indicates what to use for subject-less messages when forming a file name.
+When feedmail queues a message, it creates a unique file name.  By default, 
+the file name is based in part on the subject of the message being queued.
+If there is no subject, consult this variable.  See documentation for the
+function feedmail-queue-subject-slug-maker.
+
+If t, an innocuous default is used.
+
+If a string, it is used directly.
+
+If a function, it is called with no arguments from the buffer containing the raw
+text of the message.  It must return a string (which may be empty).
+
+If the symbol 'ask, you will be prompted for a string in the mini-buffer.
+Filename completion is available so that you can inspect what's already been
+used, but feedmail will do further manipulation on the string you return, so
+it's not expected to be a complete filename."
+  :group 'feedmail-queue
+  :type 'string
+)
+
+
 (defcustom feedmail-queue-fqm-suffix ".fqm"
   "*The FQM suffix used to distinguish feedmail queued message files.
 You probably want this to be a period followed by some letters and/or
 )
 
 
+(defcustom feedmail-queue-auto-file-nuke nil
+  "*If non-nil, automatically delete queue files when a message is sent.
+Normally, feedmail will notice such files when you send a message in
+immediate mode (i.e., not when you're running the queue) and will ask if
+you want to delete them.  Since the answer is usually yes, setting this
+variable to non-nil will tell feedmail to skip the prompt and just delete 
+the file without bothering you."
+  :group 'feedmail-queue
+  :type 'boolean
+)
+
+
 ;; defvars to make byte-compiler happy(er)
 (defvar feedmail-error-buffer        nil "not a user option variable")
 (defvar feedmail-prepped-text-buffer nil "not a user option variable")
 (defvar feedmail-raw-text-buffer     nil "not a user option variable")
 (defvar feedmail-address-list        nil "not a user option variable")
 
+
+(defun feedmail-mail-send-hook-splitter ()
+  "Facilitate dividing mail-send-hook things into queued and immediate cases.
+If you have mail-send-hook functions that should only be called for sending/
+queueing messages or only be called for the sending of queued messages, this is
+for you.  Add this function to mail-send-hook with something like this:
+
+	(add-hook 'mail-send-hook 'feedmail-mail-send-hook-splitter)
+
+Then add the functions you want called to either feedmail-mail-send-hook-queued
+or feedmail-mail-send-hook, as apprpriate.  The distinction is that
+feedmail-mail-send-hook will be called when you send mail from a composition
+buffer (typically by typing C-c C-c), whether the message is sent immediately
+or placed in the queue or drafts directory.  feedmail-mail-send-hook-queued is
+called when messages are being sent from the queue directory, typically via a
+call to feedmail-run-the-queue."
+  (if feedmail-queue-runner-is-active
+	  (run-hooks 'feedmail-mail-send-hook-queued)
+	(run-hooks 'feedmail-mail-send-hook))
+)
+
+
+(defvar feedmail-mail-send-hook nil
+  "*See documentation for feedmail-mail-send-hook-splitter.")
+
+
+(defvar feedmail-mail-send-hook-queued nil
+  "*See documentation for feedmail-mail-send-hook-splitter.")
+
+
 (defun feedmail-confirm-addresses-hook-example ()
   "An example of a feedmail-last-chance-hook.
 It shows the simple addresses and gets a confirmation.  Use as:
  (setq feedmail-last-chance-hook 'feedmail-confirm-addresses-hook-example)."
-  (save-window-excursion 
+  (save-window-excursion
 	(display-buffer (set-buffer (get-buffer-create " F-C-A-H-E")))
 	(erase-buffer)
 	(insert (mapconcat 'identity feedmail-address-list " "))
 	(if (not (y-or-n-p "How do you like them apples? "))
-		(error "Sending...gave up in last chance hook")
+		(error "FQM: Sending...gave up in last chance hook")
 	  )))
 
 
 (defcustom feedmail-last-chance-hook nil
-  "*User's last opportunity to modify the message on its way out.  
+  "*User's last opportunity to modify the message on its way out.
 It has already had all the header prepping from the standard package.
 The next step after running the hook will be to push the buffer into a
 subprocess that mails the mail.  The hook might be interested in
   :type 'hook
 )
 
+
+(defcustom feedmail-before-fcc-hook nil
+  "*User's last opportunity to modify the message before FCC action.
+It has already had all the header prepping from the standard package.
+The next step after running the hook will be to save the message via
+FCC: processing. The hook might be interested in these: (1)
+feedmail-prepped-text-buffer contains the header and body of the
+message, ready to go; (2) feedmail-address-list contains a list of
+simplified recipients of addressees to whom the message was sent (3)
+feedmail-error-buffer is an empty buffer intended to soak up errors
+for display to the user.  If the hook allows interactive activity, the
+user should not send more mail while in the hook since some of the
+internal buffers will be reused and things will get confused."
+  :group 'feedmail-misc
+  :type 'hook
+)
+
 (defcustom feedmail-queue-runner-mode-setter
   '(lambda (&optional arg) (mail-mode))
   "*A function to set the proper mode of a message file.  Called when
 )
 
 
+(defcustom feedmail-queue-alternative-mail-header-separator nil
+  "*Alternative header demarcation for queued messages.
+If you sometimes get alternative values for mail-header-separator in
+queued messages, set the value of this variable to whatever it is.
+For example, rmail-resend uses a mail-header-separator value of empty
+string (\"\") when you send/queue a message.
+
+When trying to send a queued message, if the value of this variable is
+non-nil, feedmail will first try to send the message using the value
+of mail-header-separator.  If it can't find that, it will temporarily
+set mail-header-separator to the value of
+feedmail-queue-alternative-mail-header-separator and try again."
+  :group 'feedmail-queue
+  :type 'string
+)
+
+
 (defcustom feedmail-queue-runner-message-sender 'mail-send-and-exit
   "*Function to initiate sending a message file.
 Called for each message read back out of the queue directory with a
 (defcustom feedmail-queue-runner-cleaner-upper
   '(lambda (fqm-file &optional arg)
 	 (delete-file fqm-file)
-	 (if (and arg feedmail-queue-chatty) (message "Nuked %s" fqm-file)))
+	 (if (and arg feedmail-queue-chatty) (message "FQM: Nuked %s" fqm-file)))
   "*Function that will be called after a message has been sent.  It's
 not called in the case of errors.  This function is called with two
 arguments, the name of the message queue file for the message just
 that case, the value is the name of the queued message file currently
 being processed.  This can be used for differentiating customized code
 for different scenarios.  Users shouldn't set or change this
-variable.")
+variable, but may depend on its value as described here.")
+
+
+(defvar feedmail-is-a-resend nil
+  "*Non-nil means the the message is a RESEND (in the RFC-822 sense).
+This affects the composition of certain headers.  feedmail sets this
+variable as soon as it starts prepping the message text buffer, so any
+user-supplied functions can rely on it.  Users shouldn't set or change this
+variable, but may depend on its value as described here.")
 
 
 (defcustom feedmail-buffer-eating-function 'feedmail-buffer-to-binmail
-  "*Function used to send the prepped buffer to a subprocess. 
+  "*Function used to send the prepped buffer to a subprocess.
 The function's three (mandatory) arguments are: (1) the buffer
 containing the prepped message; (2) a buffer where errors should be
 directed; and (3) a list containing the addresses individually as
 		 (append (list (point-min) (point-max)
 					   (if (boundp 'sendmail-program) sendmail-program "/usr/lib/sendmail")
 					   nil errors-to nil "-oi" "-t")
-				 ;; Don't say "from root" if running under su.
-				 (and (equal (user-real-login-name) "root") (list "-f" (user-login-name)))
+				 ;; provide envelope "from" to sendmail; results will vary
+				 (list "-f" user-mail-address)
 				 ;; These mean "report errors by mail" and "deliver in background".
 				 (if (null mail-interactive) '("-oem" "-odb")))))
 
 ;; simplified by WJC after more feedmail development;
 ;; idea (but not implementation) of copying smtpmail trace buffer to
 ;; feedmail error buffer from:
-;;   Mon 14-Oct-1996; Douglas Gray Stephens 
+;;   Mon 14-Oct-1996; Douglas Gray Stephens
 ;;   modified to insert error for displaying
 (defun feedmail-buffer-to-smtpmail (prepped errors-to addr-listoid)
   "Function which actually calls smtpmail-via-smtp to send buffer as e-mail."
 		   (buffer-list))))))
 
 
+;; just a place to park a docstring
+(defconst feedmail-fiddle-plex-blurb nil
+  "A fiddle-plex is a concise way of specifying how to fiddle with a header field.
+It is a list of up to 4 elements: NAME, VALUE, ACTION, FOLDING.  The element
+VALUE can also be a list sometimes.
+
+NAME is the name of the header field to be fiddled with.  Although case doesn't
+matter in looking for headers, case of NAME is preserved when a header is inserted
+via fiddling.  It shouldn't include the trailing colon.
+
+VALUE is either nil, a simple string, a function returning nil or a string, or,
+as described below for ACTION 'combine, a list of up to three values.
+
+ACTION describes the nature of the fiddling to be done.  Possibilities
+for ACTION (default is 'supplement):
+
+  'supplement   Leave other like fields as-is, insert this one.
+
+  'replace      Delete other like fields, if any, and insert this one.
+
+  'create       Insert this one only if no like field exists.
+
+  'combine      Combine aggregate values of like fields with this one.
+                In this case, VALUE has a special form.  It is a list
+                of three items: VAL-PRE, VAL-LIKE, and VAL-POST.
+                VAL-PRE and VAL-POST are strings or nil.  VAL-LIKE may
+                be either a string or a function (it may also be nil,
+                but there's not much point to that).
+
+                Values of like header fields are aggregated, leading and
+                trailing whitespace is removed, and embedded
+                whitespace is left as-is.  If there are no like
+                fields, or the aggregate value is an empty string,
+                VAL-LIKE is not used.  Else, if VAL-LIKE is a function,
+                it is called with two arguments: NAME and the
+                aggregate like values.  Else, if VAL-LIKE is a string, it is 
+                used as a format string where a single \%s will be
+                replaced by the aggregate values of like fields.
+
+                VAL-PRE, the results of using VAL-LIKE, and VAL-POST
+                are concatenated, and the result, if not nil and not
+                an empty string, is used as the new value for the
+                field.  Although this description sounds a bit
+                complicated, the idea is to provide a mechanism for
+                combining the old value with a new value in a flexible
+                way.  For example, if you wanted to add a new value to
+                an existing header field by adding a semi-colon and
+                then starting the new value on a continuation line,
+                you might specify this:
+
+                 (nil \"%s;\\n\\t\" \"This is my new value\")
+
+FOLDING can be nil, in which case VALUE is used as-is.  If FOLDING is
+non-nil, feedmail \"smart filling\" is done on VALUE just before
+insertion.
+")
+
+
 (defun feedmail-send-it ()
   "A function which is a suitable value for send-mail-function.
 To use it, you probably want something like this in your .emacs or
   (if (not feedmail-enable-queue) (feedmail-send-it-immediately)
 	;; else, queuing is enabled, should we ask about it or just do it?
 	(if feedmail-ask-before-queue
-		(let ((desire (feedmail-queue-send-edit-prompt)))
-		  (cond
-		   ((eq desire 'send)
-			;; hooks can make this take a while so clear the prompt
-			(message "Immediate send...") 
-			(feedmail-send-it-immediately))
-		   ((eq desire 'edit)
-			(error "Message not queued; returning to edit"))
-		   ((eq desire 'draft)
-			(feedmail-dump-message-to-queue feedmail-queue-draft-directory))
-		   ((eq desire 'queue)
-			(feedmail-dump-message-to-queue feedmail-queue-directory))
-		   (t
-			(error "feedmail-send-it lost its marbles"))))
-	  (feedmail-dump-message-to-queue feedmail-queue-directory))))
+		(funcall (feedmail-queue-send-edit-prompt))
+	  (feedmail-dump-message-to-queue feedmail-queue-directory 'after-queue))))
+
+
+(defun feedmail-message-action-send ()
+  ;; hooks can make this take a while so clear the prompt
+  (message "FQM: Immediate send...")
+  (feedmail-send-it-immediately))
+
+
+;; From a VM mailing list discussion and some suggestions from Samuel Mikes <smikes@alumni.hmc.edu>
+(defun feedmail-queue-express-to-queue ()
+  "*Send message directly to the queue, with a minimum of fuss and bother."
+  (interactive)
+  (let ((feedmail-enable-queue t)
+		(feedmail-ask-before-queue nil)
+		(feedmail-queue-reminder-alist nil)
+		(feedmail-queue-chatty-sit-for 0))
+	(feedmail-send-it)
+	)
+)
+
+
+(defun feedmail-queue-express-to-draft ()
+  "*Send message directly to the draft queue, with a minimum of fuss and bother."
+  (interactive)
+  (let ((feedmail-queue-directory feedmail-queue-draft-directory))
+	(feedmail-queue-express-to-queue)
+	)
+)
+
+
+(defun feedmail-message-action-send-strong ()
+  (let ((feedmail-confirm-outgoing nil)) (feedmail-message-action-send)))
+
+
+(defun feedmail-message-action-edit ()
+  (error "FQM: Message not queued; returning to edit"))
+
+
+(defun feedmail-message-action-draft ()
+  (feedmail-dump-message-to-queue feedmail-queue-draft-directory 'after-draft))
+
+
+(defun feedmail-message-action-draft-strong ()
+  (let ((buffer-file-name nil))
+	(feedmail-message-action-draft)))
+
+
+(defun feedmail-message-action-queue ()
+  (feedmail-dump-message-to-queue feedmail-queue-directory 'after-queue))
+
+
+(defun feedmail-message-action-queue-strong ()
+  (let ((buffer-file-name nil))
+	(feedmail-message-action-queue)))
+
+
+(defun feedmail-message-action-toggle-spray ()
+  (let ((feedmail-enable-spray (not feedmail-enable-spray)))
+	(if feedmail-enable-spray
+		(message "FQM: For this message, spray toggled ON")
+	  (message "FQM: For this message, spray toggled OFF"))
+	(sit-for 3)
+	;; recursion, but harmless
+	(feedmail-send-it)))
+
+
+(defun feedmail-message-action-help ()
+	(let ((d-string " "))
+	  (if (stringp feedmail-ask-before-queue-default)
+		  (setq d-string feedmail-ask-before-queue-default)
+		(setq d-string  (char-to-string feedmail-ask-before-queue-default)))
+	  (feedmail-queue-send-edit-prompt-help d-string)
+	  ;; recursive, but no worries (it goes deeper on user action)
+	  (feedmail-send-it)))
 
 
 ;;;###autoload
   (let ((feedmail-confirm-outgoing nil)) (feedmail-run-the-queue arg)))
 
 ;;;###autoload
+(defun feedmail-run-the-queue-global-prompt (&optional arg)
+  "Like feedmail-run-the-queue, but with a global confirmation prompt.
+This is generally most useful if run non-interactively, since you can 
+bail out with an appropriate answer to the global confirmation prompt."
+  (interactive "p")
+  (let ((feedmail-queue-runner-confirm-global t)) (feedmail-run-the-queue arg)))
+
+;;;###autoload
 (defun feedmail-run-the-queue (&optional arg)
   "Visit each message in the feedmail queue directory and send it out.
-Return value is a list of three things: number of messages sent, number of 
+Return value is a list of three things: number of messages sent, number of
 messages skipped, and number of non-message things in the queue (commonly
 backup file names and the like)."
   (interactive "p")
 	  (setq feedmail-queue-draft-directory (expand-file-name feedmail-queue-draft-directory)))
   (let* ((maybe-file)
 		 (qlist (feedmail-look-at-queue-directory feedmail-queue-directory))
-		 (message-count (nth 0 qlist))
-		 (other-count (nth 1 qlist))
+		 (dlist (feedmail-look-at-queue-directory feedmail-queue-draft-directory))
+		 (q-cnt (nth 0 qlist))
+		 (q-oth (nth 1 qlist))
+		 (d-cnt (nth 0 dlist))
+		 (d-oth (nth 1 dlist))
 		 (messages-sent 0)
 		 (messages-skipped 0)
 		 (blobby-buffer)
 		 (already-buffer)
+		 (this-mhsep)
+		 (do-the-run t)
 		 (list-of-possible-fqms))
-	(save-window-excursion
-	  (setq list-of-possible-fqms (directory-files feedmail-queue-directory))
-	  (if feedmail-queue-run-orderer
-		  (setq list-of-possible-fqms (funcall feedmail-queue-run-orderer list-of-possible-fqms)))
-	  (mapcar
-	   '(lambda (blobby)
-		  (setq maybe-file (expand-file-name blobby feedmail-queue-directory))
-		  (cond
-		   ((file-directory-p maybe-file) nil) ; don't care about subdirs	
-		   ((feedmail-fqm-p blobby)
-			(setq blobby-buffer (generate-new-buffer (concat "FQM " blobby)))
-			(setq already-buffer
-				  (if (fboundp 'find-buffer-visiting) ; missing from XEmacs
-					  (find-buffer-visiting maybe-file)
-					(get-file-buffer maybe-file)))
-			(if (and already-buffer (buffer-modified-p already-buffer))
-				(save-window-excursion
-				  (display-buffer (set-buffer already-buffer))
-				  (if (fboundp 'y-or-n-p-with-timeout)
-					  ;; make a guess that the user just forgot to save
-					  (if (y-or-n-p-with-timeout (format "Visiting %s; save before send? " blobby) 10 t)
-						  (save-buffer))
-					(if (y-or-n-p (format "Visiting %s; save before send? " blobby))
-						(save-buffer))
-					)))
-				
-			(set-buffer blobby-buffer)
-			(setq buffer-offer-save nil)
-			(buffer-disable-undo)
-			(insert-file-contents-literally maybe-file)
-			(funcall feedmail-queue-runner-mode-setter arg)
-			(condition-case nil			; don't give up the loop if user skips some
-				(let ((feedmail-enable-queue nil)
-					  (feedmail-queue-runner-is-active maybe-file))
-				  (funcall feedmail-queue-runner-message-sender arg)
-				  (set-buffer blobby-buffer)
-				  (if (buffer-modified-p) ; still modified, means wasn't sent
-					  (setq messages-skipped (1+ messages-skipped))
-					(setq messages-sent (1+ messages-sent))
-					(funcall feedmail-queue-runner-cleaner-upper maybe-file arg)))
-			  (error (setq messages-skipped (1+ messages-skipped))))
-			(kill-buffer blobby-buffer)
-			(if feedmail-queue-chatty
-				(progn
-				  (message "Messages: %d to go, %d sent, %d skipped (%d other files ignored)"
-						   (- message-count messages-sent messages-skipped)
-						   messages-sent messages-skipped other-count)
-				  (sit-for feedmail-queue-chatty-sit-for))))))
-	   list-of-possible-fqms))
+	(if (and (> q-cnt 0) feedmail-queue-runner-confirm-global)
+		(setq do-the-run
+			  (if (fboundp 'y-or-n-p-with-timeout)
+				  (y-or-n-p-with-timeout (format "FQM: Draft: %dm+%d,  Queue: %dm+%d; run the queue? "
+												 d-cnt d-oth q-cnt q-oth)
+										 5 nil)
+				(y-or-n-p (format "FQM: Draft: %dm+%d,  Queue: %dm+%d; run the queue? "
+								  d-cnt d-oth q-cnt q-oth))
+				)))
+	(if (not do-the-run)
+		(setq messages-skipped q-cnt)
+	  (save-window-excursion
+		(setq list-of-possible-fqms (directory-files feedmail-queue-directory t))
+		(if feedmail-queue-run-orderer
+			(setq list-of-possible-fqms (funcall feedmail-queue-run-orderer list-of-possible-fqms)))
+		(mapcar
+		 '(lambda (blobby)
+			(setq maybe-file (expand-file-name blobby feedmail-queue-directory))
+			(cond
+			 ((file-directory-p maybe-file) nil) ; don't care about subdirs	
+			 ((feedmail-fqm-p blobby)
+			  (setq blobby-buffer (generate-new-buffer (concat "FQM " blobby)))
+			   (setq already-buffer
+					 (if (fboundp 'find-buffer-visiting) ; missing from XEmacs
+						 (find-buffer-visiting maybe-file)
+					   (get-file-buffer maybe-file)))
+			   (if (and already-buffer (buffer-modified-p already-buffer))
+				   (save-window-excursion
+					 (display-buffer (set-buffer already-buffer))
+					 (if (fboundp 'y-or-n-p-with-timeout)
+						 ;; make a guess that the user just forgot to save
+						 (if (y-or-n-p-with-timeout (format "FQM: Visiting %s; save before send? " blobby) 10 t)
+							 (save-buffer))
+					   (if (y-or-n-p (format "FQM: Visiting %s; save before send? " blobby))
+						   (save-buffer))
+					   )))
+			
+			   (set-buffer blobby-buffer)
+			   (setq buffer-offer-save nil)
+			   (buffer-disable-undo blobby-buffer)
+			   (insert-file-contents-literally maybe-file)
+			   ;; work around text-vs-binary wierdness and also around rmail-resend's creative
+			   ;; manipulation of mail-header-separator
+			   ;;
+			   ;; if we don't find the normal M-H-S, and the alternative is defined but also
+			   ;; not found, try reading the file a different way
+			   ;;
+			   ;; if M-H-S not found and (a-M-H-S is nil or not found)
+			   (if (and (not (feedmail-find-eoh t))
+						(or (not feedmail-queue-alternative-mail-header-separator)
+							(not 
+							 (let ((mail-header-separator feedmail-queue-alternative-mail-header-separator))
+							   (feedmail-find-eoh t)))))
+				   (let ((file-name-buffer-file-type-alist nil) (default-buffer-file-type nil))
+					 (erase-buffer) (insert-file-contents maybe-file))
+				 )
+			   ;; if M-H-S not found and (a-M-H-S is non-nil and is found)
+			   ;; temporarily set M-H-S to the value of a-M-H-S
+			   (if (and (not (feedmail-find-eoh t))
+						feedmail-queue-alternative-mail-header-separator
+						(let ((mail-header-separator feedmail-queue-alternative-mail-header-separator))
+						  (feedmail-find-eoh t)))
+				   (setq this-mhsep feedmail-queue-alternative-mail-header-separator)
+				 (setq this-mhsep mail-header-separator))
+			   (funcall feedmail-queue-runner-mode-setter arg)
+			   (condition-case nil			; don't give up the loop if user skips some
+				   (let ((feedmail-enable-queue nil)
+						 (mail-header-separator this-mhsep)
+						 (feedmail-queue-runner-is-active maybe-file))
+					 (funcall feedmail-queue-runner-message-sender arg)
+					 (set-buffer blobby-buffer)
+					 (if (buffer-modified-p) ; still modified, means wasn't sent
+						 (setq messages-skipped (1+ messages-skipped))
+					   (setq messages-sent (1+ messages-sent))
+					   (funcall feedmail-queue-runner-cleaner-upper maybe-file arg)
+					   (if (and already-buffer (not (file-exists-p maybe-file)))
+						   ;; we have gotten rid of the file associated with the
+						   ;; buffer, so update the buffer's notion of that
+						   (save-excursion
+							 (set-buffer already-buffer)
+							 (setq buffer-file-name nil)))))
+				 (error (setq messages-skipped (1+ messages-skipped))))
+			   (kill-buffer blobby-buffer)
+			   (if feedmail-queue-chatty
+				   (progn
+					 (message "FQM: %d to go, %d sent, %d skipped (%d other files ignored)"
+							  (- q-cnt messages-sent messages-skipped)
+							  messages-sent messages-skipped q-oth)
+					 (sit-for feedmail-queue-chatty-sit-for))))))
+		  list-of-possible-fqms)))
 	(if feedmail-queue-chatty
-		(message "Messages: %d sent, %d skipped (%d other files ignored)"
-				 messages-sent messages-skipped other-count))
-	(list messages-sent messages-skipped other-count)))
+		(progn 
+		  (message "FQM: %d sent, %d skipped (%d other files ignored)"
+				   messages-sent messages-skipped q-oth)
+		  (sit-for feedmail-queue-chatty-sit-for)
+		  (feedmail-queue-reminder 'after-run)
+		  (sit-for feedmail-queue-chatty-sit-for)))
+	(list messages-sent messages-skipped q-oth)))
+
+
+;;;###autoload
+(defun feedmail-queue-reminder (&optional what-event)
+  "Perform some kind of reminder activity about queued and draft messages.
+Called with an optional symbol argument which says what kind of event
+is triggering the reminder activity.  The default is 'on-demand, which
+is what you typically would use if you were putting this in your emacs start-up
+or mail hook code.  Other recognized values for WHAT-EVENT (these are passed
+internally by feedmail):
+
+   after-immediate      (a message has just been sent in immediate mode)
+   after-queue          (a message has just been queued)
+   after-draft          (a message has just been placed in the draft directory)
+   after-run            (the queue has just been run, possibly sending messages)
+
+WHAT-EVENT is used as a key into the table feedmail-queue-reminder-alist.  If
+the associated value is a function, it is called without arguments and is expected
+to perform the reminder activity.  You can supply your own reminder functions 
+by redefining feedmail-queue-reminder-alist.  If you don't want any reminders, 
+you can set feedmail-queue-reminder-alist to nil."
+  (interactive "p")
+  (let ((key (if (and what-event (symbolp what-event)) what-event 'on-demand)) entry reminder)
+	(setq entry (assoc key feedmail-queue-reminder-alist))
+	(setq reminder (cdr entry))
+	(if (fboundp reminder) (funcall reminder)))
+  )
+
+
+(defun feedmail-queue-reminder-brief ()
+  "Brief display of draft and queued message counts in modeline."
+  (interactive)
+  (let (q-cnt d-cnt q-lis d-lis)
+	(setq q-lis (feedmail-look-at-queue-directory feedmail-queue-directory))
+	(setq d-lis (feedmail-look-at-queue-directory feedmail-queue-draft-directory))
+	(setq q-cnt (car q-lis))
+	(setq d-cnt (car d-lis))
+	(if (or (> q-cnt 0) (> d-cnt 0))
+		(progn
+		  (message "FQM: [D: %d,  Q: %d]" d-cnt q-cnt))))
+  )
+
+
+(defun feedmail-queue-reminder-medium ()
+  "Verbose display of draft and queued message counts in modeline."
+  (interactive)
+  (let (q-cnt d-cnt q-oth d-oth q-lis d-lis)
+	(setq q-lis (feedmail-look-at-queue-directory feedmail-queue-directory))
+	(setq d-lis (feedmail-look-at-queue-directory feedmail-queue-draft-directory))
+	(setq q-cnt (car q-lis))
+	(setq d-cnt (car d-lis))
+	(setq q-oth (nth 1 q-lis))
+	(setq d-oth (nth 1 d-lis))
+	(if (or (> q-cnt 0) (> d-cnt 0))
+		(progn
+		  (message "FQM: Draft: %dm+%d in \"%s\",  Queue: %dm+%d in \"%s\""
+				   d-cnt d-oth (file-name-nondirectory feedmail-queue-draft-directory)
+				   q-cnt q-oth (file-name-nondirectory feedmail-queue-directory)))))
+  )
 
 
 (defun feedmail-queue-send-edit-prompt ()
   ;; Some implementation ideas here came from the userlock.el code
   (discard-input)
   (save-window-excursion
-	(let ((answer) (d-char) (d-string))
+	(let ((answer) (d-char) (d-string " "))
 	  (if (stringp feedmail-ask-before-queue-default)
 		  (progn
 			(setq d-char   (string-to-char feedmail-ask-before-queue-default))
 		(setq d-char    feedmail-ask-before-queue-default)
 		)
       (while (null answer)
-		(message "Message action (q, i, d, e, ?)? [%s]: " d-string)
+		(message feedmail-ask-before-queue-prompt d-string)
 		(let ((user-sez
 			   (let ((inhibit-quit t) (cursor-in-echo-area t) (echo-keystrokes 0))
-				 (downcase (read-char-exclusive)))))
+				 (read-char-exclusive))))
 		  (if (= user-sez help-char)
-			  (feedmail-queue-send-edit-prompt-help d-string)
+			  (setq answer '(^ . feedmail-message-action-help))
 			(if (or (eq user-sez ?\C-m) (eq user-sez ?\C-j) (eq user-sez ?y))
 				(setq user-sez d-char))
-			(setq answer (assoc user-sez
-								'((?q . queue)
-								  (?d . draft) (?r . draft)
-								  (?e . edit)  (?\C-g . edit)  (?n . edit)
-								  (?i . send)  (?s . send)
-								  (?? . help))))
-			(cond
-			 ((null answer) (beep)
-			  (message "Please type q, i, d, or e; or ? for help [%s]:" d-string)
-			  (sit-for 3))
-			 ((eq (cdr answer) 'help)
-			  (feedmail-queue-send-edit-prompt-help d-string) (setq answer nil))
-			 ))))
+			;; these char-to-int things because of some incomprensible difference
+			;; between the two in byte-compiled stuff between GNUemacs and XEmacs
+			;; (well, I'm sure someone could comprehend it, but I say 'uncle')
+			(setq answer (or (assoc user-sez feedmail-prompt-before-queue-user-alist)
+							 (and (fboundp 'char-to-int)
+								  (assoc (char-to-int user-sez) feedmail-prompt-before-queue-user-alist))
+							 (assoc user-sez feedmail-prompt-before-queue-standard-alist)
+							 (and (fboundp 'char-to-int)
+								  (assoc (char-to-int user-sez) feedmail-prompt-before-queue-standard-alist))))
+			(if (or (null answer) (null (cdr answer)))
+				(progn
+				  (beep)
+				  (message feedmail-ask-before-queue-reprompt d-string)
+				  (sit-for 3)))
+			 )))
 	  (cdr answer)
 	  )))
 
+(defconst feedmail-p-h-b-n "*FQM Help*")
+
 (defun feedmail-queue-send-edit-prompt-help (d-string)
-  (with-output-to-temp-buffer "*Help*"
+  (let ((fqm-help (get-buffer feedmail-p-h-b-n)))
+	(if (and fqm-help (get-buffer-window fqm-help))
+		(feedmail-queue-send-edit-prompt-help-later fqm-help d-string)
+	  (feedmail-queue-send-edit-prompt-help-first d-string))))
+
+(defun feedmail-queue-send-edit-prompt-help-later (fqm-help d-string)
+  ;; scrolling fun
+  (save-selected-window
+	(let ((signal-error-on-buffer-boundary nil)
+		  (fqm-window (display-buffer fqm-help)))
+	  (select-window fqm-window)
+	  (if (pos-visible-in-window-p (point-max) fqm-window)
+		  (feedmail-queue-send-edit-prompt-help-first d-string)
+;;		  (goto-char (point-min))
+		(scroll-up nil)
+		))))
+
+(defun feedmail-queue-send-edit-prompt-help-first (d-string)
+  (with-output-to-temp-buffer feedmail-p-h-b-n
     (princ "You're dispatching a message and feedmail queuing is enabled.
+Typing ? or C-v will normally scroll this help buffer.
+
 Choices:
    q  QUEUE        for later sending (via feedmail-run-the-queue)
+   Q  QUEUE!       like \"q\", but always make a new file
    i  IMMEDIATELY  send this (but not the other queued messages)
+   I  IMMEDIATELY! like \"i\", but skip following confirmation prompt
    d  DRAFT        queue in the draft directory
+   D  DRAFT!       like \"d\", but always make a new file
    e  EDIT         return to the message edit buffer (don't send or queue)
+   *  SPRAY        toggle spray mode (individual message transmissions)
+
 Synonyms:
    s  SEND         immediately (same as \"i\")
+   S  SEND!        immediately (same as \"I\")
    r  ROUGH        draft (same as \"d\")
+   R  ROUGH!       draft (same as \"R\")
    n  NOPE         didn't mean it (same as \"e\")
    y  YUP          do the default behavior (same as \"C-m\")
-The default (if you just hit return) is user-configurable and is 
-currently \"")
+
+The user-configurable default is currently \"")
 	(princ d-string)
-	(princ "\".")
+	(princ "\".  For other possibilities,
+see the variable feedmail-prompt-before-queue-user-alist.
+")
+	(and (stringp feedmail-prompt-before-queue-help-supplement)
+		 (princ feedmail-prompt-before-queue-help-supplement))
     (save-excursion (set-buffer standard-output) (if (fboundp 'help-mode) (help-mode)))))
 
 (defun feedmail-look-at-queue-directory (queue-directory)
 directory, a count of other files in the directory, and a high water
 mark for prefix sequence numbers.  Subdirectories are not included in
 the counts."
-  (let ((message-count 0) (other-count 0) (high-water 0))
+  (let ((q-cnt 0) (q-oth 0) (high-water 0) (blobbet))
 	;; iterate, counting things we find along the way in the directory
 	(if (file-directory-p queue-directory)
 		(mapcar
 			(cond
 			 ((file-directory-p blobby) nil) ; don't care about subdirs
 			 ((feedmail-fqm-p blobby)
-			  (if (string-match "^[0-9][0-9][0-9]-" blobby)
+			  (setq blobbet (file-name-nondirectory blobby))
+			  (if (string-match "^[0-9][0-9][0-9]-" blobbet)
 				  (let ((water-mark))
-					(setq water-mark (string-to-int (substring blobby 0 3)))
+					(setq water-mark (string-to-int (substring blobbet 0 3)))
 					(if (> water-mark high-water) (setq high-water water-mark))))
-			  (setq message-count (1+ message-count)))
-			 (t (setq other-count (1+ other-count)))
+			  (setq q-cnt (1+ q-cnt)))
+			 (t (setq q-oth (1+ q-oth)))
 			 ))
-		 (directory-files queue-directory)))
-	(list message-count other-count high-water)))
+		 (directory-files queue-directory t)))
+	(list q-cnt q-oth high-water)))
 
-(defun feedmail-queue-subject-slug-maker ()
+(defun feedmail-tidy-up-slug (slug)
+  "Utility for mapping out suspect characters in a potential filename"
+  ;; even programmers deserve a break sometimes, so cover nil for them
+  (if (null slug) (setq slug ""))
+  ;; replace all non-alphanumerics with hyphen for safety
+  (while (string-match "[^a-z0-9-]+" slug) (setq slug (replace-match "-" nil nil slug)))
+  ;; collapse multiple hyphens to one
+  (while (string-match "--+" slug) (setq slug (replace-match "-" nil nil slug)))
+  ;; for tidyness, peel off leading hyphens
+  (if (string-match "^-*" slug) (setq slug (replace-match "" nil nil slug)))
+  ;; for tidyness, peel off trailing hyphens
+  (if (string-match "-*$" slug) (setq slug (replace-match "" nil nil slug)))
+  slug
+)  
+
+(defun feedmail-queue-subject-slug-maker (&optional queue-directory)
   "Create a name for storing the message in the queue.
-The name is based on the SUBJECT: header (if there is one).  Special
-characters are mapped to mostly alphanumerics for safety."
+Optional argument QUEUE-DIRECTORY specifies into which directory the
+file will be placed.  The name is based on the SUBJECT: header (if
+there is one).  If there is no subject,
+feedmail-queue-default-file-slug is consulted Special characters are
+mapped to mostly alphanumerics for safety."
   (let ((eoh-marker) (case-fold-search t) (subject "") (s-point))
+	(setq eoh-marker (feedmail-find-eoh))
 	(goto-char (point-min))
-	(re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n"))
-	(setq eoh-marker (point-marker))
-	(goto-char (point-min))
-	;; get raw subject value
+	;; get raw subject value (first line, anyhow)
 	(if (re-search-forward "^SUBJECT:" eoh-marker t)
 		(progn (setq s-point (point))
 			   (end-of-line)
 			   (setq subject (buffer-substring s-point (point)))))
-	;; replace all non-alphanumerics with hyphen for safety
-	(while (string-match "[^a-z0-9-]+" subject) (setq subject (replace-match "-" nil nil subject)))
-	;; collapse multiple hyphens to one
-	(while (string-match "--+" subject) (setq subject (replace-match "-" nil nil subject)))
-	;; for tidyness, peel off leading hyphens
-	(if (string-match "^-*" subject) (setq subject (replace-match "" nil nil subject)))
-	;; for tidyness, peel off trailing hyphens
-	(if (string-match "-*$" subject) (setq subject (replace-match "" nil nil subject)))
-	(if (zerop (length subject)) (setq subject "no-subject"))
-	subject
+	(setq subject (feedmail-tidy-up-slug subject))
+	(if (zerop (length subject))
+		(setq subject
+			  (cond
+			   ((stringp feedmail-queue-default-file-slug) feedmail-queue-default-file-slug)
+			   ((fboundp feedmail-queue-default-file-slug)
+				(save-excursion (funcall feedmail-queue-default-file-slug)))
+			   ((eq feedmail-queue-default-file-slug 'ask)
+				(file-name-nondirectory
+				 (read-file-name "FQM: Message filename slug? "
+								 (file-name-as-directory queue-directory) subject nil subject)))
+			   (t "no subject"))
+			  ))
+	(feedmail-tidy-up-slug subject) ;; one more time, with feeling
 	))
 
 
 (defun feedmail-create-queue-filename (queue-directory)
   (let ((slug "wjc"))
-	(if feedmail-queue-slug-maker (save-excursion (setq slug (funcall feedmail-queue-slug-maker))))
-	(if feedmail-ask-for-queue-slug
-		(setq slug (read-file-name (concat "Message filename slug [" slug "]? ") queue-directory slug nil)))
+	(cond
+	 (feedmail-queue-slug-maker
+	  (save-excursion (setq slug (funcall feedmail-queue-slug-maker queue-directory))))
+	 (feedmail-ask-for-queue-slug
+	  (setq slug (file-name-nondirectory
+				  (read-file-name (concat "FQM: Message filename slug? [" slug "]? ")
+								 (file-name-as-directory queue-directory) slug nil slug))))
+	  )
+	(setq slug (feedmail-tidy-up-slug slug))
 	(setq slug (format "%03d-%s" (1+ (nth 2 (feedmail-look-at-queue-directory queue-directory))) slug))
 	(concat
 	 (expand-file-name slug queue-directory)
 	))
 
 
-(defun feedmail-dump-message-to-queue (queue-directory)
+(defun feedmail-dump-message-to-queue (queue-directory what-event)
   (or (file-accessible-directory-p queue-directory)
 	  ;; progn to get nil result no matter what
 	  (progn (make-directory queue-directory t) nil)
 	  (file-accessible-directory-p queue-directory)
-	  (error (concat "Message not queued; trouble with directory " queue-directory)))
+	  (error (concat "FQM: Message not queued; trouble with directory " queue-directory)))
   (let ((filename)
 		(is-fqm)
 		(is-in-this-dir)
-		(previous-buffer-file-name buffer-file-name)
-		(directory-stats))
+		(previous-buffer-file-name buffer-file-name))
 	(if buffer-file-name
 		(progn
 		  (setq is-fqm (feedmail-fqm-p buffer-file-name))
 	(let ((buffer-file-type feedmail-force-binary-write)) (write-file filename))
 	;; convenient for moving from draft to q, for example
 	(if (and previous-buffer-file-name (or (not is-fqm) (not is-in-this-dir))
-			 (y-or-n-p (format "Was previously %s; delete that? " previous-buffer-file-name)))
+			 (y-or-n-p (format "FQM: Was previously %s; delete that? " previous-buffer-file-name)))
 		(delete-file previous-buffer-file-name))
 	(if feedmail-nuke-buffer-after-queue
 		(let ((a-s-file-name buffer-auto-save-file-name))
 			   (file-exists-p a-s-file-name)
 			   (delete-file a-s-file-name))))
 	(if feedmail-queue-chatty
-		(progn (message (concat "Queued in " filename))
+		(progn (message (concat "FQM: Queued in " filename))
 			   (sit-for feedmail-queue-chatty-sit-for)))
-	(setq directory-stats (feedmail-look-at-queue-directory queue-directory))
 	(if feedmail-queue-chatty
 		(progn
-		  (message "%s messages, %s other files in %s"
-				   (nth 0 directory-stats)
-				   (nth 1 directory-stats)
-				   queue-directory)
-		  (sit-for feedmail-queue-chatty-sit-for)
-		  ))))
+		  (feedmail-queue-reminder what-event)
+		  (sit-for feedmail-queue-chatty-sit-for)))))
+
 
 ;; from a similar function in mail-utils.el
 (defun feedmail-rfc822-time-zone (time)
 	 (feedmail-rfc822-time-zone time)
 	 )))
 
-(defun feedmail-default-date-generator (message-file-name)
-  "Create contents for an RFC-822 compliant message DATE: header."
-  (let ((date-time))
-	(if (and (not feedmail-queue-use-send-time-for-date) message-file-name)
-		(setq date-time (nth 5 (file-attributes message-file-name))))
-	(feedmail-rfc822-date date-time)))
-
-(defun feedmail-default-message-id-generator (message-file-name)
-  "*Create contents for a message MESSAGE-ID: header.
-Based on a date and a sort of random number for tie breaking.
-Also uses user-mail-address, so be sure it's set."
-  (let ((date-time))
-	(if (and (not feedmail-queue-use-send-time-for-message-id) message-file-name)
-		(setq date-time (nth 5 (file-attributes message-file-name))))
-	(format "<%d-%s%s-%s>"
-			(mod (random) 10000)
-			(format-time-string "%a%d%b%Y%H%M%S" date-time)
-			(feedmail-rfc822-time-zone date-time)
-			user-mail-address)
-	))
 
 (defun feedmail-send-it-immediately ()
   "Handle immediate sending, including during a queue run."
-  (let* ((feedmail-error-buffer (get-buffer-create " *Outgoing Email Errors*"))
-		 (feedmail-prepped-text-buffer (get-buffer-create " *Outgoing Email Text*"))
+  (let* ((feedmail-error-buffer (get-buffer-create " *FQM Outgoing Email Errors*"))
+		 (feedmail-prepped-text-buffer (get-buffer-create " *FQM Outgoing Email Text*"))
 		 (feedmail-raw-text-buffer (current-buffer))
+		 (feedmail-address-list)
 		 (eoh-marker)
-		 (is-a-resend)
-		 (address-list))
+		 (bcc-holder)
+		 (resent-bcc-holder)
+		 (a-re-rtcb  "^RESENT-\\(TO\\|CC\\|BCC\\):")
+		 (a-re-rtc   "^RESENT-\\(TO\\|CC\\):")
+		 (a-re-rb    "^RESENT-BCC:")
+		 (a-re-dtcb  "^\\(TO\\|CC\\|BCC\\):")
+		 (a-re-dtc   "^\\(TO\\|CC\\):")
+		 (a-re-db    "^BCC:")
+		 (mail-header-separator mail-header-separator) ;; to get a temporary changable copy
+		 )
     (unwind-protect
 		(save-excursion
+		  (set-buffer feedmail-error-buffer) (erase-buffer)
 		  (set-buffer feedmail-prepped-text-buffer) (erase-buffer)
 
 		  ;; jam contents of user-supplied mail buffer into our scratch buffer
-		  (insert-buffer-substring feedmail-raw-text-buffer)
+		  (insert-buffer feedmail-raw-text-buffer)
 
 		  ;; require one newline at the end.
 		  (goto-char (point-max))
 
 		  (let ((case-fold-search nil))
 			;; Change header-delimiter to be what mailers expect (empty line).
-			(goto-char (point-min))
-			(re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n"))
+			(setq eoh-marker (feedmail-find-eoh)) ;; leaves match data in place or signals error
 			(replace-match "\n")
-			(setq eoh-marker (point-marker)))
+			(setq mail-header-separator ""))
 
 		  ;; mail-aliases nil = mail-abbrevs.el
 		  (if (or feedmail-force-expand-mail-aliases
 		  (goto-char (point-min))
 		  (while (and (re-search-forward "\n\n\n*" eoh-marker t) (< (point) eoh-marker))
 			(replace-match "\n"))
-	  
-		  (let ((case-fold-search t))
+	
+		  (let ((case-fold-search t) (addr-regexp))
 			(goto-char (point-min))
 			;; there are some RFC-822 combinations/cases missed here,
 			;; but probably good enough and what users expect
 			;;
 			;; use resent-* stuff only if there is at least one non-empty one
-			(setq is-a-resend
+			(setq feedmail-is-a-resend
 				  (re-search-forward
 				   ;; header name, followed by optional whitespace, followed by
 				   ;; non-whitespace, followed by anything, followed by newline;
 				   ;; the idea is empty RESENT-* headers are ignored
 				   "^\\(RESENT-TO:\\|RESENT-CC:\\|RESENT-BCC:\\)\\s-*\\S-+.*$"
 				   eoh-marker t))
-			(setq address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker is-a-resend))
-			(if (not address-list) (error "Sending...abandoned, no addressees"))
+			;; if we say so, gather the BCC stuff before the main course
+			(if (eq feedmail-deduce-bcc-where 'first)
+				(progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db))
+					   (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
+			;; the main course
+			(if (or (eq feedmail-deduce-bcc-where 'first) (eq feedmail-deduce-bcc-where 'last))
+				;; handled by first or last cases, so don't get BCC stuff
+				(progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtc) (setq addr-regexp a-re-dtc))
+					   (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list)))
+			  ;; not handled by first or last cases, so also get BCC stuff
+			  (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtcb) (setq addr-regexp a-re-dtcb))
+					 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
+			;; if we say so, gather the BCC stuff after the main course
+			(if (eq feedmail-deduce-bcc-where 'last)
+				(progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db))
+					   (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
+			(if (not feedmail-address-list) (error "FQM: Sending...abandoned, no addressees"))
+			;; not needed, but meets user expectations
+			(setq feedmail-address-list (nreverse feedmail-address-list))
 			;; Find and handle any BCC fields.
-			(if feedmail-nuke-bcc
-				(feedmail-accume-n-nuke-header eoh-marker "^BCC:"))
-			(if feedmail-nuke-resent-bcc
-				(feedmail-accume-n-nuke-header eoh-marker "^RESENT-BCC:"))
+			(setq bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^BCC:"))
+			(setq resent-bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^RESENT-BCC:"))
+			(if (and bcc-holder (not feedmail-nuke-bcc))
+				(progn (goto-char (point-min))
+					   (insert bcc-holder)))
+			(if (and resent-bcc-holder (not feedmail-nuke-resent-bcc))
+				(progn (goto-char (point-min))
+					   (insert resent-bcc-holder)))
+			(goto-char (point-min))
 
-			(goto-char (point-min))
-			(if (re-search-forward (if is-a-resend "^RESENT-FROM:" "^FROM:") eoh-marker t)
-				;; If there is a FROM: and no SENDER:, put in a SENDER:
-				;; if requested by user
-				(if (and feedmail-sender-line
-						 (not (save-excursion
-								(goto-char (point-min))
-								(re-search-forward
-								 (if is-a-resend "^RESENT-SENDER:" "^SENDER:")
-								 eoh-marker t))))
-					(progn (forward-line 1)
-						   (insert
-							(if is-a-resend "Resent-Sender: " "Sender: ")
-							feedmail-sender-line "\n")))
-
-			  ;; no FROM: ... force one?
-			  (if feedmail-from-line
-				  (progn (goto-char (point-min))
-						 (insert
-						  (if is-a-resend "Resent-From: " "From: ")
-						  feedmail-from-line "\n")))
-			  )
-			;;  X-Mailer: emacs xx.yy.zz (via feedmail N X) user appendage
-			(if (and feedmail-x-mailer-line
-					 (not
-					  (save-excursion
-						(goto-char (point-min))
-						(re-search-forward
-						 ;; X-Resent-Mailer invented by WJC
-						 (if is-a-resend "^X-RESENT-MAILER:" "^X-MAILER:")
-						 eoh-marker t))))
-				(progn
-				  (goto-char (point-min))
-				  (insert
-				   (if is-a-resend "X-Resent-Mailer: " "X-Mailer: ")