Mercurial > emacs
annotate lisp/mail/rnewspost.el @ 11734:e6675e3ed8b3
(Fmod): Fix the final adjustment, when f2 < 0 and f1 == 0.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 07 May 1995 09:02:39 +0000 |
parents | 933af8a2afea |
children | 329197fc1477 |
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 | |
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\C-f\C-d" 'news-reply-distribution) | |
65 (define-key news-reply-mode-map "\C-c\C-f\C-k" 'news-reply-keywords) | |
66 (define-key news-reply-mode-map "\C-c\C-f\C-n" 'news-reply-newsgroups) | |
67 (define-key news-reply-mode-map "\C-c\C-f\C-f" 'news-reply-followup-to) | |
68 (define-key news-reply-mode-map "\C-c\C-f\C-s" 'mail-subject) | |
69 (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
|
70 (define-key news-reply-mode-map "\C-c\C-t" 'mail-text) |
35 | 71 (define-key news-reply-mode-map "\C-c\C-r" 'news-caesar-buffer-body) |
72 (define-key news-reply-mode-map "\C-c\C-w" 'news-reply-signature) | |
73 (define-key news-reply-mode-map "\C-c\C-y" 'news-reply-yank-original) | |
74 (define-key news-reply-mode-map "\C-c\C-q" 'mail-fill-yanked-message) | |
75 (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
|
76 (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
|
77 (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
|
78 (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
|
79 (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
|
80 (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
|
81 '("Distribution" . news-reply-distribution)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
82 (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
|
83 '("Keywords" . news-reply-keywords)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
84 (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
|
85 '("Newsgroups" . news-reply-newsgroups)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
86 (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
|
87 '("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
|
88 (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
|
89 '("Subject" . mail-subject)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
90 (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
|
91 '("Summary" . news-reply-summary)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
92 (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
|
93 '("Text" . mail-text)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
94 (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
|
95 (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
|
96 (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
|
97 '("Rot13" . news-caesar-buffer-body)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
98 (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
|
99 '("Signature" . news-reply-signature)) |
ffdc2e03b480
(news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents:
10891
diff
changeset
|
100 (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
|
101 '("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
|
102 (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
|
103 '("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
|
104 (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
|
105 '("Send" . news-inews)))) |
35 | 106 |
107 (defun news-reply-mode () | |
108 "Major mode for editing news to be posted on USENET. | |
109 First-time posters are asked to please read the articles in newsgroup: | |
110 news.announce.newusers . | |
111 Like Text Mode but with these additional commands: | |
112 | |
113 C-c C-s news-inews (post the message) C-c C-c news-inews | |
114 C-c C-f move to a header field (and create it if there isn't): | |
115 C-c C-f C-n move to Newsgroups: C-c C-f C-s move to Subj: | |
116 C-c C-f C-f move to Followup-To: C-c C-f C-k move to Keywords: | |
117 C-c C-f C-d move to Distribution: C-c C-f C-a move to Summary: | |
118 C-c C-y news-reply-yank-original (insert current message, in NEWS). | |
119 C-c C-q mail-fill-yanked-message (fill what was yanked). | |
120 C-c C-r caesar rotate all letters by 13 places in the article's body (rot13)." | |
121 (interactive) | |
122 ;; require... | |
123 (or (fboundp 'mail-setup) (load "sendmail")) | |
124 (kill-all-local-variables) | |
125 (make-local-variable 'mail-reply-buffer) | |
126 (setq mail-reply-buffer nil) | |
127 (set-syntax-table text-mode-syntax-table) | |
128 (use-local-map news-reply-mode-map) | |
129 (setq local-abbrev-table text-mode-abbrev-table) | |
130 (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
|
131 (setq mode-name "News Reply") |
35 | 132 (make-local-variable 'paragraph-separate) |
133 (make-local-variable 'paragraph-start) | |
11306
9b907fb88921
(news-reply-mode): Make mail-header-separator into regexp
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
134 (setq paragraph-start (concat (regexp-quote mail-header-separator) "$\\|" |
35 | 135 paragraph-start)) |
11306
9b907fb88921
(news-reply-mode): Make mail-header-separator into regexp
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
136 (setq paragraph-separate (concat (regexp-quote mail-header-separator) "$\\|" |
35 | 137 paragraph-separate)) |
138 (run-hooks 'text-mode-hook 'news-reply-mode-hook)) | |
139 | |
140 (defvar news-reply-yank-from | |
10804 | 141 "Save `From:' field for `news-reply-yank-original'." |
35 | 142 "") |
143 | |
144 (defvar news-reply-yank-message-id | |
10804 | 145 "Save `Message-Id:' field for `news-reply-yank-original'." |
35 | 146 "") |
147 | |
148 (defun news-reply-yank-original (arg) | |
10804 | 149 "Insert the message being replied to, if any (in Mail mode). |
35 | 150 Puts point before the text and mark after. |
151 Indents each nonblank line ARG spaces (default 3). | |
152 Just \\[universal-argument] as argument means don't indent | |
153 and don't delete any header fields." | |
154 (interactive "P") | |
155 (mail-yank-original arg) | |
156 (exchange-point-and-mark) | |
157 (run-hooks 'news-reply-header-hook)) | |
158 | |
159 (defvar news-reply-header-hook | |
160 '(lambda () | |
161 (insert "In article " news-reply-yank-message-id | |
162 " " news-reply-yank-from " writes:\n\n")) | |
163 "Hook for inserting a header at the top of a yanked message.") | |
164 | |
165 (defun news-reply-newsgroups () | |
10804 | 166 "Move point to end of `Newsgroups:' field. |
167 RFC 850 constrains the `Newsgroups:' field to be a comma-separated list | |
168 of valid newsgroup names at your site. For example, | |
169 Newsgroups: news.misc,comp.misc,rec.misc" | |
35 | 170 (interactive) |
171 (expand-abbrev) | |
172 (goto-char (point-min)) | |
173 (mail-position-on-field "Newsgroups")) | |
174 | |
175 (defun news-reply-followup-to () | |
10804 | 176 "Move point to end of `Followup-To:' field. Create the field if none. |
35 | 177 One usually requests followups to only one newsgroup. |
10804 | 178 RFC 850 constrains the `Followup-To:' field to be a comma-separated list |
179 of valid newsgroups names at your site, and it must be a subset of the | |
180 `Newsgroups:' field. For example: | |
181 Newsgroups: news.misc,comp.misc,rec.misc,misc.misc,soc.misc | |
182 Followup-To: news.misc,comp.misc,rec.misc" | |
35 | 183 (interactive) |
184 (expand-abbrev) | |
185 (or (mail-position-on-field "Followup-To" t) | |
186 (progn (mail-position-on-field "newsgroups") | |
187 (insert "\nFollowup-To: "))) | |
188 ;; @@ could do a completing read based on the Newsgroups: field to | |
189 ;; @@ fill in the Followup-To: field | |
190 ) | |
191 | |
192 (defun news-reply-distribution () | |
10804 | 193 "Move point to end of `Distribution:' optional field. |
35 | 194 Create the field if none. Without this field the posting goes to all of |
195 USENET. The field is used to restrict the posting to parts of USENET." | |
196 (interactive) | |
197 (expand-abbrev) | |
198 (mail-position-on-field "Distribution") | |
199 ;; @@could do a completing read based on the news library file: | |
200 ;; @@ ../distributions to fill in the field. | |
201 ) | |
202 | |
203 (defun news-reply-keywords () | |
10804 | 204 "Move point to end of `Keywords:' optional field. Create the field if none. |
35 | 205 Used as an aid to the news reader, it can contain a few, well selected keywords |
206 identifying the message." | |
207 (interactive) | |
208 (expand-abbrev) | |
209 (mail-position-on-field "Keywords")) | |
210 | |
211 (defun news-reply-summary () | |
10804 | 212 "Move point to end of `Summary:' optional field. Create the field if none. |
35 | 213 Used as an aid to the news reader, it can contain a succinct |
214 summary (abstract) of the message." | |
215 (interactive) | |
216 (expand-abbrev) | |
217 (mail-position-on-field "Summary")) | |
218 | |
219 (defun news-reply-signature () | |
220 "The inews program appends ~/.signature automatically." | |
221 (interactive) | |
222 (message "~/.signature will be appended automatically.")) | |
223 | |
224 (defun news-setup (to subject in-reply-to newsgroups replybuffer) | |
10804 | 225 "Set up the news reply or posting buffer with the proper headers and mode." |
35 | 226 (setq mail-reply-buffer replybuffer) |
227 (let ((mail-setup-hook nil)) | |
228 (if (null to) | |
229 ;; this hack is needed so that inews wont be confused by | |
230 ;; the fcc: and bcc: fields | |
231 (let ((mail-self-blind nil) | |
232 (mail-archive-file-name nil)) | |
233 (mail-setup to subject in-reply-to nil replybuffer nil) | |
234 (beginning-of-line) | |
1033 | 235 (delete-region (point) (progn (forward-line 1) (point))) |
35 | 236 (goto-char (point-max))) |
237 (mail-setup to subject in-reply-to nil replybuffer nil)) | |
238 ;;;(mail-position-on-field "Posting-Front-End") | |
239 ;;;(insert (emacs-version)) | |
240 (goto-char (point-max)) | |
241 (if (let ((case-fold-search t)) | |
242 (re-search-backward "^Subject:" (point-min) t)) | |
243 (progn (beginning-of-line) | |
244 (insert "Newsgroups: " (or newsgroups "") "\n") | |
245 (if (not newsgroups) | |
246 (backward-char 1) | |
247 (goto-char (point-max))))) | |
248 (run-hooks 'news-setup-hook))) | |
249 | |
250 (defun news-inews () | |
251 "Send a news message using inews." | |
252 (interactive) | |
253 (let* (newsgroups subject | |
254 (case-fold-search nil)) | |
255 (save-excursion | |
256 (save-restriction | |
257 (goto-char (point-min)) | |
258 (search-forward (concat "\n" mail-header-separator "\n")) | |
259 (narrow-to-region (point-min) (point)) | |
260 (setq newsgroups (mail-fetch-field "newsgroups") | |
261 subject (mail-fetch-field "subject"))) | |
262 (widen) | |
263 (goto-char (point-min)) | |
264 (run-hooks 'news-inews-hook) | |
265 (goto-char (point-min)) | |
266 (search-forward (concat "\n" mail-header-separator "\n")) | |
267 (replace-match "\n\n") | |
268 (goto-char (point-max)) | |
269 ;; require a newline at the end for inews to append .signature to | |
270 (or (= (preceding-char) ?\n) | |
271 (insert ?\n)) | |
272 (message "Posting to USENET...") | |
273 (call-process-region (point-min) (point-max) | |
274 news-inews-program nil 0 nil | |
275 "-h") ; take all header lines! | |
276 ;@@ setting of subject and newsgroups still needed? | |
277 ;"-t" subject | |
278 ;"-n" newsgroups | |
279 (message "Posting to USENET... done") | |
280 (goto-char (point-min)) ;restore internal header separator | |
281 (search-forward "\n\n") | |
282 (replace-match (concat "\n" mail-header-separator "\n")) | |
283 (set-buffer-modified-p nil)) | |
284 (and (fboundp 'bury-buffer) (bury-buffer)))) | |
285 | |
286 ;@@ shares some code with news-reply and news-post-news | |
287 (defun news-mail-reply () | |
288 "Mail a reply to the author of the current article. | |
289 While composing the reply, use \\[news-reply-yank-original] to yank the | |
290 original message into it." | |
291 (interactive) | |
292 (let (from cc subject date to reply-to | |
293 (buffer (current-buffer))) | |
294 (save-restriction | |
295 (narrow-to-region (point-min) (progn (goto-line (point-min)) | |
296 (search-forward "\n\n") | |
297 (- (point) 1))) | |
298 (setq from (mail-fetch-field "from") | |
299 subject (mail-fetch-field "subject") | |
300 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
|
301 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
|
302 (setq to from) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
303 (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
|
304 (mail nil |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
305 (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
|
306 subject |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
307 (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
|
308 (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
|
309 "'s message of " |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
310 date)) |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
311 nil |
4fe4f49bcdb1
(news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents:
9534
diff
changeset
|
312 buffer))) |
35 | 313 |
314 ;@@ the guts of news-reply and news-post-news should be combined. -tower | |
315 (defun news-reply () | |
316 "Compose and post a reply (aka a followup) to the current article on USENET. | |
317 While composing the followup, use \\[news-reply-yank-original] to yank the | |
318 original message into it." | |
319 (interactive) | |
320 (if (y-or-n-p "Are you sure you want to followup to all of USENET? ") | |
321 (let (from cc subject date to followup-to newsgroups message-of | |
322 references distribution message-id | |
323 (buffer (current-buffer))) | |
324 (save-restriction | |
325 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | |
326 ;@@ of article file | |
327 (equal major-mode 'news-mode) ;@@ if rmail-mode, | |
328 ;@@ should show full headers | |
329 (progn | |
330 (news-show-all-headers) ;@@ should save/restore header state, | |
331 ;@@ but rnews.el lacks support | |
332 (narrow-to-region (point-min) (progn (goto-char (point-min)) | |
333 (search-forward "\n\n") | |
334 (- (point) 1))))) | |
335 (setq from (mail-fetch-field "from") | |
336 news-reply-yank-from from | |
337 ;; @@ not handling old Title: field | |
338 subject (mail-fetch-field "subject") | |
339 date (mail-fetch-field "date") | |
340 followup-to (mail-fetch-field "followup-to") | |
341 newsgroups (or followup-to | |
342 (mail-fetch-field "newsgroups")) | |
343 references (mail-fetch-field "references") | |
344 ;; @@ not handling old Article-I.D.: field | |
345 distribution (mail-fetch-field "distribution") | |
346 message-id (mail-fetch-field "message-id") | |
347 news-reply-yank-message-id message-id) | |
348 (pop-to-buffer "*post-news*") | |
349 (news-reply-mode) | |
350 (if (and (buffer-modified-p) | |
351 (not | |
352 (y-or-n-p "Unsent article being composed; erase it? "))) | |
353 () | |
354 (progn | |
355 (erase-buffer) | |
356 (and subject | |
357 (progn (if (string-match "\\`Re: " subject) | |
358 (while (string-match "\\`Re: " subject) | |
359 (setq subject (substring subject 4)))) | |
360 (setq subject (concat "Re: " subject)))) | |
361 (and from | |
362 (progn | |
363 (let ((stop-pos | |
364 (string-match " *at \\| *@ \\| *(\\| *<" from))) | |
365 (setq message-of | |
366 (concat | |
367 (if stop-pos (substring from 0 stop-pos) from) | |
368 "'s message of " | |
369 date))))) | |
370 (news-setup | |
371 nil | |
372 subject | |
373 message-of | |
374 newsgroups | |
375 buffer) | |
376 (if followup-to | |
377 (progn (news-reply-followup-to) | |
378 (insert followup-to))) | |
379 (if distribution | |
380 (progn | |
381 (mail-position-on-field "Distribution") | |
382 (insert distribution))) | |
383 (mail-position-on-field "References") | |
384 (if references | |
385 (insert references)) | |
386 (if (and references message-id) | |
387 (insert " ")) | |
388 (if message-id | |
389 (insert message-id)) | |
390 (goto-char (point-max)))))) | |
391 (message ""))) | |
392 | |
393 ;@@ the guts of news-reply and news-post-news should be combined. -tower | |
10804 | 394 ;;;###autoload |
35 | 395 (defun news-post-news () |
396 "Begin editing a new USENET news article to be posted. | |
397 Type \\[describe-mode] once editing the article to get a list of commands." | |
398 (interactive) | |
399 (if (y-or-n-p "Are you sure you want to post to all of USENET? ") | |
400 (let ((buffer (current-buffer))) | |
401 (save-restriction | |
402 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of | |
403 ;@@ of article file | |
404 (equal major-mode 'news-mode) ;@@ if rmail-mode, | |
405 ;@@ should show full headers | |
406 (progn | |
407 (news-show-all-headers) ;@@ should save/restore header state, | |
408 ;@@ but rnews.el lacks support | |
409 (narrow-to-region (point-min) (progn (goto-char (point-min)) | |
410 (search-forward "\n\n") | |
411 (- (point) 1))))) | |
412 (setq news-reply-yank-from (mail-fetch-field "from") | |
413 ;; @@ not handling old Article-I.D.: field | |
414 news-reply-yank-message-id (mail-fetch-field "message-id"))) | |
415 (pop-to-buffer "*post-news*") | |
416 (news-reply-mode) | |
417 (if (and (buffer-modified-p) | |
418 (not (y-or-n-p "Unsent article being composed; erase it? "))) | |
419 () ;@@ not saving point from last time | |
420 (progn (erase-buffer) | |
421 (news-setup () () () () buffer)))) | |
422 (message ""))) | |
423 | |
424 (defun news-mail-other-window () | |
425 "Send mail in another window. | |
426 While composing the message, use \\[news-reply-yank-original] to yank the | |
427 original message into it." | |
428 (interactive) | |
429 (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
|
430 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
431 ;;; rnewspost.el ends here |