comparison lisp/mail/rnewspost.el @ 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 17ad035e0cab
children 09a101ff1885
comparison
equal deleted inserted replaced
21869:0f8ca1599a5a 21870:1afd18de6c50
116 C-c C-f C-d move to Distribution: C-c C-f C-a move to Summary: 116 C-c C-f C-d move to Distribution: C-c C-f C-a move to Summary:
117 C-c C-y news-reply-yank-original (insert current message, in NEWS). 117 C-c C-y news-reply-yank-original (insert current message, in NEWS).
118 C-c C-q mail-fill-yanked-message (fill what was yanked). 118 C-c C-q mail-fill-yanked-message (fill what was yanked).
119 C-c C-r caesar rotate all letters by 13 places in the article's body (rot13)." 119 C-c C-r caesar rotate all letters by 13 places in the article's body (rot13)."
120 (interactive) 120 (interactive)
121 ;; require...
122 (or (fboundp 'mail-setup) (load "sendmail"))
123 (kill-all-local-variables) 121 (kill-all-local-variables)
124 (make-local-variable 'mail-reply-buffer) 122 (make-local-variable 'mail-reply-buffer)
125 (setq mail-reply-buffer nil) 123 (setq mail-reply-buffer nil)
126 (set-syntax-table text-mode-syntax-table) 124 (set-syntax-table text-mode-syntax-table)
127 (use-local-map news-reply-mode-map) 125 (use-local-map news-reply-mode-map)
128 (setq local-abbrev-table text-mode-abbrev-table) 126 (setq local-abbrev-table text-mode-abbrev-table)
129 (setq major-mode 'news-reply-mode) 127 (setq major-mode 'news-reply-mode)
130 (setq mode-name "News Reply") 128 (setq mode-name "News Reply")
131 (make-local-variable 'paragraph-separate) 129 (make-local-variable 'paragraph-separate)
132 (make-local-variable 'paragraph-start) 130 (make-local-variable 'paragraph-start)
133 (setq paragraph-start
134 (concat "^" (regexp-quote mail-header-separator) "$\\|"
135 paragraph-start))
136 (setq paragraph-separate
137 (concat "^" (regexp-quote mail-header-separator) "$\\|"
138 paragraph-separate))
139 (run-hooks 'text-mode-hook 'news-reply-mode-hook)) 131 (run-hooks 'text-mode-hook 'news-reply-mode-hook))
140 132
141 (defvar news-reply-yank-from "" 133 (defvar news-reply-yank-from ""
142 "Save `From:' field for `news-reply-yank-original'.") 134 "Save `From:' field for `news-reply-yank-original'.")
143 135
244 (progn (beginning-of-line) 236 (progn (beginning-of-line)
245 (insert "Newsgroups: " (or newsgroups "") "\n") 237 (insert "Newsgroups: " (or newsgroups "") "\n")
246 (if (not newsgroups) 238 (if (not newsgroups)
247 (backward-char 1) 239 (backward-char 1)
248 (goto-char (point-max))))) 240 (goto-char (point-max)))))
241 (let (actual-header-separator)
242 (rfc822-goto-eoh)
243 (setq actual-header-separator (buffer-substring
244 (point)
245 (save-excursion (end-of-line) (point))))
246 (setq paragraph-start
247 (concat "^" actual-header-separator "$\\|" paragraph-start))
248 (setq paragraph-separate
249 (concat "^" actual-header-separator "$\\|" paragraph-separate)))
249 (run-hooks 'news-setup-hook))) 250 (run-hooks 'news-setup-hook)))
250 251
251 (defun news-inews () 252 (defun news-inews ()
252 "Send a news message using inews." 253 "Send a news message using inews."
253 (interactive) 254 (interactive)
254 (let* (newsgroups subject 255 (let* (newsgroups subject
255 (case-fold-search nil)) 256 (case-fold-search nil))
256 (save-excursion 257 (save-excursion
257 (save-restriction 258 (save-restriction
258 (goto-char (point-min)) 259 (narrow-to-region (point-min) (mail-header-end))
259 (search-forward (concat "\n" mail-header-separator "\n"))
260 (narrow-to-region (point-min) (point))
261 (setq newsgroups (mail-fetch-field "newsgroups") 260 (setq newsgroups (mail-fetch-field "newsgroups")
262 subject (mail-fetch-field "subject"))) 261 subject (mail-fetch-field "subject")))
263 (widen) 262 (widen)
264 (goto-char (point-min)) 263 (goto-char (point-min))
265 (run-hooks 'news-inews-hook) 264 (run-hooks 'news-inews-hook)
266 (goto-char (point-min)) 265 (mail-sendmail-undelimit-header)
267 (search-forward (concat "\n" mail-header-separator "\n"))
268 (replace-match "\n\n")
269 (goto-char (point-max)) 266 (goto-char (point-max))
270 ;; require a newline at the end for inews to append .signature to 267 ;; require a newline at the end for inews to append .signature to
271 (or (= (preceding-char) ?\n) 268 (or (= (preceding-char) ?\n)
272 (insert ?\n)) 269 (insert ?\n))
273 (message "Posting to USENET...") 270 (message "Posting to USENET...")
279 ;@@ setting of subject and newsgroups still needed? 276 ;@@ setting of subject and newsgroups still needed?
280 ;"-t" subject 277 ;"-t" subject
281 ;"-n" newsgroups 278 ;"-n" newsgroups
282 (error "Posting to USENET failed") 279 (error "Posting to USENET failed")
283 (message "Posting to USENET... done")) 280 (message "Posting to USENET... done"))
284 (goto-char (point-min)) ;restore internal header separator 281 (mail-sendmail-delmit-header)
285 (search-forward "\n\n")
286 (replace-match (concat "\n" mail-header-separator "\n"))
287 (set-buffer-modified-p nil))) 282 (set-buffer-modified-p nil)))
288 (bury-buffer))) 283 (bury-buffer)))
289 284
290 ;@@ shares some code with news-reply and news-post-news 285 ;@@ shares some code with news-reply and news-post-news
291 (defun news-mail-reply () 286 (defun news-mail-reply ()