Only ask question once when sending.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Sat, 28 Oct 2000 13:38:06 +0000 (13:38 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Sat, 28 Oct 2000 13:38:06 +0000 (13:38 +0000)
2000-10-28 10:09:41  ShengHuo ZHU  <zsh@cs.rochester.edu>

* message.el (message-options): New variable.
(message-send): Use it.
* gnus-int.el (gnus-request-replace-article): Use it.
(gnus-request-accept-article): Ditto.
* mml.el (mml-preview): Use it.
* gnus-sum.el (gnus-summary-edit-article): Use it.

* message.el (message-options-get): New function.
(message-options-get): New function.
* rfc2047.el (rfc2047-encode-message-header): Use them.
* mm-bodies.el (mm-encode-body): Use them.

lisp/ChangeLog
lisp/gnus-int.el
lisp/gnus-sum.el
lisp/message.el
lisp/mm-bodies.el
lisp/mml.el
lisp/rfc2047.el

index 3455736..5102a33 100644 (file)
@@ -1,3 +1,17 @@
+2000-10-28 10:09:41  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * message.el (message-options): New variable.
+       (message-send): Use it.
+       * gnus-int.el (gnus-request-replace-article): Use it.
+       (gnus-request-accept-article): Ditto.
+       * mml.el (mml-preview): Use it.
+       * gnus-sum.el (gnus-summary-edit-article): Use it.
+       
+       * message.el (message-options-get): New function.
+       (message-options-get): New function.
+       * rfc2047.el (rfc2047-encode-message-header): Use them.
+       * mm-bodies.el (mm-encode-body): Use them.
+
 2000-10-28  Simon Josefsson  <sj@extundo.com>
 
        * nnimap.el (nnimap-retrieve-which-headers): 
index bdd0227..271cb64 100644 (file)
@@ -458,11 +458,12 @@ If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned."
   (unless (bolp)
     (insert "\n"))
   (unless no-encode
-    (save-restriction
-      (message-narrow-to-head)
-      (let ((mail-parse-charset message-default-charset))
-       (mail-encode-encoded-word-buffer)))
-    (message-encode-message-body))
+    (let ((message-options message-options))
+      (save-restriction
+       (message-narrow-to-head)
+       (let ((mail-parse-charset message-default-charset))
+         (mail-encode-encoded-word-buffer)))
+      (message-encode-message-body)))
   (let ((func (car (or gnus-command-method
                       (gnus-find-method-for-group group)))))
     (funcall (intern (format "%s-request-accept-article" func))
@@ -472,11 +473,12 @@ If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned."
 
 (defun gnus-request-replace-article (article group buffer &optional no-encode)
   (unless no-encode
-    (save-restriction
-      (message-narrow-to-head)
-      (let ((mail-parse-charset message-default-charset))
-       (mail-encode-encoded-word-buffer)))
-    (message-encode-message-body))
+    (let ((message-options message-options))
+      (save-restriction
+       (message-narrow-to-head)
+       (let ((mail-parse-charset message-default-charset))
+         (mail-encode-encoded-word-buffer)))
+      (message-encode-message-body)))
   (let ((func (car (gnus-group-name-to-method group))))
     (funcall (intern (format "%s-request-replace-article" func))
             article (gnus-group-real-name group) buffer)))
index feb3f6d..64562e4 100644 (file)
@@ -7852,6 +7852,7 @@ groups."
                 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
         `(lambda (no-highlight)
            (let ((mail-parse-charset ',gnus-newsgroup-charset)
+                 (message-options message-options)
                  (mail-parse-ignored-charsets 
                   ',gnus-newsgroup-ignored-charsets))
              ,(if (not raw) '(progn 
index 00e3c3d..934a4a7 100644 (file)
@@ -1007,6 +1007,9 @@ The first matched address (not primary one) is used in the From field."
     (User-Agent))
   "Alist used for formatting headers.")
 
+(defvar        message-options nil
+  "Some saved answers when sending message.")
+
 (eval-and-compile
   (autoload 'message-setup-toolbar "messagexmas")
   (autoload 'mh-new-draft-name "mh-comp")
@@ -2124,7 +2127,8 @@ It should typically alter the sending method in some way or other."
   (message message-sending-message)
   (let ((alist message-send-method-alist)
        (success t)
-       elem sent)
+       elem sent
+       (message-options message-options))
     (while (and success
                (setq elem (pop alist)))
       (when (funcall (cadr elem))
@@ -4560,6 +4564,19 @@ regexp varstr."
       (goto-char (point-max))
       (insert "From: " email "\n"))))
 
+(defun message-options-get (symbol)
+  (cdr (assq symbol message-options)))
+
+(defun message-options-set (symbol value)
+  (let ((the-cons (assq symbol message-options)))
+    (if the-cons
+       (if value 
+           (setcdr the-cons value)
+         (setq message-options (delq the-cons message-options)))
+      (and value
+          (push (cons symbol value) message-options))))
+  value)
+
 (provide 'message)
 
 (run-hooks 'message-load-hook)
index 5b8874c..f35d273 100644 (file)
@@ -65,7 +65,10 @@ If no encoding was done, nil is returned."
        (goto-char (point-min))
        (if (re-search-forward "[^\x0-\x7f]" nil t)
            (or mail-parse-charset
-               (mm-read-charset "Charset used in the article: "))
+               (message-options-get 'mm-encody-body-charset)
+               (message-options-set 
+                'mm-encody-body-charset
+                (mm-read-charset "Charset used in the article: ")))
          ;; The logic in `mml-generate-mime-1' confirms that it's OK
          ;; to return nil here.
          nil))
index 9caae01..7168b8c 100644 (file)
@@ -844,6 +844,7 @@ TYPE is the MIME type to use."
 If RAW, don't highlight the article."
   (interactive "P")
   (let ((buf (current-buffer))
+       (message-options message-options)
        (message-posting-charset (or (gnus-setup-posting-charset 
                                      (save-restriction
                                        (message-narrow-to-headers-or-head)
index 770e403..e663384 100644 (file)
@@ -148,8 +148,12 @@ Should be called narrowed to the head of the message."
              (and (delq 'ascii 
                         (mm-find-charset-region (point-min) 
                                                 (point-max)))
-                  (if (y-or-n-p 
-                       "Some texts are not encoded. Encode them anyway?")
+                  (if (or (message-options-get
+                           'rfc2047-encode-message-header-encode-any) 
+                          (message-options-set
+                           'rfc2047-encode-message-header-encode-any
+                           (y-or-n-p 
+                            "Some texts are not encoded. Encode anyway?")))
                       (rfc2047-encode-region (point-min) (point-max))
                     (error "Cannot send unencoded text."))))
             ((mm-coding-system-p method)