Mercurial > emacs
annotate lisp/mail/rnewspost.el @ 11189:a2a85a29cdd6
(set-auto-mode): Fix previous change.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 03 Apr 1995 21:37:39 +0000 |
parents | ffdc2e03b480 |
children | e6bdaaa6ce1b |
rev | line source |
---|---|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
1 ;;; rnewspost.el --- USENET news poster/mailer for GNU Emacs |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
2 |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
814
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc. |
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
814
diff
changeset
|
4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
5 ;; Maintainer: FSF |
814
38b2499cb3e9
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: mail, news |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
7 |
35 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
35 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
24 ;; Change Log: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
25 |
35 | 26 ;; moved posting and mail code from rnews.el |
27 ;; tower@prep.ai.mit.edu Wed Oct 29 1986 | |
28 ;; brought posting code almost up to the revision of RFC 850 for News 2.11 | |
29 ;; - couldn't see handling the special meaning of the Keyword: poster | |
30 ;; - not worth the code space to support the old A news Title: (which | |
31 ;; Subject: replaced) and Article-I.D.: (which Message-ID: replaced) | |
32 ;; tower@prep Nov 86 | |
33 ;; changed C-c C-r key-binding due to rename of news-caesar-buffer-body | |
34 ;; tower@prep 21 Nov 86 | |
35 ;; added (require 'rnews) tower@prep 22 Apr 87 | |
36 ;; restricted call of news-show-all-headers in news-post-news & news-reply | |
37 ;; tower@prep 28 Apr 87 | |
38 ;; commented out Posting-Front-End to save USENET bytes tower@prep Jul 31 87 | |
39 ;; commented out -n and -t args in news-inews tower@prep 15 Oct 87 | |
40 | |
41 ;Now in paths.el. | |
42 ;(defvar news-inews-program "inews" | |
43 ; "Function to post news.") | |
44 | |
45 ;; Replying and posting news items are done by these functions. | |
46 ;; imported from rmail and modified to work with rnews ... | |
47 ;; Mon Mar 25,1985 at 03:07:04 ads@mit-hermes. | |
48 ;; this is done so that rnews can operate independently from rmail.el and | |
49 ;; sendmail and dosen't have to autoload these functions. | |
50 ;; | |
51 ;;; >> Nuked by Mly to autoload those functions again, as the duplication of | |
52 ;;; >> code was making maintenance too difficult. | |
53 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
54 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
55 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
56 (require 'sendmail) |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
57 (require 'rnews) |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
58 |
35 | 59 (defvar news-reply-mode-map () "Mode map used by news-reply.") |
60 | |
61 (or news-reply-mode-map | |
62 (progn | |
63 (setq news-reply-mode-map (make-keymap)) | |
64 (define-key news-reply-mode-map "\C-c?" 'describe-mode) | |
65 (define-key news-reply-mode-map "\C-c\C-f\C-d" 'news-reply-distribution) | |
66 (define-key news-reply-mode-map "\C-c\C-f\C-k" 'news-reply-keywords) | |
67 (define-key news-reply-mode-map "\C-c\C-f\C-n" 'news-reply-newsgroups) | |
68 (define-key news-reply-mode-map "\C-c\C-f\C-f" 'news-reply-followup-to) | |
69 (define-key news-reply-mode-map "\C-c\C-f\C-s" 'mail-subject) | |
70 (define-key news-reply-mode-map "\C-c\C-f\C-a" 'news-reply-summary) | |
9534
323dc8f5028a
(news-reply-mode-map): Add C-c C-t binding.
Richard M. Stallman <rms@gnu.org>
parents:
1033
diff
changeset
|
71 (define-key news-reply-mode-map "\C-c\C-t" 'mail-text) |
35 | 72 (define-key news-reply-mode-map "\C-c\C-r" 'news-caesar-buffer-body) |
73 (define-key news-reply-mode-map "\C-c\C-w" 'news-reply-signature) | |
74 (define-key news-reply-mode-map "\C-c\C-y" 'news-reply-yank-original) | |
75 (define-key news-reply-mode-map "\C-c\C-q" 'mail-fill-yanked-message) | |
76 (define-key news-reply-mode-map "\C-c\C-c" 'news-inews) | |
10972
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
77 (define-key news-reply-mode-map "\C-c\C-s" 'news-inews) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
78 (define-key news-reply-mode-map [menu-bar] (make-sparse-keymap)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
79 (define-key news-reply-mode-map [menu-bar fields] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
80 (cons "Fields" (make-sparse-keymap "Fields"))) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
81 (define-key news-reply-mode-map [menu-bar fields news-reply-distribution] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
82 '("Distribution" . news-reply-distribution)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
83 (define-key news-reply-mode-map [menu-bar fields news-reply-keywords] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
84 '("Keywords" . news-reply-keywords)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
85 (define-key news-reply-mode-map [menu-bar fields news-reply-newsgroups] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
86 '("Newsgroups" . news-reply-newsgroups)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
87 (define-key news-reply-mode-map [menu-bar fields news-reply-followup-to] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
88 '("Followup-to" . news-reply-followup-to)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
89 (define-key news-reply-mode-map [menu-bar fields mail-subject] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
90 '("Subject" . mail-subject)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
91 (define-key news-reply-mode-map [menu-bar fields news-reply-summary] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
92 '("Summary" . news-reply-summary)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
93 (define-key news-reply-mode-map [menu-bar fields mail-text] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
94 '("Text" . mail-text)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
95 (define-key news-reply-mode-map [menu-bar news] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
96 (cons "News" (make-sparse-keymap "News"))) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
97 (define-key news-reply-mode-map [menu-bar news news-caesar-buffer-body] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
98 '("Rot13" . news-caesar-buffer-body)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
99 (define-key news-reply-mode-map [menu-bar news news-reply-signature] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
100 '("Signature" . news-reply-signature)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
101 (define-key news-reply-mode-map [menu-bar news news-reply-yank-original] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
102 '("Yank Original" . news-reply-yank-original)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
103 (define-key news-reply-mode-map [menu-bar news mail-fill-yanked-message] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
104 '("Fill Yanked Messages" . mail-fill-yanked-message)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
105 (define-key news-reply-mode-map [menu-bar news news-inews] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
106 '("Send" . news-inews)))) |
35 | 107 |
108 (defun news-reply-mode () | |
109 "Major mode for editing news to be posted on USENET. | |
110 First-time posters are asked to please read the articles in newsgroup: | |
111 news.announce.newusers . | |
112 Like Text Mode but with these additional commands: | |
113 | |
114 C-c C-s news-inews (post the message) C-c C-c news-inews | |
115 C-c C-f move to a header field (and create it if there isn't): | |
116 C-c C-f C-n move to Newsgroups: C-c C-f C-s move to Subj: | |
117 C-c C-f C-f move to Followup-To: C-c C-f C-k move to Keywords: | |
118 C-c C-f C-d move to Distribution: C-c C-f C-a move to Summary: | |
119 C-c C-y news-reply-yank-original (insert current message, in NEWS). | |
120 C-c C-q mail-fill-yanked-message (fill what was yanked). | |
121 C-c C-r caesar rotate all letters by 13 places in the article's body (rot13)." | |
122 (interactive) | |
123 ;; require... | |
124 (or (fboundp 'mail-setup) (load "sendmail")) | |
125 (kill-all-local-variables) | |
126 (make-local-variable 'mail-reply-buffer) | |
127 (setq mail-reply-buffer nil) | |
128 (set-syntax-table text-mode-syntax-table) | |
129 (use-local-map news-reply-mode-map) | |
130 (setq local-abbrev-table text-mode-abbrev-table) | |
131 (setq major-mode 'news-reply-mode) | |
10587
99b9f20b6921
(news-reply-mode): Change mode-name to News Reply.
Richard M. Stallman <rms@gnu.org>
parents:
10184
diff
changeset
|
132 (setq mode-name "News Reply") |
35 | 133 (make-local-variable 'paragraph-separate) |
134 (make-local-variable 'paragraph-start) | |
10891
8535e6d5f8bb
(news-reply-mode): Remove ^ from paragraph-start & paragraph-separate.
Boris Goldowsky <boris@gnu.org>
parents:
10804
diff
changeset
|
135 (setq paragraph-start (concat mail-header-separator "$\\|" |
35 | 136 paragraph-start)) |
10891
8535e6d5f8bb
(news-reply-mode): Remove ^ from paragraph-start & paragraph-separate.
Boris Goldowsky <boris@gnu.org>
parents:
10804
diff
changeset
|
137 (setq paragraph-separate (concat mail-header-separator "$\\|" |
35 | 138 paragraph-separate)) |
139 (run-hooks 'text-mode-hook 'news-reply-mode-hook)) | |
140 | |
141 (defvar news-reply-yank-from | |
10804 | 142 "Save `From:' field for `news-reply-yank-original'." |
35 | 143 "") |
144 | |
145 (defvar news-reply-yank-message-id | |
10804 | 146 "Save `Message-Id:' field for `news-reply-yank-original'." |
35 | 147 "") |
148 | |
149 (defun news-reply-yank-original (arg) | |
10804 | 150 "Insert the message being replied to, if any (in Mail mode). |
35 | 151 Puts point before the text and mark after. |
152 Indents each nonblank line ARG spaces (default 3). | |
153 Just \\[universal-argument] as argument means don't indent | |
154 and don't delete any header fields." | |
155 (interactive "P") | |
156 (mail-yank-original arg) | |
157 (exchange-point-and-mark) | |
158 (run-hooks 'news-reply-header-hook)) | |
159 | |
160 (defvar news-reply-header-hook | |
161 '(lambda () | |
162 (insert "In article " news-reply-yank-message-id | |
163 " " news-reply-yank-from " writes:\n\n")) | |
164 "Hook for inserting a header at the top of a yanked message.") | |
165 | |
166 (defun news-reply-newsgroups () | |
10804 | 167 "Move point to end of `Newsgroups:' field. |
168 RFC 850 constrains the `Newsgroups:' field to be a comma-separated list | |
169 of valid newsgroup names at your site. For example, | |
170 Newsgroups: news.misc,comp.misc,rec.misc" | |
35 | 171 (interactive) |
172 (expand-abbrev) | |
173 (goto-char (point-min)) | |
174 (mail-position-on-field "Newsgroups")) | |
175 | |
176 (defun news-reply-followup-to () | |
10804 | 177 "Move point to end of `Followup-To:' field. Create the field if none. |
35 | 178 One usually requests followups to only one newsgroup. |
10804 | 179 RFC 850 constrains the `Followup-To:' field to be a comma-separated list |
180 of valid newsgroups names at your site, and it must be a subset of the | |
181 `Newsgroups:' field. For example: | |
182 Newsgroups: news.misc,comp.misc,rec.misc,misc.misc,soc.misc | |
183 Followup-To: news.misc,comp.misc,rec.misc" | |
35 | 184 (interactive) |
185 (expand-abbrev) | |
186 (or (mail-position-on-field "Followup-To" t) | |
187 (progn (mail-position-on-field "newsgroups") | |
188 (insert "\nFollowup-To: "))) | |
189 ;; @@ could do a completing read based on the Newsgroups: field to | |
190 ;; @@ fill in the Followup-To: field | |
191 ) | |
192 | |
193 (defun news-reply-distribution () | |
10804 | 194 "Move point to end of `Distribution:' optional field. |
35 | 195 Create the field if none. Without this field the posting goes to all of |
196 USENET. The field is used to restrict the posting to parts of USENET." | |
197 (interactive) | |
198 (expand-abbrev) | |
199 (mail-position-on-field "Distribution") | |
200 ;; @@could do a completing read based on the news library file: | |
201 ;; @@ ../distributions to fill in the field. | |
202 ) | |
203 | |
204 (defun news-reply-keywords () | |
10804 | 205 "Move point to end of `Keywords:' optional field. Create the field if none. |
35 | 206 Used as an aid to the news reader, it can contain a few, well selected keywords |
207 identifying the message." | |
208 (interactive) | |
209 (expand-abbrev) | |
210 (mail-position-on-field "Keywords")) | |
211 | |
212 (defun news-reply-summary () | |
10804 | 213 "Move point to end of `Summary:' optional field. Create the field if none. |
35 | 214 Used as an aid to the news reader, it can contain a succinct |
215 summary (abstract) of the message." | |
216 (interactive) | |
217 (expand-abbrev) | |
218 (mail-position-on-field "Summary")) | |
219 | |
220 (defun news-reply-signature () | |
221 "The inews program appends ~/.signature automatically." | |
222 (interactive) | |
223 (message "~/.signature will be appended automatically.")) | |
224 | |
225 (defun news-setup (to subject in-reply-to newsgroups replybuffer) | |
10804 | 226 "Set up the news reply or posting buffer with the proper headers and mode." |
35 | 227 (setq mail-reply-buffer replybuffer) |
228 (let ((mail-setup-hook nil)) | |
229 (if (null to) | |
230 ;; this hack is needed so that inews wont be confused by | |
231 ;; the fcc: and bcc: fields | |
232 (let ((mail-self-blind nil) | |
233 (mail-archive-file-name nil)) | |
234 (mail-setup to subject in-reply-to nil replybuffer nil) | |
235 (beginning-of-line) | |
1033 | 236 (delete-region (point) (progn (forward-line 1) (point))) |
35 | 237 (goto-char (point-max))) |
238 (mail-setup to subject in-reply-to nil replybuffer nil)) | |
239 ;;;(mail-position-on-field "Posting-Front-End") | |
240 ;;;(insert (emacs-version)) | |
241 (goto-char (point-max)) | |
242 (if (let ((case-fold-search t)) | |
243 (re-search-backward "^Subject:" (point-min) t)) | |
244 (progn (beginning-of-line) | |
245 (insert "Newsgroups: " (or newsgroups "") "\n") | |
246 (if (not newsgroups) | |
247 (backward-char 1) | |
248 (goto-char (point-max))))) | |
249 (run-hooks 'news-setup-hook))) | |
250 | |
251 (defun news-inews () | |
252 "Send a news message using inews." | |
253 (interactive) | |
254 (let* (newsgroups subject | |
255 (case-fold-search nil)) | |
256 (save-excursion | |
257 (save-restriction | |
258 (goto-char (point-min)) | |
259 (search-forward (concat "\n" mail-header-separator "\n")) | |
260 (narrow-to-region (point-min) (point)) | |
261 (setq newsgroups (mail-fetch-field "newsgroups") | |
262 subject (mail-fetch-field "subject"))) | |
263 (widen) | |
264 (goto-char (point-min)) | |
265 (run-hooks 'news-inews-hook) | |
266 (goto-char (point-min)) | |
267 (search-forward (concat "\n" mail-header-separator "\n")) | |
268 (replace-match "\n\n") | |
269 (goto-char (point-max)) | |
270 ;; require a newline at the end for inews to append .signature to | |
271 (or (= (preceding-char) ?\n) | |
272 (insert ?\n)) | |
273 (message "Posting to USENET...") | |
274 (call-process-region (point-min) (point-max) | |
275 news-inews-program nil 0 nil | |
276 "-h") ; take all header lines! | |
277 ;@@ setting of subject and newsgroups still needed? | |
278 ;"-t" subject | |
279 ;"-n" newsgroups | |
280 (message "Posting to USENET... done") | |
281 (goto-char (point-min)) ;restore internal header separator | |
282 (search-forward "\n\n") | |
283 (replace-match (concat "\n" mail-header-separator "\n")) | |
284 (set-buffer-modified-p nil)) | |
285 (and (fboundp 'bury-buffer) (bury-buffer)))) | |
286 | |
287 ;@@ shares some code with news-reply and news-post-news | |
288 (defun news-mail-reply () | |
289 "Mail a reply to the author of the current article. | |
290 While composing the reply, use \\[news-reply-yank-original] to yank the | |
291 original message into it." | |
292 (interactive) | |
293 (let (from cc subject date to reply-to | |
294 (buffer (current-buffer))) | |
295 (save-restriction | |
296 (narrow-to-region (point-min) (progn (goto-line (point-min)) | |
297 (search-forward "\n\n") | |
298 (- (point) 1))) | |
299 (setq from (mail-fetch-field "from") | |
300 subject (mail-fetch-field "subject") | |
301 reply-to (mail-fetch-field "reply-to") | |
10184
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
302 date (mail-fetch-field "date"))) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
303 (setq to from) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
304 (pop-to-buffer "*mail*") |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
305 (mail nil |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
306 (if reply-to reply-to to) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
307 subject |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
308 (let ((stop-pos (string-match " *at \\| *@ \\| *(\\| *<" from))) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
309 (concat (if stop-pos (substring from 0 stop-pos) from) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
310 "'s message of " |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
311 date)) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
312 nil |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
313 buffer))) |
35 | 314 |
315 ;@@ the guts of news-reply and news-post-news should be combined. -tower | |
316 (defun news-reply () | |
317 "Compose and post a reply (aka a followup) to the current article on USENET. | |
318 While composing the followup, use \\[news-reply-yank-original] to yank the | |
319 original message into it." | |
320 (interactive) | |
321 (if (y-or-n-p "Are you sure you want to followup to all of USENET? ") | |
322 (let (from cc subject date to followup-to newsgroups message-of | |
323 references distribution message-id | |
324 (buffer (current-buffer))) | |
325 (save-restriction | |
326 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | |
327 ;@@ of article file | |
328 (equal major-mode 'news-mode) ;@@ if rmail-mode, | |
329 ;@@ should show full headers | |
330 (progn | |
331 (news-show-all-headers) ;@@ should save/restore header state, | |
332 ;@@ but rnews.el lacks support | |
333 (narrow-to-region (point-min) (progn (goto-char (point-min)) | |
334 (search-forward "\n\n") | |
335 (- (point) 1))))) | |
336 (setq from (mail-fetch-field "from") | |
337 news-reply-yank-from from | |
338 ;; @@ not handling old Title: field | |
339 subject (mail-fetch-field "subject") | |
340 date (mail-fetch-field "date") | |
341 followup-to (mail-fetch-field "followup-to") | |
342 newsgroups (or followup-to | |
343 (mail-fetch-field "newsgroups")) | |
344 references (mail-fetch-field "references") | |
345 ;; @@ not handling old Article-I.D.: field | |
346 distribution (mail-fetch-field "distribution") | |
347 message-id (mail-fetch-field "message-id") | |
348 news-reply-yank-message-id message-id) | |
349 (pop-to-buffer "*post-news*") | |
350 (news-reply-mode) | |
351 (if (and (buffer-modified-p) | |
352 (not | |
353 (y-or-n-p "Unsent article being composed; erase it? "))) | |
354 () | |
355 (progn | |
356 (erase-buffer) | |
357 (and subject | |
358 (progn (if (string-match "\\`Re: " subject) | |
359 (while (string-match "\\`Re: " subject) | |
360 (setq subject (substring subject 4)))) | |
361 (setq subject (concat "Re: " subject)))) | |
362 (and from | |
363 (progn | |
364 (let ((stop-pos | |
365 (string-match " *at \\| *@ \\| *(\\| *<" from))) | |
366 (setq message-of | |
367 (concat | |
368 (if stop-pos (substring from 0 stop-pos) from) | |
369 "'s message of " | |
370 date))))) | |
371 (news-setup | |
372 nil | |
373 subject | |
374 message-of | |
375 newsgroups | |
376 buffer) | |
377 (if followup-to | |
378 (progn (news-reply-followup-to) | |
379 (insert followup-to))) | |
380 (if distribution | |
381 (progn | |
382 (mail-position-on-field "Distribution") | |
383 (insert distribution))) | |
384 (mail-position-on-field "References") | |
385 (if references | |
386 (insert references)) | |
387 (if (and references message-id) | |
388 (insert " ")) | |
389 (if message-id | |
390 (insert message-id)) | |
391 (goto-char (point-max)))))) | |
392 (message ""))) | |
393 | |
394 ;@@ the guts of news-reply and news-post-news should be combined. -tower | |
10804 | 395 ;;;###autoload |
35 | 396 (defun news-post-news () |
397 "Begin editing a new USENET news article to be posted. | |
398 Type \\[describe-mode] once editing the article to get a list of commands." | |
399 (interactive) | |
400 (if (y-or-n-p "Are you sure you want to post to all of USENET? ") | |
401 (let ((buffer (current-buffer))) | |
402 (save-restriction | |
403 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | |
404 ;@@ of article file | |
405 (equal major-mode 'news-mode) ;@@ if rmail-mode, | |
406 ;@@ should show full headers | |
407 (progn | |
408 (news-show-all-headers) ;@@ should save/restore header state, | |
409 ;@@ but rnews.el lacks support | |
410 (narrow-to-region (point-min) (progn (goto-char (point-min)) | |
411 (search-forward "\n\n") | |
412 (- (point) 1))))) | |
413 (setq news-reply-yank-from (mail-fetch-field "from") | |
414 ;; @@ not handling old Article-I.D.: field | |
415 news-reply-yank-message-id (mail-fetch-field "message-id"))) | |
416 (pop-to-buffer "*post-news*") | |
417 (news-reply-mode) | |
418 (if (and (buffer-modified-p) | |
419 (not (y-or-n-p "Unsent article being composed; erase it? "))) | |
420 () ;@@ not saving point from last time | |
421 (progn (erase-buffer) | |
422 (news-setup () () () () buffer)))) | |
423 (message ""))) | |
424 | |
425 (defun news-mail-other-window () | |
426 "Send mail in another window. | |
427 While composing the message, use \\[news-reply-yank-original] to yank the | |
428 original message into it." | |
429 (interactive) | |
430 (mail-other-window nil nil nil nil nil (current-buffer))) | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
431 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
432 ;;; rnewspost.el ends here |