annotate lisp/obsolete/rnews.el @ 91181:392369adecec

(devanagari-composition-function): Use font-shape-text if auto-compose-current-font is non-nil.
author Kenichi Handa <handa@m17n.org>
date Tue, 04 Dec 2007 06:07:44 +0000
parents f55f9811f5d7
children 53108e6cea98
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 35063
diff changeset
1 ;;; rnews.el --- USENET news reader for GNU Emacs
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
2
74509
f7702c5f335d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68640
diff changeset
3 ;; Copyright (C) 1985, 1986, 1987, 2001, 2002, 2003, 2004,
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74509
diff changeset
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
5
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
6 ;; Maintainer: FSF
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
7 ;; Keywords: news
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
8
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
10
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
78228
1e016d63f292 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
13 ;; the Free Software Foundation; either version 3, or (at your option)
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
14 ;; any later version.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
15
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
20
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62769
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62769
diff changeset
24 ;; Boston, MA 02110-1301, USA.
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
25
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
26 ;;; Change Log:
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
27
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
28 ;; Created Sun Mar 10,1985 at 21:35:01 ads and sundar@hernes.ai.mit.edu
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
29 ;; Should do the point pdl stuff sometime
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
30 ;; finito except pdl.... Sat Mar 16,1985 at 06:43:44
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
31 ;; lets keep the summary stuff out until we get it working ..
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
32 ;; sundar@hermes.ai.mit.edu Wed Apr 10,1985 at 16:32:06
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
33 ;; hack slash maim. mly@gnu.org Thu 18 Apr, 1985 06:11:14
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
34 ;; modified to correct reentrance bug, to not bother with groups that
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
35 ;; received no new traffic since last read completely, to find out
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
36 ;; what traffic a group has available much more quickly when
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
37 ;; possible, to do some completing reads for group names - should
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
38 ;; be much faster...
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
39 ;; KING@KESTREL.arpa, Thu Mar 13 09:03:28 1986
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
40 ;; made news-{next,previous}-group skip groups with no new messages; and
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
41 ;; added checking for unsubscribed groups to news-add-news-group
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
42 ;; tower@gnu.org Jul 18 1986
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
43 ;; bound rmail-output to C-o; and changed header-field commands binding to
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
44 ;; agree with the new C-c C-f usage in sendmail
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
45 ;; tower@gnu.org Sep 3 1986
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
46 ;; added news-rotate-buffer-body
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
47 ;; tower@gnu.org Oct 17 1986
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
48 ;; made messages more user friendly, cleaned up news-inews
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
49 ;; move posting and mail code to new file rnewpost.el
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
50 ;; tower@gnu.org Oct 29 1986
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
51 ;; added caesar-region, rename news-caesar-buffer-body, hacked accordingly
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
52 ;; tower@gnu.org Nov 21 1986
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
53 ;; added tower@gnu.org 22 Apr 87
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
54
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 35063
diff changeset
55 ;;; Commentary:
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 35063
diff changeset
56
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
57 ;;; Code:
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
58
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
59 (require 'mail-utils)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
60 (require 'sendmail)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
61
65186
d40a2470e3dd (news-add-news-group): Don't use `end-of-line'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
62 (defvar caesar-translate-table)
d40a2470e3dd (news-add-news-group): Don't use `end-of-line'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
63 (defvar minor-modes)
d40a2470e3dd (news-add-news-group): Don't use `end-of-line'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
64 (defvar news-buffer-save)
d40a2470e3dd (news-add-news-group): Don't use `end-of-line'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
65 (defvar news-group-name)
d40a2470e3dd (news-add-news-group): Don't use `end-of-line'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
66 (defvar news-minor-modes)
d40a2470e3dd (news-add-news-group): Don't use `end-of-line'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
67
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
68 (autoload 'rmail-output "rmailout"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
69 "Append this message to Unix mail file named FILE-NAME."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
70 t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
71
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
72 (autoload 'news-reply "rnewspost"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
73 "Compose and post a reply to the current article on USENET.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
74 While composing the reply, use \\[mail-yank-original] to yank the original
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
75 message into it."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
76 t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
77
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
78 (autoload 'news-mail-other-window "rnewspost"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
79 "Send mail in another window.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
80 While composing the message, use \\[mail-yank-original] to yank the
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
81 original message into it."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
82 t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
83
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
84 (autoload 'news-post-news "rnewspost"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
85 "Begin editing a new USENET news article to be posted."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
86 t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
87
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
88 (autoload 'news-mail-reply "rnewspost"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
89 "Mail a reply to the author of the current article.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
90 While composing the reply, use \\[mail-yank-original] to yank the original
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
91 message into it."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
92 t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
93
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
94 (defvar news-group-hook-alist nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
95 "Alist of (GROUP-REGEXP . HOOK) pairs.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
96 Just before displaying a message, each HOOK is called
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
97 if its GROUP-REGEXP matches the current newsgroup name.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
98
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
99 (defvar rmail-last-file (expand-file-name "~/mbox.news"))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
100
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
101 ;Now in paths.el.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
102 ;(defvar news-path "/usr/spool/news/"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
103 ; "The root directory below which all news files are stored.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
104
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
105 (defvar news-startup-file "$HOME/.newsrc" "Contains ~/.newsrc")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
106 (defvar news-certification-file "$HOME/.news-dates" "Contains ~/.news-dates")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
107
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
108 ;; random headers that we decide to ignore.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
109 (defvar news-ignored-headers
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
110 "^Path:\\|^Posting-Version:\\|^Article-I.D.:\\|^Expires:\\|^Date-Received:\\|^References:\\|^Control:\\|^Xref:\\|^Lines:\\|^Posted:\\|^Relay-Version:\\|^Message-ID:\\|^Nf-ID:\\|^Nf-From:\\|^Approved:\\|^Sender:"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
111 "All random fields within the header of a message.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
112
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
113 (defvar news-mode-map nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
114 (defvar news-read-first-time-p t)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
115 ;; Contains the (dotified) news groups of which you are a member.
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
116 (defvar news-user-group-list nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
117
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
118 (defvar news-current-news-group nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
119 (defvar news-current-group-begin nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
120 (defvar news-current-group-end nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
121 (defvar news-current-certifications nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
122 "An assoc list of a group name and the time at which it is
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
123 known that the group had no new traffic")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
124 (defvar news-current-certifiable nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
125 "The time when the directory we are now working on was written")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
126
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
127 (defvar news-message-filter nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
128 "User specifiable filter function that will be called during
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
129 formatting of the news file")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
130
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
131 ;(defvar news-mode-group-string "Starting-Up"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
132 ; "Mode line group name info is held in this variable")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
133 (defvar news-list-of-files nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
134 "Global variable in which we store the list of files
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
135 associated with the current newsgroup")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
136 (defvar news-list-of-files-possibly-bogus nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
137 "variable indicating we only are guessing at which files are available.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
138 Not currently used.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
139
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
140 ;; association list in which we store lists of the form
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
141 ;; (pointified-group-name (first last old-last))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
142 (defvar news-group-article-assoc nil)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
143
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
144 (defvar news-current-message-number 0 "Displayed Article Number")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
145 (defvar news-total-current-group 0 "Total no of messages in group")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
146
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
147 (defvar news-unsubscribe-groups ())
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
148 (defvar news-point-pdl () "List of visited news messages.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
149 (defvar news-no-jumps-p t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
150 (defvar news-buffer () "Buffer into which news files are read.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
151
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
152 (defmacro news-push (item ref)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
153 (list 'setq ref (list 'cons item ref)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
154
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
155 (defmacro news-cadr (x) (list 'car (list 'cdr x)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
156 (defmacro news-cdar (x) (list 'cdr (list 'car x)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
157 (defmacro news-caddr (x) (list 'car (list 'cdr (list 'cdr x))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
158 (defmacro news-cadar (x) (list 'car (list 'cdr (list 'car x))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
159 (defmacro news-caadr (x) (list 'car (list 'car (list 'cdr x))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
160 (defmacro news-cdadr (x) (list 'cdr (list 'car (list 'cdr x))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
161
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
162 (defmacro news-wins (pfx index)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
163 `(file-exists-p (concat ,pfx "/" (int-to-string ,index))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
164
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
165 (defvar news-max-plausible-gap 2
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
166 "* In an rnews directory, the maximum possible gap size.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
167 A gap is a sequence of missing messages between two messages that exist.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
168 An empty file does not contribute to a gap -- it ends one.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
169
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
170 (defun news-find-first-and-last (prefix base)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
171 (and (news-wins prefix base)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
172 (cons (news-find-first-or-last prefix base -1)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
173 (news-find-first-or-last prefix base 1))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
174
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
175 (defmacro news-/ (a1 a2)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
176 ;; a form of / that guarantees that (/ -1 2) = 0
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
177 (if (zerop (/ -1 2))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
178 `(/ ,a1 ,a2)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
179 `(if (< ,a1 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
180 (- (/ (- ,a1) ,a2))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
181 (/ ,a1 ,a2))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
182
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
183 (defun news-find-first-or-last (pfx base dirn)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
184 ;; first use powers of two to find a plausible ceiling
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
185 (let ((original-dir dirn))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
186 (while (news-wins pfx (+ base dirn))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
187 (setq dirn (* dirn 2)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
188 (setq dirn (news-/ dirn 2))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
189 ;; Then use a binary search to find the high water mark
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
190 (let ((offset (news-/ dirn 2)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
191 (while (/= offset 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
192 (if (news-wins pfx (+ base dirn offset))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
193 (setq dirn (+ dirn offset)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
194 (setq offset (news-/ offset 2))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
195 ;; If this high-water mark is bogus, recurse.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
196 (let ((offset (* news-max-plausible-gap original-dir)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
197 (while (and (/= offset 0) (not (news-wins pfx (+ base dirn offset))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
198 (setq offset (- offset original-dir)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
199 (if (= offset 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
200 (+ base dirn)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
201 (news-find-first-or-last pfx (+ base dirn offset) original-dir)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
202
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
203 (defun rnews ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
204 "Read USENET news for groups for which you are a member and add or
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
205 delete groups.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
206 You can reply to articles posted and send articles to any group.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
207
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
208 Type \\[describe-mode] once reading news to get a list of rnews commands."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
209 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
210 (let ((last-buffer (buffer-name)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
211 (make-local-variable 'rmail-last-file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
212 (switch-to-buffer (setq news-buffer (get-buffer-create "*news*")))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
213 (news-mode)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
214 (setq news-buffer-save last-buffer)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
215 (setq buffer-read-only nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
216 (erase-buffer)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
217 (setq buffer-read-only t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
218 (set-buffer-modified-p t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
219 (sit-for 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
220 (message "Getting new USENET news...")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
221 (news-set-mode-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
222 (news-get-certifications)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
223 (news-get-new-news)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
224
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
225 (defun news-group-certification (group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
226 (cdr-safe (assoc group news-current-certifications)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
227
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
228
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
229 (defun news-set-current-certifiable ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
230 ;; Record the date that corresponds to the directory you are about to check
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
231 (let ((file (concat news-path
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
232 (string-subst-char ?/ ?. news-current-news-group))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
233 (setq news-current-certifiable
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
234 (nth 5 (file-attributes
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
235 (or (file-symlink-p file) file))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
236
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
237 (defun news-get-certifications ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
238 ;; Read the certified-read file from last session
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
239 (save-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
240 (save-window-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
241 (setq news-current-certifications
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
242 (car-safe
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
243 (condition-case var
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
244 (let*
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
245 ((file (substitute-in-file-name news-certification-file))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
246 (buf (find-file-noselect file)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
247 (and (file-exists-p file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
248 (progn
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
249 (switch-to-buffer buf 'norecord)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
250 (unwind-protect
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
251 (read-from-string (buffer-string))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
252 (kill-buffer buf)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
253 (error nil)))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
254
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
255 (defun news-write-certifications ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
256 ;; Write a certification file.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
257 ;; This is an assoc list of group names with doubletons that represent
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
258 ;; mod times of the directory when group is read completely.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
259 (save-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
260 (save-window-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
261 (with-output-to-temp-buffer
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
262 "*CeRtIfIcAtIoNs*"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
263 (print news-current-certifications))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
264 (let ((buf (get-buffer "*CeRtIfIcAtIoNs*")))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
265 (switch-to-buffer buf)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
266 (write-file (substitute-in-file-name news-certification-file))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
267 (kill-buffer buf)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
268
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
269 (defun news-set-current-group-certification ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
270 (let ((cgc (assoc news-current-news-group news-current-certifications)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
271 (if cgc (setcdr cgc news-current-certifiable)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
272 (news-push (cons news-current-news-group news-current-certifiable)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
273 news-current-certifications))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
274
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
275 (defun news-set-minor-modes ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
276 "Creates a minor mode list that has group name, total articles,
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
277 and attribute for current article."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
278 (setq news-minor-modes (list (cons 'foo
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
279 (concat news-current-message-number
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
280 "/"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
281 news-total-current-group
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
282 (news-get-attribute-string)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
283 ;; Detect Emacs versions 18.16 and up, which display
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
284 ;; directly from news-minor-modes by using a list for mode-name.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
285 (or (boundp 'minor-mode-alist)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
286 (setq minor-modes news-minor-modes)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
287
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
288 (defun news-set-message-counters ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
289 "Scan through current news-groups filelist to figure out how many messages
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
290 are there. Set counters for use with minor mode display."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
291 (if (null news-list-of-files)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
292 (setq news-current-message-number 0)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
293
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
294 (if news-mode-map
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
295 nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
296 (setq news-mode-map (make-keymap))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
297 (suppress-keymap news-mode-map)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
298 (define-key news-mode-map "." 'beginning-of-buffer)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
299 (define-key news-mode-map " " 'scroll-up)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
300 (define-key news-mode-map "\177" 'scroll-down)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
301 (define-key news-mode-map "n" 'news-next-message)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
302 (define-key news-mode-map "c" 'news-make-link-to-message)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
303 (define-key news-mode-map "p" 'news-previous-message)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
304 (define-key news-mode-map "j" 'news-goto-message)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
305 (define-key news-mode-map "q" 'news-exit)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
306 (define-key news-mode-map "e" 'news-exit)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
307 (define-key news-mode-map "\ej" 'news-goto-news-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
308 (define-key news-mode-map "\en" 'news-next-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
309 (define-key news-mode-map "\ep" 'news-previous-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
310 (define-key news-mode-map "l" 'news-list-news-groups)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
311 (define-key news-mode-map "?" 'describe-mode)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
312 (define-key news-mode-map "g" 'news-get-new-news)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
313 (define-key news-mode-map "f" 'news-reply)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
314 (define-key news-mode-map "m" 'news-mail-other-window)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
315 (define-key news-mode-map "a" 'news-post-news)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
316 (define-key news-mode-map "r" 'news-mail-reply)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
317 (define-key news-mode-map "o" 'news-save-item-in-file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
318 (define-key news-mode-map "\C-o" 'rmail-output)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
319 (define-key news-mode-map "t" 'news-show-all-headers)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
320 (define-key news-mode-map "x" 'news-force-update)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
321 (define-key news-mode-map "A" 'news-add-news-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
322 (define-key news-mode-map "u" 'news-unsubscribe-current-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
323 (define-key news-mode-map "U" 'news-unsubscribe-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
324 (define-key news-mode-map "\C-c\C-r" 'news-caesar-buffer-body))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
325
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
326 (defun news-mode ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
327 "News Mode is used by M-x rnews for reading USENET Newsgroups articles.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
328 New readers can find additional help in newsgroup: news.announce.newusers .
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
329 All normal editing commands are turned off.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
330 Instead, these commands are available:
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
331
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
332 . move point to front of this news article (same as Meta-<).
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
333 Space scroll to next screen of this news article.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
334 Delete scroll down previous page of this news article.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
335 n move to next news article, possibly next group.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
336 p move to previous news article, possibly previous group.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
337 j jump to news article specified by numeric position.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
338 M-j jump to news group.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
339 M-n goto next news group.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
340 M-p goto previous news group.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
341 l list all the news groups with current status.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
342 ? print this help message.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
343 C-c C-r caesar rotate all letters by 13 places in the article's body (rot13).
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
344 g get new USENET news.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
345 f post a reply article to USENET.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
346 a post an original news article.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
347 A add a newsgroup.
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
348 o save the current article in the named file (append if file exists).
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
349 C-o output this message to a Unix-format mail file (append it).
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
350 c \"copy\" (actually link) current or prefix-arg msg to file.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
351 warning: target directory and message file must be on same device
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
352 (UNIX magic)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
353 t show all the headers this news article originally had.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
354 q quit reading news after updating .newsrc file.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
355 e exit updating .newsrc file.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
356 m mail a news article. Same as C-x 4 m.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
357 x update last message seen to be the current message.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
358 r mail a reply to this news article. Like m but initializes some fields.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
359 u unsubscribe from current newsgroup.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
360 U unsubscribe from specified newsgroup."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
361 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
362 (kill-all-local-variables)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
363 (make-local-variable 'news-read-first-time-p)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
364 (setq news-read-first-time-p t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
365 (make-local-variable 'news-current-news-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
366 ; (setq news-current-news-group "??")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
367 (make-local-variable 'news-current-group-begin)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
368 (setq news-current-group-begin 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
369 (make-local-variable 'news-current-message-number)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
370 (setq news-current-message-number 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
371 (make-local-variable 'news-total-current-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
372 (make-local-variable 'news-buffer-save)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
373 (make-local-variable 'version-control)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
374 (setq version-control 'never)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
375 (make-local-variable 'news-point-pdl)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
376 ; This breaks it. I don't have time to figure out why. -- RMS
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
377 ; (make-local-variable 'news-group-article-assoc)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
378 (setq major-mode 'news-mode)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
379 (setq mode-line-process '(news-minor-modes))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
380 (setq mode-name "NEWS")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
381 (news-set-mode-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
382 (set-syntax-table text-mode-syntax-table)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
383 (use-local-map news-mode-map)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
384 (setq local-abbrev-table text-mode-abbrev-table)
62769
a1fa16a75bde * obsolete/ooutline.el (outline-mode):
Lute Kamstra <lute@gnu.org>
parents: 62196
diff changeset
385 (run-mode-hooks 'news-mode-hook))
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
386
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
387 (defun string-subst-char (new old string)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
388 (let (index)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
389 (setq old (regexp-quote (char-to-string old))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
390 string (substring string 0))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
391 (while (setq index (string-match old string))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
392 (aset string index new)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
393 string)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
394
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
395 ;; update read message number
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
396 (defmacro news-update-message-read (ngroup nno)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
397 (list 'setcar
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
398 (list 'news-cdadr
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
399 (list 'assoc ngroup 'news-group-article-assoc))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
400 nno))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
401
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
402 (defun news-parse-range (number-string)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
403 "Parse string representing range of numbers of he form <a>-<b>
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
404 to a list (a . b)"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
405 (let ((n (string-match "-" number-string)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
406 (if n
62196
86f3ab4179bd (news-parse-range, news-select-message, news-get-pruned-list-of-files):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
407 (cons (string-to-number (substring number-string 0 n))
86f3ab4179bd (news-parse-range, news-select-message, news-get-pruned-list-of-files):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
408 (string-to-number (substring number-string (1+ n))))
86f3ab4179bd (news-parse-range, news-select-message, news-get-pruned-list-of-files):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
409 (setq n (string-to-number number-string))
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
410 (cons n n))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
411
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
412 ;(defun is-in (elt lis)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
413 ; (catch 'foo
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
414 ; (while lis
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
415 ; (if (equal (car lis) elt)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
416 ; (throw 'foo t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
417 ; (setq lis (cdr lis))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
418
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
419 (defun news-get-new-news ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
420 "Get new USENET news, if there is any for the current user."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
421 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
422 (if (not (null news-user-group-list))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
423 (news-update-newsrc-file))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
424 (setq news-group-article-assoc ())
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
425 (setq news-user-group-list ())
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
426 (message "Looking up %s file..." news-startup-file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
427 (let ((file (substitute-in-file-name news-startup-file))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
428 (temp-user-groups ()))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
429 (save-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
430 (let ((newsrcbuf (find-file-noselect file))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
431 start end endofline tem)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
432 (set-buffer newsrcbuf)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
433 (goto-char 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
434 (while (search-forward ": " nil t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
435 (setq end (point))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
436 (beginning-of-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
437 (setq start (point))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
438 (end-of-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
439 (setq endofline (point))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
440 (setq tem (buffer-substring start (- end 2)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
441 (let ((range (news-parse-range
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
442 (buffer-substring end endofline))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
443 (if (assoc tem news-group-article-assoc)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
444 (message "You are subscribed twice to %s; I ignore second"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
445 tem)
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
446 (setq temp-user-groups (cons tem temp-user-groups)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
447 news-group-article-assoc
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
448 (cons (list tem (list (car range)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
449 (cdr range)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
450 (cdr range)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
451 news-group-article-assoc)))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
452 (kill-buffer newsrcbuf)))
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
453 (setq temp-user-groups (nreverse temp-user-groups))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
454 (message "Prefrobnicating...")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
455 (switch-to-buffer news-buffer)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
456 (setq news-user-group-list temp-user-groups)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
457 (while (and temp-user-groups
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
458 (not (news-read-files-into-buffer
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
459 (car temp-user-groups) nil)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
460 (setq temp-user-groups (cdr temp-user-groups)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
461 (if (null temp-user-groups)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
462 (message "No news is good news.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
463 (message ""))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
464
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
465 (defun news-list-news-groups ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
466 "Display all the news groups to which you belong."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
467 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
468 (with-output-to-temp-buffer "*Newsgroups*"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
469 (save-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
470 (set-buffer standard-output)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
471 (insert
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
472 "News Group Msg No. News Group Msg No.\n")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
473 (insert
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
474 "------------------------- -------------------------\n")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
475 (let ((temp news-user-group-list)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
476 (flag nil))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
477 (while temp
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
478 (let ((item (assoc (car temp) news-group-article-assoc)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
479 (insert (car item))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
480 (indent-to (if flag 52 20))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
481 (insert (int-to-string (news-cadr (news-cadr item))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
482 (if flag
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
483 (insert "\n")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
484 (indent-to 33))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
485 (setq temp (cdr temp) flag (not flag))))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
486
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
487 ;; Mode line hack
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
488 (defun news-set-mode-line ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
489 "Set mode line string to something useful."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
490 (setq mode-line-process
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
491 (concat " "
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
492 (if (integerp news-current-message-number)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
493 (int-to-string news-current-message-number)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
494 "??")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
495 "/"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
496 (if (integerp news-current-group-end)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
497 (int-to-string news-current-group-end)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
498 news-current-group-end)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
499 (setq mode-line-buffer-identification
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
500 (concat "NEWS: "
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
501 news-current-news-group
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
502 ;; Enough spaces to pad group name to 17 positions.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
503 (substring " "
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
504 0 (max 0 (- 17 (length news-current-news-group))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
505 (set-buffer-modified-p t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
506 (sit-for 0))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
507
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
508 (defun news-goto-news-group (gp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
509 "Takes a string and goes to that news group."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
510 (interactive (list (completing-read "NewsGroup: "
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
511 news-group-article-assoc)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
512 (message "Jumping to news group %s..." gp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
513 (news-select-news-group gp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
514 (message "Jumping to news group %s... done." gp))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
515
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
516 (defun news-select-news-group (gp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
517 (let ((grp (assoc gp news-group-article-assoc)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
518 (if (null grp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
519 (error "Group %s not subscribed to" gp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
520 (progn
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
521 (news-update-message-read news-current-news-group
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
522 (news-cdar news-point-pdl))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
523 (news-read-files-into-buffer (car grp) nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
524 (news-set-mode-line)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
525
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
526 (defun news-goto-message (arg)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
527 "Goes to the article ARG in current newsgroup."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
528 (interactive "p")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
529 (if (null current-prefix-arg)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
530 (setq arg (read-no-blanks-input "Go to article: " "")))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
531 (news-select-message arg))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
532
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
533 (defun news-select-message (arg)
62196
86f3ab4179bd (news-parse-range, news-select-message, news-get-pruned-list-of-files):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
534 (if (stringp arg) (setq arg (string-to-number arg)))
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
535 (let ((file (concat news-path
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
536 (string-subst-char ?/ ?. news-current-news-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
537 "/" arg)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
538 (if (= arg
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
539 (or (news-cadr (memq (news-cdar news-point-pdl) news-list-of-files))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
540 0))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
541 (setcdr (car news-point-pdl) arg))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
542 (setq news-current-message-number arg)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
543 (if (file-exists-p file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
544 (let ((buffer-read-only nil))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
545 (news-read-in-file file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
546 (news-set-mode-line))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
547 (news-set-mode-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
548 (error "Article %d nonexistent" arg))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
549
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
550 (defun news-force-update ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
551 "updates the position of last article read in the current news group"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
552 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
553 (setcdr (car news-point-pdl) news-current-message-number)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
554 (message "Updated to %d" news-current-message-number))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
555
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
556 (defun news-next-message (arg)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
557 "Move ARG messages forward within one newsgroup.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
558 Negative ARG moves backward.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
559 If ARG is 1 or -1, moves to next or previous newsgroup if at end."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
560 (interactive "p")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
561 (let ((no (+ arg news-current-message-number)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
562 (if (or (< no news-current-group-begin)
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
563 (> no news-current-group-end))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
564 (cond ((= arg 1)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
565 (news-set-current-group-certification)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
566 (news-next-group))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
567 ((= arg -1)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
568 (news-previous-group))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
569 (t (error "Article out of range")))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
570 (let ((plist (news-get-motion-lists
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
571 news-current-message-number
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
572 news-list-of-files)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
573 (if (< arg 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
574 (news-select-message (nth (1- (- arg)) (car (cdr plist))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
575 (news-select-message (nth (1- arg) (car plist))))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
576
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
577 (defun news-previous-message (arg)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
578 "Move ARG messages backward in current newsgroup.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
579 With no arg or arg of 1, move one message
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
580 and move to previous newsgroup if at beginning.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
581 A negative ARG means move forward."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
582 (interactive "p")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
583 (news-next-message (- arg)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
584
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
585 (defun news-move-to-group (arg)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
586 "Given arg move forward or backward to a new newsgroup."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
587 (let ((cg news-current-news-group))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
588 (let ((plist (news-get-motion-lists cg news-user-group-list))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
589 ngrp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
590 (if (< arg 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
591 (or (setq ngrp (nth (1- (- arg)) (news-cadr plist)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
592 (error "No previous news groups"))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
593 (or (setq ngrp (nth arg (car plist)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
594 (error "No more news groups")))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
595 (news-select-news-group ngrp))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
596
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
597 (defun news-next-group ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
598 "Moves to the next user group."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
599 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
600 ; (message "Moving to next group...")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
601 (news-move-to-group 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
602 (while (null news-list-of-files)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
603 (news-move-to-group 0)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
604 ; (message "Moving to next group... done.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
605
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
606 (defun news-previous-group ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
607 "Moves to the previous user group."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
608 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
609 ; (message "Moving to previous group...")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
610 (news-move-to-group -1)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
611 (while (null news-list-of-files)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
612 (news-move-to-group -1)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
613 ; (message "Moving to previous group... done.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
614
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
615 (defun news-get-motion-lists (arg listy)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
616 "Given a msgnumber/group this will return a list of two lists;
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
617 one for moving forward and one for moving backward."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
618 (let ((temp listy)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
619 (result ()))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
620 (catch 'out
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
621 (while temp
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
622 (if (equal (car temp) arg)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
623 (throw 'out (cons (cdr temp) (list result)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
624 (setq result (nconc (list (car temp)) result))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
625 (setq temp (cdr temp)))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
626
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
627 ;; miscellaneous io routines
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
628 (defun news-read-in-file (filename)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
629 (erase-buffer)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
630 (let ((start (point)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
631 (insert-file-contents filename)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
632 (news-convert-format)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
633 ;; Run each hook that applies to the current newsgroup.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
634 (let ((hooks news-group-hook-alist))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
635 (while hooks
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
636 (goto-char start)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
637 (if (string-match (car (car hooks)) news-group-name)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
638 (funcall (cdr (car hooks))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
639 (setq hooks (cdr hooks))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
640 (goto-char start)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
641 (forward-line 1)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
642 (if (eobp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
643 (message "(Empty file?)")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
644 (goto-char start))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
645
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
646 (defun news-convert-format ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
647 (save-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
648 (save-restriction
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
649 (let* ((start (point))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
650 (end (condition-case ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
651 (progn (search-forward "\n\n") (point))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
652 (error nil)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
653 has-from has-date)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
654 (cond (end
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
655 (narrow-to-region start end)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
656 (goto-char start)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
657 (setq has-from (search-forward "\nFrom:" nil t))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
658 (cond ((and (not has-from) has-date)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
659 (goto-char start)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
660 (search-forward "\nDate:")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
661 (beginning-of-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
662 (kill-line) (kill-line)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
663 (news-delete-headers start)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
664 (goto-char start)))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
665
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
666 (defun news-show-all-headers ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
667 "Redisplay current news item with all original headers"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
668 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
669 (let (news-ignored-headers
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
670 (buffer-read-only ()))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
671 (erase-buffer)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
672 (news-set-mode-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
673 (news-read-in-file
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
674 (concat news-path
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
675 (string-subst-char ?/ ?. news-current-news-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
676 "/" (int-to-string news-current-message-number)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
677
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
678 (defun news-delete-headers (pos)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
679 (goto-char pos)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
680 (and (stringp news-ignored-headers)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
681 (while (re-search-forward news-ignored-headers nil t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
682 (beginning-of-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
683 (delete-region (point)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
684 (progn (re-search-forward "\n[^ \t]")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
685 (forward-char -1)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
686 (point))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
687
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
688 (defun news-exit ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
689 "Quit news reading session and update the .newsrc file."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
690 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
691 (if (y-or-n-p "Do you really wanna quit reading news ? ")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
692 (progn (message "Updating %s..." news-startup-file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
693 (news-update-newsrc-file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
694 (news-write-certifications)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
695 (message "Updating %s... done" news-startup-file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
696 (message "Now do some real work")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
697 (quit-window)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
698 (switch-to-buffer news-buffer-save)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
699 (setq news-user-group-list ()))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
700 (message "")))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
701
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
702 (defun news-update-newsrc-file ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
703 "Updates the .newsrc file in the users home dir."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
704 (let ((newsrcbuf (find-file-noselect
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
705 (substitute-in-file-name news-startup-file)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
706 (tem news-user-group-list)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
707 group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
708 (save-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
709 (if (not (null news-current-news-group))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
710 (news-update-message-read news-current-news-group
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
711 (news-cdar news-point-pdl)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
712 (set-buffer newsrcbuf)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
713 (while tem
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
714 (setq group (assoc (car tem) news-group-article-assoc))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
715 (if (= (news-cadr (news-cadr group)) (news-caddr (news-cadr group)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
716 nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
717 (goto-char 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
718 (if (search-forward (concat (car group) ": ") nil t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
719 (kill-line nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
720 (insert (car group) ": \n") (backward-char 1))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
721 (insert (int-to-string (car (news-cadr group))) "-"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
722 (int-to-string (news-cadr (news-cadr group)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
723 (setq tem (cdr tem)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
724 (while news-unsubscribe-groups
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
725 (setq group (assoc (car news-unsubscribe-groups)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
726 news-group-article-assoc))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
727 (goto-char 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
728 (if (search-forward (concat (car group) ": ") nil t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
729 (progn
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
730 (backward-char 2)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
731 (kill-line nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
732 (insert "! " (int-to-string (car (news-cadr group)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
733 "-" (int-to-string (news-cadr (news-cadr group))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
734 (setq news-unsubscribe-groups (cdr news-unsubscribe-groups)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
735 (save-buffer)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
736 (kill-buffer (current-buffer)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
737
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
738
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
739 (defun news-unsubscribe-group (group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
740 "Removes you from newgroup GROUP."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
741 (interactive (list (completing-read "Unsubscribe from group: "
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
742 news-group-article-assoc)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
743 (news-unsubscribe-internal group))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
744
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
745 (defun news-unsubscribe-current-group ()
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
746 "Removes you from the newsgroup you are now reading."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
747 (interactive)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
748 (if (y-or-n-p "Do you really want to unsubscribe from this group ? ")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
749 (news-unsubscribe-internal news-current-news-group)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
750
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
751 (defun news-unsubscribe-internal (group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
752 (let ((tem (assoc group news-group-article-assoc)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
753 (if tem
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
754 (progn
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
755 (setq news-unsubscribe-groups (cons group news-unsubscribe-groups))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
756 (news-update-message-read group (news-cdar news-point-pdl))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
757 (if (equal group news-current-news-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
758 (news-next-group))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
759 (message ""))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
760 (error "Not subscribed to group: %s" group))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
761
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
762 (defun news-save-item-in-file (file)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
763 "Save the current article that is being read by appending to a file."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
764 (interactive "FSave item in file: ")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
765 (append-to-file (point-min) (point-max) file))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
766
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
767 (defun news-get-pruned-list-of-files (gp-list end-file-no)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
768 "Given a news group it finds all files in the news group.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
769 The arg must be in slashified format.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
770 Using ls was found to be too slow in a previous version."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
771 (let
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
772 ((answer
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
773 (and
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
774 (not (and end-file-no
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
775 (equal (news-set-current-certifiable)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
776 (news-group-certification gp-list))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
777 (setq news-list-of-files nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
778 news-list-of-files-possibly-bogus t)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
779 (let* ((file-directory (concat news-path
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
780 (string-subst-char ?/ ?. gp-list)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
781 tem
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
782 (last-winner
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
783 (and end-file-no
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
784 (news-wins file-directory end-file-no)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
785 (news-find-first-or-last file-directory end-file-no 1))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
786 (setq news-list-of-files-possibly-bogus t news-list-of-files nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
787 (if last-winner
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
788 (progn
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
789 (setq news-list-of-files-possibly-bogus t
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
790 news-current-group-end last-winner)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
791 (while (> last-winner end-file-no)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
792 (news-push last-winner news-list-of-files)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
793 (setq last-winner (1- last-winner)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
794 news-list-of-files)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
795 (if (or (not (file-directory-p file-directory))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
796 (not (file-readable-p file-directory)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
797 nil
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
798 (setq news-list-of-files
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
799 (condition-case error
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
800 (directory-files file-directory)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
801 (file-error
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
802 (if (string= (nth 2 error) "permission denied")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
803 (message "Newsgroup %s is read-protected"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
804 gp-list)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
805 (signal 'file-error (cdr error)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
806 nil)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
807 (setq tem news-list-of-files)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
808 (while tem
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
809 (if (or (not (string-match "^[0-9]*$" (car tem)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
810 ;; don't get confused by directories that look like numbers
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
811 (file-directory-p
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
812 (concat file-directory "/" (car tem)))
62196
86f3ab4179bd (news-parse-range, news-select-message, news-get-pruned-list-of-files):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
813 (<= (string-to-number (car tem)) end-file-no))
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
814 (setq news-list-of-files
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
815 (delq (car tem) news-list-of-files)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
816 (setq tem (cdr tem)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
817 (if (null news-list-of-files)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
818 (progn (setq news-current-group-end 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
819 nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
820 (setq news-list-of-files
62196
86f3ab4179bd (news-parse-range, news-select-message, news-get-pruned-list-of-files):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
821 (mapcar 'string-to-number news-list-of-files))
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
822 (setq news-list-of-files (sort news-list-of-files '<))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
823 (setq news-current-group-end
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
824 (elt news-list-of-files
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
825 (1- (length news-list-of-files))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
826 news-list-of-files)))))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
827 (or answer (progn (news-set-current-group-certification) nil))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
828
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
829 (defun news-read-files-into-buffer (group reversep)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
830 (let* ((files-start-end (news-cadr (assoc group news-group-article-assoc)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
831 (start-file-no (car files-start-end))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
832 (end-file-no (news-cadr files-start-end))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
833 (buffer-read-only nil))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
834 (setq news-current-news-group group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
835 (setq news-current-message-number nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
836 (setq news-current-group-end nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
837 (news-set-mode-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
838 (news-get-pruned-list-of-files group end-file-no)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
839 (news-set-mode-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
840 ;; @@ should be a lot smarter than this if we have to move
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
841 ;; @@ around correctly.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
842 (setq news-point-pdl (list (cons (car files-start-end)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
843 (news-cadr files-start-end))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
844 (if (null news-list-of-files)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
845 (progn (erase-buffer)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
846 (setq news-current-group-end end-file-no)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
847 (setq news-current-group-begin end-file-no)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
848 (setq news-current-message-number end-file-no)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
849 (news-set-mode-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
850 ; (message "No new articles in " group " group.")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
851 nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
852 (setq news-current-group-begin (car news-list-of-files))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
853 (if reversep
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
854 (setq news-current-message-number news-current-group-end)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
855 (if (> (car news-list-of-files) end-file-no)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
856 (setcdr (car news-point-pdl) (car news-list-of-files)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
857 (setq news-current-message-number news-current-group-begin))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
858 (news-set-message-counters)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
859 (news-set-mode-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
860 (news-read-in-file (concat news-path
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
861 (string-subst-char ?/ ?. group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
862 "/"
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
863 (int-to-string
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
864 news-current-message-number)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
865 (news-set-message-counters)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
866 (news-set-mode-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
867 t)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
868
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
869 (defun news-add-news-group (gp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
870 "Resubscribe to or add a USENET news group named GROUP (a string)."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
871 ; @@ (completing-read ...)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
872 ; @@ could be based on news library file ../active (slightly fascist)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
873 ; @@ or (expensive to compute) all directories under the news spool directory
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
874 (interactive "sAdd news group: ")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
875 (let ((file-dir (concat news-path (string-subst-char ?/ ?. gp))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
876 (save-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
877 (if (null (assoc gp news-group-article-assoc))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
878 (let ((newsrcbuf (find-file-noselect
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
879 (substitute-in-file-name news-startup-file))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
880 (if (file-directory-p file-dir)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
881 (progn
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
882 (switch-to-buffer newsrcbuf)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
883 (goto-char 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
884 (if (search-forward (concat gp "! ") nil t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
885 (progn
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
886 (message "Re-subscribing to group %s." gp)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
887 ;;@@ news-unsubscribe-groups isn't being used
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
888 ;;(setq news-unsubscribe-groups
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
889 ;; (delq gp news-unsubscribe-groups))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
890 (backward-char 2)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
891 (delete-char 1)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
892 (insert ":"))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
893 (progn
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
894 (message
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
895 "Added %s to your list of newsgroups." gp)
65186
d40a2470e3dd (news-add-news-group): Don't use `end-of-line'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64751
diff changeset
896 (goto-char (point-max))
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
897 (insert gp ": 1-1\n")))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
898 (search-backward gp nil t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
899 (let (start end endofline tem)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
900 (search-forward ": " nil t)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
901 (setq end (point))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
902 (beginning-of-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
903 (setq start (point))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
904 (end-of-line)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
905 (setq endofline (point))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
906 (setq tem (buffer-substring start (- end 2)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
907 (let ((range (news-parse-range
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
908 (buffer-substring end endofline))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
909 (setq news-group-article-assoc
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
910 (cons (list tem (list (car range)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
911 (cdr range)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
912 (cdr range)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
913 news-group-article-assoc))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
914 (save-buffer)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
915 (kill-buffer (current-buffer)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
916 (message "Newsgroup %s doesn't exist." gp)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
917 (message "Already subscribed to group %s." gp)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
918
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
919 (defun news-make-link-to-message (number newname)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
920 "Forges a link to an rnews message numbered number (current if no arg)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
921 Good for hanging on to a message that might or might not be
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
922 automatically deleted."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
923 (interactive "P
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
924 FName to link to message: ")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
925 (add-name-to-file
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
926 (concat news-path
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
927 (string-subst-char ?/ ?. news-current-news-group)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
928 "/" (if number
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
929 (prefix-numeric-value number)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
930 news-current-message-number))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
931 newname))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
932
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
933 ;;; caesar-region written by phr@gnu.org Nov 86
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
934 ;;; modified by tower@gnu.org Nov 86
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
935 (defun caesar-region (&optional n)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
936 "Caesar rotation of region by N, default 13, for decrypting netnews."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
937 (interactive (if current-prefix-arg ; Was there a prefix arg?
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
938 (list (prefix-numeric-value current-prefix-arg))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
939 (list nil)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
940 (cond ((not (numberp n)) (setq n 13))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
941 (t (setq n (mod n 26)))) ;canonicalize N
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
942 (if (not (zerop n)) ; no action needed for a rot of 0
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
943 (progn
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
944 (if (or (not (boundp 'caesar-translate-table))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
945 (/= (aref caesar-translate-table ?a) (+ ?a n)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
946 (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
947 (message "Building caesar-translate-table...")
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
948 (setq caesar-translate-table (make-vector 256 0))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
949 (while (< i 256)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
950 (aset caesar-translate-table i i)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
951 (setq i (1+ i)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
952 (setq lower (concat lower lower) upper (upcase lower) i 0)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
953 (while (< i 26)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
954 (aset caesar-translate-table (+ ?a i) (aref lower (+ i n)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
955 (aset caesar-translate-table (+ ?A i) (aref upper (+ i n)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
956 (setq i (1+ i)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
957 (message "Building caesar-translate-table... done")))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
958 (let ((from (region-beginning))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
959 (to (region-end))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
960 (i 0) str len)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
961 (setq str (buffer-substring from to))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
962 (setq len (length str))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
963 (while (< i len)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
964 (aset str i (aref caesar-translate-table (aref str i)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
965 (setq i (1+ i)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
966 (goto-char from)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
967 (kill-region from to)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
968 (insert str)))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
969
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
970 ;;; news-caesar-buffer-body written by paul@media-lab.mit.edu Wed Oct 1, 1986
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
971 ;;; hacked further by tower@gnu.org
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
972 (defun news-caesar-buffer-body (&optional rotnum)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
973 "Caesar rotates all letters in the current buffer by 13 places.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
974 Used to encode/decode possibly offensive messages (commonly in net.jokes).
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
975 With prefix arg, specifies the number of places to rotate each letter forward.
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
976 Mail and USENET news headers are not rotated."
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
977 (interactive (if current-prefix-arg ; Was there a prefix arg?
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
978 (list (prefix-numeric-value current-prefix-arg))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
979 (list nil)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
980 (save-excursion
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
981 (let ((buffer-status buffer-read-only))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
982 (setq buffer-read-only nil)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
983 ;; setup the region
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
984 (set-mark (if (equal major-mode 'news-mode)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
985 (progn (goto-char (point-min))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
986 (search-forward "\n\n" nil t))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
987 (mail-text-start)))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
988 (goto-char (point-max))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
989 (caesar-region rotnum)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
990 (setq buffer-read-only buffer-status))))
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
991
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
992 (provide 'rnews)
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
993
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49598
diff changeset
994 ;;; arch-tag: c032a20b-cafb-466c-b3fa-5be404a18f8c
35063
5c3a343fb1ce Obsolete.
Dave Love <fx@gnu.org>
parents:
diff changeset
995 ;;; rnews.el ends here