Mercurial > emacs
annotate lisp/mail/rnewspost.el @ 21857:a22711be4750
(perl-mode): Add autoload cookie.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 30 Apr 1998 03:22:20 +0000 |
parents | 17ad035e0cab |
children | 1afd18de6c50 |
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-yank-original] |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
100 '("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
|
101 (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
|
102 '("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
|
103 (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
|
104 '("Send" . news-inews)))) |
35 | 105 |
106 (defun news-reply-mode () | |
107 "Major mode for editing news to be posted on USENET. | |
108 First-time posters are asked to please read the articles in newsgroup: | |
109 news.announce.newusers . | |
110 Like Text Mode but with these additional commands: | |
111 | |
112 C-c C-s news-inews (post the message) C-c C-c news-inews | |
113 C-c C-f move to a header field (and create it if there isn't): | |
114 C-c C-f C-n move to Newsgroups: C-c C-f C-s move to Subj: | |
115 C-c C-f C-f move to Followup-To: C-c C-f C-k move to Keywords: | |
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). | |
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)." | |
120 (interactive) | |
121 ;; require... | |
122 (or (fboundp 'mail-setup) (load "sendmail")) | |
123 (kill-all-local-variables) | |
124 (make-local-variable 'mail-reply-buffer) | |
125 (setq mail-reply-buffer nil) | |
126 (set-syntax-table text-mode-syntax-table) | |
127 (use-local-map news-reply-mode-map) | |
128 (setq local-abbrev-table text-mode-abbrev-table) | |
129 (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
|
130 (setq mode-name "News Reply") |
35 | 131 (make-local-variable 'paragraph-separate) |
132 (make-local-variable 'paragraph-start) | |
11769
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
133 (setq paragraph-start |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
134 (concat "^" (regexp-quote mail-header-separator) "$\\|" |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
135 paragraph-start)) |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
136 (setq paragraph-separate |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
137 (concat "^" (regexp-quote mail-header-separator) "$\\|" |
4b5452f8ad12
(news-reply-mode): Add ^ to paragraph delimiters.
Richard M. Stallman <rms@gnu.org>
parents:
11762
diff
changeset
|
138 paragraph-separate)) |
35 | 139 (run-hooks 'text-mode-hook 'news-reply-mode-hook)) |
140 | |
14625
4cbc6690c0f7
(news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents:
14231
diff
changeset
|
141 (defvar news-reply-yank-from "" |
4cbc6690c0f7
(news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents:
14231
diff
changeset
|
142 "Save `From:' field for `news-reply-yank-original'.") |
35 | 143 |
14625
4cbc6690c0f7
(news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents:
14231
diff
changeset
|
144 (defvar news-reply-yank-message-id "" |
4cbc6690c0f7
(news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents:
14231
diff
changeset
|
145 "Save `Message-Id:' field for `news-reply-yank-original'.") |
35 | 146 |
147 (defun news-reply-yank-original (arg) | |
10804 | 148 "Insert the message being replied to, if any (in Mail mode). |
35 | 149 Puts point before the text and mark after. |
150 Indents each nonblank line ARG spaces (default 3). | |
151 Just \\[universal-argument] as argument means don't indent | |
152 and don't delete any header fields." | |
153 (interactive "P") | |
154 (mail-yank-original arg) | |
155 (exchange-point-and-mark) | |
156 (run-hooks 'news-reply-header-hook)) | |
157 | |
158 (defvar news-reply-header-hook | |
159 '(lambda () | |
160 (insert "In article " news-reply-yank-message-id | |
161 " " news-reply-yank-from " writes:\n\n")) | |
162 "Hook for inserting a header at the top of a yanked message.") | |
163 | |
164 (defun news-reply-newsgroups () | |
10804 | 165 "Move point to end of `Newsgroups:' field. |
166 RFC 850 constrains the `Newsgroups:' field to be a comma-separated list | |
167 of valid newsgroup names at your site. For example, | |
168 Newsgroups: news.misc,comp.misc,rec.misc" | |
35 | 169 (interactive) |
170 (expand-abbrev) | |
171 (goto-char (point-min)) | |
172 (mail-position-on-field "Newsgroups")) | |
173 | |
174 (defun news-reply-followup-to () | |
10804 | 175 "Move point to end of `Followup-To:' field. Create the field if none. |
35 | 176 One usually requests followups to only one newsgroup. |
10804 | 177 RFC 850 constrains the `Followup-To:' field to be a comma-separated list |
178 of valid newsgroups names at your site, and it must be a subset of the | |
179 `Newsgroups:' field. For example: | |
180 Newsgroups: news.misc,comp.misc,rec.misc,misc.misc,soc.misc | |
181 Followup-To: news.misc,comp.misc,rec.misc" | |
35 | 182 (interactive) |
183 (expand-abbrev) | |
184 (or (mail-position-on-field "Followup-To" t) | |
185 (progn (mail-position-on-field "newsgroups") | |
186 (insert "\nFollowup-To: "))) | |
187 ;; @@ could do a completing read based on the Newsgroups: field to | |
188 ;; @@ fill in the Followup-To: field | |
189 ) | |
190 | |
191 (defun news-reply-distribution () | |
10804 | 192 "Move point to end of `Distribution:' optional field. |
35 | 193 Create the field if none. Without this field the posting goes to all of |
194 USENET. The field is used to restrict the posting to parts of USENET." | |
195 (interactive) | |
196 (expand-abbrev) | |
197 (mail-position-on-field "Distribution") | |
198 ;; @@could do a completing read based on the news library file: | |
199 ;; @@ ../distributions to fill in the field. | |
200 ) | |
201 | |
202 (defun news-reply-keywords () | |
10804 | 203 "Move point to end of `Keywords:' optional field. Create the field if none. |
35 | 204 Used as an aid to the news reader, it can contain a few, well selected keywords |
205 identifying the message." | |
206 (interactive) | |
207 (expand-abbrev) | |
208 (mail-position-on-field "Keywords")) | |
209 | |
210 (defun news-reply-summary () | |
10804 | 211 "Move point to end of `Summary:' optional field. Create the field if none. |
35 | 212 Used as an aid to the news reader, it can contain a succinct |
213 summary (abstract) of the message." | |
214 (interactive) | |
215 (expand-abbrev) | |
216 (mail-position-on-field "Summary")) | |
217 | |
218 (defun news-reply-signature () | |
11762
329197fc1477
(news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents:
11644
diff
changeset
|
219 "The inews program appends `~/.signature' automatically." |
35 | 220 (interactive) |
14625
4cbc6690c0f7
(news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents:
14231
diff
changeset
|
221 (message "Posting news will append your signature automatically.")) |
35 | 222 |
223 (defun news-setup (to subject in-reply-to newsgroups replybuffer) | |
10804 | 224 "Set up the news reply or posting buffer with the proper headers and mode." |
35 | 225 (setq mail-reply-buffer replybuffer) |
11762
329197fc1477
(news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents:
11644
diff
changeset
|
226 (let ((mail-setup-hook nil) |
329197fc1477
(news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents:
11644
diff
changeset
|
227 ;; Avoid inserting a signature. |
329197fc1477
(news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents:
11644
diff
changeset
|
228 (mail-signature)) |
35 | 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...") | |
21174
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
274 (unwind-protect |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
275 (if (not (eq 0 |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
276 (call-process-region (point-min) (point-max) |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
277 news-inews-program nil 0 nil |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
278 "-h"))) ; take all header lines! |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
279 ;@@ setting of subject and newsgroups still needed? |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
280 ;"-t" subject |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
281 ;"-n" newsgroups |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
282 (error "Posting to USENET failed") |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
283 (message "Posting to USENET... done")) |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
284 (goto-char (point-min)) ;restore internal header separator |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
285 (search-forward "\n\n") |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
286 (replace-match (concat "\n" mail-header-separator "\n")) |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
287 (set-buffer-modified-p nil))) |
17ad035e0cab
(news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
288 (bury-buffer))) |
35 | 289 |
290 ;@@ shares some code with news-reply and news-post-news | |
291 (defun news-mail-reply () | |
292 "Mail a reply to the author of the current article. | |
293 While composing the reply, use \\[news-reply-yank-original] to yank the | |
294 original message into it." | |
295 (interactive) | |
16712
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
296 (let (from cc subject date to reply-to message-id |
35 | 297 (buffer (current-buffer))) |
298 (save-restriction | |
299 (narrow-to-region (point-min) (progn (goto-line (point-min)) | |
300 (search-forward "\n\n") | |
301 (- (point) 1))) | |
302 (setq from (mail-fetch-field "from") | |
303 subject (mail-fetch-field "subject") | |
304 reply-to (mail-fetch-field "reply-to") | |
16712
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
305 date (mail-fetch-field "date") |
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
306 message-id (mail-fetch-field "message-id"))) |
10184
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) |
16712
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
314 "'s message " |
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
315 (if message-id |
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
316 (concat message-id " of ") |
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
317 "of ") |
10184
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
318 date)) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
319 nil |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
320 buffer))) |
35 | 321 |
322 ;@@ the guts of news-reply and news-post-news should be combined. -tower | |
323 (defun news-reply () | |
324 "Compose and post a reply (aka a followup) to the current article on USENET. | |
325 While composing the followup, use \\[news-reply-yank-original] to yank the | |
326 original message into it." | |
327 (interactive) | |
328 (if (y-or-n-p "Are you sure you want to followup to all of USENET? ") | |
329 (let (from cc subject date to followup-to newsgroups message-of | |
330 references distribution message-id | |
331 (buffer (current-buffer))) | |
332 (save-restriction | |
333 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | |
334 ;@@ of article file | |
335 (equal major-mode 'news-mode) ;@@ if rmail-mode, | |
336 ;@@ should show full headers | |
337 (progn | |
338 (news-show-all-headers) ;@@ should save/restore header state, | |
339 ;@@ but rnews.el lacks support | |
340 (narrow-to-region (point-min) (progn (goto-char (point-min)) | |
341 (search-forward "\n\n") | |
342 (- (point) 1))))) | |
343 (setq from (mail-fetch-field "from") | |
344 news-reply-yank-from from | |
345 ;; @@ not handling old Title: field | |
346 subject (mail-fetch-field "subject") | |
347 date (mail-fetch-field "date") | |
348 followup-to (mail-fetch-field "followup-to") | |
349 newsgroups (or followup-to | |
350 (mail-fetch-field "newsgroups")) | |
351 references (mail-fetch-field "references") | |
352 ;; @@ not handling old Article-I.D.: field | |
353 distribution (mail-fetch-field "distribution") | |
354 message-id (mail-fetch-field "message-id") | |
355 news-reply-yank-message-id message-id) | |
356 (pop-to-buffer "*post-news*") | |
357 (news-reply-mode) | |
358 (if (and (buffer-modified-p) | |
359 (not | |
360 (y-or-n-p "Unsent article being composed; erase it? "))) | |
361 () | |
362 (progn | |
363 (erase-buffer) | |
364 (and subject | |
365 (progn (if (string-match "\\`Re: " subject) | |
366 (while (string-match "\\`Re: " subject) | |
367 (setq subject (substring subject 4)))) | |
368 (setq subject (concat "Re: " subject)))) | |
369 (and from | |
370 (progn | |
371 (let ((stop-pos | |
372 (string-match " *at \\| *@ \\| *(\\| *<" from))) | |
373 (setq message-of | |
374 (concat | |
375 (if stop-pos (substring from 0 stop-pos) from) | |
16712
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
376 "'s message " |
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
377 (if message-id |
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
378 (concat message-id " of ") |
aad91ec41fa4
(news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents:
14625
diff
changeset
|
379 "of ") |
35 | 380 date))))) |
381 (news-setup | |
382 nil | |
383 subject | |
384 message-of | |
385 newsgroups | |
386 buffer) | |
387 (if followup-to | |
388 (progn (news-reply-followup-to) | |
389 (insert followup-to))) | |
390 (if distribution | |
391 (progn | |
392 (mail-position-on-field "Distribution") | |
393 (insert distribution))) | |
394 (mail-position-on-field "References") | |
395 (if references | |
396 (insert references)) | |
397 (if (and references message-id) | |
398 (insert " ")) | |
399 (if message-id | |
400 (insert message-id)) | |
401 (goto-char (point-max)))))) | |
402 (message ""))) | |
403 | |
404 ;@@ the guts of news-reply and news-post-news should be combined. -tower | |
10804 | 405 ;;;###autoload |
16932
ada95b0e82ae
(news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents:
16712
diff
changeset
|
406 (defun news-post-news (&optional noquery) |
35 | 407 "Begin editing a new USENET news article to be posted. |
16932
ada95b0e82ae
(news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents:
16712
diff
changeset
|
408 Type \\[describe-mode] once editing the article to get a list of commands. |
ada95b0e82ae
(news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents:
16712
diff
changeset
|
409 If NOQUERY is non-nil, we do not query before doing the work." |
35 | 410 (interactive) |
16932
ada95b0e82ae
(news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents:
16712
diff
changeset
|
411 (if (or noquery |
ada95b0e82ae
(news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents:
16712
diff
changeset
|
412 (y-or-n-p "Are you sure you want to post to all of USENET? ")) |
35 | 413 (let ((buffer (current-buffer))) |
414 (save-restriction | |
415 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | |
416 ;@@ of article file | |
417 (equal major-mode 'news-mode) ;@@ if rmail-mode, | |
418 ;@@ should show full headers | |
419 (progn | |
420 (news-show-all-headers) ;@@ should save/restore header state, | |
421 ;@@ but rnews.el lacks support | |
422 (narrow-to-region (point-min) (progn (goto-char (point-min)) | |
423 (search-forward "\n\n") | |
424 (- (point) 1))))) | |
425 (setq news-reply-yank-from (mail-fetch-field "from") | |
426 ;; @@ not handling old Article-I.D.: field | |
427 news-reply-yank-message-id (mail-fetch-field "message-id"))) | |
428 (pop-to-buffer "*post-news*") | |
429 (news-reply-mode) | |
430 (if (and (buffer-modified-p) | |
431 (not (y-or-n-p "Unsent article being composed; erase it? "))) | |
432 () ;@@ not saving point from last time | |
433 (progn (erase-buffer) | |
434 (news-setup () () () () buffer)))) | |
435 (message ""))) | |
436 | |
437 (defun news-mail-other-window () | |
438 "Send mail in another window. | |
439 While composing the message, use \\[news-reply-yank-original] to yank the | |
440 original message into it." | |
441 (interactive) | |
442 (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
|
443 |
18383 | 444 (provide 'rnewspost) |
445 | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
446 ;;; rnewspost.el ends here |