annotate lisp/mail/rnewspost.el @ 21896:ff66bfc5d801

(enum_font_cb2): Only ignore raster fonts when determining height and width.
author Geoff Voelker <voelker@cs.washington.edu>
date Sat, 02 May 1998 02:06:41 +0000
parents 1afd18de6c50
children 09a101ff1885
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 35
diff changeset
1 ;;; rnewspost.el --- USENET news poster/mailer for GNU Emacs
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 35
diff changeset
2
11235
e6bdaaa6ce1b Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 10972
diff changeset
3 ;; Copyright (C) 1985, 1986, 1987, 1995 Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
5 ;; Maintainer: FSF
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
6 ;; Keywords: mail, news
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
7
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; any later version.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
23 ;; Boston, MA 02111-1307, USA.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
14231
069791dced1e Fix Change Log comment line.
Erik Naggum <erik@naggum.no>
parents: 14169
diff changeset
25 ;;; Change Log:
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
26
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;; moved posting and mail code from rnews.el
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;; tower@prep.ai.mit.edu Wed Oct 29 1986
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ;; 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
30 ;; - couldn't see handling the special meaning of the Keyword: poster
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 ;; - not worth the code space to support the old A news Title: (which
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 ;; Subject: replaced) and Article-I.D.: (which Message-ID: replaced)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 ;; tower@prep Nov 86
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 ;; 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
35 ;; tower@prep 21 Nov 86
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ;; added (require 'rnews) tower@prep 22 Apr 87
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 ;; restricted call of news-show-all-headers in news-post-news & news-reply
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 ;; tower@prep 28 Apr 87
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 ;; 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
40 ;; 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
41
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 ;Now in paths.el.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 ;(defvar news-inews-program "inews"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 ; "Function to post news.")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 ;; Replying and posting news items are done by these functions.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 ;; imported from rmail and modified to work with rnews ...
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 ;; Mon Mar 25,1985 at 03:07:04 ads@mit-hermes.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 ;; this is done so that rnews can operate independently from rmail.el and
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 11769
diff changeset
50 ;; sendmail and doesn't have to autoload these functions.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 ;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 ;;; >> Nuked by Mly to autoload those functions again, as the duplication of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 ;;; >> code was making maintenance too difficult.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
55 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
56
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
57 (require 'sendmail)
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
58 (require 'rnews)
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
59
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 (defvar news-reply-mode-map () "Mode map used by news-reply.")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 (or news-reply-mode-map
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 (progn
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (setq news-reply-mode-map (make-keymap))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 (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
66 (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
67 (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
68 (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
69 (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
70 (define-key news-reply-mode-map "\C-c\C-f\C-a" 'news-reply-summary)
9534
323dc8f5028a (news-reply-mode-map): Add C-c C-t binding.
Richard M. Stallman <rms@gnu.org>
parents: 1033
diff changeset
71 (define-key news-reply-mode-map "\C-c\C-t" 'mail-text)
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 (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
73 (define-key news-reply-mode-map "\C-c\C-w" 'news-reply-signature)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 (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
75 (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
76 (define-key news-reply-mode-map "\C-c\C-c" 'news-inews)
10972
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
77 (define-key news-reply-mode-map "\C-c\C-s" 'news-inews)
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
78 (define-key news-reply-mode-map [menu-bar] (make-sparse-keymap))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
79 (define-key news-reply-mode-map [menu-bar fields]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
80 (cons "Fields" (make-sparse-keymap "Fields")))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
81 (define-key news-reply-mode-map [menu-bar fields news-reply-distribution]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
82 '("Distribution" . news-reply-distribution))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
83 (define-key news-reply-mode-map [menu-bar fields news-reply-keywords]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
84 '("Keywords" . news-reply-keywords))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
85 (define-key news-reply-mode-map [menu-bar fields news-reply-newsgroups]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
86 '("Newsgroups" . news-reply-newsgroups))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
87 (define-key news-reply-mode-map [menu-bar fields news-reply-followup-to]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
88 '("Followup-to" . news-reply-followup-to))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
89 (define-key news-reply-mode-map [menu-bar fields mail-subject]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
90 '("Subject" . mail-subject))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
91 (define-key news-reply-mode-map [menu-bar fields news-reply-summary]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
92 '("Summary" . news-reply-summary))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
93 (define-key news-reply-mode-map [menu-bar fields mail-text]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
94 '("Text" . mail-text))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
95 (define-key news-reply-mode-map [menu-bar news]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
96 (cons "News" (make-sparse-keymap "News")))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
97 (define-key news-reply-mode-map [menu-bar news news-caesar-buffer-body]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
98 '("Rot13" . news-caesar-buffer-body))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
99 (define-key news-reply-mode-map [menu-bar news news-reply-yank-original]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
100 '("Yank Original" . news-reply-yank-original))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
101 (define-key news-reply-mode-map [menu-bar news mail-fill-yanked-message]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
102 '("Fill Yanked Messages" . mail-fill-yanked-message))
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
103 (define-key news-reply-mode-map [menu-bar news news-inews]
ffdc2e03b480 (news-reply-mode-map): Add menu bar menus.
Richard M. Stallman <rms@gnu.org>
parents: 10891
diff changeset
104 '("Send" . news-inews))))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 (defun news-reply-mode ()
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 "Major mode for editing news to be posted on USENET.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 First-time posters are asked to please read the articles in newsgroup:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 news.announce.newusers .
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 Like Text Mode but with these additional commands:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 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
113 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
114 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
115 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
116 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
117 C-c C-y news-reply-yank-original (insert current message, in NEWS).
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 C-c C-q mail-fill-yanked-message (fill what was yanked).
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 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
120 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 (kill-all-local-variables)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 (make-local-variable 'mail-reply-buffer)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 (setq mail-reply-buffer nil)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 (set-syntax-table text-mode-syntax-table)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 (use-local-map news-reply-mode-map)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 (setq local-abbrev-table text-mode-abbrev-table)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 (setq major-mode 'news-reply-mode)
10587
99b9f20b6921 (news-reply-mode): Change mode-name to News Reply.
Richard M. Stallman <rms@gnu.org>
parents: 10184
diff changeset
128 (setq mode-name "News Reply")
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 (make-local-variable 'paragraph-separate)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 (make-local-variable 'paragraph-start)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 (run-hooks 'text-mode-hook 'news-reply-mode-hook))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132
14625
4cbc6690c0f7 (news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents: 14231
diff changeset
133 (defvar news-reply-yank-from ""
4cbc6690c0f7 (news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents: 14231
diff changeset
134 "Save `From:' field for `news-reply-yank-original'.")
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135
14625
4cbc6690c0f7 (news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents: 14231
diff changeset
136 (defvar news-reply-yank-message-id ""
4cbc6690c0f7 (news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents: 14231
diff changeset
137 "Save `Message-Id:' field for `news-reply-yank-original'.")
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 (defun news-reply-yank-original (arg)
10804
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
140 "Insert the message being replied to, if any (in Mail mode).
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 Puts point before the text and mark after.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 Indents each nonblank line ARG spaces (default 3).
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 Just \\[universal-argument] as argument means don't indent
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 and don't delete any header fields."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 (interactive "P")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 (mail-yank-original arg)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 (exchange-point-and-mark)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 (run-hooks 'news-reply-header-hook))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 (defvar news-reply-header-hook
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 '(lambda ()
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 (insert "In article " news-reply-yank-message-id
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 " " news-reply-yank-from " writes:\n\n"))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 "Hook for inserting a header at the top of a yanked message.")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 (defun news-reply-newsgroups ()
10804
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
157 "Move point to end of `Newsgroups:' field.
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
158 RFC 850 constrains the `Newsgroups:' field to be a comma-separated list
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
159 of valid newsgroup names at your site. For example,
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
160 Newsgroups: news.misc,comp.misc,rec.misc"
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 (expand-abbrev)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 (goto-char (point-min))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 (mail-position-on-field "Newsgroups"))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 (defun news-reply-followup-to ()
10804
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
167 "Move point to end of `Followup-To:' field. Create the field if none.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 One usually requests followups to only one newsgroup.
10804
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
169 RFC 850 constrains the `Followup-To:' field to be a comma-separated list
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
170 of valid newsgroups names at your site, and it must be a subset of the
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
171 `Newsgroups:' field. For example:
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
172 Newsgroups: news.misc,comp.misc,rec.misc,misc.misc,soc.misc
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
173 Followup-To: news.misc,comp.misc,rec.misc"
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 (expand-abbrev)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 (or (mail-position-on-field "Followup-To" t)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 (progn (mail-position-on-field "newsgroups")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 (insert "\nFollowup-To: ")))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 ;; @@ could do a completing read based on the Newsgroups: field to
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 ;; @@ fill in the Followup-To: field
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 (defun news-reply-distribution ()
10804
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
184 "Move point to end of `Distribution:' optional field.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 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
186 USENET. The field is used to restrict the posting to parts of USENET."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 (expand-abbrev)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 (mail-position-on-field "Distribution")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 ;; @@could do a completing read based on the news library file:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 ;; @@ ../distributions to fill in the field.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 )
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 (defun news-reply-keywords ()
10804
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
195 "Move point to end of `Keywords:' optional field. Create the field if none.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 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
197 identifying the message."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (expand-abbrev)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 (mail-position-on-field "Keywords"))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 (defun news-reply-summary ()
10804
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
203 "Move point to end of `Summary:' optional field. Create the field if none.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 Used as an aid to the news reader, it can contain a succinct
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 summary (abstract) of the message."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 (expand-abbrev)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 (mail-position-on-field "Summary"))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 (defun news-reply-signature ()
11762
329197fc1477 (news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents: 11644
diff changeset
211 "The inews program appends `~/.signature' automatically."
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 (interactive)
14625
4cbc6690c0f7 (news-reply-mode-map): Delete news-reply-signature.
Karl Heuer <kwzh@gnu.org>
parents: 14231
diff changeset
213 (message "Posting news will append your signature automatically."))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 (defun news-setup (to subject in-reply-to newsgroups replybuffer)
10804
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
216 "Set up the news reply or posting buffer with the proper headers and mode."
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (setq mail-reply-buffer replybuffer)
11762
329197fc1477 (news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents: 11644
diff changeset
218 (let ((mail-setup-hook nil)
329197fc1477 (news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents: 11644
diff changeset
219 ;; Avoid inserting a signature.
329197fc1477 (news-setup): Bind mail-signature to nil.
Richard M. Stallman <rms@gnu.org>
parents: 11644
diff changeset
220 (mail-signature))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 (if (null to)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 ;; this hack is needed so that inews wont be confused by
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 ;; the fcc: and bcc: fields
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 (let ((mail-self-blind nil)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 (mail-archive-file-name nil))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 (mail-setup to subject in-reply-to nil replybuffer nil)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 (beginning-of-line)
1033
230459774744 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 846
diff changeset
228 (delete-region (point) (progn (forward-line 1) (point)))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 (goto-char (point-max)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 (mail-setup to subject in-reply-to nil replybuffer nil))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 ;;;(mail-position-on-field "Posting-Front-End")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 ;;;(insert (emacs-version))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 (goto-char (point-max))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 (if (let ((case-fold-search t))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 (re-search-backward "^Subject:" (point-min) t))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 (progn (beginning-of-line)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 (insert "Newsgroups: " (or newsgroups "") "\n")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 (if (not newsgroups)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 (backward-char 1)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 (goto-char (point-max)))))
21870
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
241 (let (actual-header-separator)
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
242 (rfc822-goto-eoh)
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
243 (setq actual-header-separator (buffer-substring
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
244 (point)
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
245 (save-excursion (end-of-line) (point))))
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
246 (setq paragraph-start
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
247 (concat "^" actual-header-separator "$\\|" paragraph-start))
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
248 (setq paragraph-separate
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
249 (concat "^" actual-header-separator "$\\|" paragraph-separate)))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 (run-hooks 'news-setup-hook)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 (defun news-inews ()
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 "Send a news message using inews."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 (let* (newsgroups subject
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 (case-fold-search nil))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 (save-excursion
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 (save-restriction
21870
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
259 (narrow-to-region (point-min) (mail-header-end))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 (setq newsgroups (mail-fetch-field "newsgroups")
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 (widen)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 (goto-char (point-min))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (run-hooks 'news-inews-hook)
21870
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
265 (mail-sendmail-undelimit-header)
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (goto-char (point-max))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 ;; require a newline at the end for inews to append .signature to
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 (or (= (preceding-char) ?\n)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 (insert ?\n))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 (message "Posting to USENET...")
21174
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
271 (unwind-protect
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
272 (if (not (eq 0
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
273 (call-process-region (point-min) (point-max)
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
274 news-inews-program nil 0 nil
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
275 "-h"))) ; take all header lines!
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
276 ;@@ setting of subject and newsgroups still needed?
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
277 ;"-t" subject
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
278 ;"-n" newsgroups
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
279 (error "Posting to USENET failed")
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
280 (message "Posting to USENET... done"))
21870
1afd18de6c50 (news-reply-mode): Don't load sendmail here.
Richard M. Stallman <rms@gnu.org>
parents: 21174
diff changeset
281 (mail-sendmail-delmit-header)
21174
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
282 (set-buffer-modified-p nil)))
17ad035e0cab (news-inews): Signal error if inews fails.
Richard M. Stallman <rms@gnu.org>
parents: 18383
diff changeset
283 (bury-buffer)))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 ;@@ shares some code with news-reply and news-post-news
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 (defun news-mail-reply ()
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 "Mail a reply to the author of the current article.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 While composing the reply, use \\[news-reply-yank-original] to yank the
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 original message into it."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 (interactive)
16712
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
291 (let (from cc subject date to reply-to message-id
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 (buffer (current-buffer)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293 (save-restriction
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 (narrow-to-region (point-min) (progn (goto-line (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 subject (mail-fetch-field "subject")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 reply-to (mail-fetch-field "reply-to")
16712
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
300 date (mail-fetch-field "date")
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
301 message-id (mail-fetch-field "message-id")))
10184
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
302 (setq to from)
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
303 (pop-to-buffer "*mail*")
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
304 (mail nil
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
305 (if reply-to reply-to to)
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
306 subject
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
307 (let ((stop-pos (string-match " *at \\| *@ \\| *(\\| *<" from)))
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
308 (concat (if stop-pos (substring from 0 stop-pos) from)
16712
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
309 "'s message "
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
310 (if message-id
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
311 (concat message-id " of ")
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
312 "of ")
10184
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
313 date))
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
314 nil
4fe4f49bcdb1 (news-mail-reply): Restore the saved narrowing before calling `mail'.
Richard M. Stallman <rms@gnu.org>
parents: 9534
diff changeset
315 buffer)))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 ;@@ the guts of news-reply and news-post-news should be combined. -tower
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 (defun news-reply ()
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 "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
320 While composing the followup, use \\[news-reply-yank-original] to yank the
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 original message into it."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 (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
324 (let (from cc subject date to followup-to newsgroups message-of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 references distribution message-id
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 (buffer (current-buffer)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 (save-restriction
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 ;@@ of article file
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 (equal major-mode 'news-mode) ;@@ if rmail-mode,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 ;@@ should show full headers
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 (progn
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 (news-show-all-headers) ;@@ should save/restore header state,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 ;@@ but rnews.el lacks support
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 (narrow-to-region (point-min) (progn (goto-char (point-min))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 (search-forward "\n\n")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 (- (point) 1)))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 (setq from (mail-fetch-field "from")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 news-reply-yank-from from
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 ;; @@ not handling old Title: field
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 subject (mail-fetch-field "subject")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 date (mail-fetch-field "date")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 followup-to (mail-fetch-field "followup-to")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 newsgroups (or followup-to
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345 (mail-fetch-field "newsgroups"))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 references (mail-fetch-field "references")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 ;; @@ not handling old Article-I.D.: field
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 distribution (mail-fetch-field "distribution")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 message-id (mail-fetch-field "message-id")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 news-reply-yank-message-id message-id)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 (pop-to-buffer "*post-news*")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 (news-reply-mode)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 (if (and (buffer-modified-p)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 (not
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 (y-or-n-p "Unsent article being composed; erase it? ")))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 ()
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 (progn
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 (erase-buffer)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 (and subject
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 (progn (if (string-match "\\`Re: " subject)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 (while (string-match "\\`Re: " subject)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 (setq subject (substring subject 4))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 (setq subject (concat "Re: " subject))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 (and from
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 (progn
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 (let ((stop-pos
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 (string-match " *at \\| *@ \\| *(\\| *<" from)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 (setq message-of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369 (concat
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 (if stop-pos (substring from 0 stop-pos) from)
16712
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
371 "'s message "
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
372 (if message-id
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
373 (concat message-id " of ")
aad91ec41fa4 (news-mail-reply, news-reply): Include the message
Richard M. Stallman <rms@gnu.org>
parents: 14625
diff changeset
374 "of ")
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 date)))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376 (news-setup
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377 nil
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 subject
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 message-of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380 newsgroups
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 buffer)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 (if followup-to
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 (progn (news-reply-followup-to)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 (insert followup-to)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 (if distribution
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 (progn
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 (mail-position-on-field "Distribution")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388 (insert distribution)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 (mail-position-on-field "References")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 (if references
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 (insert references))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392 (if (and references message-id)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 (insert " "))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394 (if message-id
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395 (insert message-id))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396 (goto-char (point-max))))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 (message "")))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 ;@@ the guts of news-reply and news-post-news should be combined. -tower
10804
abd9ad4309b0 Various doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 10587
diff changeset
400 ;;;###autoload
16932
ada95b0e82ae (news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents: 16712
diff changeset
401 (defun news-post-news (&optional noquery)
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 "Begin editing a new USENET news article to be posted.
16932
ada95b0e82ae (news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents: 16712
diff changeset
403 Type \\[describe-mode] once editing the article to get a list of commands.
ada95b0e82ae (news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents: 16712
diff changeset
404 If NOQUERY is non-nil, we do not query before doing the work."
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405 (interactive)
16932
ada95b0e82ae (news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents: 16712
diff changeset
406 (if (or noquery
ada95b0e82ae (news-post-news): New arg NOQUERY.
Richard M. Stallman <rms@gnu.org>
parents: 16712
diff changeset
407 (y-or-n-p "Are you sure you want to post to all of USENET? "))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 (let ((buffer (current-buffer)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 (save-restriction
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 (and (not (= 0 (buffer-size))) ;@@real problem is non-existence of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 ;@@ of article file
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 (equal major-mode 'news-mode) ;@@ if rmail-mode,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413 ;@@ should show full headers
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414 (progn
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 (news-show-all-headers) ;@@ should save/restore header state,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 ;@@ but rnews.el lacks support
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417 (narrow-to-region (point-min) (progn (goto-char (point-min))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 (search-forward "\n\n")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419 (- (point) 1)))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 (setq news-reply-yank-from (mail-fetch-field "from")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421 ;; @@ not handling old Article-I.D.: field
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422 news-reply-yank-message-id (mail-fetch-field "message-id")))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423 (pop-to-buffer "*post-news*")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 (news-reply-mode)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 (if (and (buffer-modified-p)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 (not (y-or-n-p "Unsent article being composed; erase it? ")))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427 () ;@@ not saving point from last time
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
428 (progn (erase-buffer)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429 (news-setup () () () () buffer))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 (message "")))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
432 (defun news-mail-other-window ()
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433 "Send mail in another window.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
434 While composing the message, use \\[news-reply-yank-original] to yank the
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435 original message into it."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 (mail-other-window nil nil nil nil nil (current-buffer)))
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 35
diff changeset
438
18383
11218164bc54 Add provide call.
Richard M. Stallman <rms@gnu.org>
parents: 16932
diff changeset
439 (provide 'rnewspost)
11218164bc54 Add provide call.
Richard M. Stallman <rms@gnu.org>
parents: 16932
diff changeset
440
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 35
diff changeset
441 ;;; rnewspost.el ends here