Synch with Oort Gnus.
[elisp/gnus.git-] / lisp / message.el
index 20a1ba6..ba4f568 100644 (file)
@@ -602,7 +602,7 @@ variable isn't used."
   :type 'sexp)
 
 (defcustom message-generate-headers-first nil
-  "*If non-nil, generate all possible headers before composing."
+  "*If non-nil, generate all required headers before composing."
   :group 'message-headers
   :type 'boolean)
 
@@ -2209,10 +2209,11 @@ With the prefix argument FORCE, insert the header anyway."
 (defun message-newline-and-reformat (&optional not-break)
   "Insert four newlines, and then reformat if inside quoted text."
   (interactive)
-  (let (quoted point beg end leading-space)
+  (let (quoted point beg end leading-space bolp)
     (setq point (point))
     (beginning-of-line)
     (setq beg (point))
+    (setq bolp (= beg point))
     ;; Find first line of the paragraph.
     (if not-break
        (while (and (not (eobp))
@@ -2227,8 +2228,9 @@ With the prefix argument FORCE, insert the header anyway."
       (setq leading-space (match-string 0)))
     (if (and quoted
             (not not-break)
+            (not bolp)
             (< (- point beg) (length quoted)))
-       ;; break in the cite prefix.
+       ;; break inside the cite prefix.
        (setq quoted nil
              end nil))
     (if quoted
@@ -2269,11 +2271,13 @@ With the prefix argument FORCE, insert the header anyway."
       (narrow-to-region beg end)
       (if not-break
          (setq point nil)
-       (insert "\n\n")
+       (if bolp
+           (insert "\n")
+         (insert "\n\n"))
        (setq point (point))
        (insert "\n\n")
        (delete-region (point) (re-search-forward "[ \t]*"))
-       (when quoted
+       (when (and quoted (not bolp))
          (insert quoted leading-space)))
       (if quoted
          (let* ((adaptive-fill-regexp
@@ -5206,7 +5210,7 @@ The form is: Fwd: Subject, where Subject is the original subject of
 the message."
   (concat "Fwd: " subject))
 
-(defun message-make-forward-subject ()
+(defun message-make-forward-subject (&optional decoded)
   "Return a Subject header suitable for the message in the current buffer."
   (save-excursion
     (save-restriction
@@ -5215,7 +5219,9 @@ the message."
            (subject (message-fetch-field "Subject")))
        (setq subject
              (if subject
-                 (nnheader-decode-subject subject)
+                 (if decoded
+                     subject
+                   (nnheader-decode-subject subject))
                ""))
        (if message-wash-forwarded-subjects
            (setq subject (message-wash-subject subject)))
@@ -5707,7 +5713,8 @@ regexp varstr."
        (when lines
          (insert lines))
        (setq content-type-p
-             (re-search-backward "^Content-Type:" nil t)))
+             (or mml-boundary
+                 (re-search-backward "^Content-Type:" nil t))))
       (save-restriction
        (message-narrow-to-headers-or-head)
        (message-remove-first-header "Content-Type")