changeset 21870:1afd18de6c50

(news-reply-mode): Don't load sendmail here. Don't set paragraph-start or paragraph-separate. (news-setup): Set them here. (news-inews): Use mail-header-end, etc. Use mail-sendmail-delmit-header at the end.
author Richard M. Stallman <rms@gnu.org>
date Thu, 30 Apr 1998 06:37:04 +0000
parents 0f8ca1599a5a
children 594b894aada5
files lisp/mail/rnewspost.el
diffstat 1 files changed, 12 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rnewspost.el	Thu Apr 30 06:32:07 1998 +0000
+++ b/lisp/mail/rnewspost.el	Thu Apr 30 06:37:04 1998 +0000
@@ -118,8 +118,6 @@
 C-c C-q  mail-fill-yanked-message (fill what was yanked).
 C-c C-r  caesar rotate all letters by 13 places in the article's body (rot13)."
   (interactive)
-  ;; require...
-  (or (fboundp 'mail-setup) (load "sendmail"))
   (kill-all-local-variables)
   (make-local-variable 'mail-reply-buffer)
   (setq mail-reply-buffer nil)
@@ -130,12 +128,6 @@
   (setq mode-name "News Reply")
   (make-local-variable 'paragraph-separate)
   (make-local-variable 'paragraph-start)
-  (setq paragraph-start
-	(concat "^" (regexp-quote mail-header-separator) "$\\|"
-		paragraph-start))
-  (setq paragraph-separate
-	(concat "^" (regexp-quote mail-header-separator) "$\\|"
-		paragraph-separate))
   (run-hooks 'text-mode-hook 'news-reply-mode-hook))
 
 (defvar news-reply-yank-from ""
@@ -246,6 +238,15 @@
 	       (if (not newsgroups)
 		   (backward-char 1)
 		 (goto-char (point-max)))))
+    (let (actual-header-separator)
+      (rfc822-goto-eoh)
+      (setq actual-header-separator (buffer-substring
+				     (point)
+				     (save-excursion (end-of-line) (point))))
+      (setq paragraph-start
+	    (concat "^" actual-header-separator "$\\|" paragraph-start))
+      (setq paragraph-separate
+	    (concat "^" actual-header-separator "$\\|" paragraph-separate)))
     (run-hooks 'news-setup-hook)))
    
 (defun news-inews ()
@@ -255,17 +256,13 @@
 		    (case-fold-search nil))
     (save-excursion
       (save-restriction
-	(goto-char (point-min))
-	(search-forward (concat "\n" mail-header-separator "\n"))
-	(narrow-to-region (point-min) (point))
+	(narrow-to-region (point-min) (mail-header-end))
 	(setq newsgroups (mail-fetch-field "newsgroups")
 	      subject (mail-fetch-field "subject")))
       (widen)
       (goto-char (point-min))
       (run-hooks 'news-inews-hook)
-      (goto-char (point-min))
-      (search-forward (concat "\n" mail-header-separator "\n"))
-      (replace-match "\n\n")
+      (mail-sendmail-undelimit-header)
       (goto-char (point-max))
       ;; require a newline at the end for inews to append .signature to
       (or (= (preceding-char) ?\n)
@@ -281,9 +278,7 @@
 					;"-n" newsgroups
 	      (error "Posting to USENET failed")
 	    (message "Posting to USENET... done"))
-	(goto-char (point-min))		;restore internal header separator
-	(search-forward "\n\n")
-	(replace-match (concat "\n" mail-header-separator "\n"))
+	(mail-sendmail-delmit-header)
 	(set-buffer-modified-p nil)))
     (bury-buffer)))