comparison lisp/vm/vm-reply.el @ 54:05472e90ae02 r19-16-pre2

Import from CVS: tag r19-16-pre2
author cvs
date Mon, 13 Aug 2007 08:57:55 +0200
parents c53a95d3c46d
children 131b0175ea99
comparison
equal deleted inserted replaced
53:875393c1a535 54:05472e90ae02
295 (cond ((vm-mime-types-match "multipart" type) 295 (cond ((vm-mime-types-match "multipart" type)
296 (setq parts (copy-sequence (vm-mm-layout-parts o)))) 296 (setq parts (copy-sequence (vm-mm-layout-parts o))))
297 (t (setq parts (list o)))) 297 (t (setq parts (list o))))
298 (while parts 298 (while parts
299 (cond ((vm-mime-text-type-p (car parts)) 299 (cond ((vm-mime-text-type-p (car parts))
300 (if (vm-mime-display-internal-text/plain (car parts) t) 300 (if (cond ((vm-mime-types-match
301 "text/html"
302 (car (vm-mm-layout-type (car parts))))
303 (vm-mime-display-internal-text/html
304 (car parts)))
305 ((vm-mime-types-match
306 "text/enriched"
307 (car (vm-mm-layout-type (car parts))))
308 (vm-mime-display-internal-text/enriched
309 (car parts)))
310 ((vm-mime-display-internal-text/plain
311 (car parts) t)))
301 nil 312 nil
302 ;; charset problems probably 313 ;; charset problems probably
303 ;; just dump the raw bits 314 ;; just dump the raw bits
304 (vm-mime-insert-mime-body (car parts)) 315 (vm-mime-insert-mime-body (car parts))
305 (vm-mime-transfer-decode-region (car parts) 316 (vm-mime-transfer-decode-region (car parts)
331 (interactive "P") 342 (interactive "P")
332 (vm-check-for-killed-folder) 343 (vm-check-for-killed-folder)
333 (let ((b (current-buffer))) 344 (let ((b (current-buffer)))
334 (vm-mail-send) 345 (vm-mail-send)
335 (cond ((null (buffer-name b)) ;; dead buffer 346 (cond ((null (buffer-name b)) ;; dead buffer
347 ;; This improves window configuration behavior in
348 ;; XEmacs. It avoids taking the folder buffer from
349 ;; one frame and attaching it to the selected frame.
350 (set-buffer (window-buffer (selected-window)))
336 (vm-display nil nil '(vm-mail-send-and-exit) 351 (vm-display nil nil '(vm-mail-send-and-exit)
337 '(vm-mail-send-and-exit 352 '(vm-mail-send-and-exit
338 reading-message 353 reading-message
339 startup))) 354 startup)))
340 (t 355 (t
353 (if (not (eq vm-keep-sent-messages t)) 368 (if (not (eq vm-keep-sent-messages t))
354 (let ((extras (nthcdr (or vm-keep-sent-messages 0) 369 (let ((extras (nthcdr (or vm-keep-sent-messages 0)
355 vm-kept-mail-buffers))) 370 vm-kept-mail-buffers)))
356 (mapcar (function 371 (mapcar (function
357 (lambda (b) 372 (lambda (b)
358 (and (buffer-name b) (kill-buffer b)))) 373 (and (buffer-name b)
374 (not (buffer-modified-p b))
375 (kill-buffer b))))
359 extras) 376 extras)
360 (and vm-kept-mail-buffers extras 377 (and vm-kept-mail-buffers extras
361 (setcdr (memq (car extras) vm-kept-mail-buffers) nil))))) 378 (setcdr (memq (car extras) vm-kept-mail-buffers) nil)))))
362 379
363 (defun vm-help-tale () 380 (defun vm-help-tale ()
419 ;; 436 ;;
420 ;; also protect value of this-command from minibuffer reads 437 ;; also protect value of this-command from minibuffer reads
421 (let ((this-command this-command)) 438 (let ((this-command this-command))
422 (save-excursion 439 (save-excursion
423 (mail-send)))) 440 (mail-send))))
424 (cond ((eq vm-system-state 'replying)
425 (vm-mail-mark-replied))
426 ((eq vm-system-state 'forwarding)
427 (vm-mail-mark-forwarded))
428 ((eq vm-system-state 'redistributing)
429 (vm-mail-mark-redistributed)))
430 ;; be careful, something could have killed the composition 441 ;; be careful, something could have killed the composition
431 ;; buffer inside mail-send. 442 ;; buffer inside mail-send.
432 (if (eq (current-buffer) composition-buffer) 443 (if (eq (current-buffer) composition-buffer)
433 (progn 444 (progn
445 (cond ((eq vm-system-state 'replying)
446 (vm-mail-mark-replied))
447 ((eq vm-system-state 'forwarding)
448 (vm-mail-mark-forwarded))
449 ((eq vm-system-state 'redistributing)
450 (vm-mail-mark-redistributed)))
434 (vm-rename-current-mail-buffer) 451 (vm-rename-current-mail-buffer)
435 (vm-keep-mail-buffer (current-buffer)))) 452 (vm-keep-mail-buffer (current-buffer))))
436 (vm-display nil nil '(vm-mail-send) '(vm-mail-send)))) 453 (vm-display nil nil '(vm-mail-send) '(vm-mail-send))))
437 454
438 (defun vm-mail-mode-get-header-contents (header-name-regexp) 455 (defun vm-mail-mode-get-header-contents (header-name-regexp)
597 (interactive) 614 (interactive)
598 (vm-follow-summary-cursor) 615 (vm-follow-summary-cursor)
599 (vm-select-folder-buffer) 616 (vm-select-folder-buffer)
600 (vm-check-for-killed-summary) 617 (vm-check-for-killed-summary)
601 (vm-error-if-folder-empty) 618 (vm-error-if-folder-empty)
602 (if (eq last-command 'vm-next-command-uses-marks) 619 (if (and (eq last-command 'vm-next-command-uses-marks)
620 (cdr (vm-select-marked-or-prefixed-messages 0)))
603 (let ((vm-digest-send-type vm-forwarding-digest-type)) 621 (let ((vm-digest-send-type vm-forwarding-digest-type))
604 (setq this-command 'vm-next-command-uses-marks) 622 (setq this-command 'vm-next-command-uses-marks)
605 (command-execute 'vm-send-digest)) 623 (command-execute 'vm-send-digest))
606 (let ((dir default-directory) 624 (let ((dir default-directory)
607 (miming (and vm-send-using-mime 625 (miming (and vm-send-using-mime
608 (equal vm-forwarding-digest-type "mime"))) 626 (equal vm-forwarding-digest-type "mime")))
609 mail-buffer 627 mail-buffer
610 header-end boundary 628 header-end
611 (mp vm-message-pointer)) 629 (mp (vm-select-marked-or-prefixed-messages 1)))
612 (save-restriction 630 (save-restriction
613 (widen) 631 (widen)
614 (vm-mail-internal 632 (vm-mail-internal
615 (format "forward of %s's note re: %s" 633 (format "forward of %s's note re: %s"
616 (vm-su-full-name (car vm-message-pointer)) 634 (vm-su-full-name (car vm-message-pointer))
633 (re-search-forward (concat "^" (regexp-quote mail-header-separator) 651 (re-search-forward (concat "^" (regexp-quote mail-header-separator)
634 "\n")) 652 "\n"))
635 (goto-char (match-end 0)) 653 (goto-char (match-end 0))
636 (setq header-end (match-beginning 0))) 654 (setq header-end (match-beginning 0)))
637 (cond ((equal vm-forwarding-digest-type "mime") 655 (cond ((equal vm-forwarding-digest-type "mime")
638 (setq boundary (vm-mime-encapsulate-messages 656 (vm-mime-encapsulate-messages (list (car mp))
639 (list (car mp)) vm-forwarded-headers 657 vm-forwarded-headers
640 vm-unforwarded-header-regexp)) 658 vm-unforwarded-header-regexp
659 nil)
641 (goto-char header-end) 660 (goto-char header-end)
642 (insert "MIME-Version: 1.0\n") 661 (insert "MIME-Version: 1.0\n")
643 (insert (if vm-mime-avoid-folding-content-type 662 (insert "Content-Type: message/rfc822\n")
644 "Content-Type: multipart/digest; boundary=\""
645 "Content-Type: multipart/digest;\n\tboundary=\"")
646 boundary "\"\n")
647 (insert "Content-Transfer-Encoding: " 663 (insert "Content-Transfer-Encoding: "
648 (vm-determine-proper-content-transfer-encoding 664 (vm-determine-proper-content-transfer-encoding
649 (point) 665 (point)
650 (point-max)) 666 (point-max))
651 "\n")) 667 "\n"))
663 vm-unforwarded-header-regexp))) 679 vm-unforwarded-header-regexp)))
664 (if miming 680 (if miming
665 (let ((b (current-buffer))) 681 (let ((b (current-buffer)))
666 (set-buffer mail-buffer) 682 (set-buffer mail-buffer)
667 (mail-text) 683 (mail-text)
668 (vm-mime-attach-object b "multipart/digest" 684 (vm-mime-attach-object b "message/rfc822" nil nil t)
669 (list (concat "boundary=\""
670 boundary "\"")) nil t)
671 (add-hook 'kill-buffer-hook 685 (add-hook 'kill-buffer-hook
672 (list 'lambda () 686 (list 'lambda ()
673 (list 'if (list 'eq mail-buffer '(current-buffer)) 687 (list 'if (list 'eq mail-buffer '(current-buffer))
674 (list 'kill-buffer b)))))) 688 (list 'kill-buffer b))))))
675 (mail-position-on-field "To")) 689 (mail-position-on-field "To"))
740 (defun vm-resend-message () 754 (defun vm-resend-message ()
741 "Resend the current message to someone else. 755 "Resend the current message to someone else.
742 The current message will be copied to a Mail mode buffer and you 756 The current message will be copied to a Mail mode buffer and you
743 can edit the message and send it as usual. 757 can edit the message and send it as usual.
744 758
745 NOTE: since you are doing a resend, a Resent-To header is 759 NOTE: since you are doing a resend, a Resent-To header is provided
746 provided for you to fill in. If you don't fill it in, when you 760 for you to fill in the new recipient list. If you don't fill in
747 send the message it will go to the original recipients listed in 761 this header, what happens when you send the message is undefined.
748 the To and Cc headers. You may also create a Resent-Cc header." 762 You may also create a Resent-Cc header."
749 (interactive) 763 (interactive)
750 (vm-follow-summary-cursor) 764 (vm-follow-summary-cursor)
751 (vm-select-folder-buffer) 765 (vm-select-folder-buffer)
752 (vm-check-for-killed-summary) 766 (vm-check-for-killed-summary)
753 (vm-error-if-folder-empty) 767 (vm-error-if-folder-empty)
840 header-end (match-beginning 0))) 854 header-end (match-beginning 0)))
841 (message "Building %s digest..." vm-digest-send-type) 855 (message "Building %s digest..." vm-digest-send-type)
842 (cond ((equal vm-digest-send-type "mime") 856 (cond ((equal vm-digest-send-type "mime")
843 (setq boundary (vm-mime-encapsulate-messages 857 (setq boundary (vm-mime-encapsulate-messages
844 mlist vm-mime-digest-headers 858 mlist vm-mime-digest-headers
845 vm-mime-digest-discard-header-regexp)) 859 vm-mime-digest-discard-header-regexp
860 t))
846 (goto-char header-end) 861 (goto-char header-end)
847 (insert "MIME-Version: 1.0\n") 862 (insert "MIME-Version: 1.0\n")
848 (insert (if vm-mime-avoid-folding-content-type 863 (insert (if vm-mime-avoid-folding-content-type
849 "Content-Type: multipart/digest; boundary=\"" 864 "Content-Type: multipart/digest; boundary=\""
850 "Content-Type: multipart/digest;\n\tboundary=\"") 865 "Content-Type: multipart/digest;\n\tboundary=\"")
862 (vm-rfc1153-encapsulate-messages 877 (vm-rfc1153-encapsulate-messages
863 mlist vm-rfc1153-digest-headers 878 mlist vm-rfc1153-digest-headers
864 vm-rfc1153-digest-discard-header-regexp))) 879 vm-rfc1153-digest-discard-header-regexp)))
865 (goto-char start) 880 (goto-char start)
866 (setq mp mlist) 881 (setq mp mlist)
867 (if prefix
868 (progn
869 (message "Building digest preamble...")
870 (while mp
871 (let ((vm-summary-uninteresting-senders nil))
872 (insert (vm-sprintf 'vm-digest-preamble-format (car mp)) "\n"))
873 (if vm-digest-center-preamble
874 (progn
875 (forward-char -1)
876 (center-line)
877 (forward-char 1)))
878 (setq mp (cdr mp)))))
879 (if miming 882 (if miming
880 (let ((b (current-buffer))) 883 (let ((b (current-buffer)))
881 (set-buffer mail-buffer) 884 (set-buffer mail-buffer)
882 (mail-text) 885 (mail-text)
883 (vm-mime-attach-object b "multipart/digest" 886 (vm-mime-attach-object b "multipart/digest"
885 boundary "\"")) nil t) 888 boundary "\"")) nil t)
886 (add-hook 'kill-buffer-hook 889 (add-hook 'kill-buffer-hook
887 (list 'lambda () 890 (list 'lambda ()
888 (list 'if (list 'eq mail-buffer '(current-buffer)) 891 (list 'if (list 'eq mail-buffer '(current-buffer))
889 (list 'kill-buffer b)))))) 892 (list 'kill-buffer b))))))
893 (if prefix
894 (save-excursion
895 (message "Building digest preamble...")
896 (if miming
897 (progn
898 (set-buffer mail-buffer)
899 (mail-text)))
900 (while mp
901 (let ((vm-summary-uninteresting-senders nil))
902 (insert (vm-sprintf 'vm-digest-preamble-format (car mp)) "\n"))
903 (if vm-digest-center-preamble
904 (progn
905 (forward-char -1)
906 (center-line)
907 (forward-char 1)))
908 (setq mp (cdr mp)))))
890 (mail-position-on-field "To") 909 (mail-position-on-field "To")
891 (message "Building %s digest... done" vm-digest-send-type))) 910 (message "Building %s digest... done" vm-digest-send-type)))
892 (run-hooks 'vm-send-digest-hook) 911 (run-hooks 'vm-send-digest-hook)
893 (run-hooks 'vm-mail-mode-hook)) 912 (run-hooks 'vm-mail-mode-hook))
894 913
925 (progn 944 (progn
926 ;; avoid having the window configuration code choose a 945 ;; avoid having the window configuration code choose a
927 ;; different composition buffer. 946 ;; different composition buffer.
928 (vm-unbury-buffer b) 947 (vm-unbury-buffer b)
929 (set-buffer b) 948 (set-buffer b)
930 (if (and vm-frame-per-composition (vm-multiple-frames-possible-p) 949 (if (and vm-mutable-frames vm-frame-per-composition
950 (vm-multiple-frames-possible-p)
931 ;; only pop up a frame if there's an undisplay 951 ;; only pop up a frame if there's an undisplay
932 ;; hook in place to make the frame go away. 952 ;; hook in place to make the frame go away.
933 vm-undisplay-buffer-hook) 953 vm-undisplay-buffer-hook)
934 (let ((w (vm-get-buffer-window b))) 954 (let ((w (vm-get-buffer-window b)))
935 (if (null w) 955 (if (null w)
989 (if (fboundp 'mail-aliases-setup) ; use mail-abbrevs.el if present 1009 (if (fboundp 'mail-aliases-setup) ; use mail-abbrevs.el if present
990 (mail-aliases-setup) 1010 (mail-aliases-setup)
991 (if (eq mail-aliases t) 1011 (if (eq mail-aliases t)
992 (progn 1012 (progn
993 (setq mail-aliases nil) 1013 (setq mail-aliases nil)
994 (if (file-exists-p "~/.mailrc") 1014 (if (file-exists-p (or mail-personal-alias-file "~/.mailrc"))
995 (build-mail-aliases))))) 1015 (build-mail-aliases)))))
996 (if (stringp vm-mail-header-from) 1016 (if (stringp vm-mail-header-from)
997 (insert "From: " vm-mail-header-from "\n")) 1017 (insert "From: " vm-mail-header-from "\n"))
998 (insert "To: " (or to "") "\n") 1018 (insert "To: " (or to "") "\n")
999 (and cc (insert "Cc: " cc "\n")) 1019 (and cc (insert "Cc: " cc "\n"))
1000 (insert "Subject: " (or subject "") "\n") 1020 (insert "Subject: " (or subject "") "\n")
1001 (and newsgroups (insert "Newsgroups: " newsgroups "\n")) 1021 (and newsgroups (insert "Newsgroups: " newsgroups "\n"))
1002 (and in-reply-to (insert "In-Reply-To: " in-reply-to "\n")) 1022 (and in-reply-to (insert "In-Reply-To: " in-reply-to "\n"))
1003 (and references (insert "References: " references "\n")) 1023 (and references (insert "References: " references "\n"))
1004 (insert "X-Mailer: VM " vm-version " under " 1024 (insert "X-Mailer: VM " vm-version " under "
1005 (if (vm-fsfemacs-19-p) "Emacs " "") 1025 (if vm-fsfemacs-19-p "Emacs " "")
1006 emacs-version "\n") 1026 emacs-version "\n")
1007 ;; REPLYTO support for FSF Emacs v19.29 1027 ;; REPLYTO environmental variable support
1008 (and (eq mail-default-reply-to t) 1028 ;; note that in FSF Emacs v19.29 we would initialize if the
1029 ;; value was t. nil is the treigger value used now.
1030 (and (eq mail-default-reply-to nil)
1009 (setq mail-default-reply-to (getenv "REPLYTO"))) 1031 (setq mail-default-reply-to (getenv "REPLYTO")))
1010 (if mail-default-reply-to 1032 (if mail-default-reply-to
1011 (insert "Reply-To: " mail-default-reply-to "\n")) 1033 (insert "Reply-To: " mail-default-reply-to "\n"))
1012 (if mail-self-blind 1034 (if mail-self-blind
1013 (insert "Bcc: " (user-login-name) "\n")) 1035 (insert "Bcc: " (user-login-name) "\n"))
1030 "~/.signature"))))) 1052 "~/.signature")))))
1031 ;; move this buffer to the head of the buffer list so window 1053 ;; move this buffer to the head of the buffer list so window
1032 ;; config stuff will select it as the composition buffer. 1054 ;; config stuff will select it as the composition buffer.
1033 (vm-unbury-buffer (current-buffer)) 1055 (vm-unbury-buffer (current-buffer))
1034 ;; make a new frame if the user wants it. 1056 ;; make a new frame if the user wants it.
1035 (if (and vm-frame-per-composition (vm-multiple-frames-possible-p)) 1057 (if (and vm-mutable-frames vm-frame-per-composition
1058 (vm-multiple-frames-possible-p))
1036 (progn 1059 (progn
1037 (vm-goto-new-frame 'composition) 1060 (vm-goto-new-frame 'composition)
1038 (vm-set-hooks-for-frame-deletion))) 1061 (vm-set-hooks-for-frame-deletion)))
1039 ;; now do window configuration 1062 ;; now do window configuration
1040 (vm-display (current-buffer) t 1063 (vm-display (current-buffer) t