aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1998-07-22 18:31:25 +0000
committerKarl Heuer1998-07-22 18:31:25 +0000
commitc7d4a77785e22f0c907014af6977aed1030652d3 (patch)
tree71f644ca8c328bf8adf0a3880a2c80f7e610666a
parent31f2a064538cf272508ee6418a9d6408c256053c (diff)
downloademacs-c7d4a77785e22f0c907014af6977aed1030652d3.tar.gz
emacs-c7d4a77785e22f0c907014af6977aed1030652d3.zip
Entire file: Fix indentation.
-rw-r--r--lisp/mail/feedmail.el1709
1 files changed, 856 insertions, 853 deletions
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index 2c5b72c6c19..9c8df58f0cb 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -341,7 +341,7 @@ version of Emacs doesn't include the function y-or-n-p-with-timeout
341\(e.g., some versions of XEmacs\)." 341\(e.g., some versions of XEmacs\)."
342 :group 'feedmail-misc 342 :group 'feedmail-misc
343 :type '(choice (const nil) integer) 343 :type '(choice (const nil) integer)
344) 344 )
345 345
346 346
347(defcustom feedmail-nuke-bcc t 347(defcustom feedmail-nuke-bcc t
@@ -351,7 +351,7 @@ list. You may want to leave them in if you're using sendmail
351\(see feedmail-buffer-eating-function\)." 351\(see feedmail-buffer-eating-function\)."
352 :group 'feedmail-headers 352 :group 'feedmail-headers
353 :type 'boolean 353 :type 'boolean
354) 354 )
355 355
356 356
357(defcustom feedmail-nuke-resent-bcc t 357(defcustom feedmail-nuke-resent-bcc t
@@ -361,7 +361,7 @@ address list. You may want to leave them in if you're using sendmail
361\(see feedmail-buffer-eating-function\)." 361\(see feedmail-buffer-eating-function\)."
362 :group 'feedmail-headers 362 :group 'feedmail-headers
363 :type 'boolean 363 :type 'boolean
364) 364 )
365 365
366 366
367(defcustom feedmail-deduce-bcc-where nil 367(defcustom feedmail-deduce-bcc-where nil
@@ -387,7 +387,7 @@ is an option for either 'first or 'last because you might have a
387delivery agent that processes the addresses backwards." 387delivery agent that processes the addresses backwards."
388 :group 'feedmail-headers 388 :group 'feedmail-headers
389 :type 'boolean 389 :type 'boolean
390) 390 )
391 391
392 392
393(defcustom feedmail-fill-to-cc t 393(defcustom feedmail-fill-to-cc t
@@ -399,14 +399,14 @@ REPLY-TO: (though they seldom need it). If nil, the lines are left
399as-is. The filling is done after mail address alias expansion." 399as-is. The filling is done after mail address alias expansion."
400 :group 'feedmail-headers 400 :group 'feedmail-headers
401 :type 'boolean 401 :type 'boolean
402) 402 )
403 403
404 404
405(defcustom feedmail-fill-to-cc-fill-column default-fill-column 405(defcustom feedmail-fill-to-cc-fill-column default-fill-column
406 "*Fill column used by feedmail-fill-to-cc." 406 "*Fill column used by feedmail-fill-to-cc."
407 :group 'feedmail-headers 407 :group 'feedmail-headers
408 :type 'integer 408 :type 'integer
409) 409 )
410 410
411 411
412(defcustom feedmail-nuke-bcc-in-fcc nil 412(defcustom feedmail-nuke-bcc-in-fcc nil
@@ -416,7 +416,7 @@ with the message (see feedmail-nuke-bcc). Though not implied in the name,
416the same FCC: treatment applies to both BCC: and RESENT-BCC: lines." 416the same FCC: treatment applies to both BCC: and RESENT-BCC: lines."
417 :group 'feedmail-headers 417 :group 'feedmail-headers
418 :type 'boolean 418 :type 'boolean
419) 419 )
420 420
421 421
422(defcustom feedmail-nuke-body-in-fcc nil 422(defcustom feedmail-nuke-body-in-fcc nil
@@ -426,9 +426,9 @@ beginning of the body intact. The result is that the FCC: copy will
426consist only of the message headers, serving as a sort of an outgoing 426consist only of the message headers, serving as a sort of an outgoing
427message log." 427message log."
428 :group 'feedmail-headers 428 :group 'feedmail-headers
429 ;;:type 'boolean
429 :type '(choice (const nil) (const t) integer) 430 :type '(choice (const nil) (const t) integer)
430;; :type 'boolean 431 )
431)
432 432
433 433
434(defcustom feedmail-force-expand-mail-aliases nil 434(defcustom feedmail-force-expand-mail-aliases nil
@@ -440,7 +440,7 @@ the issue since there are configurations which fool the figuring
440out." 440out."
441 :group 'feedmail-headers 441 :group 'feedmail-headers
442 :type 'boolean 442 :type 'boolean
443) 443 )
444 444
445 445
446(defcustom feedmail-nuke-empty-headers t 446(defcustom feedmail-nuke-empty-headers t
@@ -452,7 +452,7 @@ something rather than their contents. This is rare in Internet email
452but common in some proprietary systems." 452but common in some proprietary systems."
453 :group 'feedmail-headers 453 :group 'feedmail-headers
454 :type 'boolean 454 :type 'boolean
455) 455 )
456 456
457;; wjc sez: I think the use of the SENDER: line is pretty pointless, 457;; wjc sez: I think the use of the SENDER: line is pretty pointless,
458;; but I left it in to be compatible with sendmail.el and because 458;; but I left it in to be compatible with sendmail.el and because
@@ -485,7 +485,7 @@ address. For example, \"bill@bubblegum.net (WJCarpenter)\". The SENDER:
485header is fiddled after the FROM: header is fiddled." 485header is fiddled after the FROM: header is fiddled."
486 :group 'feedmail-headers 486 :group 'feedmail-headers
487 :type '(choice (const nil) string) 487 :type '(choice (const nil) string)
488) 488 )
489 489
490 490
491(defcustom feedmail-force-binary-write t 491(defcustom feedmail-force-binary-write t
@@ -498,7 +498,7 @@ distinction or where it is controlled by other variables or other
498means, this option has no effect." 498means, this option has no effect."
499 :group 'feedmail-misc 499 :group 'feedmail-misc
500 :type 'boolean 500 :type 'boolean
501) 501 )
502 502
503 503
504(defcustom feedmail-from-line t 504(defcustom feedmail-from-line t
@@ -528,7 +528,7 @@ this variable explicitly to the string you want or find some other way
528to arrange for the message to get a FROM: line." 528to arrange for the message to get a FROM: line."
529 :group 'feedmail-headers 529 :group 'feedmail-headers
530 :type '(choice (const nil) string) 530 :type '(choice (const nil) string)
531) 531 )
532 532
533 533
534(defcustom feedmail-deduce-envelope-from t 534(defcustom feedmail-deduce-envelope-from t
@@ -557,14 +557,14 @@ senders (e.g., feedmail-buffer-to-bin-mail), there is no simple way to
557influence what they will use as the envelope." 557influence what they will use as the envelope."
558 :group 'feedmail-headers 558 :group 'feedmail-headers
559 :type 'boolean 559 :type 'boolean
560) 560 )
561 561
562 562
563(defcustom feedmail-x-mailer-line-user-appendage nil 563(defcustom feedmail-x-mailer-line-user-appendage nil
564 "*See feedmail-x-mailer-line." 564 "*See feedmail-x-mailer-line."
565 :group 'feedmail-headers 565 :group 'feedmail-headers
566 :type '(choice (const nil) string) 566 :type '(choice (const nil) string)
567) 567 )
568 568
569 569
570(defcustom feedmail-x-mailer-line t 570(defcustom feedmail-x-mailer-line t
@@ -594,7 +594,7 @@ cases the name element of the fiddle-plex is ignored and is hardwired
594by feedmail to either \"X-Mailer\" or \"X-Resent-Mailer\"." 594by feedmail to either \"X-Mailer\" or \"X-Resent-Mailer\"."
595 :group 'feedmail-headers 595 :group 'feedmail-headers
596 :type '(choice (const t) (const nil) string function) 596 :type '(choice (const t) (const nil) string function)
597) 597 )
598 598
599 599
600(defcustom feedmail-message-id-generator t 600(defcustom feedmail-message-id-generator t
@@ -624,7 +624,7 @@ probably won't hurt you to generate your own, and it will then show up
624in the saved message if you use FCC:." 624in the saved message if you use FCC:."
625 :group 'feedmail-headers 625 :group 'feedmail-headers
626 :type '(choice (const nil) function) 626 :type '(choice (const nil) function)
627) 627 )
628 628
629 629
630(defcustom feedmail-message-id-suffix nil 630(defcustom feedmail-message-id-suffix nil
@@ -638,7 +638,7 @@ the string will be used verbatim, else an \"@\" character will be prepended
638automatically." 638automatically."
639 :group 'feedmail-headers 639 :group 'feedmail-headers
640 :type 'string 640 :type 'string
641) 641 )
642 642
643;; this was suggested in various forms by several people; first was 643;; this was suggested in various forms by several people; first was
644;; Tony DeSimone in Oct 1992; sorry to be so tardy 644;; Tony DeSimone in Oct 1992; sorry to be so tardy
@@ -673,7 +673,7 @@ probably won't hurt you to generate your own, and it will then show up
673in the saved message if you use FCC:." 673in the saved message if you use FCC:."
674 :group 'feedmail-headers 674 :group 'feedmail-headers
675 :type '(choice (const nil) function) 675 :type '(choice (const nil) function)
676) 676 )
677 677
678 678
679(defcustom feedmail-fiddle-headers-upwardly t 679(defcustom feedmail-fiddle-headers-upwardly t
@@ -805,7 +805,7 @@ To transmit all the messages in the queue, invoke the command
805feedmail-run-the-queue or feedmail-run-the-queue-no-prompts." 805feedmail-run-the-queue or feedmail-run-the-queue-no-prompts."
806 :group 'feedmail-queue 806 :group 'feedmail-queue
807 :type 'boolean 807 :type 'boolean
808) 808 )
809 809
810 810
811(defcustom feedmail-queue-runner-confirm-global nil 811(defcustom feedmail-queue-runner-confirm-global nil
@@ -825,25 +825,25 @@ without having to answer no to the individual message prompts."
825(defcustom feedmail-queue-directory 825(defcustom feedmail-queue-directory
826 (if (memq system-type '(axp-vms vax-vms)) 826 (if (memq system-type '(axp-vms vax-vms))
827 (expand-file-name (concat (getenv "HOME") "[.MAIL.Q]")) 827 (expand-file-name (concat (getenv "HOME") "[.MAIL.Q]"))
828 (concat (getenv "HOME") "/mail/q")) 828 (concat (getenv "HOME") "/mail/q"))
829 "*Name of a directory where messages will be queued. 829 "*Name of a directory where messages will be queued.
830Directory will be created if necessary. Should be a string that 830Directory will be created if necessary. Should be a string that
831doesn't end with a slash. Default, except on VMS, is \"$HOME/mail/q\"." 831doesn't end with a slash. Default, except on VMS, is \"$HOME/mail/q\"."
832 :group 'feedmail-queue 832 :group 'feedmail-queue
833 :type 'string 833 :type 'string
834) 834 )
835 835
836 836
837(defcustom feedmail-queue-draft-directory 837(defcustom feedmail-queue-draft-directory
838 (if (memq system-type '(axp-vms vax-vms)) 838 (if (memq system-type '(axp-vms vax-vms))
839 (expand-file-name (concat (getenv "HOME") "[.MAIL.DRAFT]")) 839 (expand-file-name (concat (getenv "HOME") "[.MAIL.DRAFT]"))
840 (concat (getenv "HOME") "/mail/draft")) 840 (concat (getenv "HOME") "/mail/draft"))
841 "*Name of an directory where DRAFT messages will be queued. 841 "*Name of an directory where DRAFT messages will be queued.
842Directory will be created if necessary. Should be a string that 842Directory will be created if necessary. Should be a string that
843doesn't end with a slash. Default, except on VMS, is \"$HOME/mail/draft\"." 843doesn't end with a slash. Default, except on VMS, is \"$HOME/mail/draft\"."
844 :group 'feedmail-queue 844 :group 'feedmail-queue
845 :type 'string 845 :type 'string
846) 846 )
847 847
848 848
849(defcustom feedmail-ask-before-queue t 849(defcustom feedmail-ask-before-queue t
@@ -855,7 +855,7 @@ queuing is enabled. If nil, the message is placed in the main queue
855without a prompt." 855without a prompt."
856 :group 'feedmail-queue 856 :group 'feedmail-queue
857 :type 'boolean 857 :type 'boolean
858) 858 )
859 859
860 860
861(defcustom feedmail-ask-before-queue-prompt "FQM: Message action (q, i, d, e, ?)? [%s]: " 861(defcustom feedmail-ask-before-queue-prompt "FQM: Message action (q, i, d, e, ?)? [%s]: "
@@ -864,7 +864,7 @@ If it contains a \"%s\", that will be replaced with the value of
864feedmail-ask-before-queue-default." 864feedmail-ask-before-queue-default."
865 :group 'feedmail-queue 865 :group 'feedmail-queue
866 :type 'string 866 :type 'string
867) 867 )
868 868
869 869
870(defcustom feedmail-ask-before-queue-reprompt "FQM: Please type q, i, d, or e; or ? for help [%s]: " 870(defcustom feedmail-ask-before-queue-reprompt "FQM: Please type q, i, d, or e; or ? for help [%s]: "
@@ -873,7 +873,7 @@ If it contains a \"%s\", that will be replaced with the value of
873feedmail-ask-before-queue-default." 873feedmail-ask-before-queue-default."
874 :group 'feedmail-queue 874 :group 'feedmail-queue
875 :type 'string 875 :type 'string
876) 876 )
877 877
878 878
879(defcustom feedmail-ask-before-queue-default "queue" 879(defcustom feedmail-ask-before-queue-default "queue"
@@ -882,34 +882,34 @@ Should be a character or a string; if a string, only the first
882character is significant. Useful values are those described in 882character is significant. Useful values are those described in
883the help for the message action prompt." 883the help for the message action prompt."
884 :group 'feedmail-queue 884 :group 'feedmail-queue
885 :type '(choice string integer) ;use integer to get char 885 :type '(choice string integer) ;use integer to get char
886) 886 )
887 887
888 888
889(defvar feedmail-prompt-before-queue-standard-alist 889(defvar feedmail-prompt-before-queue-standard-alist
890 '((?q . feedmail-message-action-queue) 890 '((?q . feedmail-message-action-queue)
891 (?Q . feedmail-message-action-queue-strong) 891 (?Q . feedmail-message-action-queue-strong)
892 892
893 (?d . feedmail-message-action-draft) 893 (?d . feedmail-message-action-draft)
894 (?r . feedmail-message-action-draft) 894 (?r . feedmail-message-action-draft)
895 (?D . feedmail-message-action-draft-strong) 895 (?D . feedmail-message-action-draft-strong)
896 (?R . feedmail-message-action-draft-strong) 896 (?R . feedmail-message-action-draft-strong)
897 897
898 (?e . feedmail-message-action-edit) 898 (?e . feedmail-message-action-edit)
899 (?E . feedmail-message-action-edit) 899 (?E . feedmail-message-action-edit)
900 (?\C-g . feedmail-message-action-edit) 900 (?\C-g . feedmail-message-action-edit)
901 (?n . feedmail-message-action-edit) 901 (?n . feedmail-message-action-edit)
902 (?N . feedmail-message-action-edit) 902 (?N . feedmail-message-action-edit)
903 903
904 (?i . feedmail-message-action-send) 904 (?i . feedmail-message-action-send)
905 (?I . feedmail-message-action-send-strong) 905 (?I . feedmail-message-action-send-strong)
906 (?s . feedmail-message-action-send) 906 (?s . feedmail-message-action-send)
907 (?S . feedmail-message-action-send-strong) 907 (?S . feedmail-message-action-send-strong)
908 908
909 (?* . feedmail-message-action-toggle-spray) 909 (?* . feedmail-message-action-toggle-spray)
910 910
911 (?\C-v . feedmail-message-action-help) 911 (?\C-v . feedmail-message-action-help)
912 (?? . feedmail-message-action-help)) 912 (?? . feedmail-message-action-help))
913 "An alist of choices for the message action prompt. 913 "An alist of choices for the message action prompt.
914All of the values are function names, except help, which is a special 914All of the values are function names, except help, which is a special
915symbol that calls up help for the prompt (the help describes the 915symbol that calls up help for the prompt (the help describes the
@@ -944,10 +944,10 @@ It may contain embedded line breaks. It will be printed via princ."
944 944
945(defcustom feedmail-queue-reminder-alist 945(defcustom feedmail-queue-reminder-alist
946 '((after-immediate . feedmail-queue-reminder-brief) 946 '((after-immediate . feedmail-queue-reminder-brief)
947 (after-queue . feedmail-queue-reminder-medium) 947 (after-queue . feedmail-queue-reminder-medium)
948 (after-draft . feedmail-queue-reminder-medium) 948 (after-draft . feedmail-queue-reminder-medium)
949 (after-run . feedmail-queue-reminder-brief) 949 (after-run . feedmail-queue-reminder-brief)
950 (on-demand . feedmail-run-the-queue-global-prompt)) 950 (on-demand . feedmail-run-the-queue-global-prompt))
951 "See feedmail-queue-reminder." 951 "See feedmail-queue-reminder."
952 :group 'feedmail-queue 952 :group 'feedmail-queue
953 :type 'alist 953 :type 'alist
@@ -962,7 +962,7 @@ That's not affected by this variable setting. Also does not control
962reporting of error/abnormal conditions." 962reporting of error/abnormal conditions."
963 :group 'feedmail-queue 963 :group 'feedmail-queue
964 :type 'boolean 964 :type 'boolean
965) 965 )
966 966
967 967
968(defcustom feedmail-queue-chatty-sit-for 2 968(defcustom feedmail-queue-chatty-sit-for 2
@@ -972,7 +972,7 @@ something else obliterates them. This value controls the duration of
972the pause." 972the pause."
973 :group 'feedmail-queue 973 :group 'feedmail-queue
974 :type 'integer 974 :type 'integer
975) 975 )
976 976
977 977
978(defcustom feedmail-queue-run-orderer nil 978(defcustom feedmail-queue-run-orderer nil
@@ -986,7 +986,7 @@ order by queued file name, which will typically result in the order
986they were placed in the queue." 986they were placed in the queue."
987 :group 'feedmail-queue 987 :group 'feedmail-queue
988 :type '(choice (const nil) function) 988 :type '(choice (const nil) function)
989) 989 )
990 990
991 991
992(defcustom feedmail-queue-use-send-time-for-date nil 992(defcustom feedmail-queue-use-send-time-for-date nil
@@ -998,7 +998,7 @@ message DATE: header; if there is no queue file, the current time is
998used." 998used."
999 :group 'feedmail-queue 999 :group 'feedmail-queue
1000 :type 'boolean 1000 :type 'boolean
1001) 1001 )
1002 1002
1003 1003
1004(defcustom feedmail-queue-use-send-time-for-message-id nil 1004(defcustom feedmail-queue-use-send-time-for-message-id nil
@@ -1010,7 +1010,7 @@ message MESSAGE-ID: header; if there is no queue file, the current time is
1010used." 1010used."
1011 :group 'feedmail-queue 1011 :group 'feedmail-queue
1012 :type 'boolean 1012 :type 'boolean
1013) 1013 )
1014 1014
1015 1015
1016(defcustom feedmail-ask-for-queue-slug nil 1016(defcustom feedmail-ask-for-queue-slug nil
@@ -1027,7 +1027,7 @@ with this prompting since feedmail, by default, uses queue file names
1027based on the subjects of the messages." 1027based on the subjects of the messages."
1028 :group 'feedmail-queue 1028 :group 'feedmail-queue
1029 :type 'boolean 1029 :type 'boolean
1030) 1030 )
1031 1031
1032 1032
1033(defcustom feedmail-queue-slug-maker 'feedmail-queue-subject-slug-maker 1033(defcustom feedmail-queue-slug-maker 'feedmail-queue-subject-slug-maker
@@ -1040,7 +1040,7 @@ default function creates the slug based on the message subject, if
1040any." 1040any."
1041 :group 'feedmail-queue 1041 :group 'feedmail-queue
1042 :type '(choice (const nil) function) 1042 :type '(choice (const nil) function)
1043) 1043 )
1044 1044
1045 1045
1046(defcustom feedmail-queue-default-file-slug t 1046(defcustom feedmail-queue-default-file-slug t
@@ -1063,7 +1063,7 @@ used, but feedmail will do further manipulation on the string you return, so
1063it's not expected to be a complete filename." 1063it's not expected to be a complete filename."
1064 :group 'feedmail-queue 1064 :group 'feedmail-queue
1065 :type 'string 1065 :type 'string
1066) 1066 )
1067 1067
1068 1068
1069(defcustom feedmail-queue-fqm-suffix ".fqm" 1069(defcustom feedmail-queue-fqm-suffix ".fqm"
@@ -1075,7 +1075,7 @@ feedmail-queue-draft-directory. By the way, FQM stands for feedmail
1075queued message." 1075queued message."
1076 :group 'feedmail-queue 1076 :group 'feedmail-queue
1077 :type 'string 1077 :type 'string
1078) 1078 )
1079 1079
1080 1080
1081(defcustom feedmail-nuke-buffer-after-queue nil 1081(defcustom feedmail-nuke-buffer-after-queue nil
@@ -1088,7 +1088,7 @@ nil, since VM has its own options for managing the recycling of
1088message buffers." 1088message buffers."
1089 :group 'feedmail-queue 1089 :group 'feedmail-queue
1090 :type 'boolean 1090 :type 'boolean
1091) 1091 )
1092 1092
1093 1093
1094(defcustom feedmail-queue-auto-file-nuke nil 1094(defcustom feedmail-queue-auto-file-nuke nil
@@ -1100,7 +1100,7 @@ variable to non-nil will tell feedmail to skip the prompt and just delete
1100the file without bothering you." 1100the file without bothering you."
1101 :group 'feedmail-queue 1101 :group 'feedmail-queue
1102 :type 'boolean 1102 :type 'boolean
1103) 1103 )
1104 1104
1105 1105
1106;; defvars to make byte-compiler happy(er) 1106;; defvars to make byte-compiler happy(er)
@@ -1126,9 +1126,9 @@ or placed in the queue or drafts directory. feedmail-mail-send-hook-queued is
1126called when messages are being sent from the queue directory, typically via a 1126called when messages are being sent from the queue directory, typically via a
1127call to feedmail-run-the-queue." 1127call to feedmail-run-the-queue."
1128 (if feedmail-queue-runner-is-active 1128 (if feedmail-queue-runner-is-active
1129 (run-hooks 'feedmail-mail-send-hook-queued) 1129 (run-hooks 'feedmail-mail-send-hook-queued)
1130 (run-hooks 'feedmail-mail-send-hook)) 1130 (run-hooks 'feedmail-mail-send-hook))
1131) 1131 )
1132 1132
1133 1133
1134(defvar feedmail-mail-send-hook nil 1134(defvar feedmail-mail-send-hook nil
@@ -1144,12 +1144,12 @@ call to feedmail-run-the-queue."
1144It shows the simple addresses and gets a confirmation. Use as: 1144It shows the simple addresses and gets a confirmation. Use as:
1145 (setq feedmail-last-chance-hook 'feedmail-confirm-addresses-hook-example)." 1145 (setq feedmail-last-chance-hook 'feedmail-confirm-addresses-hook-example)."
1146 (save-window-excursion 1146 (save-window-excursion
1147 (display-buffer (set-buffer (get-buffer-create " F-C-A-H-E"))) 1147 (display-buffer (set-buffer (get-buffer-create " F-C-A-H-E")))
1148 (erase-buffer) 1148 (erase-buffer)
1149 (insert (mapconcat 'identity feedmail-address-list " ")) 1149 (insert (mapconcat 'identity feedmail-address-list " "))
1150 (if (not (y-or-n-p "How do you like them apples? ")) 1150 (if (not (y-or-n-p "How do you like them apples? "))
1151 (error "FQM: Sending...gave up in last chance hook") 1151 (error "FQM: Sending...gave up in last chance hook")
1152 ))) 1152 )))
1153 1153
1154 1154
1155(defcustom feedmail-last-chance-hook nil 1155(defcustom feedmail-last-chance-hook nil
@@ -1167,7 +1167,7 @@ mail while in the hook since some of the internal buffers will be
1167reused and things will get confused." 1167reused and things will get confused."
1168 :group 'feedmail-misc 1168 :group 'feedmail-misc
1169 :type 'hook 1169 :type 'hook
1170) 1170 )
1171 1171
1172 1172
1173(defcustom feedmail-before-fcc-hook nil 1173(defcustom feedmail-before-fcc-hook nil
@@ -1184,7 +1184,7 @@ user should not send more mail while in the hook since some of the
1184internal buffers will be reused and things will get confused." 1184internal buffers will be reused and things will get confused."
1185 :group 'feedmail-misc 1185 :group 'feedmail-misc
1186 :type 'hook 1186 :type 'hook
1187) 1187 )
1188 1188
1189(defcustom feedmail-queue-runner-mode-setter 1189(defcustom feedmail-queue-runner-mode-setter
1190 '(lambda (&optional arg) (mail-mode)) 1190 '(lambda (&optional arg) (mail-mode))
@@ -1199,7 +1199,7 @@ calling it, but here's your chance to have something different.
1199Called with funcall, not `call-interactively'." 1199Called with funcall, not `call-interactively'."
1200 :group 'feedmail-queue 1200 :group 'feedmail-queue
1201 :type 'function 1201 :type 'function
1202) 1202 )
1203 1203
1204 1204
1205(defcustom feedmail-queue-alternative-mail-header-separator nil 1205(defcustom feedmail-queue-alternative-mail-header-separator nil
@@ -1216,7 +1216,7 @@ set `mail-header-separator' to the value of
1216feedmail-queue-alternative-mail-header-separator and try again." 1216feedmail-queue-alternative-mail-header-separator and try again."
1217 :group 'feedmail-queue 1217 :group 'feedmail-queue
1218 :type 'string 1218 :type 'string
1219) 1219 )
1220 1220
1221 1221
1222(defcustom feedmail-queue-runner-message-sender 'mail-send-and-exit 1222(defcustom feedmail-queue-runner-message-sender 'mail-send-and-exit
@@ -1230,13 +1230,13 @@ your chance to have something different. Called with funcall, not
1230call-interactively." 1230call-interactively."
1231 :group 'feedmail-queue 1231 :group 'feedmail-queue
1232 :type 'function 1232 :type 'function
1233) 1233 )
1234 1234
1235 1235
1236(defcustom feedmail-queue-runner-cleaner-upper 1236(defcustom feedmail-queue-runner-cleaner-upper
1237 '(lambda (fqm-file &optional arg) 1237 '(lambda (fqm-file &optional arg)
1238 (delete-file fqm-file) 1238 (delete-file fqm-file)
1239 (if (and arg feedmail-queue-chatty) (message "FQM: Nuked %s" fqm-file))) 1239 (if (and arg feedmail-queue-chatty) (message "FQM: Nuked %s" fqm-file)))
1240 "*Function that will be called after a message has been sent. 1240 "*Function that will be called after a message has been sent.
1241Not called in the case of errors. This function is called with two 1241Not called in the case of errors. This function is called with two
1242arguments: the name of the message queue file for the message just sent, 1242arguments: the name of the message queue file for the message just sent,
@@ -1252,7 +1252,7 @@ function, for example, to archive all of your sent messages someplace
1252\(though there are better ways to get that particular result\)." 1252\(though there are better ways to get that particular result\)."
1253 :group 'feedmail-queue 1253 :group 'feedmail-queue
1254 :type 'function 1254 :type 'function
1255) 1255 )
1256 1256
1257 1257
1258(defvar feedmail-queue-runner-is-active nil 1258(defvar feedmail-queue-runner-is-active nil
@@ -1285,7 +1285,7 @@ to nil. If you use the binmail form, check the value of
1285feedmail-binmail-template." 1285feedmail-binmail-template."
1286 :group 'feedmail-misc 1286 :group 'feedmail-misc
1287 :type 'function 1287 :type 'function
1288) 1288 )
1289 1289
1290 1290
1291(defcustom feedmail-binmail-template (if mail-interactive "/bin/mail %s" "/bin/rmail %s") 1291(defcustom feedmail-binmail-template (if mail-interactive "/bin/mail %s" "/bin/rmail %s")
@@ -1302,7 +1302,7 @@ also like to consult local mail experts for any other interesting
1302command line possibilities." 1302command line possibilities."
1303 :group 'feedmail-misc 1303 :group 'feedmail-misc
1304 :type 'string 1304 :type 'string
1305) 1305 )
1306 1306
1307 1307
1308;; feedmail-buffer-to-binmail, feedmail-buffer-to-sendmail, and 1308;; feedmail-buffer-to-binmail, feedmail-buffer-to-sendmail, and
@@ -1316,8 +1316,8 @@ Feeds the buffer to it."
1316 (apply 1316 (apply
1317 'call-process-region 1317 'call-process-region
1318 (append (list (point-min) (point-max) "/bin/sh" nil errors-to nil "-c" 1318 (append (list (point-min) (point-max) "/bin/sh" nil errors-to nil "-c"
1319 (format feedmail-binmail-template 1319 (format feedmail-binmail-template
1320 (mapconcat 'identity addr-listoid " ")))))) 1320 (mapconcat 'identity addr-listoid " "))))))
1321 1321
1322 1322
1323(defun feedmail-buffer-to-sendmail (prepped errors-to addr-listoid) 1323(defun feedmail-buffer-to-sendmail (prepped errors-to addr-listoid)
@@ -1326,13 +1326,13 @@ Feeds the buffer to it. Probably has some flaws for RESENT-* and other
1326complicated cases." 1326complicated cases."
1327 (set-buffer prepped) 1327 (set-buffer prepped)
1328 (apply 'call-process-region 1328 (apply 'call-process-region
1329 (append (list (point-min) (point-max) 1329 (append (list (point-min) (point-max)
1330 (if (boundp 'sendmail-program) sendmail-program "/usr/lib/sendmail") 1330 (if (boundp 'sendmail-program) sendmail-program "/usr/lib/sendmail")
1331 nil errors-to nil "-oi" "-t") 1331 nil errors-to nil "-oi" "-t")
1332 ;; provide envelope "from" to sendmail; results will vary 1332 ;; provide envelope "from" to sendmail; results will vary
1333 (list "-f" user-mail-address) 1333 (list "-f" user-mail-address)
1334 ;; These mean "report errors by mail" and "deliver in background". 1334 ;; These mean "report errors by mail" and "deliver in background".
1335 (if (null mail-interactive) '("-oem" "-odb"))))) 1335 (if (null mail-interactive) '("-oem" "-odb")))))
1336 1336
1337;; provided by jam@austin.asc.slb.com (James A. McLaughlin); 1337;; provided by jam@austin.asc.slb.com (James A. McLaughlin);
1338;; simplified by WJC after more feedmail development; 1338;; simplified by WJC after more feedmail development;
@@ -1347,21 +1347,21 @@ complicated cases."
1347 ;; no evil. 1347 ;; no evil.
1348 (require 'smtpmail) 1348 (require 'smtpmail)
1349 (if (not (smtpmail-via-smtp addr-listoid prepped)) 1349 (if (not (smtpmail-via-smtp addr-listoid prepped))
1350 (progn 1350 (progn
1351 (set-buffer errors-to) 1351 (set-buffer errors-to)
1352 (insert "Send via smtpmail failed. Probable SMTP protocol error.\n") 1352 (insert "Send via smtpmail failed. Probable SMTP protocol error.\n")
1353 (insert "Look for details below or in the *Messages* buffer.\n\n") 1353 (insert "Look for details below or in the *Messages* buffer.\n\n")
1354 (let ((case-fold-search t) 1354 (let ((case-fold-search t)
1355 ;; don't be overconfident about the name of the trace buffer 1355 ;; don't be overconfident about the name of the trace buffer
1356 (tracer (concat "trace.*smtp.*" (regexp-quote smtpmail-smtp-server)))) 1356 (tracer (concat "trace.*smtp.*" (regexp-quote smtpmail-smtp-server))))
1357 (mapcar 1357 (mapcar
1358 '(lambda (buffy) 1358 '(lambda (buffy)
1359 (if (string-match tracer (buffer-name buffy)) 1359 (if (string-match tracer (buffer-name buffy))
1360 (progn 1360 (progn
1361 (insert "SMTP Trace from " (buffer-name buffy) "\n---------------") 1361 (insert "SMTP Trace from " (buffer-name buffy) "\n---------------")
1362 (insert-buffer buffy) 1362 (insert-buffer buffy)
1363 (insert "\n\n")))) 1363 (insert "\n\n"))))
1364 (buffer-list)))))) 1364 (buffer-list))))))
1365 1365
1366 1366
1367;; just a place to park a docstring 1367;; just a place to park a docstring
@@ -1431,14 +1431,14 @@ similar place:
1431 1431
1432 ;; avoid matching trouble over slash vs backslash by getting canonical 1432 ;; avoid matching trouble over slash vs backslash by getting canonical
1433 (if feedmail-queue-directory 1433 (if feedmail-queue-directory
1434 (setq feedmail-queue-directory (expand-file-name feedmail-queue-directory))) 1434 (setq feedmail-queue-directory (expand-file-name feedmail-queue-directory)))
1435 (if feedmail-queue-draft-directory 1435 (if feedmail-queue-draft-directory
1436 (setq feedmail-queue-draft-directory (expand-file-name feedmail-queue-draft-directory))) 1436 (setq feedmail-queue-draft-directory (expand-file-name feedmail-queue-draft-directory)))
1437 (if (not feedmail-enable-queue) (feedmail-send-it-immediately) 1437 (if (not feedmail-enable-queue) (feedmail-send-it-immediately)
1438 ;; else, queuing is enabled, should we ask about it or just do it? 1438 ;; else, queuing is enabled, should we ask about it or just do it?
1439 (if feedmail-ask-before-queue 1439 (if feedmail-ask-before-queue
1440 (funcall (feedmail-queue-send-edit-prompt)) 1440 (funcall (feedmail-queue-send-edit-prompt))
1441 (feedmail-dump-message-to-queue feedmail-queue-directory 'after-queue)))) 1441 (feedmail-dump-message-to-queue feedmail-queue-directory 'after-queue))))
1442 1442
1443 1443
1444(defun feedmail-message-action-send () 1444(defun feedmail-message-action-send ()
@@ -1452,21 +1452,21 @@ similar place:
1452 "*Send message directly to the queue, with a minimum of fuss and bother." 1452 "*Send message directly to the queue, with a minimum of fuss and bother."
1453 (interactive) 1453 (interactive)
1454 (let ((feedmail-enable-queue t) 1454 (let ((feedmail-enable-queue t)
1455 (feedmail-ask-before-queue nil) 1455 (feedmail-ask-before-queue nil)
1456 (feedmail-queue-reminder-alist nil) 1456 (feedmail-queue-reminder-alist nil)
1457 (feedmail-queue-chatty-sit-for 0)) 1457 (feedmail-queue-chatty-sit-for 0))
1458 (feedmail-send-it) 1458 (feedmail-send-it)
1459 ) 1459 )
1460) 1460 )
1461 1461
1462 1462
1463(defun feedmail-queue-express-to-draft () 1463(defun feedmail-queue-express-to-draft ()
1464 "*Send message directly to the draft queue, with a minimum of fuss and bother." 1464 "*Send message directly to the draft queue, with a minimum of fuss and bother."
1465 (interactive) 1465 (interactive)
1466 (let ((feedmail-queue-directory feedmail-queue-draft-directory)) 1466 (let ((feedmail-queue-directory feedmail-queue-draft-directory))
1467 (feedmail-queue-express-to-queue) 1467 (feedmail-queue-express-to-queue)
1468 ) 1468 )
1469) 1469 )
1470 1470
1471 1471
1472(defun feedmail-message-action-send-strong () 1472(defun feedmail-message-action-send-strong ()
@@ -1483,7 +1483,7 @@ similar place:
1483 1483
1484(defun feedmail-message-action-draft-strong () 1484(defun feedmail-message-action-draft-strong ()
1485 (let ((buffer-file-name nil)) 1485 (let ((buffer-file-name nil))
1486 (feedmail-message-action-draft))) 1486 (feedmail-message-action-draft)))
1487 1487
1488 1488
1489(defun feedmail-message-action-queue () 1489(defun feedmail-message-action-queue ()
@@ -1492,27 +1492,27 @@ similar place:
1492 1492
1493(defun feedmail-message-action-queue-strong () 1493(defun feedmail-message-action-queue-strong ()
1494 (let ((buffer-file-name nil)) 1494 (let ((buffer-file-name nil))
1495 (feedmail-message-action-queue))) 1495 (feedmail-message-action-queue)))
1496 1496
1497 1497
1498(defun feedmail-message-action-toggle-spray () 1498(defun feedmail-message-action-toggle-spray ()
1499 (let ((feedmail-enable-spray (not feedmail-enable-spray))) 1499 (let ((feedmail-enable-spray (not feedmail-enable-spray)))
1500 (if feedmail-enable-spray 1500 (if feedmail-enable-spray
1501 (message "FQM: For this message, spray toggled ON") 1501 (message "FQM: For this message, spray toggled ON")
1502 (message "FQM: For this message, spray toggled OFF")) 1502 (message "FQM: For this message, spray toggled OFF"))
1503 (sit-for 3) 1503 (sit-for 3)
1504 ;; recursion, but harmless 1504 ;; recursion, but harmless
1505 (feedmail-send-it))) 1505 (feedmail-send-it)))
1506 1506
1507 1507
1508(defun feedmail-message-action-help () 1508(defun feedmail-message-action-help ()
1509 (let ((d-string " ")) 1509 (let ((d-string " "))
1510 (if (stringp feedmail-ask-before-queue-default) 1510 (if (stringp feedmail-ask-before-queue-default)
1511 (setq d-string feedmail-ask-before-queue-default) 1511 (setq d-string feedmail-ask-before-queue-default)
1512 (setq d-string (char-to-string feedmail-ask-before-queue-default))) 1512 (setq d-string (char-to-string feedmail-ask-before-queue-default)))
1513 (feedmail-queue-send-edit-prompt-help d-string) 1513 (feedmail-queue-send-edit-prompt-help d-string)
1514 ;; recursive, but no worries (it goes deeper on user action) 1514 ;; recursive, but no worries (it goes deeper on user action)
1515 (feedmail-send-it))) 1515 (feedmail-send-it)))
1516 1516
1517 1517
1518;;;###autoload 1518;;;###autoload
@@ -1538,121 +1538,121 @@ backup file names and the like)."
1538 (interactive "p") 1538 (interactive "p")
1539 ;; avoid matching trouble over slash vs backslash by getting canonical 1539 ;; avoid matching trouble over slash vs backslash by getting canonical
1540 (if feedmail-queue-directory 1540 (if feedmail-queue-directory
1541 (setq feedmail-queue-directory (expand-file-name feedmail-queue-directory))) 1541 (setq feedmail-queue-directory (expand-file-name feedmail-queue-directory)))
1542 (if feedmail-queue-draft-directory 1542 (if feedmail-queue-draft-directory
1543 (setq feedmail-queue-draft-directory (expand-file-name feedmail-queue-draft-directory))) 1543 (setq feedmail-queue-draft-directory (expand-file-name feedmail-queue-draft-directory)))
1544 (let* ((maybe-file) 1544 (let* ((maybe-file)
1545 (qlist (feedmail-look-at-queue-directory feedmail-queue-directory)) 1545 (qlist (feedmail-look-at-queue-directory feedmail-queue-directory))
1546 (dlist (feedmail-look-at-queue-directory feedmail-queue-draft-directory)) 1546 (dlist (feedmail-look-at-queue-directory feedmail-queue-draft-directory))
1547 (q-cnt (nth 0 qlist)) 1547 (q-cnt (nth 0 qlist))
1548 (q-oth (nth 1 qlist)) 1548 (q-oth (nth 1 qlist))
1549 (d-cnt (nth 0 dlist)) 1549 (d-cnt (nth 0 dlist))
1550 (d-oth (nth 1 dlist)) 1550 (d-oth (nth 1 dlist))
1551 (messages-sent 0) 1551 (messages-sent 0)
1552 (messages-skipped 0) 1552 (messages-skipped 0)
1553 (blobby-buffer) 1553 (blobby-buffer)
1554 (already-buffer) 1554 (already-buffer)
1555 (this-mhsep) 1555 (this-mhsep)
1556 (do-the-run t) 1556 (do-the-run t)
1557 (list-of-possible-fqms)) 1557 (list-of-possible-fqms))
1558 (if (and (> q-cnt 0) feedmail-queue-runner-confirm-global) 1558 (if (and (> q-cnt 0) feedmail-queue-runner-confirm-global)
1559 (setq do-the-run 1559 (setq do-the-run
1560 (if (fboundp 'y-or-n-p-with-timeout) 1560 (if (fboundp 'y-or-n-p-with-timeout)
1561 (y-or-n-p-with-timeout (format "FQM: Draft: %dm+%d, Queue: %dm+%d; run the queue? " 1561 (y-or-n-p-with-timeout (format "FQM: Draft: %dm+%d, Queue: %dm+%d; run the queue? "
1562 d-cnt d-oth q-cnt q-oth) 1562 d-cnt d-oth q-cnt q-oth)
1563 5 nil) 1563 5 nil)
1564 (y-or-n-p (format "FQM: Draft: %dm+%d, Queue: %dm+%d; run the queue? " 1564 (y-or-n-p (format "FQM: Draft: %dm+%d, Queue: %dm+%d; run the queue? "
1565 d-cnt d-oth q-cnt q-oth)) 1565 d-cnt d-oth q-cnt q-oth))
1566 ))) 1566 )))
1567 (if (not do-the-run) 1567 (if (not do-the-run)
1568 (setq messages-skipped q-cnt) 1568 (setq messages-skipped q-cnt)
1569 (save-window-excursion 1569 (save-window-excursion
1570 (setq list-of-possible-fqms (directory-files feedmail-queue-directory t)) 1570 (setq list-of-possible-fqms (directory-files feedmail-queue-directory t))
1571 (if feedmail-queue-run-orderer 1571 (if feedmail-queue-run-orderer
1572 (setq list-of-possible-fqms (funcall feedmail-queue-run-orderer list-of-possible-fqms))) 1572 (setq list-of-possible-fqms (funcall feedmail-queue-run-orderer list-of-possible-fqms)))
1573 (mapcar 1573 (mapcar
1574 '(lambda (blobby) 1574 '(lambda (blobby)
1575 (setq maybe-file (expand-file-name blobby feedmail-queue-directory)) 1575 (setq maybe-file (expand-file-name blobby feedmail-queue-directory))
1576 (cond 1576 (cond
1577 ((file-directory-p maybe-file) nil) ; don't care about subdirs 1577 ((file-directory-p maybe-file) nil) ; don't care about subdirs
1578 ((feedmail-fqm-p blobby) 1578 ((feedmail-fqm-p blobby)
1579 (setq blobby-buffer (generate-new-buffer (concat "FQM " blobby))) 1579 (setq blobby-buffer (generate-new-buffer (concat "FQM " blobby)))
1580 (setq already-buffer 1580 (setq already-buffer
1581 (if (fboundp 'find-buffer-visiting) ; missing from XEmacs 1581 (if (fboundp 'find-buffer-visiting) ; missing from XEmacs
1582 (find-buffer-visiting maybe-file) 1582 (find-buffer-visiting maybe-file)
1583 (get-file-buffer maybe-file))) 1583 (get-file-buffer maybe-file)))
1584 (if (and already-buffer (buffer-modified-p already-buffer)) 1584 (if (and already-buffer (buffer-modified-p already-buffer))
1585 (save-window-excursion 1585 (save-window-excursion
1586 (display-buffer (set-buffer already-buffer)) 1586 (display-buffer (set-buffer already-buffer))
1587 (if (fboundp 'y-or-n-p-with-timeout) 1587 (if (fboundp 'y-or-n-p-with-timeout)
1588 ;; make a guess that the user just forgot to save 1588 ;; make a guess that the user just forgot to save
1589 (if (y-or-n-p-with-timeout (format "FQM: Visiting %s; save before send? " blobby) 10 t) 1589 (if (y-or-n-p-with-timeout (format "FQM: Visiting %s; save before send? " blobby) 10 t)
1590 (save-buffer)) 1590 (save-buffer))
1591 (if (y-or-n-p (format "FQM: Visiting %s; save before send? " blobby)) 1591 (if (y-or-n-p (format "FQM: Visiting %s; save before send? " blobby))
1592 (save-buffer)) 1592 (save-buffer))
1593 ))) 1593 )))
1594 1594
1595 (set-buffer blobby-buffer) 1595 (set-buffer blobby-buffer)
1596 (setq buffer-offer-save nil) 1596 (setq buffer-offer-save nil)
1597 (buffer-disable-undo blobby-buffer) 1597 (buffer-disable-undo blobby-buffer)
1598 (insert-file-contents-literally maybe-file) 1598 (insert-file-contents-literally maybe-file)
1599 ;; work around text-vs-binary wierdness and also around rmail-resend's creative 1599 ;; work around text-vs-binary wierdness and also around rmail-resend's creative
1600 ;; manipulation of mail-header-separator 1600 ;; manipulation of mail-header-separator
1601 ;; 1601 ;;
1602 ;; if we don't find the normal M-H-S, and the alternative is defined but also 1602 ;; if we don't find the normal M-H-S, and the alternative is defined but also
1603 ;; not found, try reading the file a different way 1603 ;; not found, try reading the file a different way
1604 ;; 1604 ;;
1605 ;; if M-H-S not found and (a-M-H-S is nil or not found) 1605 ;; if M-H-S not found and (a-M-H-S is nil or not found)
1606 (if (and (not (feedmail-find-eoh t)) 1606 (if (and (not (feedmail-find-eoh t))
1607 (or (not feedmail-queue-alternative-mail-header-separator) 1607 (or (not feedmail-queue-alternative-mail-header-separator)
1608 (not 1608 (not
1609 (let ((mail-header-separator feedmail-queue-alternative-mail-header-separator)) 1609 (let ((mail-header-separator feedmail-queue-alternative-mail-header-separator))
1610 (feedmail-find-eoh t))))) 1610 (feedmail-find-eoh t)))))
1611 (let ((file-name-buffer-file-type-alist nil) (default-buffer-file-type nil)) 1611 (let ((file-name-buffer-file-type-alist nil) (default-buffer-file-type nil))
1612 (erase-buffer) (insert-file-contents maybe-file)) 1612 (erase-buffer) (insert-file-contents maybe-file))
1613 ) 1613 )
1614 ;; if M-H-S not found and (a-M-H-S is non-nil and is found) 1614 ;; if M-H-S not found and (a-M-H-S is non-nil and is found)
1615 ;; temporarily set M-H-S to the value of a-M-H-S 1615 ;; temporarily set M-H-S to the value of a-M-H-S
1616 (if (and (not (feedmail-find-eoh t)) 1616 (if (and (not (feedmail-find-eoh t))
1617 feedmail-queue-alternative-mail-header-separator 1617 feedmail-queue-alternative-mail-header-separator
1618 (let ((mail-header-separator feedmail-queue-alternative-mail-header-separator)) 1618 (let ((mail-header-separator feedmail-queue-alternative-mail-header-separator))
1619 (feedmail-find-eoh t))) 1619 (feedmail-find-eoh t)))
1620 (setq this-mhsep feedmail-queue-alternative-mail-header-separator) 1620 (setq this-mhsep feedmail-queue-alternative-mail-header-separator)
1621 (setq this-mhsep mail-header-separator)) 1621 (setq this-mhsep mail-header-separator))
1622 (funcall feedmail-queue-runner-mode-setter arg) 1622 (funcall feedmail-queue-runner-mode-setter arg)
1623 (condition-case nil ; don't give up the loop if user skips some 1623 (condition-case nil ; don't give up the loop if user skips some
1624 (let ((feedmail-enable-queue nil) 1624 (let ((feedmail-enable-queue nil)
1625 (mail-header-separator this-mhsep) 1625 (mail-header-separator this-mhsep)
1626 (feedmail-queue-runner-is-active maybe-file)) 1626 (feedmail-queue-runner-is-active maybe-file))
1627 (funcall feedmail-queue-runner-message-sender arg) 1627 (funcall feedmail-queue-runner-message-sender arg)
1628 (set-buffer blobby-buffer) 1628 (set-buffer blobby-buffer)
1629 (if (buffer-modified-p) ; still modified, means wasn't sent 1629 (if (buffer-modified-p) ; still modified, means wasn't sent
1630 (setq messages-skipped (1+ messages-skipped)) 1630 (setq messages-skipped (1+ messages-skipped))
1631 (setq messages-sent (1+ messages-sent)) 1631 (setq messages-sent (1+ messages-sent))
1632 (funcall feedmail-queue-runner-cleaner-upper maybe-file arg) 1632 (funcall feedmail-queue-runner-cleaner-upper maybe-file arg)
1633 (if (and already-buffer (not (file-exists-p maybe-file))) 1633 (if (and already-buffer (not (file-exists-p maybe-file)))
1634 ;; we have gotten rid of the file associated with the 1634 ;; we have gotten rid of the file associated with the
1635 ;; buffer, so update the buffer's notion of that 1635 ;; buffer, so update the buffer's notion of that
1636 (save-excursion 1636 (save-excursion
1637 (set-buffer already-buffer) 1637 (set-buffer already-buffer)
1638 (setq buffer-file-name nil))))) 1638 (setq buffer-file-name nil)))))
1639 (error (setq messages-skipped (1+ messages-skipped)))) 1639 (error (setq messages-skipped (1+ messages-skipped))))
1640 (kill-buffer blobby-buffer) 1640 (kill-buffer blobby-buffer)
1641 (if feedmail-queue-chatty 1641 (if feedmail-queue-chatty
1642 (progn 1642 (progn
1643 (message "FQM: %d to go, %d sent, %d skipped (%d other files ignored)" 1643 (message "FQM: %d to go, %d sent, %d skipped (%d other files ignored)"
1644 (- q-cnt messages-sent messages-skipped) 1644 (- q-cnt messages-sent messages-skipped)
1645 messages-sent messages-skipped q-oth) 1645 messages-sent messages-skipped q-oth)
1646 (sit-for feedmail-queue-chatty-sit-for)))))) 1646 (sit-for feedmail-queue-chatty-sit-for))))))
1647 list-of-possible-fqms))) 1647 list-of-possible-fqms)))
1648 (if feedmail-queue-chatty 1648 (if feedmail-queue-chatty
1649 (progn 1649 (progn
1650 (message "FQM: %d sent, %d skipped (%d other files ignored)" 1650 (message "FQM: %d sent, %d skipped (%d other files ignored)"
1651 messages-sent messages-skipped q-oth) 1651 messages-sent messages-skipped q-oth)
1652 (sit-for feedmail-queue-chatty-sit-for) 1652 (sit-for feedmail-queue-chatty-sit-for)
1653 (feedmail-queue-reminder 'after-run) 1653 (feedmail-queue-reminder 'after-run)
1654 (sit-for feedmail-queue-chatty-sit-for))) 1654 (sit-for feedmail-queue-chatty-sit-for)))
1655 (list messages-sent messages-skipped q-oth))) 1655 (list messages-sent messages-skipped q-oth)))
1656 1656
1657 1657
1658;;;###autoload 1658;;;###autoload
@@ -1676,9 +1676,9 @@ by redefining feedmail-queue-reminder-alist. If you don't want any reminders,
1676you can set feedmail-queue-reminder-alist to nil." 1676you can set feedmail-queue-reminder-alist to nil."
1677 (interactive "p") 1677 (interactive "p")
1678 (let ((key (if (and what-event (symbolp what-event)) what-event 'on-demand)) entry reminder) 1678 (let ((key (if (and what-event (symbolp what-event)) what-event 'on-demand)) entry reminder)
1679 (setq entry (assoc key feedmail-queue-reminder-alist)) 1679 (setq entry (assoc key feedmail-queue-reminder-alist))
1680 (setq reminder (cdr entry)) 1680 (setq reminder (cdr entry))
1681 (if (fboundp reminder) (funcall reminder))) 1681 (if (fboundp reminder) (funcall reminder)))
1682 ) 1682 )
1683 1683
1684 1684
@@ -1686,13 +1686,13 @@ you can set feedmail-queue-reminder-alist to nil."
1686 "Brief display of draft and queued message counts in modeline." 1686 "Brief display of draft and queued message counts in modeline."
1687 (interactive) 1687 (interactive)
1688 (let (q-cnt d-cnt q-lis d-lis) 1688 (let (q-cnt d-cnt q-lis d-lis)
1689 (setq q-lis (feedmail-look-at-queue-directory feedmail-queue-directory)) 1689 (setq q-lis (feedmail-look-at-queue-directory feedmail-queue-directory))
1690 (setq d-lis (feedmail-look-at-queue-directory feedmail-queue-draft-directory)) 1690 (setq d-lis (feedmail-look-at-queue-directory feedmail-queue-draft-directory))
1691 (setq q-cnt (car q-lis)) 1691 (setq q-cnt (car q-lis))
1692 (setq d-cnt (car d-lis)) 1692 (setq d-cnt (car d-lis))
1693 (if (or (> q-cnt 0) (> d-cnt 0)) 1693 (if (or (> q-cnt 0) (> d-cnt 0))
1694 (progn 1694 (progn
1695 (message "FQM: [D: %d, Q: %d]" d-cnt q-cnt)))) 1695 (message "FQM: [D: %d, Q: %d]" d-cnt q-cnt))))
1696 ) 1696 )
1697 1697
1698 1698
@@ -1700,17 +1700,17 @@ you can set feedmail-queue-reminder-alist to nil."
1700 "Verbose display of draft and queued message counts in modeline." 1700 "Verbose display of draft and queued message counts in modeline."
1701 (interactive) 1701 (interactive)
1702 (let (q-cnt d-cnt q-oth d-oth q-lis d-lis) 1702 (let (q-cnt d-cnt q-oth d-oth q-lis d-lis)
1703 (setq q-lis (feedmail-look-at-queue-directory feedmail-queue-directory)) 1703 (setq q-lis (feedmail-look-at-queue-directory feedmail-queue-directory))
1704 (setq d-lis (feedmail-look-at-queue-directory feedmail-queue-draft-directory)) 1704 (setq d-lis (feedmail-look-at-queue-directory feedmail-queue-draft-directory))
1705 (setq q-cnt (car q-lis)) 1705 (setq q-cnt (car q-lis))
1706 (setq d-cnt (car d-lis)) 1706 (setq d-cnt (car d-lis))
1707 (setq q-oth (nth 1 q-lis)) 1707 (setq q-oth (nth 1 q-lis))
1708 (setq d-oth (nth 1 d-lis)) 1708 (setq d-oth (nth 1 d-lis))
1709 (if (or (> q-cnt 0) (> d-cnt 0)) 1709 (if (or (> q-cnt 0) (> d-cnt 0))
1710 (progn 1710 (progn
1711 (message "FQM: Draft: %dm+%d in \"%s\", Queue: %dm+%d in \"%s\"" 1711 (message "FQM: Draft: %dm+%d in \"%s\", Queue: %dm+%d in \"%s\""
1712 d-cnt d-oth (file-name-nondirectory feedmail-queue-draft-directory) 1712 d-cnt d-oth (file-name-nondirectory feedmail-queue-draft-directory)
1713 q-cnt q-oth (file-name-nondirectory feedmail-queue-directory))))) 1713 q-cnt q-oth (file-name-nondirectory feedmail-queue-directory)))))
1714 ) 1714 )
1715 1715
1716 1716
@@ -1719,62 +1719,62 @@ you can set feedmail-queue-reminder-alist to nil."
1719 ;; Some implementation ideas here came from the userlock.el code 1719 ;; Some implementation ideas here came from the userlock.el code
1720 (discard-input) 1720 (discard-input)
1721 (save-window-excursion 1721 (save-window-excursion
1722 (let ((answer) (d-char) (d-string " ")) 1722 (let ((answer) (d-char) (d-string " "))
1723 (if (stringp feedmail-ask-before-queue-default) 1723 (if (stringp feedmail-ask-before-queue-default)
1724 (progn 1724 (progn
1725 (setq d-char (string-to-char feedmail-ask-before-queue-default)) 1725 (setq d-char (string-to-char feedmail-ask-before-queue-default))
1726 (setq d-string feedmail-ask-before-queue-default)) 1726 (setq d-string feedmail-ask-before-queue-default))
1727 (setq d-string (char-to-string feedmail-ask-before-queue-default)) 1727 (setq d-string (char-to-string feedmail-ask-before-queue-default))
1728 (setq d-char feedmail-ask-before-queue-default) 1728 (setq d-char feedmail-ask-before-queue-default)
1729 ) 1729 )
1730 (while (null answer) 1730 (while (null answer)
1731 (message feedmail-ask-before-queue-prompt d-string) 1731 (message feedmail-ask-before-queue-prompt d-string)
1732 (let ((user-sez 1732 (let ((user-sez
1733 (let ((inhibit-quit t) (cursor-in-echo-area t) (echo-keystrokes 0)) 1733 (let ((inhibit-quit t) (cursor-in-echo-area t) (echo-keystrokes 0))
1734 (read-char-exclusive)))) 1734 (read-char-exclusive))))
1735 (if (= user-sez help-char) 1735 (if (= user-sez help-char)
1736 (setq answer '(^ . feedmail-message-action-help)) 1736 (setq answer '(^ . feedmail-message-action-help))
1737 (if (or (eq user-sez ?\C-m) (eq user-sez ?\C-j) (eq user-sez ?y)) 1737 (if (or (eq user-sez ?\C-m) (eq user-sez ?\C-j) (eq user-sez ?y))
1738 (setq user-sez d-char)) 1738 (setq user-sez d-char))
1739 ;; these char-to-int things are because of some 1739 ;; these char-to-int things are because of some
1740 ;; incomprensible difference between the two in 1740 ;; incomprensible difference between the two in
1741 ;; byte-compiled stuff between Emacs and XEmacs 1741 ;; byte-compiled stuff between Emacs and XEmacs
1742 ;; (well, I'm sure someone could comprehend it, 1742 ;; (well, I'm sure someone could comprehend it,
1743 ;; but I say 'uncle') 1743 ;; but I say 'uncle')
1744 (setq answer (or (assoc user-sez feedmail-prompt-before-queue-user-alist) 1744 (setq answer (or (assoc user-sez feedmail-prompt-before-queue-user-alist)
1745 (and (fboundp 'char-to-int) 1745 (and (fboundp 'char-to-int)
1746 (assoc (char-to-int user-sez) feedmail-prompt-before-queue-user-alist)) 1746 (assoc (char-to-int user-sez) feedmail-prompt-before-queue-user-alist))
1747 (assoc user-sez feedmail-prompt-before-queue-standard-alist) 1747 (assoc user-sez feedmail-prompt-before-queue-standard-alist)
1748 (and (fboundp 'char-to-int) 1748 (and (fboundp 'char-to-int)
1749 (assoc (char-to-int user-sez) feedmail-prompt-before-queue-standard-alist)))) 1749 (assoc (char-to-int user-sez) feedmail-prompt-before-queue-standard-alist))))
1750 (if (or (null answer) (null (cdr answer))) 1750 (if (or (null answer) (null (cdr answer)))
1751 (progn 1751 (progn
1752 (beep) 1752 (beep)
1753 (message feedmail-ask-before-queue-reprompt d-string) 1753 (message feedmail-ask-before-queue-reprompt d-string)
1754 (sit-for 3))) 1754 (sit-for 3)))
1755 ))) 1755 )))
1756 (cdr answer) 1756 (cdr answer)
1757 ))) 1757 )))
1758 1758
1759(defconst feedmail-p-h-b-n "*FQM Help*") 1759(defconst feedmail-p-h-b-n "*FQM Help*")
1760 1760
1761(defun feedmail-queue-send-edit-prompt-help (d-string) 1761(defun feedmail-queue-send-edit-prompt-help (d-string)
1762 (let ((fqm-help (get-buffer feedmail-p-h-b-n))) 1762 (let ((fqm-help (get-buffer feedmail-p-h-b-n)))
1763 (if (and fqm-help (get-buffer-window fqm-help)) 1763 (if (and fqm-help (get-buffer-window fqm-help))
1764 (feedmail-queue-send-edit-prompt-help-later fqm-help d-string) 1764 (feedmail-queue-send-edit-prompt-help-later fqm-help d-string)
1765 (feedmail-queue-send-edit-prompt-help-first d-string)))) 1765 (feedmail-queue-send-edit-prompt-help-first d-string))))
1766 1766
1767(defun feedmail-queue-send-edit-prompt-help-later (fqm-help d-string) 1767(defun feedmail-queue-send-edit-prompt-help-later (fqm-help d-string)
1768 ;; scrolling fun 1768 ;; scrolling fun
1769 (save-selected-window 1769 (save-selected-window
1770 (let ((signal-error-on-buffer-boundary nil) 1770 (let ((signal-error-on-buffer-boundary nil)
1771 (fqm-window (display-buffer fqm-help))) 1771 (fqm-window (display-buffer fqm-help)))
1772 (select-window fqm-window) 1772 (select-window fqm-window)
1773 (if (pos-visible-in-window-p (point-max) fqm-window) 1773 (if (pos-visible-in-window-p (point-max) fqm-window)
1774 (feedmail-queue-send-edit-prompt-help-first d-string) 1774 (feedmail-queue-send-edit-prompt-help-first d-string)
1775;; (goto-char (point-min)) 1775 ;;(goto-char (point-min))
1776 (scroll-up nil) 1776 (scroll-up nil)
1777 )))) 1777 ))))
1778 1778
1779(defun feedmail-queue-send-edit-prompt-help-first (d-string) 1779(defun feedmail-queue-send-edit-prompt-help-first (d-string)
1780 (with-output-to-temp-buffer feedmail-p-h-b-n 1780 (with-output-to-temp-buffer feedmail-p-h-b-n
@@ -1800,12 +1800,12 @@ Synonyms:
1800 y YUP do the default behavior (same as \"C-m\") 1800 y YUP do the default behavior (same as \"C-m\")
1801 1801
1802The user-configurable default is currently \"") 1802The user-configurable default is currently \"")
1803 (princ d-string) 1803 (princ d-string)
1804 (princ "\". For other possibilities, 1804 (princ "\". For other possibilities,
1805see the variable feedmail-prompt-before-queue-user-alist. 1805see the variable feedmail-prompt-before-queue-user-alist.
1806") 1806")
1807 (and (stringp feedmail-prompt-before-queue-help-supplement) 1807 (and (stringp feedmail-prompt-before-queue-help-supplement)
1808 (princ feedmail-prompt-before-queue-help-supplement)) 1808 (princ feedmail-prompt-before-queue-help-supplement))
1809 (save-excursion (set-buffer standard-output) (if (fboundp 'help-mode) (help-mode))))) 1809 (save-excursion (set-buffer standard-output) (if (fboundp 'help-mode) (help-mode)))))
1810 1810
1811(defun feedmail-look-at-queue-directory (queue-directory) 1811(defun feedmail-look-at-queue-directory (queue-directory)
@@ -1815,23 +1815,23 @@ directory, a count of other files in the directory, and a high water
1815mark for prefix sequence numbers. Subdirectories are not included in 1815mark for prefix sequence numbers. Subdirectories are not included in
1816the counts." 1816the counts."
1817 (let ((q-cnt 0) (q-oth 0) (high-water 0) (blobbet)) 1817 (let ((q-cnt 0) (q-oth 0) (high-water 0) (blobbet))
1818 ;; iterate, counting things we find along the way in the directory 1818 ;; iterate, counting things we find along the way in the directory
1819 (if (file-directory-p queue-directory) 1819 (if (file-directory-p queue-directory)
1820 (mapcar 1820 (mapcar
1821 '(lambda (blobby) 1821 '(lambda (blobby)
1822 (cond 1822 (cond
1823 ((file-directory-p blobby) nil) ; don't care about subdirs 1823 ((file-directory-p blobby) nil) ; don't care about subdirs
1824 ((feedmail-fqm-p blobby) 1824 ((feedmail-fqm-p blobby)
1825 (setq blobbet (file-name-nondirectory blobby)) 1825 (setq blobbet (file-name-nondirectory blobby))
1826 (if (string-match "^[0-9][0-9][0-9]-" blobbet) 1826 (if (string-match "^[0-9][0-9][0-9]-" blobbet)
1827 (let ((water-mark)) 1827 (let ((water-mark))
1828 (setq water-mark (string-to-int (substring blobbet 0 3))) 1828 (setq water-mark (string-to-int (substring blobbet 0 3)))
1829 (if (> water-mark high-water) (setq high-water water-mark)))) 1829 (if (> water-mark high-water) (setq high-water water-mark))))
1830 (setq q-cnt (1+ q-cnt))) 1830 (setq q-cnt (1+ q-cnt)))
1831 (t (setq q-oth (1+ q-oth))) 1831 (t (setq q-oth (1+ q-oth)))
1832 )) 1832 ))
1833 (directory-files queue-directory t))) 1833 (directory-files queue-directory t)))
1834 (list q-cnt q-oth high-water))) 1834 (list q-cnt q-oth high-water)))
1835 1835
1836(defun feedmail-tidy-up-slug (slug) 1836(defun feedmail-tidy-up-slug (slug)
1837 "Utility for mapping out suspect characters in a potential filename." 1837 "Utility for mapping out suspect characters in a potential filename."
@@ -1846,7 +1846,7 @@ the counts."
1846 ;; for tidyness, peel off trailing hyphens 1846 ;; for tidyness, peel off trailing hyphens
1847 (if (string-match "-*$" slug) (setq slug (replace-match "" nil nil slug))) 1847 (if (string-match "-*$" slug) (setq slug (replace-match "" nil nil slug)))
1848 slug 1848 slug
1849) 1849 )
1850 1850
1851(defun feedmail-queue-subject-slug-maker (&optional queue-directory) 1851(defun feedmail-queue-subject-slug-maker (&optional queue-directory)
1852 "Create a name for storing the message in the queue. 1852 "Create a name for storing the message in the queue.
@@ -1856,274 +1856,277 @@ there is one). If there is no subject,
1856feedmail-queue-default-file-slug is consulted Special characters are 1856feedmail-queue-default-file-slug is consulted Special characters are
1857mapped to mostly alphanumerics for safety." 1857mapped to mostly alphanumerics for safety."
1858 (let ((eoh-marker) (case-fold-search t) (subject "") (s-point)) 1858 (let ((eoh-marker) (case-fold-search t) (subject "") (s-point))
1859 (setq eoh-marker (feedmail-find-eoh)) 1859 (setq eoh-marker (feedmail-find-eoh))
1860 (goto-char (point-min)) 1860 (goto-char (point-min))
1861 ;; get raw subject value (first line, anyhow) 1861 ;; get raw subject value (first line, anyhow)
1862 (if (re-search-forward "^SUBJECT:" eoh-marker t) 1862 (if (re-search-forward "^SUBJECT:" eoh-marker t)
1863 (progn (setq s-point (point)) 1863 (progn (setq s-point (point))
1864 (end-of-line) 1864 (end-of-line)
1865 (setq subject (buffer-substring s-point (point))))) 1865 (setq subject (buffer-substring s-point (point)))))
1866 (setq subject (feedmail-tidy-up-slug subject)) 1866 (setq subject (feedmail-tidy-up-slug subject))
1867 (if (zerop (length subject)) 1867 (if (zerop (length subject))
1868 (setq subject 1868 (setq subject
1869 (cond 1869 (cond
1870 ((stringp feedmail-queue-default-file-slug) feedmail-queue-default-file-slug) 1870 ((stringp feedmail-queue-default-file-slug) feedmail-queue-default-file-slug)
1871 ((fboundp feedmail-queue-default-file-slug) 1871 ((fboundp feedmail-queue-default-file-slug)
1872 (save-excursion (funcall feedmail-queue-default-file-slug))) 1872 (save-excursion (funcall feedmail-queue-default-file-slug)))
1873 ((eq feedmail-queue-default-file-slug 'ask) 1873 ((eq feedmail-queue-default-file-slug 'ask)
1874 (file-name-nondirectory 1874 (file-name-nondirectory
1875 (read-file-name "FQM: Message filename slug? " 1875 (read-file-name "FQM: Message filename slug? "
1876 (file-name-as-directory queue-directory) subject nil subject))) 1876 (file-name-as-directory queue-directory) subject nil subject)))
1877 (t "no subject")) 1877 (t "no subject"))
1878 )) 1878 ))
1879 (feedmail-tidy-up-slug subject) ;; one more time, with feeling 1879 ;; one more time, with feeling
1880 )) 1880 (feedmail-tidy-up-slug subject)
1881 ))
1881 1882
1882 1883
1883(defun feedmail-create-queue-filename (queue-directory) 1884(defun feedmail-create-queue-filename (queue-directory)
1884 (let ((slug "wjc")) 1885 (let ((slug "wjc"))
1885 (cond 1886 (cond
1886 (feedmail-queue-slug-maker 1887 (feedmail-queue-slug-maker
1887 (save-excursion (setq slug (funcall feedmail-queue-slug-maker queue-directory)))) 1888 (save-excursion (setq slug (funcall feedmail-queue-slug-maker queue-directory))))
1888 (feedmail-ask-for-queue-slug 1889 (feedmail-ask-for-queue-slug
1889 (setq slug (file-name-nondirectory 1890 (setq slug (file-name-nondirectory
1890 (read-file-name (concat "FQM: Message filename slug? [" slug "]? ") 1891 (read-file-name (concat "FQM: Message filename slug? [" slug "]? ")
1891 (file-name-as-directory queue-directory) slug nil slug)))) 1892 (file-name-as-directory queue-directory) slug nil slug))))
1892 ) 1893 )
1893 (setq slug (feedmail-tidy-up-slug slug)) 1894 (setq slug (feedmail-tidy-up-slug slug))
1894 (setq slug (format "%03d-%s" (1+ (nth 2 (feedmail-look-at-queue-directory queue-directory))) slug)) 1895 (setq slug (format "%03d-%s" (1+ (nth 2 (feedmail-look-at-queue-directory queue-directory))) slug))
1895 (concat 1896 (concat
1896 (expand-file-name slug queue-directory) 1897 (expand-file-name slug queue-directory)
1897 feedmail-queue-fqm-suffix) 1898 feedmail-queue-fqm-suffix)
1898 )) 1899 ))
1899 1900
1900 1901
1901(defun feedmail-dump-message-to-queue (queue-directory what-event) 1902(defun feedmail-dump-message-to-queue (queue-directory what-event)
1902 (or (file-accessible-directory-p queue-directory) 1903 (or (file-accessible-directory-p queue-directory)
1903 ;; progn to get nil result no matter what 1904 ;; progn to get nil result no matter what
1904 (progn (make-directory queue-directory t) nil) 1905 (progn (make-directory queue-directory t) nil)
1905 (file-accessible-directory-p queue-directory) 1906 (file-accessible-directory-p queue-directory)
1906 (error (concat "FQM: Message not queued; trouble with directory " queue-directory))) 1907 (error (concat "FQM: Message not queued; trouble with directory " queue-directory)))
1907 (let ((filename) 1908 (let ((filename)
1908 (is-fqm) 1909 (is-fqm)
1909 (is-in-this-dir) 1910 (is-in-this-dir)
1910 (previous-buffer-file-name buffer-file-name)) 1911 (previous-buffer-file-name buffer-file-name))
1911 (if buffer-file-name 1912 (if buffer-file-name
1912 (progn 1913 (progn
1913 (setq is-fqm (feedmail-fqm-p buffer-file-name)) 1914 (setq is-fqm (feedmail-fqm-p buffer-file-name))
1914 (setq is-in-this-dir (string-equal 1915 (setq is-in-this-dir (string-equal
1915 (directory-file-name queue-directory) 1916 (directory-file-name queue-directory)
1916 (directory-file-name (expand-file-name (file-name-directory buffer-file-name))))))) 1917 (directory-file-name (expand-file-name (file-name-directory buffer-file-name)))))))
1917 ;; if visiting a queued message, just save 1918 ;; if visiting a queued message, just save
1918 (if (and is-fqm is-in-this-dir) 1919 (if (and is-fqm is-in-this-dir)
1919 (setq filename buffer-file-name) 1920 (setq filename buffer-file-name)
1920 (setq filename (feedmail-create-queue-filename queue-directory))) 1921 (setq filename (feedmail-create-queue-filename queue-directory)))
1921 ;; make binary file on DOS/Win95/WinNT, etc 1922 ;; make binary file on DOS/Win95/WinNT, etc
1922 (let ((buffer-file-type feedmail-force-binary-write)) (write-file filename)) 1923 (let ((buffer-file-type feedmail-force-binary-write)) (write-file filename))
1923 ;; convenient for moving from draft to q, for example 1924 ;; convenient for moving from draft to q, for example
1924 (if (and previous-buffer-file-name (or (not is-fqm) (not is-in-this-dir)) 1925 (if (and previous-buffer-file-name (or (not is-fqm) (not is-in-this-dir))
1925 (y-or-n-p (format "FQM: Was previously %s; delete that? " previous-buffer-file-name))) 1926 (y-or-n-p (format "FQM: Was previously %s; delete that? " previous-buffer-file-name)))
1926 (delete-file previous-buffer-file-name)) 1927 (delete-file previous-buffer-file-name))
1927 (if feedmail-nuke-buffer-after-queue 1928 (if feedmail-nuke-buffer-after-queue
1928 (let ((a-s-file-name buffer-auto-save-file-name)) 1929 (let ((a-s-file-name buffer-auto-save-file-name))
1929 ;; be aggressive in nuking auto-save files 1930 ;; be aggressive in nuking auto-save files
1930 (and (kill-buffer (current-buffer)) 1931 (and (kill-buffer (current-buffer))
1931 delete-auto-save-files 1932 delete-auto-save-files
1932 (file-exists-p a-s-file-name) 1933 (file-exists-p a-s-file-name)
1933 (delete-file a-s-file-name)))) 1934 (delete-file a-s-file-name))))
1934 (if feedmail-queue-chatty 1935 (if feedmail-queue-chatty
1935 (progn (message (concat "FQM: Queued in " filename)) 1936 (progn (message (concat "FQM: Queued in " filename))
1936 (sit-for feedmail-queue-chatty-sit-for))) 1937 (sit-for feedmail-queue-chatty-sit-for)))
1937 (if feedmail-queue-chatty 1938 (if feedmail-queue-chatty
1938 (progn 1939 (progn
1939 (feedmail-queue-reminder what-event) 1940 (feedmail-queue-reminder what-event)
1940 (sit-for feedmail-queue-chatty-sit-for))))) 1941 (sit-for feedmail-queue-chatty-sit-for)))))
1941 1942
1942 1943
1943;; from a similar function in mail-utils.el 1944;; from a similar function in mail-utils.el
1944(defun feedmail-rfc822-time-zone (time) 1945(defun feedmail-rfc822-time-zone (time)
1945 (let* ((sec (or (car (current-time-zone time)) 0)) 1946 (let* ((sec (or (car (current-time-zone time)) 0))
1946 (absmin (/ (abs sec) 60))) 1947 (absmin (/ (abs sec) 60)))
1947 (format "%c%02d%02d" (if (< sec 0) ?- ?+) (/ absmin 60) (% absmin 60)))) 1948 (format "%c%02d%02d" (if (< sec 0) ?- ?+) (/ absmin 60) (% absmin 60))))
1948 1949
1949(defun feedmail-rfc822-date (arg-time) 1950(defun feedmail-rfc822-date (arg-time)
1950 (let ((time (if arg-time arg-time (current-time)))) 1951 (let ((time (if arg-time arg-time (current-time))))
1951 (concat 1952 (concat
1952 (format-time-string "%a, %e %b %Y %T " time) 1953 (format-time-string "%a, %e %b %Y %T " time)
1953 (feedmail-rfc822-time-zone time) 1954 (feedmail-rfc822-time-zone time)
1954 ))) 1955 )))
1955 1956
1956 1957
1957(defun feedmail-send-it-immediately () 1958(defun feedmail-send-it-immediately ()
1958 "Handle immediate sending, including during a queue run." 1959 "Handle immediate sending, including during a queue run."
1959 (let* ((feedmail-error-buffer (get-buffer-create " *FQM Outgoing Email Errors*")) 1960 (let* ((feedmail-error-buffer (get-buffer-create " *FQM Outgoing Email Errors*"))
1960 (feedmail-prepped-text-buffer (get-buffer-create " *FQM Outgoing Email Text*")) 1961 (feedmail-prepped-text-buffer (get-buffer-create " *FQM Outgoing Email Text*"))
1961 (feedmail-raw-text-buffer (current-buffer)) 1962 (feedmail-raw-text-buffer (current-buffer))
1962 (feedmail-address-list) 1963 (feedmail-address-list)
1963 (eoh-marker) 1964 (eoh-marker)
1964 (bcc-holder) 1965 (bcc-holder)
1965 (resent-bcc-holder) 1966 (resent-bcc-holder)
1966 (a-re-rtcb "^RESENT-\\(TO\\|CC\\|BCC\\):") 1967 (a-re-rtcb "^RESENT-\\(TO\\|CC\\|BCC\\):")
1967 (a-re-rtc "^RESENT-\\(TO\\|CC\\):") 1968 (a-re-rtc "^RESENT-\\(TO\\|CC\\):")
1968 (a-re-rb "^RESENT-BCC:") 1969 (a-re-rb "^RESENT-BCC:")
1969 (a-re-dtcb "^\\(TO\\|CC\\|BCC\\):") 1970 (a-re-dtcb "^\\(TO\\|CC\\|BCC\\):")
1970 (a-re-dtc "^\\(TO\\|CC\\):") 1971 (a-re-dtc "^\\(TO\\|CC\\):")
1971 (a-re-db "^BCC:") 1972 (a-re-db "^BCC:")
1972 (mail-header-separator mail-header-separator) ;; to get a temporary changable copy 1973 ;; to get a temporary changable copy
1973 ) 1974 (mail-header-separator mail-header-separator)
1975 )
1974 (unwind-protect 1976 (unwind-protect
1975 (save-excursion 1977 (save-excursion
1976 (set-buffer feedmail-error-buffer) (erase-buffer) 1978 (set-buffer feedmail-error-buffer) (erase-buffer)
1977 (set-buffer feedmail-prepped-text-buffer) (erase-buffer) 1979 (set-buffer feedmail-prepped-text-buffer) (erase-buffer)
1978 1980
1979 ;; jam contents of user-supplied mail buffer into our scratch buffer 1981 ;; jam contents of user-supplied mail buffer into our scratch buffer
1980 (insert-buffer feedmail-raw-text-buffer) 1982 (insert-buffer feedmail-raw-text-buffer)
1981 1983
1982 ;; require one newline at the end. 1984 ;; require one newline at the end.
1983 (goto-char (point-max)) 1985 (goto-char (point-max))
1984 (or (= (preceding-char) ?\n) (insert ?\n)) 1986 (or (= (preceding-char) ?\n) (insert ?\n))
1985 1987
1986 (let ((case-fold-search nil)) 1988 (let ((case-fold-search nil))
1987 ;; Change header-delimiter to be what mailers expect (empty line). 1989 ;; Change header-delimiter to be what mailers expect (empty line).
1988 (setq eoh-marker (feedmail-find-eoh)) ;; leaves match data in place or signals error 1990 ;; leaves match data in place or signals error
1989 (replace-match "\n") 1991 (setq eoh-marker (feedmail-find-eoh))
1990 (setq mail-header-separator "")) 1992 (replace-match "\n")
1991 1993 (setq mail-header-separator ""))
1992 ;; mail-aliases nil = mail-abbrevs.el 1994
1993 (if (or feedmail-force-expand-mail-aliases 1995 ;; mail-aliases nil = mail-abbrevs.el
1994 (and (fboundp 'expand-mail-aliases) mail-aliases)) 1996 (if (or feedmail-force-expand-mail-aliases
1995 (expand-mail-aliases (point-min) eoh-marker)) 1997 (and (fboundp 'expand-mail-aliases) mail-aliases))
1996 1998 (expand-mail-aliases (point-min) eoh-marker))
1997 ;; make it pretty 1999
1998 (if feedmail-fill-to-cc (feedmail-fill-to-cc-function eoh-marker)) 2000 ;; make it pretty
1999 ;; ignore any blank lines in the header 2001 (if feedmail-fill-to-cc (feedmail-fill-to-cc-function eoh-marker))
2002 ;; ignore any blank lines in the header
2003 (goto-char (point-min))
2004 (while (and (re-search-forward "\n\n\n*" eoh-marker t) (< (point) eoh-marker))
2005 (replace-match "\n"))
2006
2007 (let ((case-fold-search t) (addr-regexp))
2008 (goto-char (point-min))
2009 ;; there are some RFC-822 combinations/cases missed here,
2010 ;; but probably good enough and what users expect
2011 ;;
2012 ;; use resent-* stuff only if there is at least one non-empty one
2013 (setq feedmail-is-a-resend
2014 (re-search-forward
2015 ;; header name, followed by optional whitespace, followed by
2016 ;; non-whitespace, followed by anything, followed by newline;
2017 ;; the idea is empty RESENT-* headers are ignored
2018 "^\\(RESENT-TO:\\|RESENT-CC:\\|RESENT-BCC:\\)\\s-*\\S-+.*$"
2019 eoh-marker t))
2020 ;; if we say so, gather the BCC stuff before the main course
2021 (if (eq feedmail-deduce-bcc-where 'first)
2022 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db))
2023 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
2024 ;; the main course
2025 (if (or (eq feedmail-deduce-bcc-where 'first) (eq feedmail-deduce-bcc-where 'last))
2026 ;; handled by first or last cases, so don't get BCC stuff
2027 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtc) (setq addr-regexp a-re-dtc))
2028 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list)))
2029 ;; not handled by first or last cases, so also get BCC stuff
2030 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtcb) (setq addr-regexp a-re-dtcb))
2031 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
2032 ;; if we say so, gather the BCC stuff after the main course
2033 (if (eq feedmail-deduce-bcc-where 'last)
2034 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db))
2035 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
2036 (if (not feedmail-address-list) (error "FQM: Sending...abandoned, no addressees"))
2037 ;; not needed, but meets user expectations
2038 (setq feedmail-address-list (nreverse feedmail-address-list))
2039 ;; Find and handle any BCC fields.
2040 (setq bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^BCC:"))
2041 (setq resent-bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^RESENT-BCC:"))
2042 (if (and bcc-holder (not feedmail-nuke-bcc))
2043 (progn (goto-char (point-min))
2044 (insert bcc-holder)))
2045 (if (and resent-bcc-holder (not feedmail-nuke-resent-bcc))
2046 (progn (goto-char (point-min))
2047 (insert resent-bcc-holder)))
2048 (goto-char (point-min))
2049
2050 ;; fiddle about, fiddle about, fiddle about....
2051 (feedmail-fiddle-from)
2052 (feedmail-fiddle-sender)
2053 (feedmail-fiddle-x-mailer)
2054 (feedmail-fiddle-message-id
2055 (or feedmail-queue-runner-is-active (buffer-file-name feedmail-raw-text-buffer)))
2056 (feedmail-fiddle-date
2057 (or feedmail-queue-runner-is-active (buffer-file-name feedmail-raw-text-buffer)))
2058 (feedmail-fiddle-list-of-fiddle-plexes feedmail-fiddle-plex-user-list)
2059
2060 ;; don't send out a blank headers of various sorts
2061 ;; (this loses on continued line with a blank first line)
2062 (goto-char (point-min))
2063 (and feedmail-nuke-empty-headers ; hey, who's an empty-header?
2064 (while (re-search-forward "^[A-Za-z0-9-]+:[ \t]*\n" eoh-marker t)
2065 (replace-match ""))))
2066
2067 (run-hooks 'feedmail-last-chance-hook)
2068
2069 (let ((fcc (feedmail-accume-n-nuke-header eoh-marker "^FCC:"))
2070 (also-file)
2071 (confirm (cond
2072 ((eq feedmail-confirm-outgoing 'immediate)
2073 (not feedmail-queue-runner-is-active))
2074 ((eq feedmail-confirm-outgoing 'queued) feedmail-queue-runner-is-active)
2075 (t feedmail-confirm-outgoing))))
2076 (if (or (not confirm) (feedmail-one-last-look feedmail-prepped-text-buffer))
2077 (let ((user-mail-address (feedmail-envelope-deducer eoh-marker)))
2078 (feedmail-give-it-to-buffer-eater)
2079 (if (and (not feedmail-queue-runner-is-active) (setq also-file (buffer-file-name feedmail-raw-text-buffer)))
2080 (progn ; if a file but not running the queue, offer to delete it
2081 (setq also-file (expand-file-name also-file))
2082 (if (or feedmail-queue-auto-file-nuke
2083 (y-or-n-p (format "FQM: Delete message file %s? " also-file)))
2084 (save-excursion
2085 ;; if we delete the affiliated file, get rid
2086 ;; of the file name association and make sure we
2087 ;; don't annoy people with a prompt on exit
2088 (delete-file also-file)
2089 (set-buffer feedmail-raw-text-buffer)
2090 (setq buffer-offer-save nil)
2091 (setq buffer-file-name nil)
2092 )
2093 )))
2000 (goto-char (point-min)) 2094 (goto-char (point-min))
2001 (while (and (re-search-forward "\n\n\n*" eoh-marker t) (< (point) eoh-marker)) 2095 ;; re-insert and handle any FCC fields (and, optionally, any BCC).
2002 (replace-match "\n")) 2096 (if fcc (let ((default-buffer-file-type feedmail-force-binary-write))
2003 2097 (insert fcc)
2004 (let ((case-fold-search t) (addr-regexp)) 2098 (if (not feedmail-nuke-bcc-in-fcc)
2005 (goto-char (point-min)) 2099 (progn (if bcc-holder (insert bcc-holder))
2006 ;; there are some RFC-822 combinations/cases missed here, 2100 (if resent-bcc-holder (insert resent-bcc-holder))))
2007 ;; but probably good enough and what users expect 2101
2008 ;; 2102 (run-hooks 'feedmail-before-fcc-hook)
2009 ;; use resent-* stuff only if there is at least one non-empty one 2103
2010 (setq feedmail-is-a-resend 2104 (if feedmail-nuke-body-in-fcc
2011 (re-search-forward 2105 (progn (goto-char eoh-marker)
2012 ;; header name, followed by optional whitespace, followed by 2106 (if (natnump feedmail-nuke-body-in-fcc)
2013 ;; non-whitespace, followed by anything, followed by newline; 2107 (forward-line feedmail-nuke-body-in-fcc))
2014 ;; the idea is empty RESENT-* headers are ignored 2108 (delete-region (point) (point-max))
2015 "^\\(RESENT-TO:\\|RESENT-CC:\\|RESENT-BCC:\\)\\s-*\\S-+.*$" 2109 ))
2016 eoh-marker t)) 2110 (mail-do-fcc eoh-marker)
2017 ;; if we say so, gather the BCC stuff before the main course 2111 )))
2018 (if (eq feedmail-deduce-bcc-where 'first) 2112 (error "FQM: Sending...abandoned") ; user bailed out of one-last-look
2019 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db)) 2113 ))) ; unwind-protect body (save-excursion)
2020 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list)))) 2114
2021 ;; the main course 2115 ;; unwind-protect cleanup forms
2022 (if (or (eq feedmail-deduce-bcc-where 'first) (eq feedmail-deduce-bcc-where 'last)) 2116 (kill-buffer feedmail-prepped-text-buffer)
2023 ;; handled by first or last cases, so don't get BCC stuff 2117 (set-buffer feedmail-error-buffer)
2024 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtc) (setq addr-regexp a-re-dtc)) 2118 (if (zerop (buffer-size)) (kill-buffer feedmail-error-buffer)
2025 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))) 2119 (progn (display-buffer feedmail-error-buffer)
2026 ;; not handled by first or last cases, so also get BCC stuff 2120 ;; read fast ... the meter is running
2027 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtcb) (setq addr-regexp a-re-dtcb)) 2121 (if (and feedmail-queue-runner-is-active feedmail-queue-chatty)
2028 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list)))) 2122 (progn (message "FQM: Sending...failed") (ding t) (sit-for 3)))
2029 ;; if we say so, gather the BCC stuff after the main course 2123 (error "FQM: Sending...failed")))
2030 (if (eq feedmail-deduce-bcc-where 'last) 2124 (set-buffer feedmail-raw-text-buffer))
2031 (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db)) 2125 ) ; let
2032 (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
2033 (if (not feedmail-address-list) (error "FQM: Sending...abandoned, no addressees"))
2034 ;; not needed, but meets user expectations
2035 (setq feedmail-address-list (nreverse feedmail-address-list))
2036 ;; Find and handle any BCC fields.
2037 (setq bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^BCC:"))
2038 (setq resent-bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^RESENT-BCC:"))
2039 (if (and bcc-holder (not feedmail-nuke-bcc))
2040 (progn (goto-char (point-min))
2041 (insert bcc-holder)))
2042 (if (and resent-bcc-holder (not feedmail-nuke-resent-bcc))
2043 (progn (goto-char (point-min))
2044 (insert resent-bcc-holder)))
2045 (goto-char (point-min))
2046
2047 ;; fiddle about, fiddle about, fiddle about....
2048 (feedmail-fiddle-from)
2049 (feedmail-fiddle-sender)
2050 (feedmail-fiddle-x-mailer)
2051 (feedmail-fiddle-message-id
2052 (or feedmail-queue-runner-is-active (buffer-file-name feedmail-raw-text-buffer)))
2053 (feedmail-fiddle-date
2054 (or feedmail-queue-runner-is-active (buffer-file-name feedmail-raw-text-buffer)))
2055 (feedmail-fiddle-list-of-fiddle-plexes feedmail-fiddle-plex-user-list)
2056
2057 ;; don't send out a blank headers of various sorts
2058 ;; (this loses on continued line with a blank first line)
2059 (goto-char (point-min))
2060 (and feedmail-nuke-empty-headers ; hey, who's an empty-header?
2061 (while (re-search-forward "^[A-Za-z0-9-]+:[ \t]*\n" eoh-marker t)
2062 (replace-match ""))))
2063
2064 (run-hooks 'feedmail-last-chance-hook)
2065
2066 (let ((fcc (feedmail-accume-n-nuke-header eoh-marker "^FCC:"))
2067 (also-file)
2068 (confirm (cond
2069 ((eq feedmail-confirm-outgoing 'immediate)
2070 (not feedmail-queue-runner-is-active))
2071 ((eq feedmail-confirm-outgoing 'queued) feedmail-queue-runner-is-active)
2072 (t feedmail-confirm-outgoing))))
2073 (if (or (not confirm) (feedmail-one-last-look feedmail-prepped-text-buffer))
2074 (let ((user-mail-address (feedmail-envelope-deducer eoh-marker)))
2075 (feedmail-give-it-to-buffer-eater)
2076 (if (and (not feedmail-queue-runner-is-active) (setq also-file (buffer-file-name feedmail-raw-text-buffer)))
2077 (progn ; if a file but not running the queue, offer to delete it
2078 (setq also-file (expand-file-name also-file))
2079 (if (or feedmail-queue-auto-file-nuke
2080 (y-or-n-p (format "FQM: Delete message file %s? " also-file)))
2081 (save-excursion
2082 ;; if we delete the affiliated file, get rid
2083 ;; of the file name association and make sure we
2084 ;; don't annoy people with a prompt on exit
2085 (delete-file also-file)
2086 (set-buffer feedmail-raw-text-buffer)
2087 (setq buffer-offer-save nil)
2088 (setq buffer-file-name nil)
2089 )
2090 )))
2091 (goto-char (point-min))
2092 ;; re-insert and handle any FCC fields (and, optionally, any BCC).
2093 (if fcc (let ((default-buffer-file-type feedmail-force-binary-write))
2094 (insert fcc)
2095 (if (not feedmail-nuke-bcc-in-fcc)
2096 (progn (if bcc-holder (insert bcc-holder))
2097 (if resent-bcc-holder (insert resent-bcc-holder))))
2098
2099 (run-hooks 'feedmail-before-fcc-hook)
2100
2101 (if feedmail-nuke-body-in-fcc
2102 (progn (goto-char eoh-marker)
2103 (if (natnump feedmail-nuke-body-in-fcc)
2104 (forward-line feedmail-nuke-body-in-fcc))
2105 (delete-region (point) (point-max))
2106 ))
2107 (mail-do-fcc eoh-marker)
2108 )))
2109 (error "FQM: Sending...abandoned") ; user bailed out of one-last-look
2110 ))) ; unwind-protect body (save-excursion)
2111
2112 ;; unwind-protect cleanup forms
2113 (kill-buffer feedmail-prepped-text-buffer)
2114 (set-buffer feedmail-error-buffer)
2115 (if (zerop (buffer-size)) (kill-buffer feedmail-error-buffer)
2116 (progn (display-buffer feedmail-error-buffer)
2117 ;; read fast ... the meter is running
2118 (if (and feedmail-queue-runner-is-active feedmail-queue-chatty)
2119 (progn (message "FQM: Sending...failed") (ding t) (sit-for 3)))
2120 (error "FQM: Sending...failed")))
2121 (set-buffer feedmail-raw-text-buffer))
2122 ) ; let
2123 (if (and feedmail-queue-chatty (not feedmail-queue-runner-is-active)) 2126 (if (and feedmail-queue-chatty (not feedmail-queue-runner-is-active))
2124 (progn 2127 (progn
2125 (feedmail-queue-reminder 'after-immediate) 2128 (feedmail-queue-reminder 'after-immediate)
2126 (sit-for feedmail-queue-chatty-sit-for))) 2129 (sit-for feedmail-queue-chatty-sit-for)))
2127 ) 2130 )
2128 2131
2129 2132
@@ -2133,98 +2136,98 @@ NAME, VALUE, ACTION, and FOLDING are the four elements of a
2133fiddle-plex, as described in the documentation for the variable 2136fiddle-plex, as described in the documentation for the variable
2134feedmail-fiddle-plex-blurb." 2137feedmail-fiddle-plex-blurb."
2135 (let ((case-fold-search t) 2138 (let ((case-fold-search t)
2136 (header-colon (concat (regexp-quote name) ":")) 2139 (header-colon (concat (regexp-quote name) ":"))
2137 header-regexp eoh-marker has-like ag-like val-like that-point) 2140 header-regexp eoh-marker has-like ag-like val-like that-point)
2138 (setq header-regexp (concat "^" header-colon)) 2141 (setq header-regexp (concat "^" header-colon))
2139 (setq eoh-marker (feedmail-find-eoh)) 2142 (setq eoh-marker (feedmail-find-eoh))
2140 (goto-char (point-min)) 2143 (goto-char (point-min))
2141 (setq has-like (re-search-forward header-regexp eoh-marker t)) 2144 (setq has-like (re-search-forward header-regexp eoh-marker t))
2142 2145
2143 (if (not action) (setq action 'supplement)) 2146 (if (not action) (setq action 'supplement))
2144 (cond 2147 (cond
2145 ((eq action 'supplement) 2148 ((eq action 'supplement)
2146 ;; trim leading/trailing whitespace 2149 ;; trim leading/trailing whitespace
2147 (if (string-match "\\`[ \t\n]+" value) 2150 (if (string-match "\\`[ \t\n]+" value)
2148 (setq value (substring value (match-end 0)))) 2151 (setq value (substring value (match-end 0))))
2149 (if (string-match "[ \t\n]+\\'" value) 2152 (if (string-match "[ \t\n]+\\'" value)
2150 (setq value (substring value 0 (match-beginning 0)))) 2153 (setq value (substring value 0 (match-beginning 0))))
2151 (if (> (length value) 0) 2154 (if (> (length value) 0)
2152 (progn 2155 (progn
2153 (if feedmail-fiddle-headers-upwardly 2156 (if feedmail-fiddle-headers-upwardly
2154 (goto-char (point-min)) 2157 (goto-char (point-min))
2155 (goto-char eoh-marker)) 2158 (goto-char eoh-marker))
2156 (setq that-point (point)) 2159 (setq that-point (point))
2157 (insert name ": " value "\n") 2160 (insert name ": " value "\n")
2158 (if folding (feedmail-fill-this-one that-point (point)))))) 2161 (if folding (feedmail-fill-this-one that-point (point))))))
2159 2162
2160 ((eq action 'replace) 2163 ((eq action 'replace)
2161 (if has-like (feedmail-accume-n-nuke-header eoh-marker header-regexp)) 2164 (if has-like (feedmail-accume-n-nuke-header eoh-marker header-regexp))
2162 (feedmail-fiddle-header name value 'supplement folding)) 2165 (feedmail-fiddle-header name value 'supplement folding))
2163 2166
2164 ((eq action 'create) 2167 ((eq action 'create)
2165 (if (not has-like) (feedmail-fiddle-header name value 'supplement folding))) 2168 (if (not has-like) (feedmail-fiddle-header name value 'supplement folding)))
2166 2169
2167 ((eq action 'combine) 2170 ((eq action 'combine)
2168 (setq val-like (nth 1 value)) 2171 (setq val-like (nth 1 value))
2169 (setq ag-like (or (feedmail-accume-n-nuke-header eoh-marker header-regexp) "")) 2172 (setq ag-like (or (feedmail-accume-n-nuke-header eoh-marker header-regexp) ""))
2170 ;; get rid of initial header name from first instance (front of string) 2173 ;; get rid of initial header name from first instance (front of string)
2171 (if (string-match (concat header-regexp "[ \t\n]+") ag-like) 2174 (if (string-match (concat header-regexp "[ \t\n]+") ag-like)
2172 (setq ag-like (replace-match "" t t ag-like))) 2175 (setq ag-like (replace-match "" t t ag-like)))
2173 ;; get rid of embedded header names from subsequent instances 2176 ;; get rid of embedded header names from subsequent instances
2174 (while (string-match (concat "\n" header-colon "[ \t\n]+") ag-like) 2177 (while (string-match (concat "\n" header-colon "[ \t\n]+") ag-like)
2175 (setq ag-like (replace-match "\n\t" t t ag-like))) 2178 (setq ag-like (replace-match "\n\t" t t ag-like)))
2176 ;; trim leading/trailing whitespace 2179 ;; trim leading/trailing whitespace
2177 (if (string-match "\\`[ \t\n]+" ag-like) 2180 (if (string-match "\\`[ \t\n]+" ag-like)
2178 (setq ag-like (substring ag-like (match-end 0)))) 2181 (setq ag-like (substring ag-like (match-end 0))))
2179 (if (string-match "[ \t\n]+\\'" ag-like) 2182 (if (string-match "[ \t\n]+\\'" ag-like)
2180 (setq ag-like (substring ag-like 0 (match-beginning 0)))) 2183 (setq ag-like (substring ag-like 0 (match-beginning 0))))
2181 ;; if ag-like is not nil and not an empty string, transform it via a function 2184 ;; if ag-like is not nil and not an empty string, transform it via a function
2182 ;; call or format operation 2185 ;; call or format operation
2183 (if (> (length ag-like) 0) 2186 (if (> (length ag-like) 0)
2184 (setq ag-like 2187 (setq ag-like
2185 (cond 2188 (cond
2186 ((and (symbolp val-like) (fboundp val-like)) 2189 ((and (symbolp val-like) (fboundp val-like))
2187 (funcall val-like name ag-like)) 2190 (funcall val-like name ag-like))
2188 ((stringp val-like) 2191 ((stringp val-like)
2189 (format val-like ag-like)) 2192 (format val-like ag-like))
2190 (t nil)))) 2193 (t nil))))
2191 (feedmail-fiddle-header name (concat (nth 0 value) ag-like (nth 2 value)) 'supplement folding))) 2194 (feedmail-fiddle-header name (concat (nth 0 value) ag-like (nth 2 value)) 'supplement folding)))
2192 )) 2195 ))
2193 2196
2194(defun feedmail-give-it-to-buffer-eater () 2197(defun feedmail-give-it-to-buffer-eater ()
2195 (save-excursion 2198 (save-excursion
2196 (if feedmail-enable-spray 2199 (if feedmail-enable-spray
2197 (mapcar 2200 (mapcar
2198 '(lambda (feedmail-spray-this-address) 2201 '(lambda (feedmail-spray-this-address)
2199 (let ((spray-buffer (get-buffer-create " *FQM Outgoing Email Spray*"))) 2202 (let ((spray-buffer (get-buffer-create " *FQM Outgoing Email Spray*")))
2200 (save-excursion 2203 (save-excursion
2201 (set-buffer spray-buffer) 2204 (set-buffer spray-buffer)
2202 (erase-buffer) 2205 (erase-buffer)
2203 ;; not life's most efficient methodology, but spraying isn't 2206 ;; not life's most efficient methodology, but spraying isn't
2204 ;; an every-5-minutes event either 2207 ;; an every-5-minutes event either
2205 (insert-buffer feedmail-prepped-text-buffer) 2208 (insert-buffer feedmail-prepped-text-buffer)
2206 ;; There's a good case to me made that each separate transmission of 2209 ;; There's a good case to me made that each separate transmission of
2207 ;; a message in the spray should have a distinct MESSAGE-ID:. There 2210 ;; a message in the spray should have a distinct MESSAGE-ID:. There
2208 ;; is also a less compelling argument in the other direction. I think 2211 ;; is also a less compelling argument in the other direction. I think
2209 ;; they technically should have distinct MESSAGE-ID:s, but I doubt that 2212 ;; they technically should have distinct MESSAGE-ID:s, but I doubt that
2210 ;; anyone cares, practically. If someone complains about it, I'll add 2213 ;; anyone cares, practically. If someone complains about it, I'll add
2211 ;; it. 2214 ;; it.
2212 (feedmail-fiddle-list-of-spray-fiddle-plexes feedmail-spray-address-fiddle-plex-list) 2215 (feedmail-fiddle-list-of-spray-fiddle-plexes feedmail-spray-address-fiddle-plex-list)
2213 ;; this (let ) is just in case some buffer eater 2216 ;; this (let ) is just in case some buffer eater
2214 ;; is cheating and using the global variable name instead 2217 ;; is cheating and using the global variable name instead
2215 ;; of its argument to find the buffer 2218 ;; of its argument to find the buffer
2216 (let ((feedmail-prepped-text-buffer spray-buffer)) 2219 (let ((feedmail-prepped-text-buffer spray-buffer))
2217 (funcall feedmail-buffer-eating-function 2220 (funcall feedmail-buffer-eating-function
2218 feedmail-prepped-text-buffer
2219 feedmail-error-buffer
2220 (list feedmail-spray-this-address))))
2221 (kill-buffer spray-buffer)
2222 ))
2223 feedmail-address-list)
2224 (funcall feedmail-buffer-eating-function
2225 feedmail-prepped-text-buffer 2221 feedmail-prepped-text-buffer
2226 feedmail-error-buffer 2222 feedmail-error-buffer
2227 feedmail-address-list)))) 2223 (list feedmail-spray-this-address))))
2224 (kill-buffer spray-buffer)
2225 ))
2226 feedmail-address-list)
2227 (funcall feedmail-buffer-eating-function
2228 feedmail-prepped-text-buffer
2229 feedmail-error-buffer
2230 feedmail-address-list))))
2228 2231
2229 2232
2230(defun feedmail-envelope-deducer (eoh-marker) 2233(defun feedmail-envelope-deducer (eoh-marker)
@@ -2232,18 +2235,18 @@ feedmail-fiddle-plex-blurb."
2232Else, look for SENDER: or FROM: (or RESENT-*) and 2235Else, look for SENDER: or FROM: (or RESENT-*) and
2233return that value." 2236return that value."
2234 (if (not feedmail-deduce-envelope-from) 2237 (if (not feedmail-deduce-envelope-from)
2235 user-mail-address 2238 user-mail-address
2236 (let ((from-list)) 2239 (let ((from-list))
2240 (setq from-list
2241 (feedmail-deduce-address-list
2242 (current-buffer) (point-min) eoh-marker (if feedmail-is-a-resend "^RESENT-SENDER:" "^SENDER:")
2243 from-list))
2244 (if (not from-list)
2237 (setq from-list 2245 (setq from-list
2238 (feedmail-deduce-address-list 2246 (feedmail-deduce-address-list
2239 (current-buffer) (point-min) eoh-marker (if feedmail-is-a-resend "^RESENT-SENDER:" "^SENDER:") 2247 (current-buffer) (point-min) eoh-marker (if feedmail-is-a-resend "^RESENT-FROM:" "^FROM:")
2240 from-list)) 2248 from-list)))
2241 (if (not from-list) 2249 (if (and from-list (car from-list)) (car from-list) user-mail-address))))
2242 (setq from-list
2243 (feedmail-deduce-address-list
2244 (current-buffer) (point-min) eoh-marker (if feedmail-is-a-resend "^RESENT-FROM:" "^FROM:")
2245 from-list)))
2246 (if (and from-list (car from-list)) (car from-list) user-mail-address))))
2247 2250
2248 2251
2249(defun feedmail-fiddle-from () 2252(defun feedmail-fiddle-from ()
@@ -2257,33 +2260,33 @@ return that value."
2257 ;; improvement using user-mail-address suggested by 2260 ;; improvement using user-mail-address suggested by
2258 ;; gray@austin.apc.slb.com (Douglas Gray Stephens) 2261 ;; gray@austin.apc.slb.com (Douglas Gray Stephens)
2259 ((eq t feedmail-from-line) 2262 ((eq t feedmail-from-line)
2260 (let ((feedmail-from-line 2263 (let ((feedmail-from-line
2261 (let ((at-stuff 2264 (let ((at-stuff
2262 (if user-mail-address user-mail-address (concat (user-login-name) "@" (system-name))))) 2265 (if user-mail-address user-mail-address (concat (user-login-name) "@" (system-name)))))
2263 (cond 2266 (cond
2264 ((eq mail-from-style nil) at-stuff) 2267 ((eq mail-from-style nil) at-stuff)
2265 ((eq mail-from-style 'parens) (concat at-stuff " (" (user-full-name) ")")) 2268 ((eq mail-from-style 'parens) (concat at-stuff " (" (user-full-name) ")"))
2266 ((eq mail-from-style 'angles) (concat "\"" (user-full-name) "\" <" at-stuff ">")) 2269 ((eq mail-from-style 'angles) (concat "\"" (user-full-name) "\" <" at-stuff ">"))
2267 )))) 2270 ))))
2268 (feedmail-fiddle-from))) 2271 (feedmail-fiddle-from)))
2269 2272
2270 ;; if it's a string, simply make a fiddle-plex out of it and recurse 2273 ;; if it's a string, simply make a fiddle-plex out of it and recurse
2271 ((stringp feedmail-from-line) 2274 ((stringp feedmail-from-line)
2272 (let ((feedmail-from-line (list "ignored" feedmail-from-line 'create))) 2275 (let ((feedmail-from-line (list "ignored" feedmail-from-line 'create)))
2273 (feedmail-fiddle-from))) 2276 (feedmail-fiddle-from)))
2274 2277
2275 ;; if it's a function, call it and recurse with the resulting value 2278 ;; if it's a function, call it and recurse with the resulting value
2276 ((and (symbolp feedmail-from-line) (fboundp feedmail-from-line)) 2279 ((and (symbolp feedmail-from-line) (fboundp feedmail-from-line))
2277 (let ((feedmail-from-line (funcall feedmail-from-line))) 2280 (let ((feedmail-from-line (funcall feedmail-from-line)))
2278 (feedmail-fiddle-from))) 2281 (feedmail-fiddle-from)))
2279 2282
2280 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle 2283 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle
2281 ((listp feedmail-from-line) 2284 ((listp feedmail-from-line)
2282 (feedmail-fiddle-header 2285 (feedmail-fiddle-header
2283 (if feedmail-is-a-resend "Resent-From" "From") 2286 (if feedmail-is-a-resend "Resent-From" "From")
2284 (nth 1 feedmail-from-line) ;; value 2287 (nth 1 feedmail-from-line) ; value
2285 (nth 2 feedmail-from-line) ;; action 2288 (nth 2 feedmail-from-line) ; action
2286 (nth 3 feedmail-from-line))))) ;; folding 2289 (nth 3 feedmail-from-line))))) ; folding
2287 2290
2288 2291
2289(defun feedmail-fiddle-sender () 2292(defun feedmail-fiddle-sender ()
@@ -2297,29 +2300,29 @@ return that value."
2297 2300
2298 ;; if it's a string, simply make a fiddle-plex out of it and recurse 2301 ;; if it's a string, simply make a fiddle-plex out of it and recurse
2299 ((stringp feedmail-sender-line) 2302 ((stringp feedmail-sender-line)
2300 (let ((feedmail-sender-line (list "ignored" feedmail-sender-line 'create))) 2303 (let ((feedmail-sender-line (list "ignored" feedmail-sender-line 'create)))
2301 (feedmail-fiddle-sender))) 2304 (feedmail-fiddle-sender)))
2302 2305
2303 ;; if it's a function, call it and recurse with the resulting value 2306 ;; if it's a function, call it and recurse with the resulting value
2304 ((and (symbolp feedmail-sender-line) (fboundp feedmail-sender-line)) 2307 ((and (symbolp feedmail-sender-line) (fboundp feedmail-sender-line))
2305 (let ((feedmail-sender-line (funcall feedmail-sender-line))) 2308 (let ((feedmail-sender-line (funcall feedmail-sender-line)))
2306 (feedmail-fiddle-sender))) 2309 (feedmail-fiddle-sender)))
2307 2310
2308 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle 2311 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle
2309 ((listp feedmail-sender-line) 2312 ((listp feedmail-sender-line)
2310 (feedmail-fiddle-header 2313 (feedmail-fiddle-header
2311 (if feedmail-is-a-resend "Resent-Sender" "Sender") 2314 (if feedmail-is-a-resend "Resent-Sender" "Sender")
2312 (nth 1 feedmail-sender-line) ;; value 2315 (nth 1 feedmail-sender-line) ; value
2313 (nth 2 feedmail-sender-line) ;; action 2316 (nth 2 feedmail-sender-line) ; action
2314 (nth 3 feedmail-sender-line))))) ;; folding 2317 (nth 3 feedmail-sender-line))))) ; folding
2315 2318
2316 2319
2317(defun feedmail-default-date-generator (maybe-file) 2320(defun feedmail-default-date-generator (maybe-file)
2318 "Default function for generating DATE: header contents." 2321 "Default function for generating DATE: header contents."
2319 (let ((date-time)) 2322 (let ((date-time))
2320 (if (and (not feedmail-queue-use-send-time-for-date) maybe-file) 2323 (if (and (not feedmail-queue-use-send-time-for-date) maybe-file)
2321 (setq date-time (nth 5 (file-attributes maybe-file)))) 2324 (setq date-time (nth 5 (file-attributes maybe-file))))
2322 (feedmail-rfc822-date date-time)) 2325 (feedmail-rfc822-date date-time))
2323 ) 2326 )
2324 2327
2325 2328
@@ -2331,26 +2334,26 @@ return that value."
2331 ((eq nil feedmail-date-generator) nil) 2334 ((eq nil feedmail-date-generator) nil)
2332 ;; t is the same a using the function feedmail-default-date-generator, so let it and recurse 2335 ;; t is the same a using the function feedmail-default-date-generator, so let it and recurse
2333 ((eq t feedmail-date-generator) 2336 ((eq t feedmail-date-generator)
2334 (let ((feedmail-date-generator (feedmail-default-date-generator maybe-file))) 2337 (let ((feedmail-date-generator (feedmail-default-date-generator maybe-file)))
2335 (feedmail-fiddle-date maybe-file))) 2338 (feedmail-fiddle-date maybe-file)))
2336 2339
2337 ;; if it's a string, simply make a fiddle-plex out of it and recurse 2340 ;; if it's a string, simply make a fiddle-plex out of it and recurse
2338 ((stringp feedmail-date-generator) 2341 ((stringp feedmail-date-generator)
2339 (let ((feedmail-date-generator (list "ignored" feedmail-date-generator 'create))) 2342 (let ((feedmail-date-generator (list "ignored" feedmail-date-generator 'create)))
2340 (feedmail-fiddle-date maybe-file))) 2343 (feedmail-fiddle-date maybe-file)))
2341 2344
2342 ;; if it's a function, call it and recurse with the resulting value 2345 ;; if it's a function, call it and recurse with the resulting value
2343 ((and (symbolp feedmail-date-generator) (fboundp feedmail-date-generator)) 2346 ((and (symbolp feedmail-date-generator) (fboundp feedmail-date-generator))
2344 (let ((feedmail-date-generator (funcall feedmail-date-generator maybe-file))) 2347 (let ((feedmail-date-generator (funcall feedmail-date-generator maybe-file)))
2345 (feedmail-fiddle-date maybe-file))) 2348 (feedmail-fiddle-date maybe-file)))
2346 2349
2347 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle 2350 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle
2348 ((listp feedmail-date-generator) 2351 ((listp feedmail-date-generator)
2349 (feedmail-fiddle-header 2352 (feedmail-fiddle-header
2350 (if feedmail-is-a-resend "Resent-Date" "Date") 2353 (if feedmail-is-a-resend "Resent-Date" "Date")
2351 (nth 1 feedmail-date-generator) ;; value 2354 (nth 1 feedmail-date-generator) ; value
2352 (nth 2 feedmail-date-generator) ;; action 2355 (nth 2 feedmail-date-generator) ; action
2353 (nth 3 feedmail-date-generator))))) ;; folding 2356 (nth 3 feedmail-date-generator))))) ; folding
2354 2357
2355 2358
2356(defun feedmail-default-message-id-generator (maybe-file) 2359(defun feedmail-default-message-id-generator (maybe-file)
@@ -2359,18 +2362,18 @@ Based on a date and a sort of random number for tie breaking. Unless
2359feedmail-message-id-suffix is defined, uses `user-mail-address', so be 2362feedmail-message-id-suffix is defined, uses `user-mail-address', so be
2360sure it's set." 2363sure it's set."
2361 (let ((date-time) 2364 (let ((date-time)
2362 (end-stuff (if feedmail-message-id-suffix feedmail-message-id-suffix user-mail-address))) 2365 (end-stuff (if feedmail-message-id-suffix feedmail-message-id-suffix user-mail-address)))
2363 (if (string-match "^\\(.*\\)@" end-stuff) 2366 (if (string-match "^\\(.*\\)@" end-stuff)
2364 (setq end-stuff 2367 (setq end-stuff
2365 (concat (if (equal (match-beginning 1) (match-end 1)) "" "-") end-stuff)) 2368 (concat (if (equal (match-beginning 1) (match-end 1)) "" "-") end-stuff))
2366 (setq end-stuff (concat "@" end-stuff))) 2369 (setq end-stuff (concat "@" end-stuff)))
2367 (if (and (not feedmail-queue-use-send-time-for-message-id) maybe-file) 2370 (if (and (not feedmail-queue-use-send-time-for-message-id) maybe-file)
2368 (setq date-time (nth 5 (file-attributes maybe-file)))) 2371 (setq date-time (nth 5 (file-attributes maybe-file))))
2369 (format "<%d-%s%s%s>" 2372 (format "<%d-%s%s%s>"
2370 (mod (random) 10000) 2373 (mod (random) 10000)
2371 (format-time-string "%a%d%b%Y%H%M%S" date-time) 2374 (format-time-string "%a%d%b%Y%H%M%S" date-time)
2372 (feedmail-rfc822-time-zone date-time) 2375 (feedmail-rfc822-time-zone date-time)
2373 end-stuff)) 2376 end-stuff))
2374 ) 2377 )
2375 2378
2376(defun feedmail-fiddle-message-id (maybe-file) 2379(defun feedmail-fiddle-message-id (maybe-file)
@@ -2381,26 +2384,26 @@ sure it's set."
2381 ((eq nil feedmail-message-id-generator) nil) 2384 ((eq nil feedmail-message-id-generator) nil)
2382 ;; t is the same a using the function feedmail-default-message-id-generator, so let it and recurse 2385 ;; t is the same a using the function feedmail-default-message-id-generator, so let it and recurse
2383 ((eq t feedmail-message-id-generator) 2386 ((eq t feedmail-message-id-generator)
2384 (let ((feedmail-message-id-generator (feedmail-default-message-id-generator maybe-file))) 2387 (let ((feedmail-message-id-generator (feedmail-default-message-id-generator maybe-file)))
2385 (feedmail-fiddle-message-id maybe-file))) 2388 (feedmail-fiddle-message-id maybe-file)))
2386 2389
2387 ;; if it's a string, simply make a fiddle-plex out of it and recurse 2390 ;; if it's a string, simply make a fiddle-plex out of it and recurse
2388 ((stringp feedmail-message-id-generator) 2391 ((stringp feedmail-message-id-generator)
2389 (let ((feedmail-message-id-generator (list "ignored" feedmail-message-id-generator 'create))) 2392 (let ((feedmail-message-id-generator (list "ignored" feedmail-message-id-generator 'create)))
2390 (feedmail-fiddle-message-id maybe-file))) 2393 (feedmail-fiddle-message-id maybe-file)))
2391 2394
2392 ;; if it's a function, call it and recurse with the resulting value 2395 ;; if it's a function, call it and recurse with the resulting value
2393 ((and (symbolp feedmail-message-id-generator) (fboundp feedmail-message-id-generator)) 2396 ((and (symbolp feedmail-message-id-generator) (fboundp feedmail-message-id-generator))
2394 (let ((feedmail-message-id-generator (funcall feedmail-message-id-generator maybe-file))) 2397 (let ((feedmail-message-id-generator (funcall feedmail-message-id-generator maybe-file)))
2395 (feedmail-fiddle-message-id maybe-file))) 2398 (feedmail-fiddle-message-id maybe-file)))
2396 2399
2397 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle 2400 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle
2398 ((listp feedmail-message-id-generator) 2401 ((listp feedmail-message-id-generator)
2399 (feedmail-fiddle-header 2402 (feedmail-fiddle-header
2400 (if feedmail-is-a-resend "Resent-Message-ID" "Message-ID") 2403 (if feedmail-is-a-resend "Resent-Message-ID" "Message-ID")
2401 (nth 1 feedmail-message-id-generator) ;; value 2404 (nth 1 feedmail-message-id-generator) ; value
2402 (nth 2 feedmail-message-id-generator) ;; action 2405 (nth 2 feedmail-message-id-generator) ; action
2403 (nth 3 feedmail-message-id-generator))))) ;; folding 2406 (nth 3 feedmail-message-id-generator))))) ; folding
2404 2407
2405 2408
2406(defun feedmail-default-x-mailer-generator () 2409(defun feedmail-default-x-mailer-generator ()
@@ -2420,26 +2423,26 @@ sure it's set."
2420 (cond 2423 (cond
2421 ;; t is the same a using the function feedmail-default-x-mailer-generator, so let it and recurse 2424 ;; t is the same a using the function feedmail-default-x-mailer-generator, so let it and recurse
2422 ((eq t feedmail-x-mailer-line) 2425 ((eq t feedmail-x-mailer-line)
2423 (let ((feedmail-x-mailer-line (feedmail-default-x-mailer-generator))) 2426 (let ((feedmail-x-mailer-line (feedmail-default-x-mailer-generator)))
2424 (feedmail-fiddle-x-mailer))) 2427 (feedmail-fiddle-x-mailer)))
2425 2428
2426 ;; if it's a string, simply make a fiddle-plex out of it and recurse 2429 ;; if it's a string, simply make a fiddle-plex out of it and recurse
2427 ((stringp feedmail-x-mailer-line) 2430 ((stringp feedmail-x-mailer-line)
2428 (let ((feedmail-x-mailer-line (list "ignored" (list feedmail-x-mailer-line ";\n\t%s") 'combine))) 2431 (let ((feedmail-x-mailer-line (list "ignored" (list feedmail-x-mailer-line ";\n\t%s") 'combine)))
2429 (feedmail-fiddle-x-mailer))) 2432 (feedmail-fiddle-x-mailer)))
2430 2433
2431 ;; if it's a function, call it and recurse with the resulting value 2434 ;; if it's a function, call it and recurse with the resulting value
2432 ((and (symbolp feedmail-x-mailer-line) (fboundp feedmail-x-mailer-line)) 2435 ((and (symbolp feedmail-x-mailer-line) (fboundp feedmail-x-mailer-line))
2433 (let ((feedmail-x-mailer-line (funcall feedmail-x-mailer-line))) 2436 (let ((feedmail-x-mailer-line (funcall feedmail-x-mailer-line)))
2434 (feedmail-fiddle-x-mailer))) 2437 (feedmail-fiddle-x-mailer)))
2435 2438
2436 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle 2439 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle
2437 ((listp feedmail-x-mailer-line) 2440 ((listp feedmail-x-mailer-line)
2438 (feedmail-fiddle-header 2441 (feedmail-fiddle-header
2439 (if feedmail-is-a-resend "X-Resent-Mailer" "X-Mailer") 2442 (if feedmail-is-a-resend "X-Resent-Mailer" "X-Mailer")
2440 (nth 1 feedmail-x-mailer-line) ;; value 2443 (nth 1 feedmail-x-mailer-line) ; value
2441 (nth 2 feedmail-x-mailer-line) ;; action 2444 (nth 2 feedmail-x-mailer-line) ; action
2442 (nth 3 feedmail-x-mailer-line))))) ;; folding 2445 (nth 3 feedmail-x-mailer-line))))) ; folding
2443 2446
2444 2447
2445(defun feedmail-fiddle-spray-address (addy-plex) 2448(defun feedmail-fiddle-spray-address (addy-plex)
@@ -2450,27 +2453,27 @@ sure it's set."
2450 ((eq nil addy-plex) nil) 2453 ((eq nil addy-plex) nil)
2451 ;; t means the same as using "TO: and unembellished addy 2454 ;; t means the same as using "TO: and unembellished addy
2452 ((eq t addy-plex) 2455 ((eq t addy-plex)
2453 (let ((addy-plex (list "To" feedmail-spray-this-address))) 2456 (let ((addy-plex (list "To" feedmail-spray-this-address)))
2454 (feedmail-fiddle-spray-address addy-plex))) 2457 (feedmail-fiddle-spray-address addy-plex)))
2455 2458
2456 ;; if it's a string, simply make a fiddle-plex out of it and recurse, assuming 2459 ;; if it's a string, simply make a fiddle-plex out of it and recurse, assuming
2457 ;; the string names a header field (e.g., "TO") 2460 ;; the string names a header field (e.g., "TO")
2458 ((stringp addy-plex) 2461 ((stringp addy-plex)
2459 (let ((addy-plex (list addy-plex feedmail-spray-this-address))) 2462 (let ((addy-plex (list addy-plex feedmail-spray-this-address)))
2460 (feedmail-fiddle-spray-address addy-plex))) 2463 (feedmail-fiddle-spray-address addy-plex)))
2461 2464
2462 ;; if it's a function, call it and recurse with the resulting value 2465 ;; if it's a function, call it and recurse with the resulting value
2463 ((and (symbolp addy-plex) (fboundp addy-plex)) 2466 ((and (symbolp addy-plex) (fboundp addy-plex))
2464 (let ((addy-plex (funcall addy-plex))) 2467 (let ((addy-plex (funcall addy-plex)))
2465 (feedmail-fiddle-spray-address addy-plex))) 2468 (feedmail-fiddle-spray-address addy-plex)))
2466 2469
2467 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle 2470 ;; if it's a list, it must be a fiddle-plex -- so fiddle, man, fiddle
2468 ((listp addy-plex) 2471 ((listp addy-plex)
2469 (feedmail-fiddle-header 2472 (feedmail-fiddle-header
2470 (nth 0 addy-plex) ;; name 2473 (nth 0 addy-plex) ; name
2471 (nth 1 addy-plex) ;; value 2474 (nth 1 addy-plex) ; value
2472 (nth 2 addy-plex) ;; action 2475 (nth 2 addy-plex) ; action
2473 (nth 3 addy-plex))))) ;; folding 2476 (nth 3 addy-plex))))) ; folding
2474 2477
2475 2478
2476(defun feedmail-fiddle-list-of-spray-fiddle-plexes (list-of-fiddle-plexes) 2479(defun feedmail-fiddle-list-of-spray-fiddle-plexes (list-of-fiddle-plexes)
@@ -2502,9 +2505,9 @@ sure it's set."
2502 ((listp fp) 2505 ((listp fp)
2503 (feedmail-fiddle-header 2506 (feedmail-fiddle-header
2504 (nth 0 fp) 2507 (nth 0 fp)
2505 (nth 1 fp);; value 2508 (nth 1 fp) ; value
2506 (nth 2 fp);; action 2509 (nth 2 fp) ; action
2507 (nth 3 fp)))))));; folding 2510 (nth 3 fp))))))) ; folding
2508 2511
2509 2512
2510(defun feedmail-accume-n-nuke-header (header-end header-regexp) 2513(defun feedmail-accume-n-nuke-header (header-end header-regexp)
@@ -2525,7 +2528,7 @@ headers, including the intervening newlines."
2525 (forward-line 1) 2528 (forward-line 1)
2526 (setq dropout (concat dropout (buffer-substring (match-beginning 0) (point)))) 2529 (setq dropout (concat dropout (buffer-substring (match-beginning 0) (point))))
2527 (replace-match "")))) 2530 (replace-match ""))))
2528 (identity dropout))) 2531 (identity dropout)))
2529 2532
2530(defun feedmail-fill-to-cc-function (header-end) 2533(defun feedmail-fill-to-cc-function (header-end)
2531 "Smart filling of address headers (don't be fooled by the name). 2534 "Smart filling of address headers (don't be fooled by the name).
@@ -2534,103 +2537,103 @@ avoids, in particular, splitting within parenthesized comments in
2534addresses. Headers filled include FROM:, REPLY-TO:, TO:, CC:, BCC:, 2537addresses. Headers filled include FROM:, REPLY-TO:, TO:, CC:, BCC:,
2535RESENT-TO:, RESENT-CC:, and RESENT-BCC:." 2538RESENT-TO:, RESENT-CC:, and RESENT-BCC:."
2536 (let ((case-fold-search t) 2539 (let ((case-fold-search t)
2537 this-line 2540 this-line
2538 this-line-end) 2541 this-line-end)
2539 (save-excursion 2542 (save-excursion
2540 (goto-char (point-min)) 2543 (goto-char (point-min))
2541 ;; iterate over all TO:/CC:, etc, lines 2544 ;; iterate over all TO:/CC:, etc, lines
2542 (while 2545 (while
2543 (re-search-forward 2546 (re-search-forward
2544 "^\\(FROM:\\|REPLY-TO:\\|TO:\\|CC:\\|BCC:\\|RESENT-TO:\\|RESENT-CC:\\|RESENT-BCC:\\)" 2547 "^\\(FROM:\\|REPLY-TO:\\|TO:\\|CC:\\|BCC:\\|RESENT-TO:\\|RESENT-CC:\\|RESENT-BCC:\\)"
2545 header-end t) 2548 header-end t)
2546 (setq this-line (match-beginning 0)) 2549 (setq this-line (match-beginning 0))
2547 ;; replace 0 or more leading spaces with a single space 2550 ;; replace 0 or more leading spaces with a single space
2548 (and (looking-at "[ \t]*") (replace-match " ")) 2551 (and (looking-at "[ \t]*") (replace-match " "))
2549 (forward-line 1) 2552 (forward-line 1)
2550 ;; get any continuation lines 2553 ;; get any continuation lines
2551 (while (and (looking-at "[ \t]+") (< (point) header-end)) 2554 (while (and (looking-at "[ \t]+") (< (point) header-end))
2552 (forward-line 1)) 2555 (forward-line 1))
2553 (setq this-line-end (point-marker)) 2556 (setq this-line-end (point-marker))
2554 (save-excursion (feedmail-fill-this-one this-line this-line-end)) 2557 (save-excursion (feedmail-fill-this-one this-line this-line-end))
2555 )))) 2558 ))))
2556 2559
2557 2560
2558(defun feedmail-fill-this-one (this-line this-line-end) 2561(defun feedmail-fill-this-one (this-line this-line-end)
2559 "In-place smart filling of the region bounded by the two arguments." 2562 "In-place smart filling of the region bounded by the two arguments."
2560 (let ((fill-prefix "\t") 2563 (let ((fill-prefix "\t")
2561 (fill-column feedmail-fill-to-cc-fill-column)) 2564 (fill-column feedmail-fill-to-cc-fill-column))
2562 ;; The general idea is to break only on commas. Collapse 2565 ;; The general idea is to break only on commas. Collapse
2563 ;; multiple whitespace to a single blank; change 2566 ;; multiple whitespace to a single blank; change
2564 ;; all the blanks to something unprintable; change the 2567 ;; all the blanks to something unprintable; change the
2565 ;; commas to blanks; fill the region; change it back. 2568 ;; commas to blanks; fill the region; change it back.
2566 (goto-char this-line) 2569 (goto-char this-line)
2567 (while (re-search-forward "\\s-+" (1- this-line-end) t) 2570 (while (re-search-forward "\\s-+" (1- this-line-end) t)
2568 (replace-match " ")) 2571 (replace-match " "))
2569 2572
2570 (subst-char-in-region this-line this-line-end ? 2 t) ; blank->C-b 2573 (subst-char-in-region this-line this-line-end ? 2 t) ; blank->C-b
2571 (subst-char-in-region this-line this-line-end ?, ? t) ; comma->blank 2574 (subst-char-in-region this-line this-line-end ?, ? t) ; comma->blank
2572 2575
2573 (fill-region-as-paragraph this-line this-line-end) 2576 (fill-region-as-paragraph this-line this-line-end)
2574 2577
2575 (subst-char-in-region this-line this-line-end ? ?, t) ; comma<-blank 2578 (subst-char-in-region this-line this-line-end ? ?, t) ; comma<-blank
2576 (subst-char-in-region this-line this-line-end 2 ? t) ; blank<-C-b 2579 (subst-char-in-region this-line this-line-end 2 ? t) ; blank<-C-b
2577 2580
2578 ;; look out for missing commas before continuation lines 2581 ;; look out for missing commas before continuation lines
2579 (goto-char this-line) 2582 (goto-char this-line)
2580 (while (re-search-forward "\\([^,]\\)\n\t[ ]*" this-line-end t) 2583 (while (re-search-forward "\\([^,]\\)\n\t[ ]*" this-line-end t)
2581 (replace-match "\\1,\n\t")) 2584 (replace-match "\\1,\n\t"))
2582 )) 2585 ))
2583 2586
2584 2587
2585(require 'mail-utils) ; pick up mail-strip-quoted-names 2588(require 'mail-utils) ; pick up mail-strip-quoted-names
2586(defun feedmail-deduce-address-list (message-buffer header-start header-end addr-regexp address-list) 2589(defun feedmail-deduce-address-list (message-buffer header-start header-end addr-regexp address-list)
2587 "Get address list with all comments and other excitement trimmed. 2590 "Get address list with all comments and other excitement trimmed.
2588Addresses are collected only from headers whose names match the fourth 2591Addresses are collected only from headers whose names match the fourth
2589argument Returns a list of strings. Duplicate addresses will have 2592argument Returns a list of strings. Duplicate addresses will have
2590been weeded out." 2593been weeded out."
2591 (let ((simple-address) 2594 (let ((simple-address)
2592 (address-blob) 2595 (address-blob)
2593 (this-line) 2596 (this-line)
2594 (this-line-end)) 2597 (this-line-end))
2595 (unwind-protect 2598 (unwind-protect
2596 (save-excursion 2599 (save-excursion
2597 (set-buffer (get-buffer-create " *FQM scratch*")) (erase-buffer) 2600 (set-buffer (get-buffer-create " *FQM scratch*")) (erase-buffer)
2598 (insert-buffer-substring message-buffer header-start header-end) 2601 (insert-buffer-substring message-buffer header-start header-end)
2599 (goto-char (point-min)) 2602 (goto-char (point-min))
2600 (let ((case-fold-search t)) 2603 (let ((case-fold-search t))
2601 (while (re-search-forward addr-regexp (point-max) t) 2604 (while (re-search-forward addr-regexp (point-max) t)
2602 (replace-match "") 2605 (replace-match "")
2603 (setq this-line (match-beginning 0)) 2606 (setq this-line (match-beginning 0))
2604 (forward-line 1) 2607 (forward-line 1)
2605 ;; get any continuation lines 2608 ;; get any continuation lines
2606 (while (and (looking-at "^[ \t]+") (< (point) (point-max))) 2609 (while (and (looking-at "^[ \t]+") (< (point) (point-max)))
2607 (forward-line 1)) 2610 (forward-line 1))
2608 (setq this-line-end (point-marker)) 2611 (setq this-line-end (point-marker))
2609 ;; only keep if we don't have it already 2612 ;; only keep if we don't have it already
2610 (setq address-blob 2613 (setq address-blob
2611 (mail-strip-quoted-names (buffer-substring this-line this-line-end))) 2614 (mail-strip-quoted-names (buffer-substring this-line this-line-end)))
2612 (while (string-match "\\([, \t\n\r]*\\)\\([^, \t\n\r]+\\)" address-blob) 2615 (while (string-match "\\([, \t\n\r]*\\)\\([^, \t\n\r]+\\)" address-blob)
2613 (setq simple-address (substring address-blob (match-beginning 2) (match-end 2))) 2616 (setq simple-address (substring address-blob (match-beginning 2) (match-end 2)))
2614 (setq address-blob (replace-match "" t t address-blob)) 2617 (setq address-blob (replace-match "" t t address-blob))
2615 (if (not (member simple-address address-list)) 2618 (if (not (member simple-address address-list))
2616 (add-to-list 'address-list simple-address))) 2619 (add-to-list 'address-list simple-address)))
2617 )) 2620 ))
2618 (kill-buffer nil))) 2621 (kill-buffer nil)))
2619 (identity address-list))) 2622 (identity address-list)))
2620 2623
2621 2624
2622(defun feedmail-one-last-look (feedmail-prepped-text-buffer) 2625(defun feedmail-one-last-look (feedmail-prepped-text-buffer)
2623 "Offer the user one last chance to give it up." 2626 "Offer the user one last chance to give it up."
2624 (save-excursion 2627 (save-excursion
2625 (save-window-excursion 2628 (save-window-excursion
2626 (switch-to-buffer feedmail-prepped-text-buffer) 2629 (switch-to-buffer feedmail-prepped-text-buffer)
2627 (if (and (fboundp 'y-or-n-p-with-timeout) (numberp feedmail-confirm-outgoing-timeout)) 2630 (if (and (fboundp 'y-or-n-p-with-timeout) (numberp feedmail-confirm-outgoing-timeout))
2628 (y-or-n-p-with-timeout 2631 (y-or-n-p-with-timeout
2629 "FQM: Send this email? " 2632 "FQM: Send this email? "
2630 (abs feedmail-confirm-outgoing-timeout) 2633 (abs feedmail-confirm-outgoing-timeout)
2631 (> feedmail-confirm-outgoing-timeout 0)) 2634 (> feedmail-confirm-outgoing-timeout 0))
2632 (y-or-n-p "FQM: Send this email? ")) 2635 (y-or-n-p "FQM: Send this email? "))
2633 ))) 2636 )))
2634 2637
2635(defun feedmail-fqm-p (might-be) 2638(defun feedmail-fqm-p (might-be)
2636 "Internal; does filename end with FQM suffix?" 2639 "Internal; does filename end with FQM suffix?"
@@ -2640,11 +2643,11 @@ been weeded out."
2640(defun feedmail-find-eoh (&optional noerror) 2643(defun feedmail-find-eoh (&optional noerror)
2641 "Internal; finds the end of message header fields, returns mark just before it" 2644 "Internal; finds the end of message header fields, returns mark just before it"
2642 (save-excursion 2645 (save-excursion
2643 (goto-char (point-min)) 2646 (goto-char (point-min))
2644 (if (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n") nil noerror) 2647 (if (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n") nil noerror)
2645 (progn 2648 (progn
2646 (forward-line -1) 2649 (forward-line -1)
2647 (point-marker))))) 2650 (point-marker)))))
2648 2651
2649(provide 'feedmail) 2652(provide 'feedmail)
2650;;; feedmail.el ends here 2653;;; feedmail.el ends here