annotate lisp/packages/rnewspost.el @ 8:4b173ad71786 r19-15b5

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