Mercurial > emacs
annotate lisp/mail/rnewspost.el @ 14266:a8bd2aaa0d8c
(turn-on-font-lock): Test window-system.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 24 Jan 1996 05:40:21 +0000 |
parents | 069791dced1e |
children | 4cbc6690c0f7 |
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 |
11235 | 3 ;; Copyright (C) 1985, 1986, 1987, 1995 Free Software Foundation, Inc. |
846
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 | |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
35 | 24 |
14231
069791dced1e
Fix Change Log comment line.
Erik Naggum <erik@naggum.no>
parents:
14169
diff
changeset
|
25 ;;; Change Log: |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
26 |
35 | 27 ;; moved posting and mail code from rnews.el |
28 ;; tower@prep.ai.mit.edu Wed Oct 29 1986 | |
29 ;; brought posting code almost up to the revision of RFC 850 for News 2.11 | |
30 ;; - couldn't see handling the special meaning of the Keyword: poster | |
31 ;; - not worth the code space to support the old A news Title: (which | |
32 ;; Subject: replaced) and Article-I.D.: (which Message-ID: replaced) | |
33 ;; tower@prep Nov 86 | |
34 ;; changed C-c C-r key-binding due to rename of news-caesar-buffer-body | |
35 ;; tower@prep 21 Nov 86 | |
36 ;; added (require 'rnews) tower@prep 22 Apr 87 | |
37 ;; restricted call of news-show-all-headers in news-post-news & news-reply | |
38 ;; tower@prep 28 Apr 87 | |
39 ;; commented out Posting-Front-End to save USENET bytes tower@prep Jul 31 87 | |
40 ;; commented out -n and -t args in news-inews tower@prep 15 Oct 87 | |
41 | |
42 ;Now in paths.el. | |
43 ;(defvar news-inews-program "inews" | |
44 ; "Function to post news.") | |
45 | |
46 ;; Replying and posting news items are done by these functions. | |
47 ;; imported from rmail and modified to work with rnews ... | |
48 ;; Mon Mar 25,1985 at 03:07:04 ads@mit-hermes. | |
49 ;; this is done so that rnews can operate independently from rmail.el and | |
14040 | 50 ;; sendmail and doesn't have to autoload these functions. |
35 | 51 ;; |
52 ;;; >> Nuked by Mly to autoload those functions again, as the duplication of | |
53 ;;; >> code was making maintenance too difficult. | |
54 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
55 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
56 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
57 (require 'sendmail) |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
58 (require 'rnews) |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
59 |
35 | 60 (defvar news-reply-mode-map () "Mode map used by news-reply.") |
61 | |
62 (or news-reply-mode-map | |
63 (progn | |
64 (setq news-reply-mode-map (make-keymap)) | |
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) | |
11769
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
135 (setq paragraph-start |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
136 (concat "^" (regexp-quote mail-header-separator) "$\\|" |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
137 paragraph-start)) |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
138 (setq paragraph-separate |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
139 (concat "^" (regexp-quote mail-header-separator) "$\\|" |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
140 paragraph-separate)) |
35 | 141 (run-hooks 'text-mode-hook 'news-reply-mode-hook)) |
142 | |
143 (defvar news-reply-yank-from | |
10804 | 144 "Save `From:' field for `news-reply-yank-original'." |
35 | 145 "") |
146 | |
147 (defvar news-reply-yank-message-id | |
10804 | 148 "Save `Message-Id:' field for `news-reply-yank-original'." |
35 | 149 "") |
150 | |
151 (defun news-reply-yank-original (arg) | |
10804 | 152 "Insert the message being replied to, if any (in Mail mode). |
35 | 153 Puts point before the text and mark after. |
154 Indents each nonblank line ARG spaces (default 3). | |
155 Just \\[universal-argument] as argument means don't indent | |
156 and don't delete any header fields." | |
157 (interactive "P") | |
158 (mail-yank-original arg) | |
159 (exchange-point-and-mark) | |
160 (run-hooks 'news-reply-header-hook)) | |
161 | |
162 (defvar news-reply-header-hook | |
163 '(lambda () | |
164 (insert "In article " news-reply-yank-message-id | |
165 " " news-reply-yank-from " writes:\n\n")) | |
166 "Hook for inserting a header at the top of a yanked message.") | |
167 | |
168 (defun news-reply-newsgroups () | |
10804 | 169 "Move point to end of `Newsgroups:' field. |
170 RFC 850 constrains the `Newsgroups:' field to be a comma-separated list | |
171 of valid newsgroup names at your site. For example, | |
172 Newsgroups: news.misc,comp.misc,rec.misc" | |
35 | 173 (interactive) |
174 (expand-abbrev) | |
175 (goto-char (point-min)) | |
176 (mail-position-on-field "Newsgroups")) | |
177 | |
178 (defun news-reply-followup-to () | |
10804 | 179 "Move point to end of `Followup-To:' field. Create the field if none. |
35 | 180 One usually requests followups to only one newsgroup. |
10804 | 181 RFC 850 constrains the `Followup-To:' field to be a comma-separated list |
182 of valid newsgroups names at your site, and it must be a subset of the | |
183 `Newsgroups:' field. For example: | |
184 Newsgroups: news.misc,comp.misc,rec.misc,misc.misc,soc.misc | |
185 Followup-To: news.misc,comp.misc,rec.misc" | |
35 | 186 (interactive) |
187 (expand-abbrev) | |
188 (or (mail-position-on-field "Followup-To" t) | |
189 (progn (mail-position-on-field "newsgroups") | |
190 (insert "\nFollowup-To: "))) | |
191 ;; @@ could do a completing read based on the Newsgroups: field to | |
192 ;; @@ fill in the Followup-To: field | |
193 ) | |
194 | |
195 (defun news-reply-distribution () | |
10804 | 196 "Move point to end of `Distribution:' optional field. |
35 | 197 Create the field if none. Without this field the posting goes to all of |
198 USENET. The field is used to restrict the posting to parts of USENET." | |
199 (interactive) | |
200 (expand-abbrev) | |
201 (mail-position-on-field "Distribution") | |
202 ;; @@could do a completing read based on the news library file: | |
203 ;; @@ ../distributions to fill in the field. | |
204 ) | |
205 | |
206 (defun news-reply-keywords () | |
10804 | 207 "Move point to end of `Keywords:' optional field. Create the field if none. |
35 | 208 Used as an aid to the news reader, it can contain a few, well selected keywords |
209 identifying the message." | |
210 (interactive) | |
211 (expand-abbrev) | |
212 (mail-position-on-field "Keywords")) | |
213 | |
214 (defun news-reply-summary () | |
10804 | 215 "Move point to end of `Summary:' optional field. Create the field if none. |
35 | 216 Used as an aid to the news reader, it can contain a succinct |
217 summary (abstract) of the message." | |
218 (interactive) | |
219 (expand-abbrev) | |
220 (mail-position-on-field "Summary")) | |
221 | |
222 (defun news-reply-signature () | |
11762
329197fc1477
(news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents:
11644
diff
changeset
|
223 "The inews program appends `~/.signature' automatically." |
35 | 224 (interactive) |
11762
329197fc1477
(news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents:
11644
diff
changeset
|
225 (message "`~/.signature' will be appended automatically.")) |
35 | 226 |
227 (defun news-setup (to subject in-reply-to newsgroups replybuffer) | |
10804 | 228 "Set up the news reply or posting buffer with the proper headers and mode." |
35 | 229 (setq mail-reply-buffer replybuffer) |
11762
329197fc1477
(news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents:
11644
diff
changeset
|
230 (let ((mail-setup-hook nil) |
329197fc1477
(news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents:
11644
diff
changeset
|
231 ;; Avoid inserting a signature. |
329197fc1477
(news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents:
11644
diff
changeset
|
232 (mail-signature)) |
35 | 233 (if (null to) |
234 ;; this hack is needed so that inews wont be confused by | |
235 ;; the fcc: and bcc: fields | |
236 (let ((mail-self-blind nil) | |
237 (mail-archive-file-name nil)) | |
238 (mail-setup to subject in-reply-to nil replybuffer nil) | |
239 (beginning-of-line) | |
1033 | 240 (delete-region (point) (progn (forward-line 1) (point))) |
35 | 241 (goto-char (point-max))) |
242 (mail-setup to subject in-reply-to nil replybuffer nil)) | |
243 ;;;(mail-position-on-field "Posting-Front-End") | |
244 ;;;(insert (emacs-version)) | |
245 (goto-char (point-max)) | |
246 (if (let ((case-fold-search t)) | |
247 (re-search-backward "^Subject:" (point-min) t)) | |
248 (progn (beginning-of-line) | |
249 (insert "Newsgroups: " (or newsgroups "") "\n") | |
250 (if (not newsgroups) | |
251 (backward-char 1) | |
252 (goto-char (point-max))))) | |
253 (run-hooks 'news-setup-hook))) | |
254 | |
255 (defun news-inews () | |
256 "Send a news message using inews." | |
257 (interactive) | |
258 (let* (newsgroups subject | |
259 (case-fold-search nil)) | |
260 (save-excursion | |
261 (save-restriction | |
262 (goto-char (point-min)) | |
263 (search-forward (concat "\n" mail-header-separator "\n")) | |
264 (narrow-to-region (point-min) (point)) | |
265 (setq newsgroups (mail-fetch-field "newsgroups") | |
266 subject (mail-fetch-field "subject"))) | |
267 (widen) | |
268 (goto-char (point-min)) | |
269 (run-hooks 'news-inews-hook) | |
270 (goto-char (point-min)) | |
271 (search-forward (concat "\n" mail-header-separator "\n")) | |
272 (replace-match "\n\n") | |
273 (goto-char (point-max)) | |
274 ;; require a newline at the end for inews to append .signature to | |
275 (or (= (preceding-char) ?\n) | |
276 (insert ?\n)) | |
277 (message "Posting to USENET...") | |
278 (call-process-region (point-min) (point-max) | |
279 news-inews-program nil 0 nil | |
280 "-h") ; take all header lines! | |
281 ;@@ setting of subject and newsgroups still needed? | |
282 ;"-t" subject | |
283 ;"-n" newsgroups | |
284 (message "Posting to USENET... done") | |
285 (goto-char (point-min)) ;restore internal header separator | |
286 (search-forward "\n\n") | |
287 (replace-match (concat "\n" mail-header-separator "\n")) | |
288 (set-buffer-modified-p nil)) | |
289 (and (fboundp 'bury-buffer) (bury-buffer)))) | |
290 | |
291 ;@@ shares some code with news-reply and news-post-news | |
292 (defun news-mail-reply () | |
293 "Mail a reply to the author of the current article. | |
294 While composing the reply, use \\[news-reply-yank-original] to yank the | |
295 original message into it." | |
296 (interactive) | |
297 (let (from cc subject date to reply-to | |
298 (buffer (current-buffer))) | |
299 (save-restriction | |
300 (narrow-to-region (point-min) (progn (goto-line (point-min)) | |
301 (search-forward "\n\n") | |
302 (- (point) 1))) | |
303 (setq from (mail-fetch-field "from") | |
304 subject (mail-fetch-field "subject") | |
305 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
|
306 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
|
307 (setq to from) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
308 (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
|
309 (mail nil |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
310 (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
|
311 subject |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
312 (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
|
313 (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
|
314 "'s message of " |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
315 date)) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
316 nil |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
317 buffer))) |
35 | 318 |
319 ;@@ the guts of news-reply and news-post-news should be combined. -tower | |
320 (defun news-reply () | |
321 "Compose and post a reply (aka a followup) to the current article on USENET. | |
322 While composing the followup, use \\[news-reply-yank-original] to yank the | |
323 original message into it." | |
324 (interactive) | |
325 (if (y-or-n-p "Are you sure you want to followup to all of USENET? ") | |
326 (let (from cc subject date to followup-to newsgroups message-of | |
327 references distribution message-id | |
328 (buffer (current-buffer))) | |
329 (save-restriction | |
330 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | |
331 ;@@ of article file | |
332 (equal major-mode 'news-mode) ;@@ if rmail-mode, | |
333 ;@@ should show full headers | |
334 (progn | |
335 (news-show-all-headers) ;@@ should save/restore header state, | |
336 ;@@ but rnews.el lacks support | |
337 (narrow-to-region (point-min) (progn (goto-char (point-min)) | |
338 (search-forward "\n\n") | |
339 (- (point) 1))))) | |
340 (setq from (mail-fetch-field "from") | |
341 news-reply-yank-from from | |
342 ;; @@ not handling old Title: field | |
343 subject (mail-fetch-field "subject") | |
344 date (mail-fetch-field "date") | |
345 followup-to (mail-fetch-field "followup-to") | |
346 newsgroups (or followup-to | |
347 (mail-fetch-field "newsgroups")) | |
348 references (mail-fetch-field "references") | |
349 ;; @@ not handling old Article-I.D.: field | |
350 distribution (mail-fetch-field "distribution") | |
351 message-id (mail-fetch-field "message-id") | |
352 news-reply-yank-message-id message-id) | |
353 (pop-to-buffer "*post-news*") | |
354 (news-reply-mode) | |
355 (if (and (buffer-modified-p) | |
356 (not | |
357 (y-or-n-p "Unsent article being composed; erase it? "))) | |
358 () | |
359 (progn | |
360 (erase-buffer) | |
361 (and subject | |
362 (progn (if (string-match "\\`Re: " subject) | |
363 (while (string-match "\\`Re: " subject) | |
364 (setq subject (substring subject 4)))) | |
365 (setq subject (concat "Re: " subject)))) | |
366 (and from | |
367 (progn | |
368 (let ((stop-pos | |
369 (string-match " *at \\| *@ \\| *(\\| *<" from))) | |
370 (setq message-of | |
371 (concat | |
372 (if stop-pos (substring from 0 stop-pos) from) | |
373 "'s message of " | |
374 date))))) | |
375 (news-setup | |
376 nil | |
377 subject | |
378 message-of | |
379 newsgroups | |
380 buffer) | |
381 (if followup-to | |
382 (progn (news-reply-followup-to) | |
383 (insert followup-to))) | |
384 (if distribution | |
385 (progn | |
386 (mail-position-on-field "Distribution") | |
387 (insert distribution))) | |
388 (mail-position-on-field "References") | |
389 (if references | |
390 (insert references)) | |
391 (if (and references message-id) | |
392 (insert " ")) | |
393 (if message-id | |
394 (insert message-id)) | |
395 (goto-char (point-max)))))) | |
396 (message ""))) | |
397 | |
398 ;@@ the guts of news-reply and news-post-news should be combined. -tower | |
10804 | 399 ;;;###autoload |
35 | 400 (defun news-post-news () |
401 "Begin editing a new USENET news article to be posted. | |
402 Type \\[describe-mode] once editing the article to get a list of commands." | |
403 (interactive) | |
404 (if (y-or-n-p "Are you sure you want to post to all of USENET? ") | |
405 (let ((buffer (current-buffer))) | |
406 (save-restriction | |
407 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | |
408 ;@@ of article file | |
409 (equal major-mode 'news-mode) ;@@ if rmail-mode, | |
410 ;@@ should show full headers | |
411 (progn | |
412 (news-show-all-headers) ;@@ should save/restore header state, | |
413 ;@@ but rnews.el lacks support | |
414 (narrow-to-region (point-min) (progn (goto-char (point-min)) | |
415 (search-forward "\n\n") | |
416 (- (point) 1))))) | |
417 (setq news-reply-yank-from (mail-fetch-field "from") | |
418 ;; @@ not handling old Article-I.D.: field | |
419 news-reply-yank-message-id (mail-fetch-field "message-id"))) | |
420 (pop-to-buffer "*post-news*") | |
421 (news-reply-mode) | |
422 (if (and (buffer-modified-p) | |
423 (not (y-or-n-p "Unsent article being composed; erase it? "))) | |
424 () ;@@ not saving point from last time | |
425 (progn (erase-buffer) | |
426 (news-setup () () () () buffer)))) | |
427 (message ""))) | |
428 | |
429 (defun news-mail-other-window () | |
430 "Send mail in another window. | |
431 While composing the message, use \\[news-reply-yank-original] to yank the | |
432 original message into it." | |
433 (interactive) | |
434 (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
|
435 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
436 ;;; rnewspost.el ends here |