bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sendmail.el fixes


From: Simon Josefsson
Subject: sendmail.el fixes
Date: Sun, 04 Nov 2001 12:25:54 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu)

Two minor fixes, and a new variable `mail-use-multiple-buffers-p' to
optionally enable some previously disabled code.  (Sorry for sending
this again, but I didn't hear anything so maybe it was lost among the
amount of bug reports you get.)

2001-09-22  Simon Josefsson  <address@hidden>

        * mail/sendmail.el (mail-envelope-from): Fix :type.
        (mail-use-multiple-buffers-p): Add.
        (mail): Use it.
        (mail-mode): Fix doc.

Index: sendmail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mail/sendmail.el,v
retrieving revision 1.245
diff -u -r1.245 sendmail.el
--- sendmail.el 2001/10/27 22:19:29     1.245
+++ sendmail.el 2001/11/04 11:21:06
@@ -81,7 +81,8 @@
 If this is nil while `mail-specify-envelope-from' is non-nil, the
 content of `user-mail-address' is used."
   :version "21.1"
-  :type 'boolean
+  :type '(choice (const :tag "Use `user-mail-address'" nil)
+                string)
   :group 'sendmail)
 
 ;;;###autoload
@@ -324,6 +325,11 @@
 The value should be an expression to test whether the problem will
 actually occur.")
 
+(defcustom mail-use-multiple-buffers-p nil
+  "Non-nil means `mail' will create a new buffer if one already exists."
+  :type 'boolean
+  :group 'sendmail)
+
 (defvar mail-mode-syntax-table
   (let ((st (make-syntax-table)))
     ;; define-derived-mode will make it inherit from text-mode-syntax-table.
@@ -462,7 +468,7 @@
 Here are commands that move to a header field (and create it if there isn't):
         \\[mail-to]  move to To:       \\[mail-subject]  move to Subject:
         \\[mail-cc]  move to CC:       \\[mail-bcc]  move to BCC:
-        \\[mail-fcc]  move to FCC:     \\[mail-reply-to] move to Reply-To:
+        \\[mail-fcc]  move to FCC:     \\[mail-reply-to]  move to Reply-To:
 \\[mail-text]  mail-text (move to beginning of message text).
 \\[mail-signature]  mail-signature (insert `mail-signature-file' file).
 \\[mail-yank-original]  mail-yank-original (insert current message, in Rmail).
@@ -1451,48 +1457,52 @@
  when the message is sent, we apply FUNCTION to ARGS.
  This is how Rmail arranges to mark messages `answered'."
   (interactive "P")
+  (if mail-use-multiple-buffers-p
 ;;; This is commented out because I found it was confusing in practice.
 ;;; It is easy enough to rename *mail* by hand with rename-buffer
 ;;; if you want to have multiple mail buffers.
 ;;; And then you can control which messages to save. --rms.
-;;;  (let ((index 1)
-;;;    buffer)
-;;;    ;; If requested, look for a mail buffer that is modified and go to it.
-;;;    (if noerase
-;;;    (progn
-;;;      (while (and (setq buffer
-;;;                        (get-buffer (if (= 1 index) "*mail*"
-;;;                                      (format "*mail*<%d>" index))))
-;;;                  (not (buffer-modified-p buffer)))
-;;;        (setq index (1+ index)))
-;;;      (if buffer (switch-to-buffer buffer)
-;;;        ;; If none exists, start a new message.
-;;;        ;; This will never re-use an existing unmodified mail buffer
-;;;        ;; (since index is not 1 anymore).  Perhaps it should.
-;;;        (setq noerase nil))))
-;;;    ;; Unless we found a modified message and are happy, start a new 
message.
-;;;    (if (not noerase)
-;;;    (progn
-;;;      ;; Look for existing unmodified mail buffer.
-;;;      (while (and (setq buffer
-;;;                        (get-buffer (if (= 1 index) "*mail*"
-;;;                                      (format "*mail*<%d>" index))))
-;;;                  (buffer-modified-p buffer))
-;;;        (setq index (1+ index)))
-;;;      ;; If none, make a new one.
-;;;      (or buffer
-;;;          (setq buffer (generate-new-buffer "*mail*")))
-;;;      ;; Go there and initialize it.
-;;;      (switch-to-buffer buffer)
-;;;      (erase-buffer)
-;;;          (setq default-directory (expand-file-name "~/"))
-;;;          (auto-save-mode auto-save-default)
-;;;          (mail-mode)
-;;;          (mail-setup to subject in-reply-to cc replybuffer actions)
-;;;      (if (and buffer-auto-save-file-name
-;;;               (file-exists-p buffer-auto-save-file-name))
-;;;          (message "Auto save file for draft message exists; consider M-x 
mail-recover"))
-;;;          t))
+;;; Put it back in, conditional on mail-use-multiple-buffers-p --jas
+      (let ((index 1)
+           buffer)
+       ;; If requested, look for a mail buffer that is modified and go to it.
+       (if noerase
+           (progn
+             (while (and (setq buffer
+                               (get-buffer (if (= 1 index) "*mail*"
+                                             (format "*mail*<%d>" index))))
+                         (not (buffer-modified-p buffer)))
+               (setq index (1+ index)))
+             (if buffer (switch-to-buffer buffer)
+               ;; If none exists, start a new message.
+               ;; This will never re-use an existing unmodified mail buffer
+               ;; (since index is not 1 anymore).  Perhaps it should.
+               (setq noerase nil))))
+       ;; Unless we found a modified message and are happy, start a
+       ;; new message.
+       (if (not noerase)
+           (progn
+             ;; Look for existing unmodified mail buffer.
+             (while (and (setq buffer
+                               (get-buffer (if (= 1 index) "*mail*"
+                                             (format "*mail*<%d>" index))))
+                         (buffer-modified-p buffer))
+               (setq index (1+ index)))
+             ;; If none, make a new one.
+             (or buffer
+                 (setq buffer (generate-new-buffer "*mail*")))
+             ;; Go there and initialize it.
+             (switch-to-buffer buffer)
+             (erase-buffer)
+             (setq default-directory (expand-file-name "~/"))
+             (auto-save-mode auto-save-default)
+             (mail-mode)
+             (mail-setup to subject in-reply-to cc replybuffer actions)
+             (if (and buffer-auto-save-file-name
+                      (file-exists-p buffer-auto-save-file-name))
+                 (message "Auto save file for draft message exists; consider 
M-x mail-recover"))
+             t)))
+
   (pop-to-buffer "*mail*")
   ;; Put the auto-save file in the home dir
   ;; to avoid any danger that it can't be written.
@@ -1528,7 +1538,7 @@
     (if (and buffer-auto-save-file-name
             (file-exists-p buffer-auto-save-file-name))
        (message "Auto save file for draft message exists; consider M-x 
mail-recover"))
-    initialized))
+    initialized)))
 
 (defun mail-recover ()
   "Reread contents of current buffer from its last auto-save file."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]