Synch to No Gnus 200501120840.
[elisp/gnus.git-] / lisp / gnus-msg.el
index f41a272..7a5558e 100644 (file)
@@ -307,6 +307,7 @@ If nil, Gnus will never ask for confirmation if replying to mail."
   "If non-nil, Gnus tries to suggest a default address to resend to.
 If nil, the address field will always be empty after invoking
 `gnus-summary-resend-message'."
+  :version "21.4"
   :group 'gnus-message
   :type 'boolean)
 
@@ -1118,52 +1119,14 @@ If SILENT, don't prompt the user."
      (t gnus-select-method))))
 
 \f
-;; Dummies to avoid byte-compile warning.
-(eval-when-compile
-  (defvar xemacs-codename))
-
-(defun gnus-message-make-user-agent (&optional include-mime-info max-column
-                                                newline-product)
-  "Return a user-agent info.  If INCLUDE-MIME-INFO is non-nil and the
-variable `mime-edit-user-agent-value' is bound, the value will be
-included in the return value, and `gnus-user-agent' is ignored.  If
-MAX-COLUMN is specified, the return value will be folded up as it were
-filled.  NEWLINE-PRODUCT specifies whether a newline should be
-inserted in front of each product-token.  If the value is t or `hard',
-it works strictly.  Otherwise, if it is non-nil (e.g. `soft'), it
-works semi-strictly.
-
-Here is an odd example, which inserts a User-Agent: header when you
-begin to compose a message:
-
-\(add-hook 'gnus-message-setup-hook
-         (lambda nil
-           (setq message-user-agent nil)
-           (save-excursion
-             (save-restriction
-               (message-narrow-to-headers)
-               (goto-char (point-max))
-               (insert \"User-Agent: \"
-                       (gnus-message-make-user-agent t 76 'soft)
-                       \"\\n\")))))
-"
-  (let ((gnus-v (gnus-extended-version))
-       user-agent)
-    (cond ((and include-mime-info
-               (boundp 'mime-edit-user-agent-value))
-          (setq user-agent (concat gnus-v " " mime-edit-user-agent-value)))
-         ((eq gnus-user-agent 'gnus-mime-edit)
-          (setq user-agent
-                (if (boundp 'mime-edit-user-agent-value)
-                    (concat gnus-v " " mime-edit-user-agent-value)
-                  gnus-v)))
-         (t
-          (setq user-agent (if (stringp gnus-user-agent)
-                               gnus-user-agent
-                             (concat gnus-v
-                                     (let ((emacs-v (gnus-emacs-version)))
-                                       (when emacs-v
-                                         (concat " " emacs-v))))))))
+(defun gnus-message-make-user-agent (&optional dummy max-column
+                                              newline-product)
+  "Return a user-agent info.  If MAX-COLUMN is specified, the return
+value will be folded up as it were filled.  NEWLINE-PRODUCT specifies
+whether a newline should be inserted in front of each product-token;
+if the value is t or `hard', it works strictly.  Otherwise, if it is
+non-nil (e.g. `soft'), it works semi-strictly."
+  (let ((user-agent (gnus-extended-version)))
     (when max-column
       (unless (natnump max-column)
        (setq max-column 76))
@@ -2164,10 +2127,12 @@ this is a reply."
       (when (and filep v)
        (setq v (with-temp-buffer
                  (insert-file-contents v)
-                 (goto-char (point-max))
-                 (skip-chars-backward "\n")
-                 (delete-region (+ (point) (if (bolp) 0 1)) (point-max))
-                 (buffer-string))))
+                 (buffer-substring (point-min)
+                                   (progn
+                                     (goto-char (point-max))
+                                     (if (zerop (skip-chars-backward "\n"))
+                                         (point)
+                                       (1+ (point))))))))
       (if (eq element 'import)
          (progn
            (if (member v stack)