annotate lisp/mail/rnewspost.el @ 39:bd9c72156bbf

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