diff options
| author | Richard M. Stallman | 1992-07-30 04:31:37 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-07-30 04:31:37 +0000 |
| commit | e635fdf0c9de935ea84dd912bc98a87b6b084f16 (patch) | |
| tree | 32f0ac711251ac6109e474fa45a33bcc7fc72adb | |
| parent | 97e707232d7c70e7f20d6425593013dfee785f1c (diff) | |
| download | emacs-e635fdf0c9de935ea84dd912bc98a87b6b084f16.tar.gz emacs-e635fdf0c9de935ea84dd912bc98a87b6b084f16.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/mail/sendmail.el | 109 |
1 files changed, 63 insertions, 46 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 31c56000cfc..7296a524099 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el | |||
| @@ -550,12 +550,10 @@ and don't delete any header fields." | |||
| 550 | 550 | ||
| 551 | ;;;###autoload | 551 | ;;;###autoload |
| 552 | (defun mail (&optional noerase to subject in-reply-to cc replybuffer actions) | 552 | (defun mail (&optional noerase to subject in-reply-to cc replybuffer actions) |
| 553 | "Edit a message to be sent. Argument means resume editing (don't erase). | 553 | "Edit a message to be sent. Prefix arg means resume editing (don't erase). |
| 554 | Search for an existing mail buffer currently not in use and initialize it, | 554 | When this function returns, the buffer `*mail*' is selected. |
| 555 | or make a new one if all existing mail buffers are busy. | 555 | The value is t if the message was newly initialized; otherwise, nil. |
| 556 | With an argument, search for a busy existing mail buffer and re-select it. | ||
| 557 | 556 | ||
| 558 | Returns with message buffer selected; value t if message freshly initialized. | ||
| 559 | By default, the signature file `~/.signature' is inserted at the end; | 557 | By default, the signature file `~/.signature' is inserted at the end; |
| 560 | see the variable `mail-signature'. | 558 | see the variable `mail-signature'. |
| 561 | 559 | ||
| @@ -589,47 +587,63 @@ The seventh argument ACTIONS is a list of actions to take | |||
| 589 | when the message is sent, we apply FUNCTION to ARGS. | 587 | when the message is sent, we apply FUNCTION to ARGS. |
| 590 | This is how Rmail arranges to mark messages `answered'." | 588 | This is how Rmail arranges to mark messages `answered'." |
| 591 | (interactive "P") | 589 | (interactive "P") |
| 592 | (let ((index 1) | 590 | ;;; This is commented out because I found it was confusing in practice. |
| 593 | buffer) | 591 | ;;; It is easy enough to rename *mail* by hand with rename-buffer |
| 594 | ;; If requested, look for a mail buffer that is modified and go to it. | 592 | ;;; if you want to have multiple mail buffers. |
| 595 | (if noerase | 593 | ;;; And then you can control which messages to save. --rms. |
| 596 | (progn | 594 | ;;; (let ((index 1) |
| 597 | (while (and (setq buffer | 595 | ;;; buffer) |
| 598 | (get-buffer (if (= 1 index) "*mail*" | 596 | ;;; ;; If requested, look for a mail buffer that is modified and go to it. |
| 599 | (format "*mail*<%d>" index)))) | 597 | ;;; (if noerase |
| 600 | (not (buffer-modified-p buffer))) | 598 | ;;; (progn |
| 601 | (setq index (1+ index))) | 599 | ;;; (while (and (setq buffer |
| 602 | (if buffer (switch-to-buffer buffer) | 600 | ;;; (get-buffer (if (= 1 index) "*mail*" |
| 603 | ;; If none exists, start a new message. | 601 | ;;; (format "*mail*<%d>" index)))) |
| 604 | ;; This will never re-use an existing unmodified mail buffer | 602 | ;;; (not (buffer-modified-p buffer))) |
| 605 | ;; (since index is not 1 anymore). Perhaps it should. | 603 | ;;; (setq index (1+ index))) |
| 606 | (setq noerase nil)))) | 604 | ;;; (if buffer (switch-to-buffer buffer) |
| 607 | ;; Unless we found a modified message and are happy, start a new message. | 605 | ;;; ;; If none exists, start a new message. |
| 608 | (if (not noerase) | 606 | ;;; ;; This will never re-use an existing unmodified mail buffer |
| 609 | (progn | 607 | ;;; ;; (since index is not 1 anymore). Perhaps it should. |
| 610 | ;; Look for existing unmodified mail buffer. | 608 | ;;; (setq noerase nil)))) |
| 611 | (while (and (setq buffer | 609 | ;;; ;; Unless we found a modified message and are happy, start a new message. |
| 612 | (get-buffer (if (= 1 index) "*mail*" | 610 | ;;; (if (not noerase) |
| 613 | (format "*mail*<%d>" index)))) | 611 | ;;; (progn |
| 614 | (buffer-modified-p buffer)) | 612 | ;;; ;; Look for existing unmodified mail buffer. |
| 615 | (setq index (1+ index))) | 613 | ;;; (while (and (setq buffer |
| 616 | ;; If none, make a new one. | 614 | ;;; (get-buffer (if (= 1 index) "*mail*" |
| 617 | (or buffer | 615 | ;;; (format "*mail*<%d>" index)))) |
| 618 | (setq buffer (generate-new-buffer "*mail*"))) | 616 | ;;; (buffer-modified-p buffer)) |
| 619 | ;; Go there and initialize it. | 617 | ;;; (setq index (1+ index))) |
| 620 | (switch-to-buffer buffer) | 618 | ;;; ;; If none, make a new one. |
| 621 | (erase-buffer) | 619 | ;;; (or buffer |
| 622 | (setq default-directory (expand-file-name "~/")) | 620 | ;;; (setq buffer (generate-new-buffer "*mail*"))) |
| 623 | (auto-save-mode auto-save-default) | 621 | ;;; ;; Go there and initialize it. |
| 624 | (mail-mode) | 622 | ;;; (switch-to-buffer buffer) |
| 625 | (mail-setup to subject in-reply-to cc replybuffer actions) | 623 | ;;; (erase-buffer) |
| 626 | (if (and buffer-auto-save-file-name | 624 | ;;; (setq default-directory (expand-file-name "~/")) |
| 627 | (file-exists-p buffer-auto-save-file-name)) | 625 | ;;; (auto-save-mode auto-save-default) |
| 628 | (message "Auto save file for draft message exists; consider M-x mail-recover")) | 626 | ;;; (mail-mode) |
| 629 | t)))) | 627 | ;;; (mail-setup to subject in-reply-to cc replybuffer actions) |
| 630 | 628 | ;;; (if (and buffer-auto-save-file-name | |
| 631 | ;;;###autoload | 629 | ;;; (file-exists-p buffer-auto-save-file-name)) |
| 632 | (define-key ctl-x-map "m" 'mail) | 630 | ;;; (message "Auto save file for draft message exists; consider M-x mail-recover")) |
| 631 | ;;; t)) | ||
| 632 | (switch-to-buffer "*mail*") | ||
| 633 | (setq default-directory (expand-file-name "~/")) | ||
| 634 | (auto-save-mode auto-save-default) | ||
| 635 | (mail-mode) | ||
| 636 | (let (initialized) | ||
| 637 | (and (not noerase) | ||
| 638 | (or (not (buffer-modified-p)) | ||
| 639 | (y-or-n-p "Unsent message being composed; erase it? ")) | ||
| 640 | (progn (erase-buffer) | ||
| 641 | (mail-setup to subject in-reply-to cc replybuffer actions) | ||
| 642 | (setq initialized t))) | ||
| 643 | (if (and buffer-auto-save-file-name | ||
| 644 | (file-exists-p buffer-auto-save-file-name)) | ||
| 645 | (message "Auto save file for draft message exists; consider M-x mail-recover")) | ||
| 646 | initialized)) | ||
| 633 | 647 | ||
| 634 | (defun mail-recover () | 648 | (defun mail-recover () |
| 635 | "Reread contents of current buffer from its last auto-save file." | 649 | "Reread contents of current buffer from its last auto-save file." |
| @@ -664,6 +678,9 @@ The seventh argument ACTIONS is a list of actions to take | |||
| 664 | 678 | ||
| 665 | 679 | ||
| 666 | ;;;###autoload | 680 | ;;;###autoload |
| 681 | (define-key ctl-x-map "m" 'mail) | ||
| 682 | |||
| 683 | ;;;###autoload | ||
| 667 | (define-key ctl-x-4-map "m" 'mail-other-window) | 684 | (define-key ctl-x-4-map "m" 'mail-other-window) |
| 668 | 685 | ||
| 669 | ;;;###autoload | 686 | ;;;###autoload |