annotate lisp/=gnus.el @ 951:c23539669808

*** empty log message ***
author Roland McGrath <roland@gnu.org>
date Fri, 07 Aug 1992 21:31:57 +0000
parents 9f3cc03dae67
children 2596132752ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
660
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; gnus.el --- GNUS: an NNTP-based News Reader for GNU Emacs
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 811
diff changeset
3 ;; Copyright (C) 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 811
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 716
diff changeset
5 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
6 ;; Keywords: news
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 716
diff changeset
7
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9
711
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 716
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
711
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
13 ;; any later version.
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
14
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
711
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
18 ;; GNU General Public License for more details.
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
19
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
20 ;; You should have received a copy of the GNU General Public License
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22b98190b7ef *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 660
diff changeset
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 716
diff changeset
24 ;;; Commentary:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 716
diff changeset
25
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 ;; GNUS Mailing List:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;; There are two mailing lists for GNUS lovers in the world:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ;; info-gnus@flab.fujitsu.co.jp, and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 ;; info-gnus-english@tut.cis.ohio-state.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 ;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 ;; They are intended to exchange useful information about GNUS, such
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 ;; as bug fixes, useful hooks, and extensions. The major difference
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 ;; between the lists is what the official language is. Both Japanese
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 ;; and English are available in info-gnus, while English is only
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ;; available in info-gnus-english. There is no need to subscribe to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 ;; info-gnus if you cannot read Japanese messages, because most of the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 ;; discussion and important announcements will be sent to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 ;; info-gnus-english. Moreover, if you can read gnu.emacs.gnus
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 ;; newsgroup of USENET, you need not, either. info-gnus-english and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 ;; gnu.emacs.gnus are linked each other.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 ;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 ;; Please send subscription request to:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 ;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 ;; info-gnus-request@flab.fujitsu.co.jp, or
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 ;; info-gnus-english-request@cis.ohio-state.edu
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 ;; TO DO:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 ;; (1) Incremental update of active info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 ;; (2) GNUS own poster.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 ;; (3) Multi-GNUS (Talking to many hosts same time).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 ;; (4) Asynchronous transmission of large messages.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 716
diff changeset
54 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 716
diff changeset
55
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 (require 'nntp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 (require 'mail-utils)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58
716
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
59 (defvar gnus-nntp-server (or (getenv "NNTPSERVER")
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
60 (and (boundp 'gnus-default-nntp-server)
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
61 gnus-default-nntp-server))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 "The name of the host running NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 If it is a string such as `:DIRECTORY', the user's private DIRECTORY
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 is used as a news spool.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 Initialized from the NNTPSERVER environment variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66
716
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
67 (defvar gnus-nntp-service "nntp"
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
68 "The name of the network service for GNUS to use. Usually \"nntp\".")
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
69
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 (defvar gnus-signature-file "~/.signature"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 "*Your .signature file. Use `.signature-DISTRIBUTION' instead if exists.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 (defvar gnus-use-cross-reference t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 "Specifies what to do with cross references (Xref: field).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 If nil, ignore cross references. If t, mark articles as read in subscribed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 newsgroups. Otherwise, mark articles as read in all newsgroups.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 (defvar gnus-use-followup-to t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 "*Specifies what to do with Followup-To: field.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 If nil, ignore followup-to: field. If t, use its value execpt for
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 `poster'. Otherewise, if not nil nor t, always use its value.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 (defvar gnus-large-newsgroup 50
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 "*The number of articles which indicates a large newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 If the number of articles in a newsgroup is greater than the value,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 confirmation is required for selecting the newsgroup.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 (defvar gnus-author-copy (getenv "AUTHORCOPY")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 "*Filename for saving a copy of an article posted using FCC: field.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 Initialized from the AUTHORCOPY environment variable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 Articles are saved using a function specified by the the variable
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 `gnus-author-copy-saver' (`rmail-output' is the default) if a file name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 is given. Instead, if the first character of the name is `|', the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 contents of the article is piped out to the named program. It is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 possible to save an article in an MH folder as follows:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 (setq gnus-author-copy \"|/usr/local/lib/mh/rcvstore +Article\")")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 (defvar gnus-author-copy-saver (function rmail-output)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 "*A function called with a file name to save an author copy to.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 The default function is `rmail-output' which saves in Unix mailbox format.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 (defvar gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 (not (memq system-type '(usg-unix-v xenix)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 "Non-nil means that a newsgroup name is used as a default file name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 to save articles to. If nil, the directory form of a newsgroup is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 used instead.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 (defvar gnus-article-save-directory (getenv "SAVEDIR")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 "*The directory in which to save articles; defaults to ~/News.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 Initialized from the SAVEDIR environment variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 (defvar gnus-default-article-saver (function gnus-Subject-save-in-rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 "A function used to save articles in your favorite format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 The function must be interactively callable (in other words, it must
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 be an Emacs command).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 GNUS provides the following functions:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 gnus-Subject-save-in-rmail (in Rmail format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 gnus-Subject-save-in-mail (in Unix mail format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 gnus-Subject-save-in-folder (in an MH folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 gnus-Subject-save-in-file (in article format).")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 (defvar gnus-rmail-save-name (function gnus-plain-save-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 "A function generating a file name to save articles in Rmail format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 (defvar gnus-mail-save-name (function gnus-plain-save-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 "A function generating a file name to save articles in Unix mail format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 (defvar gnus-folder-save-name (function gnus-folder-save-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 "A function generating a file name to save articles in MH folder.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 (defvar gnus-file-save-name (function gnus-numeric-save-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 "A function generating a file name to save articles in article format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 (defvar gnus-kill-file-name "KILL"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 "File name of a KILL file.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 (defvar gnus-default-distribution "local"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 "*Use this value as distribution if no distribution is specified.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 (defvar gnus-novice-user t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 "*Non-nil means that you are a novice to USENET.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 If non-nil, verbose messages may be displayed or your confirmation
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 may be required.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 (defvar gnus-interactive-post t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 "*Newsgroup, subject, and distribution will be asked for if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 (defvar gnus-user-login-name nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 "*The login name of the user.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 Uses USER and LOGNAME environment variables if undefined.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 (defvar gnus-user-full-name nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 "*The full name of the user.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 Uses from the NAME environment variable if undefined.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 (defvar gnus-show-threads t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 "*Show conversation threads in Subject Mode if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 (defvar gnus-thread-hide-subject t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 "*Non-nil means hide subjects for thread subtrees.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 (defvar gnus-thread-hide-subtree nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 "*Non-nil means hide thread subtrees initially.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 If non-nil, you have to run the command `gnus-Subject-show-thread' by
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 hand or by using `gnus-Select-article-hook' to show hidden threads.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 (defvar gnus-thread-hide-killed t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 "*Non-nil means hide killed thread subtrees automatically.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 (defvar gnus-thread-ignore-subject nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 "*Don't take care of subject differences, but only references if non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 If it is non-nil, some commands work with subjects do not work properly.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 (defvar gnus-thread-indent-level 4
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 "Indentation of thread subtrees.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 (defvar gnus-ignored-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 "^Path:\\|^Posting-Version:\\|^Article-I.D.:\\|^Expires:\\|^Date-Received:\\|^References:\\|^Control:\\|^Xref:\\|^Lines:\\|^Posted:\\|^Relay-Version:\\|^Message-ID:\\|^Nf-ID:\\|^Nf-From:\\|^Approved:\\|^Sender:\\|^In-Reply-To:"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 "Regexp matching headers not to display in messages.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 (defvar gnus-show-all-headers nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 "*Show all headers of an article if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 (defvar gnus-save-all-headers nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 "*Save all headers of an article if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 (defvar gnus-optional-headers (function gnus-optional-lines-and-from)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 "A function generating a optional string displayed in GNUS Subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 mode buffer. The function is called with an article HEADER. The
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 result must be a string excluding `[' and `]'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (defvar gnus-auto-extend-newsgroup t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 "*Extend visible articles to forward and backward if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 (defvar gnus-auto-select-first t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 "*Select the first unread article automagically if non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 If you want to prevent automatic selection of the first unread article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 in some newsgroups, set the variable to nil in `gnus-Select-group-hook'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 or `gnus-Apply-kill-hook'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 (defvar gnus-auto-select-next t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 "*Select the next newsgroup automagically if non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 If the value is t and the next newsgroup is empty, GNUS will exit
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 Subject mode and go back to Group mode. If the value is neither nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 nor t, GNUS will select the following unread newsgroup. Especially, if
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 the value is the symbol `quietly', the next unread newsgroup will be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 selected without any confirmations.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 (defvar gnus-auto-select-same nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 "*Select the next article with the same subject automagically if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 (defvar gnus-auto-center-subject t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 "*Always center the current subject in GNUS Subject mode window if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 (defvar gnus-break-pages t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 "*Break an article into pages if non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 Page delimiter is specified by the variable `gnus-page-delimiter'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 (defvar gnus-page-delimiter "^\^L"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 "*Regexp describing line-beginnings that separate pages of news article.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 (defvar gnus-digest-show-summary t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 "*Show a summary of undigestified messages if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 (defvar gnus-digest-separator "^Subject:[ \t]"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 "*Regexp that separates messages in a digest article.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 (defvar gnus-use-full-window t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 "*Non-nil means to take up the entire screen of Emacs.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 (defvar gnus-window-configuration
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 '((SelectNewsgroup (0 1 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 (ExitNewsgroup (1 0 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 (SelectArticle (0 3 10))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 (ExpandSubject (0 1 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 "Specify window configurations for each action.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 The format of the variable is a list of (ACTION (G S A)), where
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 G, S, and A are the relative height of Group, Subject, and Article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 windows, respectively. ACTION is `SelectNewsgroup', `ExitNewsgroup',
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 `SelectArticle', or `ExpandSubject'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 (defvar gnus-mail-reply-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 (function gnus-mail-reply-using-mail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 "A function to compose reply mail.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 The function `gnus-mail-reply-using-mail' uses usual the sendmail mail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 program. The function `gnus-mail-reply-using-mhe' uses the mh-e mail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 program. You can use yet another program by customizing this variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 (defvar gnus-mail-other-window-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 (function gnus-mail-other-window-using-mail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 "A function to compose mail in other window.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 The function `gnus-mail-other-window-using-mail' uses usual sendmail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 mail program. The function `gnus-mail-other-window-using-mhe' uses mh-e
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 mail program. You can use yet another program by customizing this variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 (defvar gnus-subscribe-newsgroup-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 (lambda (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (gnus-subscribe-newsgroup newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 (car (car gnus-newsrc-assoc)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 "A function called with a newsgroup name when it is created.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 (defvar gnus-Group-mode-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 "A hook for GNUS Group Mode.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 (defvar gnus-Subject-mode-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 "A hook for GNUS Subject Mode.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 (defvar gnus-Article-mode-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 "A hook for GNUS Article Mode.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 (defvar gnus-Kill-file-mode-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 "A hook for GNUS KILL File Mode.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 (defvar gnus-Open-server-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 "A hook called just before opening connection to news server.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 (defvar gnus-Startup-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 "A hook called at start up time.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 This hook is called after GNUS is connected to the NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 So, it is possible to change the behavior of GNUS according to the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 selected NNTP server.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 (defvar gnus-Group-prepare-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 "A hook called after newsgroup list is created in the Newsgroup buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293 If you want to modify the Newsgroup buffer, you can use this hook.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 (defvar gnus-Subject-prepare-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 "A hook called after subject list is created in the Subject buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 If you want to modify the Subject buffer, you can use this hook.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 (defvar gnus-Article-prepare-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 "A hook called after an article is prepared in the Article buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 If you want to run a special decoding program like nkf, use this hook.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 (defvar gnus-Select-group-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 "A hook called when a newsgroup is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 If you want to sort Subject buffer by date and then by subject, you
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 can use the following hook:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 (setq gnus-Select-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 ;; First of all, sort by date.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 (gnus-sort-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 '(lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 (gnus-date-lessp (gnus-header-date a)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 (gnus-header-date b))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 ;; Then sort by subject string ignoring `Re:'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 ;; If case-fold-search is non-nil, case of letters is ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 (gnus-sort-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 '(lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 (gnus-string-lessp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 (gnus-simplify-subject (gnus-header-subject a) 're)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 (gnus-simplify-subject (gnus-header-subject b) 're)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 )))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 If you'd like to simplify subjects like the `gnus-Subject-next-same-subject'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 command does, you can use the following hook:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 (setq gnus-Select-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 (mapcar (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 (lambda (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 (nntp-set-header-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 (gnus-simplify-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 (gnus-header-subject header) 're-only))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 gnus-newsgroup-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 In some newsgroups author name is meaningless. It is possible to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 prevent listing author names in the GNUS Subject buffer as follows:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 (setq gnus-Select-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 (cond ((string-equal \"comp.sources.unix\" gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 (setq gnus-optional-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 (function gnus-optional-lines)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 (setq gnus-optional-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 (function gnus-optional-lines-and-from))))))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 (defvar gnus-Select-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 (function (lambda () (gnus-Subject-show-thread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 "Hook called when an article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 The default hook automatically shows conversation thread subtrees
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 of the selected article as follows:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 (setq gnus-Select-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 (gnus-Subject-show-thread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 If you'd like to run RMAIL on a digest article automagically, you can
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 use the following hook:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 (setq gnus-Select-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 (gnus-Subject-show-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 (cond ((string-equal \"comp.sys.sun\" gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 (gnus-Subject-rmail-digest))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 ((and (string-equal \"comp.text\" gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 (string-match \"^TeXhax Digest\"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369 (gnus-header-subject gnus-current-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 (gnus-Subject-rmail-digest)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 ))))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 (defvar gnus-Select-digest-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 (lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376 ;; Reply-To: is required by `undigestify-rmail-message'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377 (or (mail-position-on-field "Reply-to" t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 (mail-position-on-field "Reply-to")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380 (insert (gnus-fetch-field "From"))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 "A hook called when reading digest messages using Rmail.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 This hook can be used to modify incomplete digest articles as follows
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 (this is the default):
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 (setq gnus-Select-digest-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 ;; Reply-To: is required by `undigestify-rmail-message'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388 (or (mail-position-on-field \"Reply-to\" t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 (mail-position-on-field \"Reply-to\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 (insert (gnus-fetch-field \"From\"))))))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 (defvar gnus-Rmail-digest-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394 "A hook called when reading digest messages using Rmail.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395 This hook is intended to customize Rmail mode for reading digest articles.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 (defvar gnus-Apply-kill-hook (function gnus-apply-kill-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398 "A hook called when a newsgroup is selected and subject list is prepared.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 This hook is intended to apply a KILL file to the selected newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
400 The function `gnus-apply-kill-file' is called defaultly.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
401
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 Since a general KILL file is too heavy to use for only a few
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
403 newsgroups, we recommend you use a lighter hook function. For
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404 example, if you'd like to apply a KILL file to articles which contains
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405 a string `rmgroup' in subject in newsgroup `control', you can use the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
406 following hook:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
407
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 (setq gnus-Apply-kill-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 (cond ((string-match \"control\" gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 (gnus-kill \"Subject\" \"rmgroup\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 (gnus-expunge \"X\")))))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414 (defvar gnus-Mark-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 (lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417 (or (memq gnus-current-article gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 (gnus-Subject-mark-as-read gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419 (gnus-Subject-set-current-mark "+")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 "A hook called when an article is selected for the first time.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421 The hook is intended to mark an article as read when it is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422 If you'd like to mark as unread (-) instead, use the following hook:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 (setq gnus-Mark-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 (gnus-Subject-mark-as-unread gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427 (gnus-Subject-set-current-mark \"+\")))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
428
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429 (defvar gnus-Inews-article-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 "A hook called before posting an article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 If you'd like to run a special encoding program, use this hook.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
432
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433 (defvar gnus-Exit-group-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
434 "A hook called when exiting (not quitting) Subject mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435 If your machine is so slow that exiting from Subject mode takes a
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436 long time, set the variable `gnus-newsgroup-headers' to nil. This
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 inhibits marking articles as read using cross-reference information.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439 (defvar gnus-Suspend-gnus-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440 "A hook called when suspending (not exiting) GNUS.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
441
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442 (defvar gnus-Exit-gnus-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443 "A hook called when exiting (not suspending) GNUS.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
445 (defvar gnus-Save-newsrc-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 "A hook called when saving the newsrc file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447 This hook is called before saving .newsrc file.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
449 (defvar gnus-your-domain nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
450 "*Your domain name without your host name like: \"stars.flab.Fujitsu.CO.JP\"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451 The environment variable DOMAINNAME is used instead if defined. If
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
452 the function `system-name' returns the full internet name, there is no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
453 need to define this variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
454
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 (defvar gnus-your-organization nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456 "*Your organization like: \"Fujitsu Laboratories Ltd., Kawasaki, Japan.\"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457 The `ORGANIZATION' environment variable is used instead if defined.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459 (defvar gnus-use-generic-from nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 "*If nil, prepend local host name to the defined domain in the From:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461 field; if stringp, use this; if non-nil, strip of the local host name.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
462
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
463 (defvar gnus-use-generic-path nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
464 "*If nil, use the NNTP server name in the Path: field; if stringp,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
465 use this; if non-nil, use no host name (user name only)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467 ;; Internal variables.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
468
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469 (defconst gnus-version "GNUS 3.13"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 "Version numbers of this version of GNUS.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 (defvar gnus-Info-nodes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473 '((gnus-Group-mode . "(gnus)Newsgroup Commands")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474 (gnus-Subject-mode . "(gnus)Subject Commands")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 (gnus-Article-mode . "(gnus)Article Commands")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 (gnus-Kill-file-mode . "(gnus)KILL File")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477 (gnus-Browse-killed-mode . "(gnus)Maintenance"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
478 "Assoc list of major modes and related Info nodes.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
480 (defvar gnus-access-methods
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481 '((nntp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
482 (gnus-retrieve-headers . nntp-retrieve-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
483 (gnus-open-server . nntp-open-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484 (gnus-close-server . nntp-close-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485 (gnus-server-opened . nntp-server-opened)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
486 (gnus-status-message . nntp-status-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 (gnus-request-article . nntp-request-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488 (gnus-request-group . nntp-request-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
489 (gnus-request-list . nntp-request-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
490 (gnus-request-post . nntp-request-post))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
491 (nnspool
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
492 (gnus-retrieve-headers . nnspool-retrieve-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
493 (gnus-open-server . nnspool-open-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
494 (gnus-close-server . nnspool-close-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
495 (gnus-server-opened . nnspool-server-opened)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
496 (gnus-status-message . nnspool-status-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
497 (gnus-request-article . nnspool-request-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498 (gnus-request-group . nnspool-request-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
499 (gnus-request-list . nnspool-request-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
500 (gnus-request-post . nnspool-request-post))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
501 (mhspool
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
502 (gnus-retrieve-headers . mhspool-retrieve-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
503 (gnus-open-server . mhspool-open-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
504 (gnus-close-server . mhspool-close-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505 (gnus-server-opened . mhspool-server-opened)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
506 (gnus-status-message . mhspool-status-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507 (gnus-request-article . mhspool-request-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
508 (gnus-request-group . mhspool-request-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
509 (gnus-request-list . mhspool-request-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
510 (gnus-request-post . mhspool-request-post)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
511 "Access method for NNTP, nnspool, and mhspool.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
512
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
513 (defvar gnus-Group-buffer "*Newsgroup*")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
514 (defvar gnus-Subject-buffer "*Subject*")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
515 (defvar gnus-Article-buffer "*Article*")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
516 (defvar gnus-Digest-buffer "GNUS Digest")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
517 (defvar gnus-Digest-summary-buffer "GNUS Digest-summary")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
518
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
519 (defvar gnus-buffer-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
520 (list gnus-Group-buffer gnus-Subject-buffer gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
521 gnus-Digest-buffer gnus-Digest-summary-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
522 "GNUS buffer names which should be killed when exiting.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
523
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
524 (defvar gnus-variable-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
525 '(gnus-newsrc-options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
526 gnus-newsrc-options-n-yes gnus-newsrc-options-n-no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
527 gnus-newsrc-assoc gnus-killed-assoc gnus-marked-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
528 "GNUS variables saved in the quick startup file.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
529
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
530 (defvar gnus-overload-functions
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
531 '((news-inews gnus-inews-news "rnewspost")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
532 (caesar-region gnus-caesar-region "rnews"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
533 "Functions overloaded by gnus.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
534 It is a list of `(original overload &optional file)'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
535
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
536 (defvar gnus-newsrc-options nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
537 "Options line in the .newsrc file.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
538
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
539 (defvar gnus-newsrc-options-n-yes nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
540 "Regexp representing subscribed newsgroups.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
541
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
542 (defvar gnus-newsrc-options-n-no nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
543 "Regexp representing unsubscribed newsgroups.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
544
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
545 (defvar gnus-newsrc-assoc nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
546 "Assoc list of read articles.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
547
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
548 (defvar gnus-killed-assoc nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
549 "Assoc list of newsgroups removed from `gnus-newsrc-assoc'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
550
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
551 (defvar gnus-marked-assoc nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
552 "Assoc list of articles marked as unread.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
553
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
554 (defvar gnus-unread-hashtb nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
555 "Hashtable of unread articles.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
556
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
557 (defvar gnus-active-hashtb nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
558 "Hashtable of active articles.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
559
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
560 (defvar gnus-octive-hashtb nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
561 "Hashtable of OLD active articles.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
562
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
563 (defvar gnus-current-startup-file nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
564 "Startup file for the current host.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
565
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
566 (defvar gnus-last-search-regexp nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
567 "Default regexp for article search command.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
568
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
569 (defvar gnus-last-shell-command nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
570 "Default shell command on article.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
572 (defvar gnus-have-all-newsgroups nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
573
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
574 (defvar gnus-newsgroup-name nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
575 (defvar gnus-newsgroup-begin nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
576 (defvar gnus-newsgroup-end nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577 (defvar gnus-newsgroup-last-rmail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578 (defvar gnus-newsgroup-last-mail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579 (defvar gnus-newsgroup-last-folder nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580 (defvar gnus-newsgroup-last-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
581
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
582 (defvar gnus-newsgroup-unreads nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
583 "List of unread articles in the current newsgroup.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
585 (defvar gnus-newsgroup-unselected nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
586 "List of unselected unread articles in the current newsgroup.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
587
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
588 (defvar gnus-newsgroup-marked nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
589 "List of marked articles in the current newsgroup (a subset of unread art).")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
590
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
591 (defvar gnus-newsgroup-headers nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
592 "List of article headers in the current newsgroup.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
593
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
594 (defvar gnus-current-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
595 (defvar gnus-current-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
596 (defvar gnus-current-history nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
597 (defvar gnus-have-all-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
598 (defvar gnus-last-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
599 (defvar gnus-current-kill-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
600
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
601 ;; Save window configuration.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
602 (defvar gnus-winconf-kill-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
603
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604 (defvar gnus-Group-mode-map nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
605 (defvar gnus-Subject-mode-map nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
606 (defvar gnus-Article-mode-map nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
607 (defvar gnus-Kill-file-mode-map nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
608
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
609 (defvar rmail-last-file (expand-file-name "~/XMBOX"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
610 (defvar rmail-last-rmail-file (expand-file-name "~/XNEWS"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
611
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
612 ;; Define GNUS Subsystems.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
613 (autoload 'gnus-Group-post-news "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
614 "Post an article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
615 (autoload 'gnus-Subject-post-news "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
616 "Post an article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
617 (autoload 'gnus-Subject-post-reply "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
618 "Post a reply article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
619 (autoload 'gnus-Subject-post-reply-with-original "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
620 "Post a reply article with original article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
621 (autoload 'gnus-Subject-cancel-article "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
622 "Cancel an article you posted." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
623
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
624 (autoload 'gnus-Subject-mail-reply "gnusmail"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
625 "Reply mail to news author." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
626 (autoload 'gnus-Subject-mail-reply-with-original "gnusmail"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
627 "Reply mail to news author with original article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
628 (autoload 'gnus-Subject-mail-other-window "gnusmail"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
629 "Compose mail in other window." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
630
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
631 (autoload 'gnus-Group-kill-group "gnusmisc"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
632 "Kill newsgroup on current line." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
633 (autoload 'gnus-Group-yank-group "gnusmisc"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
634 "Yank the last killed newsgroup on current line." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
635 (autoload 'gnus-Browse-killed-groups "gnusmisc"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
636 "Browse the killed newsgroups." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
637
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
638 (autoload 'rmail-output "rmailout"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
639 "Append this message to Unix mail file named FILE-NAME." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
640 (autoload 'mail-position-on-field "sendmail")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
641 (autoload 'mh-find-path "mh-e")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
642 (autoload 'mh-prompt-for-folder "mh-e")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
643
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
644 (put 'gnus-Group-mode 'mode-class 'special)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
645 (put 'gnus-Subject-mode 'mode-class 'special)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
646 (put 'gnus-Article-mode 'mode-class 'special)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
647
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
648
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
649 ;;(put 'gnus-eval-in-buffer-window 'lisp-indent-function 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
650
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
651 (defmacro gnus-eval-in-buffer-window (buffer &rest forms)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
652 "Pop to BUFFER, evaluate FORMS, and then returns to original window."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
653 (` (let ((GNUSStartBufferWindow (selected-window)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
654 (unwind-protect
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
655 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
656 (pop-to-buffer (, buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
657 (,@ forms))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
658 (select-window GNUSStartBufferWindow)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
659
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
660 (defmacro gnus-make-hashtable ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
661 '(make-abbrev-table))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
662
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
663 (defmacro gnus-gethash (string hashtable)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
664 "Get hash value of STRING in HASHTABLE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
665 ;;(` (symbol-value (abbrev-symbol (, string) (, hashtable))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
666 (` (abbrev-expansion (, string) (, hashtable))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
667
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
668 (defmacro gnus-sethash (string value hashtable)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
669 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
670 ;; We cannot use define-abbrev since it only accepts string as value.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
671 (` (set (intern (, string) (, hashtable)) (, value))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
672
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
673 ;; Note: Macros defined here are also defined in nntp.el. I don't like
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
674 ;; to put them here, but many users got troubled with the old
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
675 ;; definitions in nntp.elc. These codes are NNTP 3.10 version.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
676
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
677 (defmacro nntp-header-number (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
678 "Return article number in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
679 (` (aref (, header) 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
680
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
681 (defmacro nntp-set-header-number (header number)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
682 "Set article number of HEADER to NUMBER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
683 (` (aset (, header) 0 (, number))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
684
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
685 (defmacro nntp-header-subject (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
686 "Return subject string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
687 (` (aref (, header) 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
688
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
689 (defmacro nntp-set-header-subject (header subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
690 "Set article subject of HEADER to SUBJECT."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
691 (` (aset (, header) 1 (, subject))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
692
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
693 (defmacro nntp-header-from (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
694 "Return author string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
695 (` (aref (, header) 2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
696
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
697 (defmacro nntp-set-header-from (header from)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
698 "Set article author of HEADER to FROM."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
699 (` (aset (, header) 2 (, from))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
700
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
701 (defmacro nntp-header-xref (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
702 "Return xref string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
703 (` (aref (, header) 3)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
704
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
705 (defmacro nntp-set-header-xref (header xref)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
706 "Set article xref of HEADER to xref."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
707 (` (aset (, header) 3 (, xref))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
708
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
709 (defmacro nntp-header-lines (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
710 "Return lines in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
711 (` (aref (, header) 4)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
712
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
713 (defmacro nntp-set-header-lines (header lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
714 "Set article lines of HEADER to LINES."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
715 (` (aset (, header) 4 (, lines))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
716
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
717 (defmacro nntp-header-date (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
718 "Return date in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
719 (` (aref (, header) 5)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
720
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
721 (defmacro nntp-set-header-date (header date)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
722 "Set article date of HEADER to DATE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
723 (` (aset (, header) 5 (, date))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
724
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
725 (defmacro nntp-header-id (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
726 "Return Id in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
727 (` (aref (, header) 6)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
728
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
729 (defmacro nntp-set-header-id (header id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
730 "Set article Id of HEADER to ID."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
731 (` (aset (, header) 6 (, id))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
732
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
733 (defmacro nntp-header-references (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
734 "Return references in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
735 (` (aref (, header) 7)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
736
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
737 (defmacro nntp-set-header-references (header ref)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
738 "Set article references of HEADER to REF."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
739 (` (aset (, header) 7 (, ref))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
740
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
741
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
742 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
743 ;;; GNUS Group Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
744 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
745
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
746 (if gnus-Group-mode-map
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
747 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
748 (setq gnus-Group-mode-map (make-keymap))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
749 (suppress-keymap gnus-Group-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
750 (define-key gnus-Group-mode-map " " 'gnus-Group-read-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
751 (define-key gnus-Group-mode-map "=" 'gnus-Group-select-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
752 (define-key gnus-Group-mode-map "j" 'gnus-Group-jump-to-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
753 (define-key gnus-Group-mode-map "n" 'gnus-Group-next-unread-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
754 (define-key gnus-Group-mode-map "p" 'gnus-Group-prev-unread-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
755 (define-key gnus-Group-mode-map "\177" 'gnus-Group-prev-unread-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
756 (define-key gnus-Group-mode-map "N" 'gnus-Group-next-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
757 (define-key gnus-Group-mode-map "P" 'gnus-Group-prev-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
758 (define-key gnus-Group-mode-map "\C-n" 'gnus-Group-next-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
759 (define-key gnus-Group-mode-map "\C-p" 'gnus-Group-prev-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
760 (define-key gnus-Group-mode-map "\r" 'next-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
761 (define-key gnus-Group-mode-map "/" 'isearch-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
762 (define-key gnus-Group-mode-map "<" 'beginning-of-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
763 (define-key gnus-Group-mode-map ">" 'end-of-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
764 (define-key gnus-Group-mode-map "u" 'gnus-Group-unsubscribe-current-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
765 (define-key gnus-Group-mode-map "U" 'gnus-Group-unsubscribe-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
766 (define-key gnus-Group-mode-map "c" 'gnus-Group-catch-up)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
767 (define-key gnus-Group-mode-map "C" 'gnus-Group-catch-up-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
768 (define-key gnus-Group-mode-map "l" 'gnus-Group-list-groups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
769 (define-key gnus-Group-mode-map "L" 'gnus-Group-list-all-groups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
770 (define-key gnus-Group-mode-map "g" 'gnus-Group-get-new-news)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
771 (define-key gnus-Group-mode-map "R" 'gnus-Group-restart)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
772 (define-key gnus-Group-mode-map "b" 'gnus-Group-check-bogus-groups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
773 (define-key gnus-Group-mode-map "r" 'gnus-Group-restrict-groups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
774 (define-key gnus-Group-mode-map "a" 'gnus-Group-post-news)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
775 (define-key gnus-Group-mode-map "\ek" 'gnus-Group-edit-local-kill)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
776 (define-key gnus-Group-mode-map "\eK" 'gnus-Group-edit-global-kill)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
777 (define-key gnus-Group-mode-map "\C-k" 'gnus-Group-kill-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
778 (define-key gnus-Group-mode-map "\C-y" 'gnus-Group-yank-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
779 (define-key gnus-Group-mode-map "\C-c\C-y" 'gnus-Browse-killed-groups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
780 (define-key gnus-Group-mode-map "V" 'gnus-version)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
781 (define-key gnus-Group-mode-map "x" 'gnus-Group-force-update)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
782 (define-key gnus-Group-mode-map "s" 'gnus-Group-force-update)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
783 (define-key gnus-Group-mode-map "z" 'gnus-Group-suspend)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
784 (define-key gnus-Group-mode-map "q" 'gnus-Group-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
785 (define-key gnus-Group-mode-map "Q" 'gnus-Group-quit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
786 (define-key gnus-Group-mode-map "?" 'gnus-Group-describe-briefly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
787 (define-key gnus-Group-mode-map "\C-c\C-i" 'gnus-Info-find-node))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
788
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
789 (defun gnus-Group-mode ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
790 "Major mode for reading network news.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
791 All normal editing commands are turned off.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
792 Instead, these commands are available:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
793 \\{gnus-Group-mode-map}
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
794
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
795 The name of the host running NNTP server is asked for if no default
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
796 host is specified. It is also possible to choose another NNTP server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
797 even when the default server is defined by giving a prefix argument to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
798 the command `\\[gnus]'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
799
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
800 If an NNTP server is preceded by a colon such as `:Mail', the user's
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
801 private directory `~/Mail' is used as a news spool. This makes it
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
802 possible to read mail stored in MH folders or articles saved by GNUS.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
803 File names of mail or articles must consist of only numeric
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
804 characters. Otherwise, they are ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
805
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
806 If there is a file named `~/.newsrc-SERVER', it is used as the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
807 startup file instead of standard one when talking to SERVER. It is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
808 possible to talk to many hosts by using different startup files for
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
809 each.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
810
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
811 Option `-n' of the options line in the startup file is recognized
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
812 properly the same as the Bnews system. For example, if the options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
813 line is `options -n !talk talk.rumors', newsgroups under the `talk'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
814 hierarchy except for `talk.rumors' are ignored while checking new
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
815 newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
816
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
817 If there is a file named `~/.signature-DISTRIBUTION', it is used as
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
818 signature file instead of standard one when posting a news in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
819 DISTRIBUTION.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
820
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
821 If an Info file generated from `gnus.texinfo' is installed, you can
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
822 read an appropriate Info node of the Info file according to the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
823 current major mode of GNUS by \\[gnus-Info-find-node].
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
824
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
825 The variable `gnus-version', `nntp-version', `nnspool-version', and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
826 `mhspool-version' have the version numbers of this version of gnus.el,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
827 nntp.el, nnspool.el, and mhspoo.el, respectively.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
828
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
829 User customizable variables:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
830 gnus-nntp-server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
831 Specifies the name of the host running the NNTP server. If its
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
832 value is a string such as `:DIRECTORY', the user's private
716
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
833 DIRECTORY is used as a news spool. If its value is `::', then
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
834 the local news spool on the current machine is used directly.
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
835 The `NNTPSERVER' environment variable specifies the initial value
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
836 for this variable.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
837
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
838 gnus-nntp-service
716
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
839 Specifies a NNTP service name. It is usually \"nntp\".
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
840
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
841 gnus-startup-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
842 Specifies a startup file (.newsrc). If there is a file named
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
843 `.newsrc-SERVER', it's used instead when talking to SERVER. I
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
844 recommend you to use the server specific file, if you'd like to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
845 talk to many servers. Especially if you'd like to read your
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
846 private directory, the name of the file must be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
847 `.newsrc-:DIRECTORY'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
848
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
849 gnus-signature-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
850 Specifies a signature file (.signature). If there is a file named
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
851 `.signature-DISTRIBUTION', it's used instead when posting an
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
852 article in DISTRIBUTION. Set the variable to nil to prevent
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
853 appending the file automatically. If you use an NNTP inews which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
854 comes with the NNTP package, you may have to set the variable to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
855 nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
856
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
857 gnus-use-cross-reference
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
858 Specifies what to do with cross references (Xref: field). If it
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
859 is nil, cross references are ignored. If it is t, articles in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
860 subscribed newsgroups are only marked as read. Otherwise, if it
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
861 is not nil nor t, articles in all newsgroups are marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
862
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
863 gnus-use-followup-to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
864 Specifies what to do with followup-to: field. If it is nil, its
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
865 value is ignored. If it is non-nil, its value is used as followup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
866 newsgroups. Especially, if it is t and field value is `poster',
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
867 your confirmation is required.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
868
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
869 gnus-author-copy
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
870 Specifies a file name to save a copy of article you posted using
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
871 FCC: field. If the first character of the value is `|', the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
872 contents of the article is piped out to a program specified by the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
873 rest of the value. The variable is initialized from the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
874 AUTHORCOPY environment variable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
875
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
876 gnus-author-copy-saver
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
877 Specifies a function to save an author copy. The function is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
878 called with a file name. The default function `rmail-output'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
879 saves in Unix mail format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
880
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
881 gnus-kill-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
882 Use specified file name as a KILL file (default to `KILL').
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
883
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
884 gnus-novice-user
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
885 Non-nil means that you are a novice to USENET. If non-nil,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
886 verbose messages may be displayed or your confirmations may be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
887 required.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
888
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
889 gnus-interactive-post
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
890 Non-nil means that newsgroup, subject and distribution are asked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
891 for interactively when posting a new article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
892
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
893 gnus-use-full-window
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
894 Non-nil means to take up the entire screen of Emacs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
895
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
896 gnus-window-configuration
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
897 Specifies the configuration of Group, Subject, and Article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
898 windows. It is a list of (ACTION (G S A)), where G, S, and A are
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
899 the relative height of Group, Subject, and Article windows,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
900 respectively. ACTION is `SelectNewsgroup', `ExitNewsgroup',
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
901 `SelectArticle', or `ExpandSubject'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
902
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
903 gnus-subscribe-newsgroup-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
904 Specifies a function called with a newsgroup name when new
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
905 newsgroup is found. The default definition adds new newsgroup at
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
906 the beginning of other newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
907
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
908 Various hooks for customization:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
909 gnus-Group-mode-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910 Entry to this mode calls the value with no arguments, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911 value is non-nil. This hook is called before GNUS is connected to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 the NNTP server. So, you can change or define the NNTP server in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
913 this hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
915 gnus-Startup-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
916 Called with no arguments after the NNTP server is selected. It is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917 possible to change the behavior of GNUS or initialize the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
918 variables according to the selected NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
919
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
920 gnus-Group-prepare-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
921 Called with no arguments after a newsgroup list is created in the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
922 Newsgroup buffer, if that value is non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
923
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
924 gnus-Save-newsrc-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
925 Called with no arguments when saving newsrc file if that value is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
926 non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
927
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
928 gnus-Inews-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
929 Called with no arguments when posting an article if that value is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
930 non-nil. This hook is called just before posting an article, while
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
931 `news-inews-hook' is called before preparing article headers. If
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
932 you'd like to convert kanji code of the article, this hook is recommended.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
933
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934 gnus-Suspend-gnus-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
935 Called with no arguments when suspending (not exiting) GNUS, if
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
936 that value is non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938 gnus-Exit-gnus-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
939 Called with no arguments when exiting (not suspending) GNUS, if
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
940 that value is non-nil."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
941 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
942 (kill-all-local-variables)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
943 ;; Gee. Why don't you upgrade?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
944 (cond ((boundp 'mode-line-modified)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
945 (setq mode-line-modified "--- "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
946 ((listp (default-value 'mode-line-format))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 (setq mode-line-format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
948 (cons "--- " (cdr (default-value 'mode-line-format)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
949 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
950 (setq mode-line-format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
951 "--- GNUS: List of Newsgroups %[(%m)%]----%3p-%-")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
952 (setq major-mode 'gnus-Group-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
953 (setq mode-name "Newsgroup")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
954 (setq mode-line-buffer-identification "GNUS: List of Newsgroups")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
955 (setq mode-line-process nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
956 (use-local-map gnus-Group-mode-map)
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 853
diff changeset
957 (buffer-disable-undo (current-buffer))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
958 (setq buffer-read-only t) ;Disable modification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
959 (run-hooks 'gnus-Group-mode-hook))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
960
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
961 ;;;###autoload
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
962 (defun gnus (&optional confirm)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
963 "Read network news.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
964 If optional argument CONFIRM is non-nil, ask NNTP server."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
965 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
966 (unwind-protect
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
967 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
968 (switch-to-buffer (get-buffer-create gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
969 (gnus-Group-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
970 (gnus-start-news-server confirm))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
971 (if (not (gnus-server-opened))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
972 (gnus-Group-quit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973 ;; NNTP server is successfully open.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 (setq mode-line-process (format " {%s}" gnus-nntp-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
975 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
977 (gnus-Group-startup-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
978 (sit-for 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
979 (run-hooks 'gnus-Startup-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
980 (gnus-setup-news-info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
981 (if gnus-novice-user
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
982 (gnus-Group-describe-briefly)) ;Show brief help message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
983 (gnus-Group-list-groups nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
984 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
985
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
986 (defun gnus-Group-startup-message ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
987 "Insert startup message in current buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
988 ;; Insert the message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
989 (insert "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
990 GNUS Version 3.13
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
991
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
992 NNTP-based News Reader for GNU Emacs
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
993
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
994
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
995 If you have any trouble with this software, please let me
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
996 know. I will fix your problems in the next release.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
997
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
998 Comments, suggestions, and bug fixes are welcome.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
999
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1000 Masanobu UMEDA
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1001 umerin@tc.Nagasaki.GO.JP")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002 ;; And then hack it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1003 ;; 57 is the longest line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004 (indent-rigidly (point-min) (point-max) (/ (max (- (window-width) 57) 0) 2))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006 ;; +4 is fuzzy factor.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1007 (insert-char ?\n (/ (max (- (window-height) 18) 0) 2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1008
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1009 (defun gnus-Group-list-groups (show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1010 "List newsgroups in the Newsgroup buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1011 If argument SHOW-ALL is non-nil, unsubscribed groups are also listed."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1012 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1013 (let ((last-group ;Current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1014 (gnus-Group-group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1015 (next-group ;Next possible newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1016 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1017 (gnus-Group-search-forward nil nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1018 (gnus-Group-group-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1019 (prev-group ;Previous possible newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1020 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1021 (gnus-Group-search-forward t nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1022 (gnus-Group-group-name))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1023 (gnus-Group-prepare show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1024 (if (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1025 (message "No news is good news")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1026 ;; Go to last newsgroup if possible. If cannot, try next and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1027 ;; previous. If all fail, go to first unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1028 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1029 (or (and last-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1030 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1031 (concat "^.+: " (regexp-quote last-group) "$") nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1032 (and next-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1033 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1034 (concat "^.+: " (regexp-quote next-group) "$") nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1035 (and prev-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1036 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1037 (concat "^.+: " (regexp-quote prev-group) "$") nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1038 (re-search-forward "^[ \t]+[1-9][0-9]*:" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1039 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1040 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1041 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1042 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1043
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1044 (defun gnus-Group-prepare (&optional all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1045 "Prepare list of newsgroups in current buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1046 If optional argument ALL is non-nil, unsubscribed groups are also listed."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1047 (let ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1048 (newsrc gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1049 (group-info nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1050 (group-name nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1051 (unread-count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1052 ;; This specifies the format of Group buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1053 (cntl "%s%s%5d: %s\n"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1054 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1055 ;; List newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1056 (while newsrc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1057 (setq group-info (car newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1058 (setq group-name (car group-info))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1059 (setq unread-count (nth 1 (gnus-gethash group-name gnus-unread-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1060 (if (or all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1061 (and (nth 1 group-info) ;Subscribed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1062 (> unread-count 0))) ;There are unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1063 ;; Yes, I can use gnus-Group-prepare-line, but this is faster.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1064 (insert
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1065 (format cntl
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1066 ;; Subscribed or not.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1067 (if (nth 1 group-info) " " "U")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1068 ;; Has new news?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1069 (if (and (> unread-count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1070 (>= 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1071 (- unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1072 (length
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1073 (cdr (assoc group-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1074 gnus-marked-assoc))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1075 "*" " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1076 ;; Number of unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1077 unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1078 ;; Newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1079 group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1080 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1081 (setq newsrc (cdr newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1082 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1083 (setq gnus-have-all-newsgroups all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1084 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1085 (run-hooks 'gnus-Group-prepare-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1086 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1087
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1088 (defun gnus-Group-prepare-line (info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1089 "Return a string for the Newsgroup buffer from INFO.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1090 INFO is an element of gnus-newsrc-assoc or gnus-killed-assoc."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1091 (let* ((group-name (car info))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1092 (unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1093 (or (nth 1 (gnus-gethash group-name gnus-unread-hashtb))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1094 ;; Not in hash table, so compute it now.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1095 (gnus-number-of-articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1096 (gnus-difference-of-range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1097 (nth 2 (gnus-gethash group-name gnus-active-hashtb))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1098 (nthcdr 2 info)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1099 ;; This specifies the format of Group buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1100 (cntl "%s%s%5d: %s\n"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1101 (format cntl
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1102 ;; Subscribed or not.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1103 (if (nth 1 info) " " "U")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1104 ;; Has new news?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1105 (if (and (> unread-count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1106 (>= 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1107 (- unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1108 (length
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1109 (cdr (assoc group-name gnus-marked-assoc))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1110 "*" " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1111 ;; Number of unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1112 unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1113 ;; Newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1114 group-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1115 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1116
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1117 (defun gnus-Group-update-group (group &optional visible-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1118 "Update newsgroup info of GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1119 If optional argument VISIBLE-ONLY is non-nil, non displayed group is ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1120 (let ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1121 (visible nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1122 ;; Buffer may be narrowed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1123 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1124 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1125 ;; Search point to modify.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1126 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1127 (if (re-search-forward (concat "^.+: " (regexp-quote group) "$") nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1128 ;; GROUP is listed in current buffer. So, delete old line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1129 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1130 (setq visible t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1131 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1132 (delete-region (point) (progn (forward-line 1) (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1133 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1134 (if (or visible (not visible-only))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1135 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1136 (insert (gnus-Group-prepare-line (assoc group gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1137 (forward-line -1) ;Move point on that line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1138 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1139 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1140
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1141 ;; GNUS Group mode command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1142
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1143 (defun gnus-Group-group-name ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1144 "Get newsgroup name around point."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1145 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1146 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1147 (if (looking-at ".[* \t]*[0-9]+:[ \t]+\\([^ \t\n]+\\)$")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1148 (buffer-substring (match-beginning 1) (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1149 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1150
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1151 (defun gnus-Group-read-group (all &optional no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1152 "Read news in this newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1153 If argument ALL is non-nil, already read articles become readable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1154 If optional argument NO-ARTICLE is non-nil, no article body is displayed."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1155 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1156 (let ((group (gnus-Group-group-name))) ;Newsgroup name to read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1157 (if group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1158 (gnus-Subject-read-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1159 group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1160 (or all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1161 ;;(not (nth 1 (assoc group gnus-newsrc-assoc))) ;Unsubscribed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1162 (zerop
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1163 (nth 1 (gnus-gethash group gnus-unread-hashtb)))) ;No unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1164 no-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1165 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1166 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1167
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1168 (defun gnus-Group-select-group (all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1169 "Select this newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1170 No article is selected automatically.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1171 If argument ALL is non-nil, already read articles become readable."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1172 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1173 (gnus-Group-read-group all t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1174
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1175 (defun gnus-Group-jump-to-group (group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1176 "Jump to newsgroup GROUP."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1177 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1178 (list (completing-read "Newsgroup: " gnus-newsrc-assoc nil 'require-match)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1179 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1180 (or (re-search-forward (concat "^.+: " (regexp-quote group) "$") nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1181 (if (assoc group gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1182 ;; Add GROUP entry, then seach again.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1183 (gnus-Group-update-group group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1184 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1185 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1186 (search-forward ":" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1187
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1188 (defun gnus-Group-search-forward (backward any-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1189 "Search for newsgroup forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1190 If first argument BACKWARD is non-nil, search backward instead.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1191 If second argument ANY-GROUP is non-nil, unsubscribed or empty
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1192 group may be selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1193 (let ((func (if backward 're-search-backward 're-search-forward))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1194 (regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1195 (format "^%s[ \t]*\\(%s\\):"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1196 (if any-group ".." " [ \t]")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1197 (if any-group "[0-9]+" "[1-9][0-9]*")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1198 (found nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1199 (if backward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1200 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1201 (end-of-line))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1202 (setq found (funcall func regexp nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1203 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1204 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1205 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1206 ;; Return T if found.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1207 found
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1208 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1209
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1210 (defun gnus-Group-next-group (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1211 "Go to next N'th newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1212 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1213 (while (and (> n 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1214 (gnus-Group-search-forward nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1215 (setq n (1- n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1216 (or (gnus-Group-search-forward nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1217 (message "No more newsgroups")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1218
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1219 (defun gnus-Group-next-unread-group (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1220 "Go to next N'th unread newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1221 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1222 (while (and (> n 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1223 (gnus-Group-search-forward nil nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1224 (setq n (1- n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1225 (or (gnus-Group-search-forward nil nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1226 (message "No more unread newsgroups")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1227
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1228 (defun gnus-Group-prev-group (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1229 "Go to previous N'th newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1230 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1231 (while (and (> n 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1232 (gnus-Group-search-forward t t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1233 (setq n (1- n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1234 (or (gnus-Group-search-forward t t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1235 (message "No more newsgroups")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1236
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1237 (defun gnus-Group-prev-unread-group (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1238 "Go to previous N'th unread newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1239 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1240 (while (and (> n 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1241 (gnus-Group-search-forward t nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1242 (setq n (1- n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1243 (or (gnus-Group-search-forward t nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1244 (message "No more unread newsgroups")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1245
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1246 (defun gnus-Group-catch-up (all &optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1247 "Mark all articles not marked as unread in current newsgroup as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1248 If prefix argument ALL is non-nil, all articles are marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1249 Cross references (Xref: field) of articles are ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1250 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1251 (let* ((group (gnus-Group-group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1252 (marked (if (not all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1253 (cdr (assoc group gnus-marked-assoc)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1254 (and group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1255 (or quietly
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1256 (y-or-n-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1257 (if all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1258 "Do you really want to mark everything as read? "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1259 "Delete all articles not marked as read? ")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1260 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1261 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1262 ;; Any marked articles will be preserved.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1263 (gnus-update-unread-articles group marked marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1264 (gnus-Group-update-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1265 (gnus-Group-next-group 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1266 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1267
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1268 (defun gnus-Group-catch-up-all (&optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1269 "Mark all articles in current newsgroup as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1270 Cross references (Xref: field) of articles are ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1271 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1272 (gnus-Group-catch-up t quietly))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1273
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1274 (defun gnus-Group-unsubscribe-current-group ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1275 "Toggle subscribe from/to unsubscribe current group."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1276 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1277 (gnus-Group-unsubscribe-group (gnus-Group-group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1278 (gnus-Group-next-group 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1279
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1280 (defun gnus-Group-unsubscribe-group (group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1281 "Toggle subscribe from/to unsubscribe GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1282 New newsgroup is added to .newsrc automatically."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1283 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1284 (list (completing-read "Newsgroup: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1285 gnus-active-hashtb nil 'require-match)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1286 (let ((newsrc (assoc group gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1287 (cond ((not (null newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1288 ;; Toggle subscription flag.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1289 (setcar (nthcdr 1 newsrc) (not (nth 1 newsrc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1290 (gnus-update-newsrc-buffer group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1291 (gnus-Group-update-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1292 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1293 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1294 (search-forward ":" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1295 ((and (stringp group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1296 (gnus-gethash group gnus-active-hashtb))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1297 ;; Add new newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1298 (gnus-add-newsgroup group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1299 (gnus-Group-update-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1300 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1301 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1302 (search-forward ":" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1303 (t (error "No such newsgroup: %s" group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1304 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1305
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1306 (defun gnus-Group-list-all-groups ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1307 "List all of newsgroups in the Newsgroup buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1308 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1309 (gnus-Group-list-groups t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1310
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1311 (defun gnus-Group-get-new-news ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1312 "Get newly arrived articles. In fact, read the active file again."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1313 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1314 (gnus-setup-news-info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1315 (gnus-Group-list-groups gnus-have-all-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1316
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1317 (defun gnus-Group-restart ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1318 "Force GNUS to read the raw startup file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1319 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1320 (gnus-save-newsrc-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1321 (gnus-setup-news-info t) ;Force to read the raw startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1322 (gnus-Group-list-groups gnus-have-all-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1323
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1324 (defun gnus-Group-check-bogus-groups ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1325 "Check bogus newsgroups."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1326 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1327 (gnus-check-bogus-newsgroups t) ;Require confirmation.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1328 (gnus-Group-list-groups gnus-have-all-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1329
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1330 (defun gnus-Group-restrict-groups (start end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1331 "Restrict visible newsgroups to the current region (START and END).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1332 Type \\[widen] to remove restriction."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1333 (interactive "r")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1334 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1335 (narrow-to-region (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1336 (goto-char start)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1337 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1338 (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1339 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1340 (goto-char end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1341 (forward-line 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1342 (point))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1343 (message (substitute-command-keys "Type \\[widen] to remove restriction")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1344
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1345 (defun gnus-Group-edit-global-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1346 "Edit a global KILL file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1347 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1348 (setq gnus-current-kill-article nil) ;No articles selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1349 (gnus-Kill-file-edit-file nil) ;Nil stands for global KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1350 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1351 (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1352 "Editing a global KILL file (Type \\[gnus-Kill-file-exit] to exit)")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1353
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1354 (defun gnus-Group-edit-local-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1355 "Edit a local KILL file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1356 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1357 (setq gnus-current-kill-article nil) ;No articles selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1358 (gnus-Kill-file-edit-file (gnus-Group-group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1359 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1360 (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1361 "Editing a local KILL file (Type \\[gnus-Kill-file-exit] to exit)")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1362
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1363 (defun gnus-Group-force-update ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1364 "Update .newsrc file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1365 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1366 (gnus-save-newsrc-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1367
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1368 (defun gnus-Group-suspend ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1369 "Suspend the current GNUS session.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1370 In fact, cleanup buffers except for Group Mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1371 The hook `gnus-Suspend-gnus-hook' is called before actually suspending."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1372 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1373 (run-hooks 'gnus-Suspend-gnus-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1374 ;; Kill GNUS buffers except for Group Mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1375 (let ((buffers gnus-buffer-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1376 (while buffers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1377 (and (not (eq (car buffers) gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1378 (get-buffer (car buffers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1379 (kill-buffer (car buffers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1380 (setq buffers (cdr buffers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1381 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1382 (bury-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1383
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1384 (defun gnus-Group-exit ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1385 "Quit reading news after updating .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1386 The hook `gnus-Exit-gnus-hook' is called before actually quitting."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1387 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1388 (if (or noninteractive ;For gnus-batch-kill
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1389 (zerop (buffer-size)) ;No news is good news.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1390 (not (gnus-server-opened)) ;NNTP connection closed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1391 (y-or-n-p "Are you sure you want to quit reading news? "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1392 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1393 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1394 (run-hooks 'gnus-Exit-gnus-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1395 (gnus-save-newsrc-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1396 (gnus-clear-system)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1397 (gnus-close-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1398 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1399
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1400 (defun gnus-Group-quit ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1401 "Quit reading news without updating .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1402 The hook `gnus-Exit-gnus-hook' is called before actually quitting."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1403 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1404 (if (or (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1405 (not (gnus-server-opened))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1406 (yes-or-no-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1407 (format "Quit reading news without saving %s? "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1408 (file-name-nondirectory gnus-current-startup-file))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1409 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1410 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1411 (run-hooks 'gnus-Exit-gnus-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1412 (gnus-clear-system)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1413 (gnus-close-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1414 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1415
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1416 (defun gnus-Group-describe-briefly ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1417 "Describe Group mode commands briefly."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1418 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1419 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1420 (concat
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1421 (substitute-command-keys "\\[gnus-Group-read-group]:Select ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1422 (substitute-command-keys "\\[gnus-Group-next-unread-group]:Forward ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1423 (substitute-command-keys "\\[gnus-Group-prev-unread-group]:Backward ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1424 (substitute-command-keys "\\[gnus-Group-exit]:Exit ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1425 (substitute-command-keys "\\[gnus-Info-find-node]:Run Info ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1426 (substitute-command-keys "\\[gnus-Group-describe-briefly]:This help")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1427 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1428
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1429
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1430 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1431 ;;; GNUS Subject Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1432 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1433
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1434 (if gnus-Subject-mode-map
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1435 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1436 (setq gnus-Subject-mode-map (make-keymap))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1437 (suppress-keymap gnus-Subject-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1438 (define-key gnus-Subject-mode-map " " 'gnus-Subject-next-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1439 (define-key gnus-Subject-mode-map "\177" 'gnus-Subject-prev-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1440 (define-key gnus-Subject-mode-map "\r" 'gnus-Subject-scroll-up)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1441 (define-key gnus-Subject-mode-map "n" 'gnus-Subject-next-unread-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1442 (define-key gnus-Subject-mode-map "p" 'gnus-Subject-prev-unread-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1443 (define-key gnus-Subject-mode-map "N" 'gnus-Subject-next-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1444 (define-key gnus-Subject-mode-map "P" 'gnus-Subject-prev-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1445 (define-key gnus-Subject-mode-map "\e\C-n" 'gnus-Subject-next-same-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1446 (define-key gnus-Subject-mode-map "\e\C-p" 'gnus-Subject-prev-same-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1447 ;;(define-key gnus-Subject-mode-map "\e\C-n" 'gnus-Subject-next-unread-same-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1448 ;;(define-key gnus-Subject-mode-map "\e\C-p" 'gnus-Subject-prev-unread-same-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1449 (define-key gnus-Subject-mode-map "\C-c\C-n" 'gnus-Subject-next-digest)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1450 (define-key gnus-Subject-mode-map "\C-c\C-p" 'gnus-Subject-prev-digest)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1451 (define-key gnus-Subject-mode-map "\C-n" 'gnus-Subject-next-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1452 (define-key gnus-Subject-mode-map "\C-p" 'gnus-Subject-prev-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1453 (define-key gnus-Subject-mode-map "\en" 'gnus-Subject-next-unread-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1454 (define-key gnus-Subject-mode-map "\ep" 'gnus-Subject-prev-unread-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1455 ;;(define-key gnus-Subject-mode-map "\C-cn" 'gnus-Subject-next-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1456 ;;(define-key gnus-Subject-mode-map "\C-cp" 'gnus-Subject-prev-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1457 (define-key gnus-Subject-mode-map "." 'gnus-Subject-first-unread-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1458 (define-key gnus-Subject-mode-map "/" 'isearch-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1459 (define-key gnus-Subject-mode-map "s" 'gnus-Subject-isearch-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1460 (define-key gnus-Subject-mode-map "\es" 'gnus-Subject-search-article-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1461 (define-key gnus-Subject-mode-map "\eS" 'gnus-Subject-search-article-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1462 (define-key gnus-Subject-mode-map "<" 'gnus-Subject-beginning-of-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1463 (define-key gnus-Subject-mode-map ">" 'gnus-Subject-end-of-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1464 (define-key gnus-Subject-mode-map "j" 'gnus-Subject-goto-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1465 (define-key gnus-Subject-mode-map "J" 'gnus-Subject-goto-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1466 (define-key gnus-Subject-mode-map "l" 'gnus-Subject-goto-last-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1467 (define-key gnus-Subject-mode-map "^" 'gnus-Subject-refer-parent-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1468 (define-key gnus-Subject-mode-map "\er" 'gnus-Subject-refer-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1469 (define-key gnus-Subject-mode-map "u" 'gnus-Subject-mark-as-unread-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1470 (define-key gnus-Subject-mode-map "U" 'gnus-Subject-mark-as-unread-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1471 (define-key gnus-Subject-mode-map "d" 'gnus-Subject-mark-as-read-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1472 (define-key gnus-Subject-mode-map "D" 'gnus-Subject-mark-as-read-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1473 (define-key gnus-Subject-mode-map "\eu" 'gnus-Subject-clear-mark-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1474 (define-key gnus-Subject-mode-map "\eU" 'gnus-Subject-clear-mark-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1475 (define-key gnus-Subject-mode-map "k" 'gnus-Subject-kill-same-subject-and-select)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1476 (define-key gnus-Subject-mode-map "\C-k" 'gnus-Subject-kill-same-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1477 (define-key gnus-Subject-mode-map "\e\C-t" 'gnus-Subject-toggle-threads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1478 (define-key gnus-Subject-mode-map "\e\C-s" 'gnus-Subject-show-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1479 (define-key gnus-Subject-mode-map "\e\C-h" 'gnus-Subject-hide-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1480 (define-key gnus-Subject-mode-map "\e\C-f" 'gnus-Subject-next-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1481 (define-key gnus-Subject-mode-map "\e\C-b" 'gnus-Subject-prev-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1482 (define-key gnus-Subject-mode-map "\e\C-u" 'gnus-Subject-up-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1483 (define-key gnus-Subject-mode-map "\e\C-d" 'gnus-Subject-down-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1484 (define-key gnus-Subject-mode-map "\e\C-k" 'gnus-Subject-kill-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1485 (define-key gnus-Subject-mode-map "&" 'gnus-Subject-execute-command)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1486 ;;(define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1487 ;;(define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1488 (define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up-and-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1489 ;;(define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up-all-and-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1490 (define-key gnus-Subject-mode-map "\C-t" 'gnus-Subject-toggle-truncation)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1491 (define-key gnus-Subject-mode-map "x" 'gnus-Subject-delete-marked-as-read)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1492 (define-key gnus-Subject-mode-map "X" 'gnus-Subject-delete-marked-with)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1493 (define-key gnus-Subject-mode-map "\C-c\C-sn" 'gnus-Subject-sort-by-number)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1494 (define-key gnus-Subject-mode-map "\C-c\C-sa" 'gnus-Subject-sort-by-author)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1495 (define-key gnus-Subject-mode-map "\C-c\C-ss" 'gnus-Subject-sort-by-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1496 (define-key gnus-Subject-mode-map "\C-c\C-sd" 'gnus-Subject-sort-by-date)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1497 (define-key gnus-Subject-mode-map "\C-c\C-s\C-n" 'gnus-Subject-sort-by-number)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1498 (define-key gnus-Subject-mode-map "\C-c\C-s\C-a" 'gnus-Subject-sort-by-author)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1499 (define-key gnus-Subject-mode-map "\C-c\C-s\C-s" 'gnus-Subject-sort-by-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1500 (define-key gnus-Subject-mode-map "\C-c\C-s\C-d" 'gnus-Subject-sort-by-date)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1501 (define-key gnus-Subject-mode-map "=" 'gnus-Subject-expand-window)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1502 (define-key gnus-Subject-mode-map "G" 'gnus-Subject-reselect-current-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1503 (define-key gnus-Subject-mode-map "w" 'gnus-Subject-stop-page-breaking)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1504 (define-key gnus-Subject-mode-map "\C-c\C-r" 'gnus-Subject-caesar-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1505 (define-key gnus-Subject-mode-map "g" 'gnus-Subject-show-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1506 (define-key gnus-Subject-mode-map "t" 'gnus-Subject-toggle-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1507 (define-key gnus-Subject-mode-map "v" 'gnus-Subject-show-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1508 (define-key gnus-Subject-mode-map "\C-d" 'gnus-Subject-rmail-digest)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1509 (define-key gnus-Subject-mode-map "a" 'gnus-Subject-post-news)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1510 (define-key gnus-Subject-mode-map "f" 'gnus-Subject-post-reply)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1511 (define-key gnus-Subject-mode-map "F" 'gnus-Subject-post-reply-with-original)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1512 (define-key gnus-Subject-mode-map "C" 'gnus-Subject-cancel-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1513 (define-key gnus-Subject-mode-map "r" 'gnus-Subject-mail-reply)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1514 (define-key gnus-Subject-mode-map "R" 'gnus-Subject-mail-reply-with-original)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1515 (define-key gnus-Subject-mode-map "m" 'gnus-Subject-mail-other-window)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1516 (define-key gnus-Subject-mode-map "o" 'gnus-Subject-save-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1517 (define-key gnus-Subject-mode-map "\C-o" 'gnus-Subject-save-in-mail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1518 (define-key gnus-Subject-mode-map "|" 'gnus-Subject-pipe-output)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1519 (define-key gnus-Subject-mode-map "\ek" 'gnus-Subject-edit-local-kill)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1520 (define-key gnus-Subject-mode-map "\eK" 'gnus-Subject-edit-global-kill)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1521 (define-key gnus-Subject-mode-map "V" 'gnus-version)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1522 (define-key gnus-Subject-mode-map "q" 'gnus-Subject-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1523 (define-key gnus-Subject-mode-map "Q" 'gnus-Subject-quit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1524 (define-key gnus-Subject-mode-map "?" 'gnus-Subject-describe-briefly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1525 (define-key gnus-Subject-mode-map "\C-c\C-i" 'gnus-Info-find-node))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1526
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1527 (defun gnus-Subject-mode ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1528 "Major mode for reading articles in this newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1529 All normal editing commands are turned off.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1530 Instead, these commands are available:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1531 \\{gnus-Subject-mode-map}
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1532
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1533 User customizable variables:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1534 gnus-large-newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1535 The number of articles which indicates a large newsgroup. If the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1536 number of articles in a newsgroup is greater than the value, the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1537 number of articles to be selected is asked for. If the given value
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1538 N is positive, the last N articles is selected. If N is negative,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1539 the first N articles are selected. An empty string means to select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1540 all articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1541
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1542 gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1543 Non-nil means that a newsgroup name is used as a default file name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1544 to save articles to. If it's nil, the directory form of a
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1545 newsgroup is used instead.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1546
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1547 gnus-default-article-saver
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1548 Specifies your favorite article saver which is interactively
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1549 funcallable. Following functions are available:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1550
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1551 gnus-Subject-save-in-rmail (in Rmail format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1552 gnus-Subject-save-in-mail (in Unix mail format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1553 gnus-Subject-save-in-folder (in MH folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1554 gnus-Subject-save-in-file (in article format).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1555
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1556 gnus-rmail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1557 gnus-mail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1558 gnus-folder-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1559 gnus-file-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1560 Specifies a function generating a file name to save articles in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1561 specified format. The function is called with NEWSGROUP, HEADERS,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1562 and optional LAST-FILE. Access macros to the headers are defined
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1563 as nntp-header-FIELD, and functions are defined as `gnus-header-FIELD'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1564
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1565 gnus-article-save-directory
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1566 Specifies a directory name to save articles to using the commands
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1567 `gnus-Subject-save-in-rmail', `gnus-Subject-save-in-mail' and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1568 `gnus-Subject-save-in-file'. The variable is initialized from the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1569 SAVEDIR environment variable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1570
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1571 gnus-show-all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1572 Non-nil means that all headers of an article are shown.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1573
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1574 gnus-save-all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1575 Non-nil means that all headers of an article are saved in a file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1576
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1577 gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1578 Non-nil means that conversation threads are shown in tree structure.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1579
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1580 gnus-thread-hide-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1581 Non-nil means that subjects for thread subtrees are hidden.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1582
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1583 gnus-thread-hide-subtree
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1584 Non-nil means that thread subtrees are hidden initially.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1585
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1586 gnus-thread-hide-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1587 Non-nil means that killed thread subtrees are hidden automatically.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1588
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1589 gnus-thread-ignore-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1590 Non-nil means that subject differences are ignored in constructing
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1591 thread trees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1592
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1593 gnus-thread-indent-level
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1594 Indentation of thread subtrees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1595
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1596 gnus-optional-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1597 Specifies a function which generates an optional string displayed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1598 in the Subject buffer. The function is called with an article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1599 HEADERS. The result must be a string excluding `[' and `]'. The
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1600 default function returns a string like NNN:AUTHOR, where NNN is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1601 the number of lines in an article and AUTHOR is the name of the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1602 author.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1603
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1604 gnus-auto-extend-newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1605 Non-nil means visible articles are extended to forward and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1606 backward automatically if possible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1607
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1608 gnus-auto-select-first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1609 Non-nil means the first unread article is selected automagically
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1610 when a newsgroup is selected normally (by gnus-Group-read-group).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1611 If you'd like to prevent automatic selection of the first unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1612 article in some newsgroups, set the variable to nil in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1613 gnus-Select-group-hook or gnus-Apply-kill-hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1614
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1615 gnus-auto-select-next
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1616 Non-nil means the next newsgroup is selected automagically at the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1617 end of the newsgroup. If the value is t and the next newsgroup is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1618 empty (no unread articles), GNUS will exit Subject mode and go
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1619 back to Group mode. If the value is neither nil nor t, GNUS won't
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1620 exit Subject mode but select the following unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1621 Especially, if the value is the symbol `quietly', the next unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1622 newsgroup will be selected without any confirmations.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1623
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1624 gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1625 Non-nil means an article with the same subject as the current
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1626 article is selected automagically like `rn -S'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1627
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1628 gnus-auto-center-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1629 Non-nil means the point of Subject Mode window is always kept
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1630 centered.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1631
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1632 gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1633 Non-nil means an article is broken into pages at page delimiters.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1634 This may not work with some versions of GNU Emacs earlier than
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1635 version 18.50.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1636
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1637 gnus-page-delimiter
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1638 Specifies a regexp describing line-beginnings that separate pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1639 of news article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1640
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1641 [gnus-more-message is obsolete. overlay-arrow-string interfares
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1642 with other subsystems, such as dbx mode.]
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1643
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1644 gnus-digest-show-summary
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1645 Non-nil means that a summary of digest messages is shown when
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1646 reading a digest article using `gnus-Subject-rmail-digest' command.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1647
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1648 gnus-digest-separator
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1649 Specifies a regexp separating messages in a digest article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1650
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1651 gnus-mail-reply-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1652 gnus-mail-other-window-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1653 Specifies a function to begin composing mail message using
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1654 commands gnus-Subject-mail-reply and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1655 gnus-Subject-mail-other-window. Functions
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1656 gnus-mail-reply-using-mail and gnus-mail-reply-using-mhe are
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1657 available for the value of gnus-mail-reply-method. And functions
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1658 gnus-mail-other-window-using-mail and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1659 gnus-mail-other-window-using-mhe are available for the value of
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1660 gnus-mail-other-window-method.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1661
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1662 Various hooks for customization:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1663 gnus-Subject-mode-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1664 Entry to this mode calls the value with no arguments, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1665 value is non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1666
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1667 gnus-Select-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1668 Called with no arguments when newsgroup is selected, if that value
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1669 is non-nil. It is possible to sort subjects in this hook. See the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1670 documentation of this variable for more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1671
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1672 gnus-Subject-prepare-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1673 Called with no arguments after a subject list is created in the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1674 Subject buffer, if that value is non-nil. If you'd like to modify
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1675 the buffer, you can use this hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1676
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1677 gnus-Select-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1678 Called with no arguments when an article is selected, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1679 value is non-nil. See the documentation of this variable for
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1680 more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1681
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1682 gnus-Select-digest-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1683 Called with no arguments when reading digest messages using Rmail,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1684 if that value is non-nil. This hook can be used to modify an
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1685 article so that Rmail can work with it. See the documentation of
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1686 the variable for more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1687
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1688 gnus-Rmail-digest-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1689 Called with no arguments when reading digest messages using Rmail,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1690 if that value is non-nil. This hook is intended to customize Rmail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1691 mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1692
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1693 gnus-Apply-kill-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1694 Called with no arguments when a newsgroup is selected and the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1695 Subject buffer is prepared. This hook is intended to apply a KILL
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1696 file to the selected newsgroup. The format of KILL file is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1697 completely different from that of version 3.8. You have to rewrite
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1698 them in the new format. See the documentation of Kill file mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1699 for more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1700
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1701 gnus-Mark-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1702 Called with no arguments when an article is selected at the first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1703 time. The hook is intended to mark an article as read (or unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1704 automatically when it is selected. See the documentation of the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1705 variable for more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1706
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1707 gnus-Exit-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1708 Called with no arguments when exiting the current newsgroup, if
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1709 that value is non-nil. If your machine is so slow that exiting
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1710 from Subject mode takes very long time, inhibit marking articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1711 as read using cross-references by setting the variable
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1712 `gnus-newsgroup-headers' to nil in this hook."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1713 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1714 (kill-all-local-variables)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1715 ;; Gee. Why don't you upgrade?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1716 (cond ((boundp 'mode-line-modified)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1717 (setq mode-line-modified "--- "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1718 ((listp (default-value 'mode-line-format))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1719 (setq mode-line-format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1720 (cons "--- " (cdr (default-value 'mode-line-format))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1721 (make-local-variable 'global-mode-string)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1722 (setq global-mode-string nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1723 (setq major-mode 'gnus-Subject-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1724 (setq mode-name "Subject")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1725 ;;(setq mode-line-process '(" " gnus-newsgroup-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1726 (make-local-variable 'minor-mode-alist)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1727 (or (assq 'gnus-show-threads minor-mode-alist)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1728 (setq minor-mode-alist
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1729 (cons (list 'gnus-show-threads " Thread") minor-mode-alist)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1730 (gnus-Subject-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1731 (use-local-map gnus-Subject-mode-map)
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 853
diff changeset
1732 (buffer-disable-undo (current-buffer))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1733 (setq buffer-read-only t) ;Disable modification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1734 (setq truncate-lines t) ;Stop line folding
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1735 (setq selective-display t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1736 (setq selective-display-ellipses t) ;Display `...'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1737 ;;(setq case-fold-search t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1738 (run-hooks 'gnus-Subject-mode-hook))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1739
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1740 (defun gnus-Subject-setup-buffer ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1741 "Initialize subject display buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1742 (if (get-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1743 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1744 (set-buffer (get-buffer-create gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1745 (gnus-Subject-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1746 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1747
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1748 (defun gnus-Subject-read-group (group &optional show-all no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1749 "Start reading news in newsgroup GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1750 If optional first argument SHOW-ALL is non-nil, already read articles are
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1751 also listed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1752 If optional second argument NO-ARTICLE is non-nil, no article is selected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1753 initially."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1754 (message "Retrieving newsgroup: %s..." group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1755 (if (gnus-select-newsgroup group show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1756 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1757 ;; Don't switch-to-buffer to prevent displaying old contents
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1758 ;; of the buffer until new subjects list is created.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1759 ;; Suggested by Juha Heinanen <jh@tut.fi>
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1760 (gnus-Subject-setup-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1761 ;; You can change the order of subjects in this hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1762 (run-hooks 'gnus-Select-group-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1763 (gnus-Subject-prepare)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1764 ;; Function `gnus-apply-kill-file' must be called in this hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1765 (run-hooks 'gnus-Apply-kill-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1766 (if (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1767 ;; This newsgroup is empty.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1768 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1769 (gnus-Subject-catch-up-and-exit nil t) ;Without confirmations.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1770 (message "No unread news"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1771 ;; Hide conversation thread subtrees. We cannot do this in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1772 ;; gnus-Subject-prepare-hook since kill processing may not
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1773 ;; work with hidden articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1774 (and gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1775 gnus-thread-hide-subtree
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1776 (gnus-Subject-hide-all-threads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1777 ;; Show first unread article if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1778 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1779 (if (and (not no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1780 gnus-auto-select-first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1781 (gnus-Subject-first-unread-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1782 ;; Window is configured automatically.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1783 ;; Current buffer may be changed as a result of hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1784 ;; evaluation, especially by gnus-Subject-rmail-digest
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1785 ;; command, so we should adjust cursor point carefully.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1786 (if (eq (current-buffer) (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1787 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1788 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1789 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1790 (search-forward ":" nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1791 (gnus-configure-windows 'SelectNewsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1792 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1793 (gnus-Subject-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1794 ;; I sometime get confused with the old Article buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1795 (if (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1796 (if (get-buffer-window gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1797 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1798 (set-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1799 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1800 (erase-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1801 (kill-buffer gnus-Article-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1802 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1803 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1804 (search-forward ":" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1805 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1806 ;; Cannot select newsgroup GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1807 (if (gnus-gethash group gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1808 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1809 ;; If NNTP is used, nntp_access file may not be installed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1810 ;; properly. Otherwise, may be active file problem.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1811 (ding)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1812 (message "Cannot select %s. May be security or active file problem." group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1813 (sit-for 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1814 ;; Check bogus newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1815 ;; We must be in Group Mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1816 (gnus-Group-check-bogus-groups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1817 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1818
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1819 (defun gnus-Subject-prepare ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1820 "Prepare subject list of current newsgroup in Subject mode buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1821 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1822 ;; Note: The next codes are not actually used because the user who
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1823 ;; want it can define them in gnus-Select-group-hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1824 ;; Print verbose messages if too many articles are selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1825 ;; (and (numberp gnus-large-newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1826 ;; (> (length gnus-newsgroup-headers) gnus-large-newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1827 ;; (message "Preparing headers..."))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1828 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1829 (gnus-Subject-prepare-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1830 (if gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1831 (gnus-make-threads gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1832 gnus-newsgroup-headers) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1833 ;; Erase header retrieval message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1834 (message "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1835 ;; Call hooks for modifying Subject mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1836 ;; Suggested by sven@tde.LTH.Se (Sven Mattisson).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1837 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1838 (run-hooks 'gnus-Subject-prepare-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1839 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1840
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1841 ;; Basic ideas by Paul Dworkin <paul@media-lab.media.mit.edu>
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1842
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1843 (defun gnus-Subject-prepare-threads (threads level)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1844 "Prepare Subject buffer from THREADS and indentation LEVEL.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1845 THREADS is a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...]).'"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1846 (let ((thread nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1847 (header nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1848 (number nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1849 ;; `M Indent NUM: [OPT] SUBJECT'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1850 (cntl (format "%%s %%s%%%dd: [%%s] %%s\n"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1851 (length (prin1-to-string gnus-newsgroup-end)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1852 (while threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1853 (setq thread (car threads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1854 (setq threads (cdr threads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1855 ;; If thread is a cons, hierarchical threads is given.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1856 ;; Otherwise, thread itself is header.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1857 (if (consp thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1858 (setq header (car thread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1859 (setq header thread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1860 ;; Print valid header only.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1861 (if (vectorp header) ;Depends on nntp.el.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1862 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1863 (setq number (nntp-header-number header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1864 (insert
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1865 (format cntl
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1866 ;; Read or not.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1867 (cond ((memq number gnus-newsgroup-marked) "-")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1868 ((memq number gnus-newsgroup-unreads) " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1869 (t "D"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1870 ;; Thread level.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1871 (make-string (* level gnus-thread-indent-level) ? )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1872 ;; Article number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1873 number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1874 ;; Optional headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1875 (or (and gnus-optional-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1876 (funcall gnus-optional-headers header)) "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1877 ;; Its subject string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1878 (concat (if (or (zerop level)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1879 (not gnus-thread-hide-subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1880 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1881 (make-string (window-width) ? ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1882 (nntp-header-subject header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1883 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1884 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1885 ;; Print subthreads.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1886 (and (consp thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1887 (cdr thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1888 (gnus-Subject-prepare-threads (cdr thread) (1+ level)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1889 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1890
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1891 (defun gnus-Subject-set-mode-line ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1892 "Set Subject mode line string."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1893 ;; The value must be a string to escape %-constructs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1894 (let ((subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1895 (if gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1896 (nntp-header-subject gnus-current-headers) gnus-newsgroup-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1897 (setq mode-line-buffer-identification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1898 (concat "GNUS: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1899 subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1900 ;; Enough spaces to pad subject to 17 positions.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1901 (make-string (max 0 (- 17 (length subject))) ? ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1902 (set-buffer-modified-p t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1903
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1904 ;; GNUS Subject mode command.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1905
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1906 (defun gnus-Subject-search-group (&optional backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1907 "Search for next unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1908 If optional argument BACKWARD is non-nil, search backward instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1909 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1910 (set-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1911 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1912 ;; We don't want to alter current point of Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1913 (if (gnus-Group-search-forward backward nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1914 (gnus-Group-group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1915 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1916
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1917 (defun gnus-Subject-search-subject (backward unread subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1918 "Search for article forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1919 If first argument BACKWARD is non-nil, search backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1920 If second argument UNREAD is non-nil, only unread article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1921 If third argument SUBJECT is non-nil, the article which has
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1922 the same subject will be searched for."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1923 (let ((func (if backward 're-search-backward 're-search-forward))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1924 (article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1925 ;; We have to take care of hidden lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1926 (regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1927 (format "^%s[ \t]+\\([0-9]+\\):.\\[[^]\r\n]*\\][ \t]+%s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1928 ;;(if unread " " ".")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1929 (cond ((eq unread t) " ") (unread "[ ---]") (t "."))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1930 (if subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1931 (concat "\\([Rr][Ee]:[ \t]+\\)*"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1932 (regexp-quote (gnus-simplify-subject subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1933 ;; Ignore words in parentheses.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1934 "\\([ \t]*([^\r\n]*)\\)*[ \t]*\\(\r\\|$\\)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1935 "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1936 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1937 (if backward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1938 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1939 (end-of-line))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1940 (if (funcall func regexp nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1941 (setq article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1942 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1943 (buffer-substring (match-beginning 1) (match-end 1)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1944 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1945 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1946 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1947 ;; This is the result.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1948 article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1949 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1950
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1951 (defun gnus-Subject-search-forward (&optional unread subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1952 "Search for article forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1953 If first optional argument UNREAD is non-nil, only unread article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1954 If second optional argument SUBJECT is non-nil, the article which has
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1955 the same subject will be searched for."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1956 (gnus-Subject-search-subject nil unread subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1957
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1958 (defun gnus-Subject-search-backward (&optional unread subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1959 "Search for article backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1960 If first optional argument UNREAD is non-nil, only unread article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1961 If second optional argument SUBJECT is non-nil, the article which has
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1962 the same subject will be searched for."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1963 (gnus-Subject-search-subject t unread subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1964
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1965 (defun gnus-Subject-article-number ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1966 "Article number around point. If nothing, return current number."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1967 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1968 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1969 (if (looking-at ".[ \t]+\\([0-9]+\\):")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1970 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1971 (buffer-substring (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1972 ;; If search fail, return current article number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1973 gnus-current-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1974 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1975
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1976 (defun gnus-Subject-subject-string ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1977 "Return current subject string or nil if nothing."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1978 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1979 ;; It is possible to implement this function using
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1980 ;; `gnus-Subject-article-number' and `gnus-newsgroup-headers'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1981 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1982 ;; We have to take care of hidden lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1983 (if (looking-at ".[ \t]+[0-9]+:.\\[[^]\r\n]*\\][ \t]+\\([^\r\n]*\\)[\r\n]")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1984 (buffer-substring (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1985 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1986
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1987 (defun gnus-Subject-goto-subject (article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1988 "Move point to ARTICLE's subject."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1989 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1990 (list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1991 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1992 (completing-read "Article number: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1993 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1994 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1995 (lambda (headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1996 (list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1997 (int-to-string (nntp-header-number headers)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1998 gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1999 nil 'require-match))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2000 (let ((current (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2001 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2002 (or (and article (re-search-forward (format "^.[ \t]+%d:" article) nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2003 (progn (goto-char current) nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2004 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2005
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2006 (defun gnus-Subject-recenter ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2007 "Center point in Subject mode window."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2008 ;; Scroll window so as to cursor comes center of Subject mode window
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2009 ;; only when article is displayed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2010 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2011 ;; Recenter only when requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2012 ;; Suggested by popovich@park.cs.columbia.edu
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2013 (and gnus-auto-center-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2014 (get-buffer-window gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2015 (< (/ (- (window-height) 1) 2)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2016 (count-lines (point) (point-max)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2017 (recenter (/ (- (window-height) 2) 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2018
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2019 ;; Walking around Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2020
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2021 (defun gnus-Subject-jump-to-group (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2022 "Move point to NEWSGROUP in Group mode buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2023 ;; Keep update point of Group mode buffer if visible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2024 (if (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2025 (get-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2026 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2027 ;; Take care of tree window mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2028 (if (get-buffer-window gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2029 (pop-to-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2030 (gnus-Group-jump-to-group newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2031 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2032 ;; Take care of tree window mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2033 (if (get-buffer-window gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2034 (pop-to-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2035 (set-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2036 (gnus-Group-jump-to-group newsgroup))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2037
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2038 (defun gnus-Subject-next-group (no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2039 "Exit current newsgroup and then select next unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2040 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2041 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2042 ;; Make sure Group mode buffer point is on current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2043 (gnus-Subject-jump-to-group gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2044 (let ((group (gnus-Subject-search-group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2045 (if (null group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2046 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2047 (message "Exiting %s..." gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2048 (gnus-Subject-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2049 (message ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2050 (message "Selecting %s..." group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2051 (gnus-Subject-exit t) ;Exit Subject mode temporary.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2052 ;; We are now in Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2053 ;; Make sure Group mode buffer point is on GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2054 (gnus-Subject-jump-to-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2055 (gnus-Subject-read-group group nil no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2056 (or (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2057 (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2058 (eq gnus-auto-select-next t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2059 ;; Expected newsgroup has nothing to read since the articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2060 ;; are marked as read by cross-referencing. So, try next
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2061 ;; newsgroup. (Make sure we are in Group mode buffer now.)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2062 (and (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2063 (get-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2064 (gnus-Group-group-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2065 (gnus-Subject-read-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2066 (gnus-Group-group-name) nil no-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2067 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2068 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2069
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2070 (defun gnus-Subject-prev-group (no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2071 "Exit current newsgroup and then select previous unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2072 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2073 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2074 ;; Make sure Group mode buffer point is on current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2075 (gnus-Subject-jump-to-group gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2076 (let ((group (gnus-Subject-search-group t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2077 (if (null group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2078 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2079 (message "Exiting %s..." gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2080 (gnus-Subject-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2081 (message ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2082 (message "Selecting %s..." group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2083 (gnus-Subject-exit t) ;Exit Subject mode temporary.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2084 ;; We are now in Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2085 ;; We have to adjust point of Group mode buffer because current
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2086 ;; point is moved to next unread newsgroup by exiting.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2087 (gnus-Subject-jump-to-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2088 (gnus-Subject-read-group group nil no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2089 (or (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2090 (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2091 (eq gnus-auto-select-next t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2092 ;; Expected newsgroup has nothing to read since the articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2093 ;; are marked as read by cross-referencing. So, try next
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2094 ;; newsgroup. (Make sure we are in Group mode buffer now.)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2095 (and (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2096 (get-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2097 (gnus-Subject-search-group t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2098 (gnus-Subject-read-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2099 (gnus-Subject-search-group t) nil no-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2100 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2101 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2102
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2103 ;; Walking around subject lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2104
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2105 (defun gnus-Subject-next-subject (n &optional unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2106 "Go to next N'th subject line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2107 If optional argument UNREAD is non-nil, only unread article is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2108 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2109 (while (and (> n 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2110 (gnus-Subject-search-forward unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2111 (setq n (1- n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2112 (cond ((gnus-Subject-search-forward unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2113 (gnus-Subject-recenter))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2114 (unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2115 (message "No more unread articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2116 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2117 (message "No more articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2118 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2119
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2120 (defun gnus-Subject-next-unread-subject (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2121 "Go to next N'th unread subject line."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2122 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2123 (gnus-Subject-next-subject n t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2124
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2125 (defun gnus-Subject-prev-subject (n &optional unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2126 "Go to previous N'th subject line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2127 If optional argument UNREAD is non-nil, only unread article is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2128 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2129 (while (and (> n 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2130 (gnus-Subject-search-backward unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2131 (setq n (1- n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2132 (cond ((gnus-Subject-search-backward unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2133 (gnus-Subject-recenter))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2134 (unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2135 (message "No more unread articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2136 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2137 (message "No more articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2138 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2139
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2140 (defun gnus-Subject-prev-unread-subject (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2141 "Go to previous N'th unread subject line."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2142 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2143 (gnus-Subject-prev-subject n t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2144
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2145 ;; Walking around subject lines with displaying articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2146
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2147 (defun gnus-Subject-expand-window ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2148 "Expand Subject window to show headers full window."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2149 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2150 (gnus-configure-windows 'ExpandSubject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2151 (pop-to-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2152
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2153 (defun gnus-Subject-display-article (article &optional all-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2154 "Display ARTICLE in Article buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2155 (if (null article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2156 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2157 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2158 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2159 (gnus-Article-prepare article all-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2160 (gnus-Subject-recenter)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2161 (gnus-Subject-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2162 (run-hooks 'gnus-Select-article-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2163 ;; Successfully display article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2164 t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2165 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2166
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2167 (defun gnus-Subject-select-article (&optional all-headers force)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2168 "Select the current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2169 Optional argument ALL-HEADERS is non-nil, show all headers."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2170 (let ((article (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2171 (if (or (null gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2172 (/= article gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2173 (and force (not (eq all-headers gnus-have-all-headers))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2174 ;; The selected subject is different from that of the current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2175 (gnus-Subject-display-article article all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2176 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2177 (pop-to-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2178 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2179
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2180 (defun gnus-Subject-set-current-mark (&optional current-mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2181 "Put `+' at the current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2182 Optional argument specifies CURRENT-MARK instead of `+'."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2183 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2184 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2185 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2186 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2187 ;; First of all clear mark at last article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2188 (if (re-search-forward "^.[ \t]+[0-9]+:[^ \t]" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2189 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2190 (delete-char -1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2191 (insert " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2192 (goto-char (point-min))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2193 (if (re-search-forward (format "^.[ \t]+%d:" gnus-current-article) nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2194 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2195 (delete-char 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2196 (insert (or current-mark "+"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2197 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2198
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2199 (defun gnus-Subject-next-article (unread &optional subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2200 "Select article after current one.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2201 If argument UNREAD is non-nil, only unread article is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2202 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2203 (let ((header nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2204 (cond ((gnus-Subject-display-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2205 (gnus-Subject-search-forward unread subject)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2206 ((and subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2207 gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2208 (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2209 gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2210 (memq this-command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2211 '(gnus-Subject-next-unread-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2212 gnus-Subject-next-page
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2213 gnus-Subject-kill-same-subject-and-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2214 ;;gnus-Subject-next-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2215 ;;gnus-Subject-next-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2216 ;;gnus-Subject-next-unread-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2217 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2218 ;; Wrap article pointer if there are unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2219 ;; Hook function, such as gnus-Subject-rmail-digest, may
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2220 ;; change current buffer, so need check.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2221 (let ((buffer (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2222 (last-point (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2223 ;; No more articles with same subject, so jump to the first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2224 ;; unread article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2225 (gnus-Subject-first-unread-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2226 ;;(and (eq buffer (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2227 ;; (= (point) last-point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2228 ;; ;; Ignore given SUBJECT, and try again.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2229 ;; (gnus-Subject-next-article unread nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2230 (and (eq buffer (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2231 (< (point) last-point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2232 (message "Wrapped"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2233 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2234 ((and (not unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2235 gnus-auto-extend-newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2236 (setq header (gnus-more-header-forward)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2237 ;; Extend to next article if possible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2238 ;; Basic ideas by himacdonald@watdragon.waterloo.edu
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2239 (gnus-extend-newsgroup header nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2240 ;; Threads feature must be turned off.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2241 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2242 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2243 (gnus-Subject-prepare-threads (list header) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2244 (gnus-Subject-goto-article gnus-newsgroup-end))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2245 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2246 ;; Select next newsgroup automatically if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2247 (let ((cmd (string-to-char (this-command-keys)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2248 (group (gnus-Subject-search-group))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2249 (auto-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2250 (and gnus-auto-select-next
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2251 ;;(null (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2252 ;; gnus-newsgroup-marked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2253 (memq this-command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2254 '(gnus-Subject-next-unread-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2255 gnus-Subject-next-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2256 gnus-Subject-next-page
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2257 gnus-Subject-next-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2258 gnus-Subject-next-unread-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2259 gnus-Subject-kill-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2260 gnus-Subject-kill-same-subject-and-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2261 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2262 ;; Ignore characters typed ahead.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2263 (not (input-pending-p))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2264 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2265 (message "No more%s articles%s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2266 (if unread " unread" "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2267 (if (and auto-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2268 (not (eq gnus-auto-select-next 'quietly)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2269 (if group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2270 (format " (Type %s to %s [%d])"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2271 (key-description (char-to-string cmd))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2272 group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2273 (nth 1 (gnus-gethash group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2274 gnus-unread-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2275 (format " (Type %s to exit %s)"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2276 (key-description (char-to-string cmd))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2277 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2278 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2279 ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2280 ;; Select next unread newsgroup automagically.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2281 (cond ((and auto-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2282 (eq gnus-auto-select-next 'quietly))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2283 ;; Select quietly.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2284 (gnus-Subject-next-group nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2285 (auto-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2286 ;; Confirm auto selection.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2287 (let ((char (read-char)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2288 (if (= char cmd)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2289 (gnus-Subject-next-group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2290 (setq unread-command-char char))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2291 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2292 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2293 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2294
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2295 (defun gnus-Subject-next-unread-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2296 "Select unread article after current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2297 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2298 (gnus-Subject-next-article t (and gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2299 (gnus-Subject-subject-string))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2300
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2301 (defun gnus-Subject-prev-article (unread &optional subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2302 "Select article before current one.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2303 If argument UNREAD is non-nil, only unread article is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2304 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2305 (let ((header nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2306 (cond ((gnus-Subject-display-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2307 (gnus-Subject-search-backward unread subject)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2308 ((and subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2309 gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2310 (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2311 gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2312 (memq this-command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2313 '(gnus-Subject-prev-unread-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2314 ;;gnus-Subject-prev-page
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2315 ;;gnus-Subject-prev-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2316 ;;gnus-Subject-prev-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2317 ;;gnus-Subject-prev-unread-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2318 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2319 ;; Ignore given SUBJECT, and try again.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2320 (gnus-Subject-prev-article unread nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2321 (unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2322 (message "No more unread articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2323 ((and gnus-auto-extend-newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2324 (setq header (gnus-more-header-backward)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2325 ;; Extend to previous article if possible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2326 ;; Basic ideas by himacdonald@watdragon.waterloo.edu
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2327 (gnus-extend-newsgroup header t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2328 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2329 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2330 (gnus-Subject-prepare-threads (list header) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2331 (gnus-Subject-goto-article gnus-newsgroup-begin))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2332 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2333 (message "No more articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2334 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2335
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2336 (defun gnus-Subject-prev-unread-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2337 "Select unred article before current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2338 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2339 (gnus-Subject-prev-article t (and gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2340 (gnus-Subject-subject-string))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2341
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2342 (defun gnus-Subject-next-page (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2343 "Show next page of selected article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2344 If end of artile, select next article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2345 Argument LINES specifies lines to be scrolled up."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2346 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2347 (let ((article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2348 (endp nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2349 (if (or (null gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2350 (/= article gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2351 ;; Selected subject is different from current article's.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2352 (gnus-Subject-display-article article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2353 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2354 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2355 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2356 (setq endp (gnus-Article-next-page lines)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2357 (cond ((and endp lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2358 (message "End of message"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2359 ((and endp (null lines))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2360 (gnus-Subject-next-unread-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2361 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2362
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2363 (defun gnus-Subject-prev-page (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2364 "Show previous page of selected article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2365 Argument LINES specifies lines to be scrolled down."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2366 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2367 (let ((article (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2368 (if (or (null gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2369 (/= article gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2370 ;; Selected subject is different from current article's.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2371 (gnus-Subject-display-article article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2372 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2373 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2374 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2375 (gnus-Article-prev-page lines))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2376 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2377
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2378 (defun gnus-Subject-scroll-up (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2379 "Scroll up (or down) one line current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2380 Argument LINES specifies lines to be scrolled up (or down if negative)."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2381 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2382 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2383 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2384 (cond ((> lines 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2385 (if (gnus-Article-next-page lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2386 (message "End of message")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2387 ((< lines 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2388 (gnus-Article-prev-page (- 0 lines))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2389 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2390
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2391 (defun gnus-Subject-next-same-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2392 "Select next article which has the same subject as current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2393 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2394 (gnus-Subject-next-article nil (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2395
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2396 (defun gnus-Subject-prev-same-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2397 "Select previous article which has the same subject as current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2398 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2399 (gnus-Subject-prev-article nil (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2400
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2401 (defun gnus-Subject-next-unread-same-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2402 "Select next unread article which has the same subject as current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2403 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2404 (gnus-Subject-next-article t (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2405
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2406 (defun gnus-Subject-prev-unread-same-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2407 "Select previous unread article which has the same subject as current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2408 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2409 (gnus-Subject-prev-article t (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2410
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2411 (defun gnus-Subject-refer-parent-article (child)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2412 "Refer parent article of current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2413 If a prefix argument CHILD is non-nil, go back to the child article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2414 using internally maintained articles history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2415 NOTE: This command may not work with nnspool.el."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2416 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2417 (gnus-Subject-select-article t t) ;Request all headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2418 (let ((referenced-id nil)) ;Message-id of parent or child article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2419 (if child
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2420 ;; Go back to child article using history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2421 (gnus-Subject-refer-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2422 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2423 ;; Look for parent Message-ID.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2424 ;; We cannot use gnus-current-headers to get references
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2425 ;; because we may be looking at parent or refered article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2426 (let ((references (gnus-fetch-field "References")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2427 ;; Get the last message-id in the references.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2428 (and references
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2429 (string-match "\\(<[^<>]+>\\)[^>]*\\'" references)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2430 (setq referenced-id
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2431 (substring references
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2432 (match-beginning 1) (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2433 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2434 (if (stringp referenced-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2435 (gnus-Subject-refer-article referenced-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2436 (error "No more parents"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2437 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2438
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2439 (defun gnus-Subject-refer-article (message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2440 "Refer article specified by MESSAGE-ID.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2441 If MESSAGE-ID is nil or an empty string, it is popped from an
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2442 internally maintained articles history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2443 NOTE: This command may not work with nnspool.el."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2444 (interactive "sMessage-ID: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2445 ;; Make sure that this command depends on the fact that article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2446 ;; related information is not updated when an article is retrieved
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2447 ;; by Message-ID.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2448 (gnus-Subject-select-article t t) ;Request all headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2449 (if (and (stringp message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2450 (> (length message-id) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2451 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2452 ;; Construct the correct Message-ID if necessary.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2453 ;; Suggested by tale@pawl.rpi.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2454 (or (string-match "^<" message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2455 (setq message-id (concat "<" message-id)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2456 (or (string-match ">$" message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2457 (setq message-id (concat message-id ">")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2458 ;; Push current message-id on history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2459 ;; We cannot use gnus-current-headers to get current
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2460 ;; message-id because we may be looking at parent or refered
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2461 ;; article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2462 (let ((current (gnus-fetch-field "Message-ID")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2463 (or (equal current message-id) ;Nothing to do.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2464 (equal current (car gnus-current-history))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2465 (setq gnus-current-history
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2466 (cons current gnus-current-history)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2467 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2468 ;; Pop message-id from history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2469 (setq message-id (car gnus-current-history))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2470 (setq gnus-current-history (cdr gnus-current-history)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2471 (if (stringp message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2472 ;; Retrieve article by message-id. This may not work with nnspool.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2473 (gnus-Article-prepare message-id t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2474 (error "No such references"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2475 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2476
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2477 (defun gnus-Subject-next-digest (nth)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2478 "Move to head of NTH next digested message."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2479 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2480 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2481 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2482 (gnus-Article-next-digest (or nth 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2483 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2484
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2485 (defun gnus-Subject-prev-digest (nth)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2486 "Move to head of NTH previous digested message."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2487 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2488 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2489 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2490 (gnus-Article-prev-digest (or nth 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2491 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2492
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2493 (defun gnus-Subject-first-unread-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2494 "Select first unread article. Return non-nil if successfully selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2495 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2496 (let ((begin (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2497 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2498 (if (re-search-forward "^ [ \t]+[0-9]+:" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2499 (gnus-Subject-display-article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2500 ;; If there is no unread articles, stay there.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2501 (goto-char begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2502 ;;(gnus-Subject-display-article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2503 (message "No more unread articles")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2504 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2505 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2506 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2507
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2508 (defun gnus-Subject-isearch-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2509 "Do incremental search forward on current article."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2510 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2511 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2512 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2513 (call-interactively 'isearch-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2514 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2515
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2516 (defun gnus-Subject-search-article-forward (regexp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2517 "Search for an article containing REGEXP forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2518 `gnus-Select-article-hook' is not called during the search."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2519 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2520 (list (read-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2521 (concat "Search forward (regexp): "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2522 (if gnus-last-search-regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2523 (concat "(default " gnus-last-search-regexp ") "))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2524 (if (string-equal regexp "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2525 (setq regexp (or gnus-last-search-regexp ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2526 (setq gnus-last-search-regexp regexp))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2527 (if (gnus-Subject-search-article regexp nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2528 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2529 (recenter 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2530 ;;(sit-for 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2531 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2532 (error "Search failed: \"%s\"" regexp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2533 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2534
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2535 (defun gnus-Subject-search-article-backward (regexp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2536 "Search for an article containing REGEXP backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2537 `gnus-Select-article-hook' is not called during the search."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2538 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2539 (list (read-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2540 (concat "Search backward (regexp): "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2541 (if gnus-last-search-regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2542 (concat "(default " gnus-last-search-regexp ") "))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2543 (if (string-equal regexp "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2544 (setq regexp (or gnus-last-search-regexp ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2545 (setq gnus-last-search-regexp regexp))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2546 (if (gnus-Subject-search-article regexp t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2547 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2548 (recenter 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2549 ;;(sit-for 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2550 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2551 (error "Search failed: \"%s\"" regexp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2552 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2553
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2554 (defun gnus-Subject-search-article (regexp &optional backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2555 "Search for an article containing REGEXP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2556 Optional argument BACKWARD means do search for backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2557 `gnus-Select-article-hook' is not called during the search."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2558 (let ((gnus-Select-article-hook nil) ;Disable hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2559 (gnus-Mark-article-hook nil) ;Inhibit marking as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2560 (re-search
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2561 (if backward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2562 (function re-search-backward) (function re-search-forward)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2563 (found nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2564 (last nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2565 ;; Hidden thread subtrees must be searched for ,too.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2566 (gnus-Subject-show-all-threads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2567 ;; First of all, search current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2568 ;; We don't want to read article again from NNTP server nor reset
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2569 ;; current point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2570 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2571 (message "Searching article: %d..." gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2572 (setq last gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2573 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2574 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2575 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2576 ;; Begin search from current point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2577 (setq found (funcall re-search regexp nil t))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2578 ;; Then search next articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2579 (while (and (not found)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2580 (gnus-Subject-display-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2581 (gnus-Subject-search-subject backward nil nil)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2582 (message "Searching article: %d..." gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2583 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2584 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2585 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2586 (goto-char (if backward (point-max) (point-min)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2587 (setq found (funcall re-search regexp nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2588 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2589 (message "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2590 ;; Adjust article pointer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2591 (or (eq last gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2592 (setq gnus-last-article last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2593 ;; Return T if found such article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2594 found
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2595 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2596
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2597 (defun gnus-Subject-execute-command (field regexp command &optional backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2598 "If FIELD of article header matches REGEXP, execute COMMAND string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2599 If FIELD is an empty string (or nil), entire article body is searched for.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2600 If optional (prefix) argument BACKWARD is non-nil, do backward instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2601 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2602 (list (let ((completion-ignore-case t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2603 (completing-read "Field name: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2604 '(("Number")("Subject")("From")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2605 ("Lines")("Date")("Id")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2606 ("Xref")("References"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2607 nil 'require-match))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2608 (read-string "Regexp: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2609 (read-key-sequence "Command: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2610 current-prefix-arg))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2611 ;; Hidden thread subtrees must be searched for ,too.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2612 (gnus-Subject-show-all-threads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2613 ;; We don't want to change current point nor window configuration.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2614 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2615 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2616 (message "Executing %s..." (key-description command))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2617 ;; We'd like to execute COMMAND interactively so as to give arguments.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2618 (gnus-execute field regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2619 (` (lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2620 (call-interactively '(, (key-binding command)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2621 backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2622 (message "Executing %s... done" (key-description command)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2623
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2624 (defun gnus-Subject-beginning-of-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2625 "Go to beginning of article body"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2626 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2627 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2628 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2629 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2630 (beginning-of-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2631 (if gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2632 (gnus-narrow-to-page))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2633 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2634
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2635 (defun gnus-Subject-end-of-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2636 "Go to end of article body"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2637 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2638 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2639 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2640 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2641 (end-of-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2642 (if gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2643 (gnus-narrow-to-page))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2644 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2645
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2646 (defun gnus-Subject-goto-article (article &optional all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2647 "Read ARTICLE if exists.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2648 Optional argument ALL-HEADERS means all headers are shown."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2649 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2650 (list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2651 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2652 (completing-read "Article number: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2653 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2654 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2655 (lambda (headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2656 (list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2657 (int-to-string (nntp-header-number headers)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2658 gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2659 nil 'require-match))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2660 (if (gnus-Subject-goto-subject article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2661 (gnus-Subject-display-article article all-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2662
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2663 (defun gnus-Subject-goto-last-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2664 "Go to last subject line."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2665 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2666 (if gnus-last-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2667 (gnus-Subject-goto-article gnus-last-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2668
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2669 (defun gnus-Subject-show-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2670 "Force to show current article."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2671 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2672 ;; The following is a trick to force to read the current article again.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2673 (setq gnus-have-all-headers (not gnus-have-all-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2674 (gnus-Subject-select-article (not gnus-have-all-headers) t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2675
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2676 (defun gnus-Subject-toggle-header (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2677 "Show original header if pruned header currently shown, or vice versa.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2678 With arg, show original header iff arg is positive."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2679 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2680 ;; Variable gnus-show-all-headers must be NIL to toggle really.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2681 (let ((gnus-show-all-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2682 (all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2683 (if (null arg) (not gnus-have-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2684 (> (prefix-numeric-value arg) 0))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2685 (gnus-Subject-select-article all-headers t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2686
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2687 (defun gnus-Subject-show-all-headers ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2688 "Show original article header."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2689 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2690 (gnus-Subject-select-article t t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2691
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2692 (defun gnus-Subject-stop-page-breaking ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2693 "Stop page breaking by linefeed temporary (Widen article buffer)."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2694 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2695 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2696 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2697 (widen)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2698
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2699 (defun gnus-Subject-kill-same-subject-and-select (unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2700 "Mark articles which has the same subject as read, and then select next.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2701 If argument UNMARK is positive, remove any kinds of marks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2702 If argument UNMARK is negative, mark articles as unread instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2703 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2704 (if unmark
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2705 (setq unmark (prefix-numeric-value unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2706 (let ((count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2707 (gnus-Subject-mark-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2708 (gnus-Subject-subject-string) unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2709 ;; Select next unread article. If auto-select-same mode, should
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2710 ;; select the first unread article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2711 (gnus-Subject-next-article t (and gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2712 (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2713 (message "%d articles are marked as %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2714 count (if unmark "unread" "read"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2715 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2716
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2717 (defun gnus-Subject-kill-same-subject (unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2718 "Mark articles which has the same subject as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2719 If argument UNMARK is positive, remove any kinds of marks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2720 If argument UNMARK is negative, mark articles as unread instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2721 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2722 (if unmark
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2723 (setq unmark (prefix-numeric-value unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2724 (let ((count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2725 (gnus-Subject-mark-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2726 (gnus-Subject-subject-string) unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2727 ;; If marked as read, go to next unread subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2728 (if (null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2729 ;; Go to next unread subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2730 (gnus-Subject-next-subject 1 t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2731 (message "%d articles are marked as %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2732 count (if unmark "unread" "read"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2733 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2734
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2735 (defun gnus-Subject-mark-same-subject (subject &optional unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2736 "Mark articles with same SUBJECT as read, and return marked number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2737 If optional argument UNMARK is positive, remove any kinds of marks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2738 If optional argument UNMARK is negative, mark articles as unread instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2739 (let ((count 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2740 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2741 (cond ((null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2742 (gnus-Subject-mark-as-read nil "K"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2743 ((> unmark 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2744 (gnus-Subject-mark-as-unread nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2745 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2746 (gnus-Subject-mark-as-unread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2747 (while (and subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2748 (gnus-Subject-search-forward nil subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2749 (cond ((null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2750 (gnus-Subject-mark-as-read nil "K"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2751 ((> unmark 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2752 (gnus-Subject-mark-as-unread nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2753 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2754 (gnus-Subject-mark-as-unread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2755 (setq count (1+ count))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2756 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2757 ;; Hide killed thread subtrees. Does not work properly always.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2758 ;;(and (null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2759 ;; gnus-thread-hide-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2760 ;; (gnus-Subject-hide-thread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2761 ;; Return number of articles marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2762 count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2763 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2764
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2765 (defun gnus-Subject-mark-as-unread-forward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2766 "Mark current article as unread, and then go forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2767 Argument COUNT specifies number of articles marked as unread."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2768 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2769 (while (> count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2770 (gnus-Subject-mark-as-unread nil nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2771 (gnus-Subject-next-subject 1 nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2772 (setq count (1- count))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2773
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2774 (defun gnus-Subject-mark-as-unread-backward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2775 "Mark current article as unread, and then go backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2776 Argument COUNT specifies number of articles marked as unread."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2777 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2778 (while (> count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2779 (gnus-Subject-mark-as-unread nil nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2780 (gnus-Subject-prev-subject 1 nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2781 (setq count (1- count))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2782
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2783 (defun gnus-Subject-mark-as-unread (&optional article clear-mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2784 "Mark current article as unread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2785 Optional first argument ARTICLE specifies article number to be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2786 marked as unread. Optional second argument CLEAR-MARK removes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2787 any kind of mark."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2788 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2789 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2790 ;; First of all, show hidden thread subtrees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2791 (gnus-Subject-show-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2792 (let* ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2793 (current (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2794 (article (or article current)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2795 (gnus-mark-article-as-unread article clear-mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2796 (if (or (eq article current)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2797 (gnus-Subject-goto-subject article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2798 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2799 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2800 (delete-char 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2801 (insert (if clear-mark " " "-"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2802 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2803
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2804 (defun gnus-Subject-mark-as-read-forward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2805 "Mark current article as read, and then go forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2806 Argument COUNT specifies number of articles marked as read"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2807 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2808 (while (> count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2809 (gnus-Subject-mark-as-read)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2810 (gnus-Subject-next-subject 1 'unread-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2811 (setq count (1- count))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2812
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2813 (defun gnus-Subject-mark-as-read-backward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2814 "Mark current article as read, and then go backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2815 Argument COUNT specifies number of articles marked as read"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2816 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2817 (while (> count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2818 (gnus-Subject-mark-as-read)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2819 (gnus-Subject-prev-subject 1 'unread-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2820 (setq count (1- count))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2821
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2822 (defun gnus-Subject-mark-as-read (&optional article mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2823 "Mark current article as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2824 Optional first argument ARTICLE specifies article number to be marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2825 Optional second argument MARK specifies a string inserted at beginning of line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2826 Any kind of string (length 1) except for a space and `-' is ok."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2827 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2828 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2829 ;; First of all, show hidden thread subtrees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2830 (gnus-Subject-show-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2831 (let* ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2832 (mark (or mark "D")) ;Default mark is `D'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2833 (current (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2834 (article (or article current)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2835 (gnus-mark-article-as-read article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2836 (if (or (eq article current)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2837 (gnus-Subject-goto-subject article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2838 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2839 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2840 (delete-char 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2841 (insert mark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2842 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2843
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2844 (defun gnus-Subject-clear-mark-forward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2845 "Remove current article's mark, and go forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2846 Argument COUNT specifies number of articles unmarked"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2847 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2848 (while (> count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2849 (gnus-Subject-mark-as-unread nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2850 (gnus-Subject-next-subject 1 nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2851 (setq count (1- count))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2852
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2853 (defun gnus-Subject-clear-mark-backward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2854 "Remove current article's mark, and go backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2855 Argument COUNT specifies number of articles unmarked"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2856 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2857 (while (> count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2858 (gnus-Subject-mark-as-unread nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2859 (gnus-Subject-prev-subject 1 nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2860 (setq count (1- count))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2861
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2862 (defun gnus-Subject-delete-marked-as-read ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2863 "Delete lines which are marked as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2864 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2865 (if gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2866 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2867 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2868 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2869 (delete-non-matching-lines "^[ ---]"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2870 ;; Adjust point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2871 (if (eobp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2872 (gnus-Subject-prev-subject 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2873 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2874 (search-forward ":" nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2875 ;; It is not so good idea to make the buffer empty.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2876 (message "All articles are marked as read")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2877 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2878
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2879 (defun gnus-Subject-delete-marked-with (marks)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2880 "Delete lines which are marked with MARKS (e.g. \"DK\")."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2881 (interactive "sMarks: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2882 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2883 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2884 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2885 (delete-matching-lines (concat "^[" marks "]")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2886 ;; Adjust point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2887 (or (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2888 (if (eobp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2889 (gnus-Subject-prev-subject 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2890 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2891 (search-forward ":" nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2892 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2893
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2894 ;; Thread-based commands.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2895
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2896 (defun gnus-Subject-toggle-threads (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2897 "Toggle showing conversation threads.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2898 With arg, turn showing conversation threads on iff arg is positive."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2899 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2900 (let ((current (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2901 (setq gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2902 (if (null arg) (not gnus-show-threads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2903 (> (prefix-numeric-value arg) 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2904 (gnus-Subject-prepare)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2905 (gnus-Subject-goto-subject current)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2906 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2907
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2908 (defun gnus-Subject-show-all-threads ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2909 "Show all thread subtrees."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2910 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2911 (if gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2912 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2913 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2914 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2915 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2916
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2917 (defun gnus-Subject-show-thread ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2918 "Show thread subtrees."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2919 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2920 (if gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2921 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2922 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2923 (subst-char-in-region (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2924 (beginning-of-line) (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2925 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2926 (end-of-line) (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2927 ?\^M ?\n t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2928 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2929
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2930 (defun gnus-Subject-hide-all-threads ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2931 "Hide all thread subtrees."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2932 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2933 (if gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2934 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2935 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2936 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2937 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2938 (let ((level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2939 (gnus-Subject-hide-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2940 (while (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2941 (and (>= level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2942 (gnus-Subject-hide-thread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2943 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2944
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2945 (defun gnus-Subject-hide-thread ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2946 "Hide thread subtrees."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2947 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2948 (if gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2949 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2950 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2951 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2952 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2953 (let ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2954 (init (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2955 (last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2956 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2957 (while (and (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2958 (< level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2959 ;; Interested in lower levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2960 (if (< level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2961 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2962 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2963 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2964 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2965 (subst-char-in-region init last ?\n ?\^M t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2966 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2967
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2968 (defun gnus-Subject-next-thread (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2969 "Go to the same level next thread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2970 Argument N specifies the number of threads."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2971 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2972 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2973 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2974 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2975 (let ((init (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2976 (last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2977 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2978 (while (and (> n 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2979 (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2980 (<= level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2981 ;; We have to skip lower levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2982 (if (= level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2983 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2984 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2985 (setq n (1- n))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2986 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2987 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2988 ;; Return non-nil if successfully move to the next.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2989 (prog1 (not (= init last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2990 (goto-char last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2991 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2992
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2993 (defun gnus-Subject-prev-thread (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2994 "Go to the same level previous thread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2995 Argument N specifies the number of threads."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2996 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2997 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2998 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2999 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3000 (let ((init (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3001 (last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3002 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3003 (while (and (> n 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3004 (gnus-Subject-search-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3005 (<= level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3006 ;; We have to skip lower levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3007 (if (= level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3008 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3009 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3010 (setq n (1- n))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3011 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3012 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3013 ;; Return non-nil if successfully move to the previous.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3014 (prog1 (not (= init last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3015 (goto-char last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3016 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3017
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3018 (defun gnus-Subject-down-thread (d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3019 "Go downward current thread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3020 Argument D specifies the depth goes down."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3021 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3022 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3023 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3024 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3025 (let ((last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3026 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3027 (while (and (> d 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3028 (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3029 (<= level (current-column))) ;<= can be <. Which do you like?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3030 ;; We have to skip the same levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3031 (if (< level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3032 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3033 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3034 (setq level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3035 (setq d (1- d))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3036 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3037 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3038 (goto-char last)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3039 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3040
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3041 (defun gnus-Subject-up-thread (d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3042 "Go upward current thread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3043 Argument D specifies the depth goes up."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3044 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3045 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3046 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3047 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3048 (let ((last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3049 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3050 (while (and (> d 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3051 (gnus-Subject-search-backward))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3052 ;; We have to skip the same levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3053 (if (> level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3054 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3055 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3056 (setq level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3057 (setq d (1- d))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3058 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3059 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3060 (goto-char last)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3061 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3062
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3063 (defun gnus-Subject-kill-thread (unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3064 "Mark articles under current thread as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3065 If argument UNMARK is positive, remove any kinds of marks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3066 If argument UNMARK is negative, mark articles as unread instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3067 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3068 (if unmark
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3069 (setq unmark (prefix-numeric-value unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3070 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3071 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3072 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3073 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3074 (let ((level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3075 ;; Mark current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3076 (cond ((null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3077 (gnus-Subject-mark-as-read nil "K"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3078 ((> unmark 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3079 (gnus-Subject-mark-as-unread nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3080 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3081 (gnus-Subject-mark-as-unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3082 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3083 ;; Mark following articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3084 (while (and (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3085 (< level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3086 (cond ((null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3087 (gnus-Subject-mark-as-read nil "K"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3088 ((> unmark 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3089 (gnus-Subject-mark-as-unread nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3090 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3091 (gnus-Subject-mark-as-unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3092 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3093 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3094 ;; Hide killed subtrees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3095 (and (null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3096 gnus-thread-hide-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3097 (gnus-Subject-hide-thread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3098 ;; If marked as read, go to next unread subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3099 (if (null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3100 ;; Go to next unread subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3101 (gnus-Subject-next-subject 1 t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3102 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3103
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3104 (defun gnus-Subject-toggle-truncation (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3105 "Toggle truncation of subject lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3106 With ARG, turn line truncation on iff ARG is positive."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3107 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3108 (setq truncate-lines
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3109 (if (null arg) (not truncate-lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3110 (> (prefix-numeric-value arg) 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3111 (redraw-display))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3112
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3113 (defun gnus-Subject-sort-by-number (reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3114 "Sort subject display buffer by article number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3115 Argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3116 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3117 (gnus-Subject-sort-subjects
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3118 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3119 (lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3120 (< (nntp-header-number a) (nntp-header-number b))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3121 reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3122 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3123
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3124 (defun gnus-Subject-sort-by-author (reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3125 "Sort subject display buffer by author name alphabetically.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3126 If case-fold-search is non-nil, case of letters is ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3127 Argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3128 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3129 (gnus-Subject-sort-subjects
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3130 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3131 (lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3132 (gnus-string-lessp (nntp-header-from a) (nntp-header-from b))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3133 reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3134 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3135
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3136 (defun gnus-Subject-sort-by-subject (reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3137 "Sort subject display buffer by subject alphabetically. `Re:'s are ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3138 If case-fold-search is non-nil, case of letters is ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3139 Argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3140 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3141 (gnus-Subject-sort-subjects
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3142 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3143 (lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3144 (gnus-string-lessp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3145 (gnus-simplify-subject (nntp-header-subject a) 're-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3146 (gnus-simplify-subject (nntp-header-subject b) 're-only))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3147 reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3148 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3149
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3150 (defun gnus-Subject-sort-by-date (reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3151 "Sort subject display buffer by posted date.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3152 Argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3153 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3154 (gnus-Subject-sort-subjects
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3155 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3156 (lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3157 (gnus-date-lessp (nntp-header-date a) (nntp-header-date b))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3158 reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3159 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3160
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3161 (defun gnus-Subject-sort-subjects (predicate &optional reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3162 "Sort subject display buffer by PREDICATE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3163 Optional argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3164 (let ((current (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3165 (gnus-sort-headers predicate reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3166 (gnus-Subject-prepare)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3167 (gnus-Subject-goto-subject current)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3168 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3169
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3170 (defun gnus-Subject-reselect-current-group (show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3171 "Once exit and then reselect the current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3172 Prefix argument SHOW-ALL means to select all articles."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3173 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3174 (let ((current-subject (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3175 (gnus-Subject-exit t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3176 ;; We have to adjust the point of Group mode buffer because the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3177 ;; current point was moved to the next unread newsgroup by
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3178 ;; exiting.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3179 (gnus-Subject-jump-to-group gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3180 (gnus-Group-read-group show-all t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3181 (gnus-Subject-goto-subject current-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3182 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3183
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3184 (defun gnus-Subject-caesar-message (rotnum)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3185 "Caesar rotates all letters of current message by 13/47 places.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3186 With prefix arg, specifies the number of places to rotate each letter forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3187 Caesar rotates Japanese letters by 47 places in any case."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3188 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3189 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3190 (gnus-overload-functions)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3191 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3192 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3193 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3194 ;; We don't want to jump to the beginning of the message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3195 ;; `save-excursion' does not do its job.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3196 (move-to-window-line 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3197 (let ((last (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3198 (news-caesar-buffer-body rotnum)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3199 (goto-char last)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3200 (recenter 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3201 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3202 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3203
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3204 (defun gnus-Subject-rmail-digest ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3205 "Run RMAIL on current digest article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3206 `gnus-Select-digest-hook' will be called with no arguments, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3207 value is non-nil. It is possible to modify the article so that Rmail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3208 can work with it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3209
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3210 `gnus-Rmail-digest-hook' will be called with no arguments, if that value
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3211 is non-nil. The hook is intended to customize Rmail mode."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3212 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3213 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3214 (require 'rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3215 (let ((artbuf gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3216 (digbuf (get-buffer-create gnus-Digest-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3217 (mail-header-separator ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3218 (set-buffer digbuf)
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 853
diff changeset
3219 (buffer-disable-undo (current-buffer))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3220 (setq buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3221 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3222 (insert-buffer-substring artbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3223 (run-hooks 'gnus-Select-digest-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3224 (gnus-convert-article-to-rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3225 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3226 ;; Rmail initializations.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3227 (rmail-insert-rmail-file-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3228 (rmail-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3229 (rmail-set-message-counters)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3230 (rmail-show-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3231 (condition-case ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3232 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3233 (undigestify-rmail-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3234 (rmail-expunge) ;Delete original message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3235 ;; File name is meaningless but `save-buffer' requires it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3236 (setq buffer-file-name "GNUS Digest")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3237 (setq mode-line-buffer-identification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3238 (concat "Digest: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3239 (nntp-header-subject gnus-current-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3240 ;; There is no need to write this buffer to a file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3241 (make-local-variable 'write-file-hooks)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3242 (setq write-file-hooks
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3243 (list (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3244 (lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3245 (set-buffer-modified-p nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3246 (message "(No changes need to be saved)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3247 'no-need-to-write-this-buffer))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3248 ;; Default file name saving digest messages.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3249 (setq rmail-last-rmail-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3250 (funcall gnus-rmail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3251 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3252 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3253 gnus-newsgroup-last-rmail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3254 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3255 (setq rmail-last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3256 (funcall gnus-mail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3257 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3258 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3259 gnus-newsgroup-last-mail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3260 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3261 ;; Prevent generating new buffer named ***<N> each time.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3262 (setq rmail-summary-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3263 (get-buffer-create gnus-Digest-summary-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3264 (run-hooks 'gnus-Rmail-digest-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3265 ;; Take all windows safely.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3266 (gnus-configure-windows '(1 0 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3267 (pop-to-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3268 ;; Use Subject and Article windows for Digest summary and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3269 ;; Digest buffers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3270 (if gnus-digest-show-summary
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3271 (let ((gnus-Subject-buffer gnus-Digest-summary-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3272 (gnus-Article-buffer gnus-Digest-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3273 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3274 (pop-to-buffer gnus-Digest-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3275 (rmail-summary)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3276 (pop-to-buffer gnus-Digest-summary-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3277 (message (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3278 "Type \\[rmail-summary-quit] to return to GNUS")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3279 (let ((gnus-Subject-buffer gnus-Digest-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3280 (gnus-configure-windows 'ExpandSubject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3281 (pop-to-buffer gnus-Digest-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3282 (message (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3283 "Type \\[rmail-quit] to return to GNUS")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3284 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3285 ;; Move the buffers to the end of buffer list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3286 (bury-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3287 (bury-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3288 (bury-buffer gnus-Digest-summary-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3289 (bury-buffer gnus-Digest-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3290 (error (set-buffer-modified-p nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3291 (kill-buffer digbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3292 ;; This command should not signal an error because the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3293 ;; command is called from hooks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3294 (ding) (message "Article is not a digest")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3295 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3296
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3297 (defun gnus-Subject-save-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3298 "Save this article using default saver function.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3299 Variable `gnus-default-article-saver' specifies the saver function."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3300 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3301 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3302 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3303 (if gnus-default-article-saver
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3304 (call-interactively gnus-default-article-saver)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3305 (error "No default saver is defined.")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3306
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3307 (defun gnus-Subject-save-in-rmail (&optional filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3308 "Append this article to Rmail file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3309 Optional argument FILENAME specifies file name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3310 Directory to save to is default to `gnus-article-save-directory' which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3311 is initialized from the SAVEDIR environment variable."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3312 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3313 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3314 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3315 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3316 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3317 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3318 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3319 (let ((default-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3320 (funcall gnus-rmail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3321 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3322 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3323 gnus-newsgroup-last-rmail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3324 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3325 (or filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3326 (setq filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3327 (read-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3328 (concat "Save article in Rmail file: (default "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3329 (file-name-nondirectory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3330 ") ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3331 (file-name-directory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3332 default-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3333 (gnus-make-directory (file-name-directory filename))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3334 (gnus-output-to-rmail filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3335 ;; Remember the directory name to save articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3336 (setq gnus-newsgroup-last-rmail filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3337 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3338 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3339
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3340 (defun gnus-Subject-save-in-mail (&optional filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3341 "Append this article to Unix mail file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3342 Optional argument FILENAME specifies file name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3343 Directory to save to is default to `gnus-article-save-directory' which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3344 is initialized from the SAVEDIR environment variable."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3345 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3346 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3347 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3348 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3349 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3350 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3351 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3352 (let ((default-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3353 (funcall gnus-mail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3354 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3355 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3356 gnus-newsgroup-last-mail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3357 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3358 (or filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3359 (setq filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3360 (read-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3361 (concat "Save article in Unix mail file: (default "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3362 (file-name-nondirectory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3363 ") ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3364 (file-name-directory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3365 default-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3366 (gnus-make-directory (file-name-directory filename))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3367 (rmail-output filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3368 ;; Remember the directory name to save articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3369 (setq gnus-newsgroup-last-mail filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3370 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3371 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3372
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3373 (defun gnus-Subject-save-in-file (&optional filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3374 "Append this article to file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3375 Optional argument FILENAME specifies file name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3376 Directory to save to is default to `gnus-article-save-directory' which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3377 is initialized from the SAVEDIR environment variable."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3378 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3379 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3380 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3381 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3382 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3383 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3384 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3385 (let ((default-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3386 (funcall gnus-file-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3387 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3388 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3389 gnus-newsgroup-last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3390 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3391 (or filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3392 (setq filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3393 (read-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3394 (concat "Save article in file: (default "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3395 (file-name-nondirectory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3396 ") ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3397 (file-name-directory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3398 default-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3399 (gnus-make-directory (file-name-directory filename))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3400 (gnus-output-to-file filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3401 ;; Remember the directory name to save articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3402 (setq gnus-newsgroup-last-file filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3403 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3404 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3405
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3406 (defun gnus-Subject-save-in-folder (&optional folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3407 "Save this article to MH folder (using `rcvstore' in MH library).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3408 Optional argument FOLDER specifies folder name."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3409 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3410 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3411 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3412 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3413 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3414 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3415 ;; Thanks to yuki@flab.Fujitsu.JUNET and ohm@kaba.junet.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3416 (mh-find-path)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3417 (let ((folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3418 (or folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3419 (mh-prompt-for-folder "Save article in"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3420 (funcall gnus-folder-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3421 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3422 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3423 gnus-newsgroup-last-folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3424 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3425 t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3426 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3427 (errbuf (get-buffer-create " *GNUS rcvstore*")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3428 (unwind-protect
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3429 (call-process-region (point-min) (point-max)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3430 (expand-file-name "rcvstore" mh-lib)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3431 nil errbuf nil folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3432 (set-buffer errbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3433 (if (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3434 (message "Article saved in folder: %s" folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3435 (message "%s" (buffer-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3436 (kill-buffer errbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3437 (setq gnus-newsgroup-last-folder folder))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3438 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3439 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3440
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3441 (defun gnus-Subject-pipe-output ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3442 "Pipe this article to subprocess."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3443 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3444 ;; Ignore `gnus-save-all-headers' since this is not save command.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3445 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3446 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3447 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3448 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3449 (let ((command (read-string "Shell command on article: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3450 gnus-last-shell-command)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3451 (if (string-equal command "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3452 (setq command gnus-last-shell-command))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3453 (shell-command-on-region (point-min) (point-max) command nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3454 (setq gnus-last-shell-command command)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3455 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3456 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3457
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3458 (defun gnus-Subject-catch-up (all &optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3459 "Mark all articles not marked as unread in this newsgroup as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3460 If prefix argument ALL is non-nil, all articles are marked as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3461 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3462 (if (or quietly
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3463 (y-or-n-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3464 (if all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3465 "Do you really want to mark everything as read? "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3466 "Delete all articles not marked as unread? ")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3467 (let ((unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3468 (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3469 (if (not all) gnus-newsgroup-marked))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3470 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3471 (while unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3472 (gnus-Subject-mark-as-read (car unmarked) "C")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3473 (setq unmarked (cdr unmarked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3474 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3475 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3476
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3477 (defun gnus-Subject-catch-up-all (&optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3478 "Mark all articles in this newsgroup as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3479 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3480 (gnus-Subject-catch-up t quietly))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3481
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3482 (defun gnus-Subject-catch-up-and-exit (all &optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3483 "Mark all articles not marked as unread in this newsgroup as read, then exit.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3484 If prefix argument ALL is non-nil, all articles are marked as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3485 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3486 (if (or quietly
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3487 (y-or-n-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3488 (if all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3489 "Do you really want to mark everything as read? "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3490 "Delete all articles not marked as unread? ")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3491 (let ((unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3492 (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3493 (if (not all) gnus-newsgroup-marked))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3494 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3495 (while unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3496 (gnus-mark-article-as-read (car unmarked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3497 (setq unmarked (cdr unmarked)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3498 ;; Select next newsgroup or exit.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3499 (cond ((eq gnus-auto-select-next 'quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3500 ;; Select next newsgroup quietly.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3501 (gnus-Subject-next-group nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3502 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3503 (gnus-Subject-exit)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3504 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3505
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3506 (defun gnus-Subject-catch-up-all-and-exit (&optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3507 "Mark all articles in this newsgroup as read, and then exit."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3508 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3509 (gnus-Subject-catch-up-and-exit t quietly))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3510
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3511 (defun gnus-Subject-edit-global-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3512 "Edit a global KILL file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3513 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3514 (setq gnus-current-kill-article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3515 (gnus-Kill-file-edit-file nil) ;Nil stands for global KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3516 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3517 (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3518 "Editing a global KILL file (Type \\[gnus-Kill-file-exit] to exit)")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3519
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3520 (defun gnus-Subject-edit-local-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3521 "Edit a local KILL file applied to the current newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3522 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3523 (setq gnus-current-kill-article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3524 (gnus-Kill-file-edit-file gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3525 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3526 (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3527 "Editing a local KILL file (Type \\[gnus-Kill-file-exit] to exit)")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3528
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3529 (defun gnus-Subject-exit (&optional temporary)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3530 "Exit reading current newsgroup, and then return to group selection mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3531 gnus-Exit-group-hook is called with no arguments if that value is non-nil."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3532 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3533 (let ((updated nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3534 (gnus-newsgroup-headers gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3535 (gnus-newsgroup-unreads gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3536 (gnus-newsgroup-unselected gnus-newsgroup-unselected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3537 (gnus-newsgroup-marked gnus-newsgroup-marked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3538 ;; Important internal variables are save, so we can reenter
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3539 ;; Subject Mode buffer even if hook changes them.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3540 (run-hooks 'gnus-Exit-group-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3541 (gnus-update-unread-articles gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3542 (append gnus-newsgroup-unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3543 gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3544 gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3545 ;; T means ignore unsubscribed newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3546 (if gnus-use-cross-reference
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3547 (setq updated
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3548 (gnus-mark-as-read-by-xref gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3549 gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3550 gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3551 (eq gnus-use-cross-reference t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3552 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3553 ;; Do not switch windows but change the buffer to work.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3554 (set-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3555 ;; Update cross referenced group info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3556 (while updated
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3557 (gnus-Group-update-group (car updated) t) ;Ignore invisible group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3558 (setq updated (cdr updated)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3559 (gnus-Group-update-group gnus-newsgroup-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3560 ;; Make sure where I was, and go to next newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3561 (gnus-Group-jump-to-group gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3562 (gnus-Group-next-unread-group 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3563 (if temporary
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3564 ;; If exiting temporary, caller should adjust Group mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3565 ;; buffer point by itself.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3566 nil ;Nothing to do.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3567 ;; Return to Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3568 (if (get-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3569 (bury-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3570 (if (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3571 (bury-buffer gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3572 (gnus-configure-windows 'ExitNewsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3573 (pop-to-buffer gnus-Group-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3574
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3575 (defun gnus-Subject-quit ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3576 "Quit reading current newsgroup without updating read article info."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3577 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3578 (if (y-or-n-p "Do you really wanna quit reading this group? ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3579 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3580 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3581 ;; Return to Group selection mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3582 (if (get-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3583 (bury-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3584 (if (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3585 (bury-buffer gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3586 (gnus-configure-windows 'ExitNewsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3587 (pop-to-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3588 (gnus-Group-jump-to-group gnus-newsgroup-name) ;Make sure where I was.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3589 (gnus-Group-next-group 1) ;(gnus-Group-next-unread-group 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3590 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3591
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3592 (defun gnus-Subject-describe-briefly ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3593 "Describe Subject mode commands briefly."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3594 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3595 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3596 (concat
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3597 (substitute-command-keys "\\[gnus-Subject-next-page]:Select ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3598 (substitute-command-keys "\\[gnus-Subject-next-unread-article]:Forward ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3599 (substitute-command-keys "\\[gnus-Subject-prev-unread-article]:Backward ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3600 (substitute-command-keys "\\[gnus-Subject-exit]:Exit ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3601 (substitute-command-keys "\\[gnus-Info-find-node]:Run Info ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3602 (substitute-command-keys "\\[gnus-Subject-describe-briefly]:This help")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3603 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3604
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3605
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3606 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3607 ;;; GNUS Article Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3608 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3609
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3610 (if gnus-Article-mode-map
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3611 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3612 (setq gnus-Article-mode-map (make-keymap))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3613 (suppress-keymap gnus-Article-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3614 (define-key gnus-Article-mode-map " " 'gnus-Article-next-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3615 (define-key gnus-Article-mode-map "\177" 'gnus-Article-prev-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3616 (define-key gnus-Article-mode-map "r" 'gnus-Article-refer-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3617 (define-key gnus-Article-mode-map "o" 'gnus-Article-pop-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3618 (define-key gnus-Article-mode-map "h" 'gnus-Article-show-subjects)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3619 (define-key gnus-Article-mode-map "s" 'gnus-Article-show-subjects)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3620 (define-key gnus-Article-mode-map "?" 'gnus-Article-describe-briefly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3621 (define-key gnus-Article-mode-map "\C-c\C-i" 'gnus-Info-find-node))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3622
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3623 (defun gnus-Article-mode ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3624 "Major mode for browsing through an article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3625 All normal editing commands are turned off.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3626 Instead, these commands are available:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3627 \\{gnus-Article-mode-map}
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3628
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3629 Various hooks for customization:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3630 gnus-Article-mode-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3631 Entry to this mode calls the value with no arguments, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3632 value is non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3633
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3634 gnus-Article-prepare-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3635 Called with no arguments after an article is prepared for reading,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3636 if that value is non-nil."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3637 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3638 (kill-all-local-variables)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3639 ;; Gee. Why don't you upgrade?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3640 (cond ((boundp 'mode-line-modified)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3641 (setq mode-line-modified "--- "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3642 ((listp (default-value 'mode-line-format))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3643 (setq mode-line-format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3644 (cons "--- " (cdr (default-value 'mode-line-format))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3645 (make-local-variable 'global-mode-string)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3646 (setq global-mode-string nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3647 (setq major-mode 'gnus-Article-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3648 (setq mode-name "Article")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3649 (gnus-Article-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3650 (use-local-map gnus-Article-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3651 (make-local-variable 'page-delimiter)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3652 (setq page-delimiter gnus-page-delimiter)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3653 (make-local-variable 'mail-header-separator)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3654 (setq mail-header-separator "") ;For caesar function.
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 853
diff changeset
3655 (buffer-disable-undo (current-buffer))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3656 (setq buffer-read-only t) ;Disable modification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3657 (run-hooks 'gnus-Article-mode-hook))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3658
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3659 (defun gnus-Article-setup-buffer ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3660 "Initialize Article mode buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3661 (or (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3662 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3663 (set-buffer (get-buffer-create gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3664 (gnus-Article-mode))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3665 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3666
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3667 (defun gnus-Article-prepare (article &optional all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3668 "Prepare ARTICLE in Article mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3669 If optional argument ALL-HEADERS is non-nil, all headers are inserted."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3670 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3671 (set-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3672 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3673 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3674 (if (gnus-request-article article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3675 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3676 ;; Prepare article buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3677 (insert-buffer-substring nntp-server-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3678 (setq gnus-have-all-headers (or all-headers gnus-show-all-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3679 (if (and (numberp article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3680 (not (eq article gnus-current-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3681 ;; Seems me that a new article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3682 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3683 ;; gnus-current-article must be an article number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3684 (setq gnus-last-article gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3685 (setq gnus-current-article article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3686 (setq gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3687 (gnus-find-header-by-number gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3688 gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3689 ;; Clear articles history only when articles are
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3690 ;; retrieved by article numbers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3691 (setq gnus-current-history nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3692 (run-hooks 'gnus-Mark-article-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3693 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3694 ;; Hooks for modifying contents of the article. This hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3695 ;; must be called before being narrowed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3696 (run-hooks 'gnus-Article-prepare-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3697 ;; Delete unnecessary headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3698 (or gnus-have-all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3699 (gnus-Article-delete-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3700 ;; Do page break.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3701 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3702 (if gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3703 (gnus-narrow-to-page))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3704 ;; Next function must be called after setting
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3705 ;; `gnus-current-article' variable and narrowed to page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3706 (gnus-Article-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3707 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3708 (if (numberp article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3709 (gnus-Subject-mark-as-read article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3710 (ding) (message "No such article (may be canceled)"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3711 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3712
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3713 (defun gnus-Article-show-all-headers ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3714 "Show all article headers in Article mode buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3715 (or gnus-have-all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3716 (gnus-Article-prepare gnus-current-article t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3717
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3718 ;;(defun gnus-Article-set-mode-line ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3719 ;; "Set Article mode line string."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3720 ;; (setq mode-line-buffer-identification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3721 ;; (list 17
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3722 ;; (format "GNUS: %s {%d-%d} %d"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3723 ;; gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3724 ;; gnus-newsgroup-begin
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3725 ;; gnus-newsgroup-end
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3726 ;; gnus-current-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3727 ;; )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3728 ;; (set-buffer-modified-p t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3729
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3730 (defun gnus-Article-set-mode-line ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3731 "Set Article mode line string."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3732 (let ((unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3733 (- (length gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3734 (length (gnus-intersection
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3735 gnus-newsgroup-unreads gnus-newsgroup-marked))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3736 (unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3737 (- (length gnus-newsgroup-unselected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3738 (length (gnus-intersection
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3739 gnus-newsgroup-unselected gnus-newsgroup-marked)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3740 (setq mode-line-buffer-identification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3741 (list 17
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3742 (format "GNUS: %s{%d} %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3743 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3744 gnus-current-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3745 ;; This is proposed by tale@pawl.rpi.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3746 (cond ((and (zerop unmarked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3747 (zerop unselected))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3748 " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3749 ((zerop unselected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3750 (format "%d more" unmarked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3751 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3752 (format "%d(+%d) more" unmarked unselected)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3753 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3754 (set-buffer-modified-p t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3755
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3756 (defun gnus-Article-delete-headers ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3757 "Delete unnecessary headers."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3758 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3759 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3760 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3761 (narrow-to-region (point-min)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3762 (progn (search-forward "\n\n" nil 'move) (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3763 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3764 (and (stringp gnus-ignored-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3765 (while (re-search-forward gnus-ignored-headers nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3766 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3767 (delete-region (point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3768 (progn (re-search-forward "\n[^ \t]")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3769 (forward-char -1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3770 (point)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3771 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3772
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3773 ;; Working on article's buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3774
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3775 (defun gnus-Article-next-page (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3776 "Show next page of current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3777 If end of article, return non-nil. Otherwise return nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3778 Argument LINES specifies lines to be scrolled up."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3779 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3780 (move-to-window-line -1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3781 ;; Fixed by enami@ptgd.sony.co.jp (enami tsugutomo)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3782 (if (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3783 (end-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3784 (and (pos-visible-in-window-p) ;Not continuation line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3785 (eobp)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3786 ;; Nothing in this page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3787 (if (or (not gnus-break-pages)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3788 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3789 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3790 (widen) (forward-line 1) (eobp)))) ;Real end-of-buffer?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3791 t ;Nothing more.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3792 (gnus-narrow-to-page 1) ;Go to next page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3793 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3794 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3795 ;; More in this page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3796 (condition-case ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3797 (scroll-up lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3798 (end-of-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3799 ;; Long lines may cause an end-of-buffer error.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3800 (goto-char (point-max))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3801 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3802 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3803
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3804 (defun gnus-Article-prev-page (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3805 "Show previous page of current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3806 Argument LINES specifies lines to be scrolled down."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3807 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3808 (move-to-window-line 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3809 (if (and gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3810 (bobp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3811 (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3812 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3813 (gnus-narrow-to-page -1) ;Go to previous page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3814 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3815 (recenter -1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3816 (scroll-down lines)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3817
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3818 (defun gnus-Article-next-digest (nth)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3819 "Move to head of NTH next digested message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3820 Set mark at end of digested message."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3821 ;; Stop page breaking in digest mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3822 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3823 (end-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3824 ;; Skip NTH - 1 digest.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3825 ;; Suggested by Khalid Sattar <admin@cs.exeter.ac.uk>.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3826 ;; Digest separator is customizable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3827 ;; Suggested by Skip Montanaro <montanaro@sprite.crd.ge.com>.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3828 (while (and (> nth 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3829 (re-search-forward gnus-digest-separator nil 'move))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3830 (setq nth (1- nth)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3831 (if (re-search-forward gnus-digest-separator nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3832 (let ((begin (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3833 ;; Search for end of this message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3834 (end-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3835 (if (re-search-forward gnus-digest-separator nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3836 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3837 (search-backward "\n\n") ;This may be incorrect.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3838 (forward-line 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3839 (goto-char (point-max)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3840 (push-mark) ;Set mark at end of digested message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3841 (goto-char begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3842 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3843 ;; Show From: and Subject: fields.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3844 (recenter 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3845 (message "End of message")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3846 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3847
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3848 (defun gnus-Article-prev-digest (nth)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3849 "Move to head of NTH previous digested message."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3850 ;; Stop page breaking in digest mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3851 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3852 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3853 ;; Skip NTH - 1 digest.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3854 ;; Suggested by Khalid Sattar <admin@cs.exeter.ac.uk>.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3855 ;; Digest separator is customizable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3856 ;; Suggested by Skip Montanaro <montanaro@sprite.crd.ge.com>.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3857 (while (and (> nth 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3858 (re-search-backward gnus-digest-separator nil 'move))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3859 (setq nth (1- nth)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3860 (if (re-search-backward gnus-digest-separator nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3861 (let ((begin (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3862 ;; Search for end of this message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3863 (end-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3864 (if (re-search-forward gnus-digest-separator nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3865 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3866 (search-backward "\n\n") ;This may be incorrect.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3867 (forward-line 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3868 (goto-char (point-max)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3869 (push-mark) ;Set mark at end of digested message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3870 (goto-char begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3871 ;; Show From: and Subject: fields.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3872 (recenter 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3873 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3874 (message "Top of message")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3875 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3876
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3877 (defun gnus-Article-refer-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3878 "Read article specified by message-id around point."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3879 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3880 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3881 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3882 (re-search-forward ">" nil t) ;Move point to end of "<....>".
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3883 (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3884 (let ((message-id
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3885 (buffer-substring (match-beginning 1) (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3886 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3887 (gnus-Subject-refer-article message-id))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3888 (error "No references around point"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3889 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3890
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3891 (defun gnus-Article-pop-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3892 "Pop up article history."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3893 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3894 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3895 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3896 (gnus-Subject-refer-article nil)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3897
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3898 (defun gnus-Article-show-subjects ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3899 "Reconfigure windows to show headers."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3900 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3901 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3902 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3903 (gnus-Subject-goto-subject gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3904
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3905 (defun gnus-Article-describe-briefly ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3906 "Describe Article mode commands briefly."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3907 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3908 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3909 (concat
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3910 (substitute-command-keys "\\[gnus-Article-next-page]:Next page ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3911 (substitute-command-keys "\\[gnus-Article-prev-page]:Prev page ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3912 (substitute-command-keys "\\[gnus-Article-show-subjects]:Show headers ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3913 (substitute-command-keys "\\[gnus-Info-find-node]:Run Info ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3914 (substitute-command-keys "\\[gnus-Article-describe-briefly]:This help")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3915 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3916
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3917
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3918 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3919 ;;; GNUS KILL-File Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3920 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3921
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3922 (if gnus-Kill-file-mode-map
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3923 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3924 (setq gnus-Kill-file-mode-map (copy-keymap emacs-lisp-mode-map))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3925 (define-key gnus-Kill-file-mode-map "\C-c\C-k\C-s" 'gnus-Kill-file-kill-by-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3926 (define-key gnus-Kill-file-mode-map "\C-c\C-k\C-a" 'gnus-Kill-file-kill-by-author)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3927 (define-key gnus-Kill-file-mode-map "\C-c\C-a" 'gnus-Kill-file-apply-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3928 (define-key gnus-Kill-file-mode-map "\C-c\C-e" 'gnus-Kill-file-apply-last-sexp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3929 (define-key gnus-Kill-file-mode-map "\C-c\C-c" 'gnus-Kill-file-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3930 (define-key gnus-Kill-file-mode-map "\C-c\C-i" 'gnus-Info-find-node))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3931
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3932 (defun gnus-Kill-file-mode ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3933 "Major mode for editing KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3934
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3935 In addition to Emacs-Lisp Mode, the following commands are available:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3936
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3937 \\[gnus-Kill-file-kill-by-subject] Insert KILL command for current subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3938 \\[gnus-Kill-file-kill-by-author] Insert KILL command for current author.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3939 \\[gnus-Kill-file-apply-buffer] Apply current buffer to selected newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3940 \\[gnus-Kill-file-apply-last-sexp] Apply sexp before point to selected newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3941 \\[gnus-Kill-file-exit] Save file and exit editing KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3942 \\[gnus-Info-find-node] Read Info about KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3943
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3944 A KILL file contains lisp expressions to be applied to a selected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3945 newsgroup. The purpose is to mark articles as read on the basis of
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3946 some set of regexps. A global KILL file is applied to every newsgroup,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3947 and a local KILL file is applied to a specified newsgroup. Since a
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3948 global KILL file is applied to every newsgroup, for better performance
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3949 use a local one.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3950
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3951 A KILL file can contain any kind of Emacs lisp expressions expected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3952 to be evaluated in the Subject buffer. Writing lisp programs for this
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3953 purpose is not so easy because the internal working of GNUS must be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3954 well-known. For this reason, GNUS provides a general function which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3955 does this easily for non-Lisp programmers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3956
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3957 The `gnus-kill' function executes commands available in Subject Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3958 by their key sequences. `gnus-kill' should be called with FIELD,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3959 REGEXP and optional COMMAND and ALL. FIELD is a string representing
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3960 the header field or an empty string. If FIELD is an empty string, the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3961 entire article body is searched for. REGEXP is a string which is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3962 compared with FIELD value. COMMAND is a string representing a valid
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3963 key sequence in Subject Mode or Lisp expression. COMMAND is default to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3964 '(gnus-Subject-mark-as-read nil \"X\"). Make sure that COMMAND is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3965 executed in the Subject buffer. If the second optional argument ALL
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3966 is non-nil, the COMMAND is applied to articles which are already
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3967 marked as read or unread. Articles which are marked are skipped over
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3968 by default.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3969
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3970 For example, if you want to mark articles of which subjects contain
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3971 the string `AI' as read, a possible KILL file may look like:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3972
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3973 (gnus-kill \"Subject\" \"AI\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3974
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3975 If you want to mark articles with `D' instead of `X', you can use
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3976 the following expression:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3977
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3978 (gnus-kill \"Subject\" \"AI\" \"d\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3979
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3980 In this example it is assumed that the command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3981 `gnus-Subject-mark-as-read-forward' is assigned to `d' in Subject Mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3982
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3983 It is possible to delete unnecessary headers which are marked with
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3984 `X' in a KILL file as follows:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3985
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3986 (gnus-expunge \"X\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3987
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3988 If the Subject buffer is empty after applying KILL files, GNUS will
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3989 exit the selected newsgroup normally. If headers which are marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3990 with `D' are deleted in a KILL file, it is impossible to read articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3991 which are marked as read in the previous GNUS sessions. Marks other
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3992 than `D' should be used for articles which should really be deleted.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3993
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3994 Entry to this mode calls emacs-lisp-mode-hook and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3995 gnus-Kill-file-mode-hook with no arguments, if that value is non-nil."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3996 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3997 (kill-all-local-variables)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3998 (use-local-map gnus-Kill-file-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3999 (set-syntax-table emacs-lisp-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4000 (setq major-mode 'gnus-Kill-file-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4001 (setq mode-name "KILL-File")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4002 (lisp-mode-variables nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4003 (run-hooks 'emacs-lisp-mode-hook 'gnus-Kill-file-mode-hook))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4004
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4005 (defun gnus-Kill-file-edit-file (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4006 "Begin editing a KILL file of NEWSGROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4007 If NEWSGROUP is nil, the global KILL file is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4008 (interactive "sNewsgroup: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4009 (let ((file (gnus-newsgroup-kill-file newsgroup)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4010 (gnus-make-directory (file-name-directory file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4011 ;; Save current window configuration if this is first invocation.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4012 (or (and (get-file-buffer file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4013 (get-buffer-window (get-file-buffer file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4014 (setq gnus-winconf-kill-file (current-window-configuration)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4015 ;; Hack windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4016 (let ((buffer (find-file-noselect file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4017 (cond ((get-buffer-window buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4018 (pop-to-buffer buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4019 ((eq major-mode 'gnus-Group-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4020 (gnus-configure-windows '(1 0 0)) ;Take all windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4021 (pop-to-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4022 (let ((gnus-Subject-buffer buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4023 (gnus-configure-windows '(1 1 0)) ;Split into two.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4024 (pop-to-buffer buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4025 ((eq major-mode 'gnus-Subject-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4026 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4027 (pop-to-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4028 (bury-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4029 (switch-to-buffer buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4030 (t ;No good rules.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4031 (find-file-other-window file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4032 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4033 (gnus-Kill-file-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4034 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4035
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4036 (defun gnus-Kill-file-kill-by-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4037 "Insert KILL command for current subject."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4038 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4039 (insert
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4040 (format "(gnus-kill \"Subject\" %s)\n"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4041 (prin1-to-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4042 (if gnus-current-kill-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4043 (regexp-quote
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4044 (nntp-header-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4045 (gnus-find-header-by-number gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4046 gnus-current-kill-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4047 "")))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4048
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4049 (defun gnus-Kill-file-kill-by-author ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4050 "Insert KILL command for current author."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4051 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4052 (insert
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4053 (format "(gnus-kill \"From\" %s)\n"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4054 (prin1-to-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4055 (if gnus-current-kill-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4056 (regexp-quote
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4057 (nntp-header-from
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4058 (gnus-find-header-by-number gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4059 gnus-current-kill-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4060 "")))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4061
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4062 (defun gnus-Kill-file-apply-buffer ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4063 "Apply current buffer to current newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4064 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4065 (if (and gnus-current-kill-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4066 (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4067 ;; Assume newsgroup is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4068 (let ((string (concat "(progn \n" (buffer-string) "\n)" )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4069 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4070 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4071 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4072 (eval (car (read-from-string string))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4073 (ding) (message "No newsgroup is selected.")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4074
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4075 (defun gnus-Kill-file-apply-last-sexp ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4076 "Apply sexp before point in current buffer to current newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4077 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4078 (if (and gnus-current-kill-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4079 (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4080 ;; Assume newsgroup is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4081 (let ((string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4082 (buffer-substring
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4083 (save-excursion (forward-sexp -1) (point)) (point))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4084 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4085 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4086 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4087 (eval (car (read-from-string string))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4088 (ding) (message "No newsgroup is selected.")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4089
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4090 (defun gnus-Kill-file-exit ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4091 "Save a KILL file, then return to the previous buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4092 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4093 (save-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4094 (let ((killbuf (current-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4095 ;; We don't want to return to Article buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4096 (and (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4097 (bury-buffer (get-buffer gnus-Article-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4098 ;; Delete the KILL file windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4099 (delete-windows-on killbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4100 ;; Restore last window configuration if available.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4101 (and gnus-winconf-kill-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4102 (set-window-configuration gnus-winconf-kill-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4103 (setq gnus-winconf-kill-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4104 ;; Kill the KILL file buffer. Suggested by tale@pawl.rpi.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4105 (kill-buffer killbuf)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4106
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4107
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4108 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4109 ;;; Utility functions
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4110 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4111
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4112 ;; Basic ideas by emv@math.lsa.umich.edu (Edward Vielmetti)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4113
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4114 (defun gnus-batch-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4115 "Run batched KILL.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4116 Usage: emacs -batch -l gnus -f gnus-batch-kill NEWSGROUP ..."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4117 (if (not noninteractive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4118 (error "gnus-batch-kill is to be used only with -batch"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4119 (let* ((group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4120 (subscribed nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4121 (newsrc nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4122 (yes-and-no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4123 (gnus-parse-n-options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4124 (apply (function concat)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4125 (mapcar (function (lambda (g) (concat g " ")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4126 command-line-args-left))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4127 (yes (car yes-and-no))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4128 (no (cdr yes-and-no))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4129 ;; Disable verbose message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4130 (gnus-novice-user nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4131 (gnus-large-newsgroup nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4132 (nntp-large-newsgroup nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4133 ;; Eat all arguments.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4134 (setq command-line-args-left nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4135 ;; Startup GNUS.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4136 (gnus)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4137 ;; Apply kills to specified newsgroups in command line arguments.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4138 (setq newsrc (copy-sequence gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4139 (while newsrc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4140 (setq group (car (car newsrc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4141 (setq subscribed (nth 1 (car newsrc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4142 (setq newsrc (cdr newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4143 (if (and subscribed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4144 (not (zerop (nth 1 (gnus-gethash group gnus-unread-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4145 (if yes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4146 (string-match yes group) t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4147 (or (null no)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4148 (not (string-match no group))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4149 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4150 (gnus-Subject-read-group group nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4151 (if (eq (current-buffer) (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4152 (gnus-Subject-exit t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4153 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4154 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4155 ;; Finally, exit Emacs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4156 (set-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4157 (gnus-Group-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4158 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4159
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4160 (defun gnus-Numeric-save-name (newsgroup headers &optional last-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4161 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4162 If variable `gnus-use-long-file-name' is nil, it is ~/News/News.group/num.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4163 Otherwise, it is like ~/News/news/group/num."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4164 (let ((default
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4165 (expand-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4166 (concat (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4167 (capitalize newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4168 (gnus-newsgroup-directory-form newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4169 "/" (int-to-string (nntp-header-number headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4170 (or gnus-article-save-directory "~/News"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4171 (if (and last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4172 (string-equal (file-name-directory default)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4173 (file-name-directory last-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4174 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4175 default
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4176 (or last-file default))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4177
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4178 (defun gnus-numeric-save-name (newsgroup headers &optional last-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4179 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4180 If variable `gnus-use-long-file-name' is nil, it is ~/News/news.group/num.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4181 Otherwise, it is like ~/News/news/group/num."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4182 (let ((default
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4183 (expand-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4184 (concat (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4185 newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4186 (gnus-newsgroup-directory-form newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4187 "/" (int-to-string (nntp-header-number headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4188 (or gnus-article-save-directory "~/News"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4189 (if (and last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4190 (string-equal (file-name-directory default)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4191 (file-name-directory last-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4192 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4193 default
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4194 (or last-file default))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4195
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4196 (defun gnus-Plain-save-name (newsgroup headers &optional last-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4197 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4198 If variable `gnus-use-long-file-name' is nil, it is ~/News/News.group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4199 Otherwise, it is like ~/News/news/group/news."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4200 (or last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4201 (expand-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4202 (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4203 (capitalize newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4204 (concat (gnus-newsgroup-directory-form newsgroup) "/news"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4205 (or gnus-article-save-directory "~/News"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4206
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4207 (defun gnus-plain-save-name (newsgroup headers &optional last-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4208 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4209 If variable `gnus-use-long-file-name' is nil, it is ~/News/news.group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4210 Otherwise, it is like ~/News/news/group/news."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4211 (or last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4212 (expand-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4213 (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4214 newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4215 (concat (gnus-newsgroup-directory-form newsgroup) "/news"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4216 (or gnus-article-save-directory "~/News"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4217
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4218 (defun gnus-Folder-save-name (newsgroup headers &optional last-folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4219 "Generate folder name from NEWSGROUP, HEADERS, and optional LAST-FOLDER.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4220 If variable `gnus-use-long-file-name' is nil, it is +News.group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4221 Otherwise, it is like +news/group."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4222 (or last-folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4223 (concat "+"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4224 (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4225 (capitalize newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4226 (gnus-newsgroup-directory-form newsgroup)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4227
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4228 (defun gnus-folder-save-name (newsgroup headers &optional last-folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4229 "Generate folder name from NEWSGROUP, HEADERS, and optional LAST-FOLDER.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4230 If variable `gnus-use-long-file-name' is nil, it is +news.group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4231 Otherwise, it is like +news/group."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4232 (or last-folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4233 (concat "+"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4234 (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4235 newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4236 (gnus-newsgroup-directory-form newsgroup)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4237
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4238 (defun gnus-apply-kill-file ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4239 "Apply KILL file to the current newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4240 ;; Apply the global KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4241 (load (gnus-newsgroup-kill-file nil) t nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4242 ;; And then apply the local KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4243 (load (gnus-newsgroup-kill-file gnus-newsgroup-name) t nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4244
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4245 (defun gnus-Newsgroup-kill-file (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4246 "Return the name of a KILL file of NEWSGROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4247 If NEWSGROUP is nil, return the global KILL file instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4248 (cond ((or (null newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4249 (string-equal newsgroup ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4250 ;; The global KILL file is placed at top of the directory.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4251 (expand-file-name gnus-kill-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4252 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4253 (gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4254 ;; Append ".KILL" to capitalized newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4255 (expand-file-name (concat (capitalize newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4256 "." gnus-kill-file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4257 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4258 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4259 ;; Place "KILL" under the hierarchical directory.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4260 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4261 "/" gnus-kill-file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4262 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4263 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4264
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4265 (defun gnus-newsgroup-kill-file (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4266 "Return the name of a KILL file of NEWSGROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4267 If NEWSGROUP is nil, return the global KILL file instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4268 (cond ((or (null newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4269 (string-equal newsgroup ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4270 ;; The global KILL file is placed at top of the directory.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4271 (expand-file-name gnus-kill-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4272 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4273 (gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4274 ;; Append ".KILL" to newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4275 (expand-file-name (concat newsgroup "." gnus-kill-file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4276 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4277 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4278 ;; Place "KILL" under the hierarchical directory.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4279 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4280 "/" gnus-kill-file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4281 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4282 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4283
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4284 (defun gnus-newsgroup-directory-form (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4285 "Make hierarchical directory name from NEWSGROUP name."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4286 (let ((newsgroup (substring newsgroup 0)) ;Copy string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4287 (len (length newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4288 (idx 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4289 ;; Replace all occurence of `.' with `/'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4290 (while (< idx len)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4291 (if (= (aref newsgroup idx) ?.)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4292 (aset newsgroup idx ?/))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4293 (setq idx (1+ idx)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4294 newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4295 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4296
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4297 (defun gnus-make-directory (directory)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4298 "Make DIRECTORY recursively."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4299 (let ((directory (expand-file-name directory default-directory)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4300 (or (file-exists-p directory)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4301 (gnus-make-directory-1 "" directory))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4302 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4303
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4304 (defun gnus-make-directory-1 (head tail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4305 (cond ((string-match "^/\\([^/]+\\)" tail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4306 (setq head
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4307 (concat (file-name-as-directory head)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4308 (substring tail (match-beginning 1) (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4309 (or (file-exists-p head)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4310 (call-process "mkdir" nil nil nil head))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4311 (gnus-make-directory-1 head (substring tail (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4312 ((string-equal tail "") t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4313 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4314
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4315 (defun gnus-simplify-subject (subject &optional re-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4316 "Remove `Re:' and words in parentheses.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4317 If optional argument RE-ONLY is non-nil, strip `Re:' only."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4318 (let ((case-fold-search t)) ;Ignore case.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4319 ;; Remove `Re:' and `Re^N:'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4320 (if (string-match "\\`\\(re\\(\\^[0-9]+\\)?:[ \t]+\\)+" subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4321 (setq subject (substring subject (match-end 0))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4322 ;; Remove words in parentheses from end.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4323 (or re-only
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4324 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4325 (setq subject (substring subject 0 (match-beginning 0)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4326 ;; Return subject string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4327 subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4328 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4329
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4330 (defun gnus-optional-lines-and-from (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4331 "Return a string like `NNN:AUTHOR' from HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4332 (let ((name-length (length "umerin@photon")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4333 (substring (format "%3d:%s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4334 ;; Lines of the article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4335 ;; Suggested by dana@bellcore.com.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4336 (nntp-header-lines header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4337 ;; Its author.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4338 (concat (mail-strip-quoted-names
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4339 (nntp-header-from header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4340 (make-string name-length ? )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4341 ;; 4 stands for length of `NNN:'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4342 0 (+ 4 name-length))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4343
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4344 (defun gnus-optional-lines (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4345 "Return a string like `NNN' from HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4346 (format "%4d" (nntp-header-lines header)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4347
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4348 (defun gnus-sort-headers (predicate &optional reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4349 "Sort current group headers by PREDICATE safely.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4350 *Safely* means C-g quitting is disabled during sorting.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4351 Optional argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4352 (let ((inhibit-quit t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4353 (setq gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4354 (if reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4355 (nreverse (sort (nreverse gnus-newsgroup-headers) predicate))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4356 (sort gnus-newsgroup-headers predicate)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4357 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4358
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4359 (defun gnus-string-lessp (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4360 "Return T if first arg string is less than second in lexicographic order.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4361 If case-fold-search is non-nil, case of letters is ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4362 (if case-fold-search
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4363 (string-lessp (downcase a) (downcase b)) (string-lessp a b)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4364
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4365 (defun gnus-date-lessp (date1 date2)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4366 "Return T if DATE1 is earlyer than DATE2."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4367 (string-lessp (gnus-comparable-date date1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4368 (gnus-comparable-date date2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4369
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4370 (defun gnus-comparable-date (date)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4371 "Make comparable string by string-lessp from DATE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4372 (let ((month '(("JAN" . " 1")("FEB" . " 2")("MAR" . " 3")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4373 ("APR" . " 4")("MAY" . " 5")("JUN" . " 6")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4374 ("JUL" . " 7")("AUG" . " 8")("SEP" . " 9")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4375 ("OCT" . "10")("NOV" . "11")("DEC" . "12")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4376 (date (or date "")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4377 ;; Can understand the following styles:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4378 ;; (1) 14 Apr 89 03:20:12 GMT
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4379 ;; (2) Fri, 17 Mar 89 4:01:33 GMT
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4380 (if (string-match
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4381 "\\([0-9]+\\) \\([^ ,]+\\) \\([0-9]+\\) \\([0-9:]+\\)" date)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4382 (concat
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4383 ;; Year
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4384 (substring date (match-beginning 3) (match-end 3))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4385 ;; Month
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4386 (cdr
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4387 (assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4388 (upcase (substring date (match-beginning 2) (match-end 2))) month))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4389 ;; Day
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4390 (format "%2d" (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4391 (substring date
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4392 (match-beginning 1) (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4393 ;; Time
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4394 (substring date (match-beginning 4) (match-end 4)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4395 ;; Cannot understand DATE string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4396 date
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4397 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4398 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4399
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4400 (defun gnus-fetch-field (field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4401 "Return the value of the header FIELD of current article."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4402 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4403 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4404 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4405 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4406 (narrow-to-region (point-min)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4407 (progn (search-forward "\n\n" nil 'move) (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4408 (mail-fetch-field field))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4409
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4410 (fset 'gnus-expunge 'gnus-Subject-delete-marked-with)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4411
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4412 (defun gnus-kill (field regexp &optional command all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4413 "If FIELD of an article matches REGEXP, execute COMMAND.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4414 Optional third argument COMMAND is default to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4415 (gnus-Subject-mark-as-read nil \"X\").
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4416 If optional fourth argument ALL is non-nil, articles marked are also applied
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4417 to. If FIELD is an empty string (or nil), entire article body is searched for.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4418 COMMAND must be a lisp expression or a string representing a key sequence."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4419 ;; We don't want to change current point nor window configuration.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4420 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4421 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4422 ;; Selected window must be Subject mode buffer to execute
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4423 ;; keyboard macros correctly. See command_loop_1.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4424 (switch-to-buffer gnus-Subject-buffer 'norecord)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4425 (goto-char (point-min)) ;From the beginning.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4426 (if (null command)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4427 (setq command '(gnus-Subject-mark-as-read nil "X")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4428 (gnus-execute field regexp command nil (not all))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4429 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4430
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4431 (defun gnus-execute (field regexp form &optional backward ignore-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4432 "If FIELD of article header matches REGEXP, execute lisp FORM (or a string).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4433 If FIELD is an empty string (or nil), entire article body is searched for.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4434 If optional fifth argument BACKWARD is non-nil, do backward instead.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4435 If optional sixth argument IGNORE-MARKED is non-nil, articles which are
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4436 marked as read or unread are ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4437 (let ((function nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4438 (header nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4439 (article nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4440 (if (string-equal field "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4441 (setq field nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4442 (if (null field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4443 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4444 (or (stringp field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4445 (setq field (symbol-name field)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4446 ;; Get access function of header filed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4447 (setq function (intern-soft (concat "gnus-header-" (downcase field))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4448 (if (and function (fboundp function))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4449 (setq function (symbol-function function))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4450 (error "Unknown header field: \"%s\"" field)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4451 ;; Make FORM funcallable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4452 (if (and (listp form) (not (eq (car form) 'lambda)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4453 (setq form (list 'lambda nil form)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4454 ;; Starting from the current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4455 (or (and ignore-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4456 ;; Articles marked as read and unread should be ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4457 (setq article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4458 (or (not (memq article gnus-newsgroup-unreads)) ;Marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4459 (memq article gnus-newsgroup-marked) ;Marked as unread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4460 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4461 (gnus-execute-1 function regexp form))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4462 (while (gnus-Subject-search-subject backward ignore-marked nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4463 (gnus-execute-1 function regexp form))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4464 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4465
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4466 (defun gnus-execute-1 (function regexp form)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4467 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4468 ;; The point of Subject mode buffer must be saved during execution.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4469 (let ((article (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4470 (if (null article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4471 nil ;Nothing to do.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4472 (if function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4473 ;; Compare with header field.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4474 (let ((header (gnus-find-header-by-number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4475 gnus-newsgroup-headers article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4476 (value nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4477 (and header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4478 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4479 (setq value (funcall function header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4480 ;; Number (Lines:) or symbol must be converted to string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4481 (or (stringp value)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4482 (setq value (prin1-to-string value)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4483 (string-match regexp value))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4484 (if (stringp form) ;Keyboard macro.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4485 (execute-kbd-macro form)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4486 (funcall form))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4487 ;; Search article body.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4488 (let ((gnus-current-article nil) ;Save article pointer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4489 (gnus-last-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4490 (gnus-break-pages nil) ;No need to break pages.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4491 (gnus-Mark-article-hook nil)) ;Inhibit marking as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4492 (message "Searching for article: %d..." article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4493 (gnus-Article-setup-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4494 (gnus-Article-prepare article t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4495 (if (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4496 (set-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4497 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4498 (re-search-forward regexp nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4499 (if (stringp form) ;Keyboard macro.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4500 (execute-kbd-macro form)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4501 (funcall form))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4502 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4503 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4504
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4505 ;;; caesar-region written by phr@prep.ai.mit.edu Nov 86
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4506 ;;; modified by tower@prep Nov 86
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4507 ;;; Modified by umerin@flab.flab.Fujitsu.JUNET for ROT47.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4508
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4509 (defun gnus-caesar-region (&optional n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4510 "Caesar rotation of region by N, default 13, for decrypting netnews.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4511 ROT47 will be performed for Japanese text in any case."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4512 (interactive (if current-prefix-arg ; Was there a prefix arg?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4513 (list (prefix-numeric-value current-prefix-arg))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4514 (list nil)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4515 (cond ((not (numberp n)) (setq n 13))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4516 ((< n 0) (setq n (- 26 (% (- n) 26))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4517 (t (setq n (% n 26)))) ;canonicalize N
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4518 (if (not (zerop n)) ; no action needed for a rot of 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4519 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4520 (if (or (not (boundp 'caesar-translate-table))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4521 (/= (aref caesar-translate-table ?a) (+ ?a n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4522 (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4523 (message "Building caesar-translate-table...")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4524 (setq caesar-translate-table (make-vector 256 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4525 (while (< i 256)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4526 (aset caesar-translate-table i i)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4527 (setq i (1+ i)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4528 (setq lower (concat lower lower) upper (upcase lower) i 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4529 (while (< i 26)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4530 (aset caesar-translate-table (+ ?a i) (aref lower (+ i n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4531 (aset caesar-translate-table (+ ?A i) (aref upper (+ i n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4532 (setq i (1+ i)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4533 ;; ROT47 for Japanese text.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4534 ;; Thanks to ichikawa@flab.fujitsu.junet.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4535 (setq i 161)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4536 (let ((t1 (logior ?O 128))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4537 (t2 (logior ?! 128))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4538 (t3 (logior ?~ 128)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4539 (while (< i 256)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4540 (aset caesar-translate-table i
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4541 (let ((v (aref caesar-translate-table i)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4542 (if (<= v t1) (if (< v t2) v (+ v 47))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4543 (if (<= v t3) (- v 47) v))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4544 (setq i (1+ i))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4545 (message "Building caesar-translate-table... done")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4546 (let ((from (region-beginning))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4547 (to (region-end))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4548 (i 0) str len)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4549 (setq str (buffer-substring from to))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4550 (setq len (length str))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4551 (while (< i len)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4552 (aset str i (aref caesar-translate-table (aref str i)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4553 (setq i (1+ i)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4554 (goto-char from)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4555 (delete-region from to)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4556 (insert str)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4557
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4558 ;; Functions accessing headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4559 ;; Functions are more convenient than macros in some case.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4560
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4561 (defun gnus-header-number (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4562 "Return article number in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4563 (nntp-header-number header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4564
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4565 (defun gnus-header-subject (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4566 "Return subject string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4567 (nntp-header-subject header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4568
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4569 (defun gnus-header-from (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4570 "Return author string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4571 (nntp-header-from header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4572
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4573 (defun gnus-header-xref (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4574 "Return xref string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4575 (nntp-header-xref header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4576
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4577 (defun gnus-header-lines (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4578 "Return lines in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4579 (nntp-header-lines header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4580
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4581 (defun gnus-header-date (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4582 "Return date in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4583 (nntp-header-date header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4584
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4585 (defun gnus-header-id (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4586 "Return Id in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4587 (nntp-header-id header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4588
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4589 (defun gnus-header-references (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4590 "Return references in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4591 (nntp-header-references header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4592
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4593
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4594 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4595 ;;; Article savers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4596 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4597
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4598 (defun gnus-output-to-rmail (file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4599 "Append the current article to an Rmail file named FILE-NAME."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4600 (require 'rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4601 ;; Most of these codes are borrowed from rmailout.el.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4602 (setq file-name (expand-file-name file-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4603 (setq rmail-last-rmail-file file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4604 (let ((artbuf (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4605 (tmpbuf (get-buffer-create " *GNUS-output*")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4606 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4607 (or (get-file-buffer file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4608 (file-exists-p file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4609 (if (yes-or-no-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4610 (concat "\"" file-name "\" does not exist, create it? "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4611 (let ((file-buffer (create-file-buffer file-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4612 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4613 (set-buffer file-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4614 (rmail-insert-rmail-file-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4615 (let ((require-final-newline nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4616 (write-region (point-min) (point-max) file-name t 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4617 (kill-buffer file-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4618 (error "Output file does not exist")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4619 (set-buffer tmpbuf)
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 853
diff changeset
4620 (buffer-disable-undo (current-buffer))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4621 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4622 (insert-buffer-substring artbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4623 (gnus-convert-article-to-rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4624 ;; Decide whether to append to a file or to an Emacs buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4625 (let ((outbuf (get-file-buffer file-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4626 (if (not outbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4627 (append-to-file (point-min) (point-max) file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4628 ;; File has been visited, in buffer OUTBUF.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4629 (set-buffer outbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4630 (let ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4631 (msg (and (boundp 'rmail-current-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4632 rmail-current-message)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4633 ;; If MSG is non-nil, buffer is in RMAIL mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4634 (if msg
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4635 (progn (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4636 (narrow-to-region (point-max) (point-max))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4637 (insert-buffer-substring tmpbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4638 (if msg
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4639 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4640 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4641 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4642 (search-backward "\^_")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4643 (narrow-to-region (point) (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4644 (goto-char (1+ (point-min)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4645 (rmail-count-new-messages t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4646 (rmail-show-message msg))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4647 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4648 (kill-buffer tmpbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4649 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4650
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4651 (defun gnus-output-to-file (file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4652 "Append the current article to a file named FILE-NAME."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4653 (setq file-name (expand-file-name file-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4654 (let ((artbuf (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4655 (tmpbuf (get-buffer-create " *GNUS-output*")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4656 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4657 (set-buffer tmpbuf)
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 853
diff changeset
4658 (buffer-disable-undo (current-buffer))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4659 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4660 (insert-buffer-substring artbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4661 ;; Append newline at end of the buffer as separator, and then
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4662 ;; save it to file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4663 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4664 (insert "\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4665 (append-to-file (point-min) (point-max) file-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4666 (kill-buffer tmpbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4667 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4668
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4669 (defun gnus-convert-article-to-rmail ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4670 "Convert article in current buffer to Rmail message format."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4671 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4672 ;; Convert article directly into Babyl format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4673 ;; Suggested by Rob Austein <sra@lcs.mit.edu>
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4674 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4675 (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4676 (while (search-forward "\n\^_" nil t) ;single char
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4677 (replace-match "\n^_")) ;2 chars: "^" and "_"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4678 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4679 (insert "\^_")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4680
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4681 ;;(defun gnus-convert-article-to-rmail ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4682 ;; "Convert article in current buffer to Rmail message format."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4683 ;; (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4684 ;; ;; Insert special header of Unix mail.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4685 ;; (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4686 ;; (insert "From "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4687 ;; (or (mail-strip-quoted-names (mail-fetch-field "from"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4688 ;; "unknown")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4689 ;; " " (current-time-string) "\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4690 ;; ;; Stop quoting `From' since this seems unnecessary in most cases.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4691 ;; ;; ``Quote'' "\nFrom " as "\n>From "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4692 ;; ;;(while (search-forward "\nFrom " nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4693 ;; ;; (forward-char -5)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4694 ;; ;; (insert ?>))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4695 ;; ;; Convert article to babyl format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4696 ;; (rmail-convert-to-babyl-format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4697 ;; ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4698
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4699
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4700 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4701 ;;; Internal functions.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4702 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4703
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4704 (defun gnus-start-news-server (&optional confirm)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4705 "Open network stream to remote NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4706 If optional argument CONFIRM is non-nil, ask you host that NNTP server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4707 is running even if it is defined.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4708 Run gnus-Open-server-hook just before opening news server."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4709 (if (gnus-server-opened)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4710 ;; Stream is already opened.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4711 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4712 ;; Open NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4713 (if (or confirm
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4714 (null gnus-nntp-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4715 (if (and (boundp 'gnus-secondary-servers) gnus-secondary-servers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4716 ;; Read server name with completion.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4717 (setq gnus-nntp-server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4718 (completing-read "NNTP server: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4719 (cons (list gnus-nntp-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4720 gnus-secondary-servers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4721 nil nil gnus-nntp-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4722 (setq gnus-nntp-server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4723 (read-string "NNTP server: " gnus-nntp-server))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4724 ;; If no server name is given, local host is assumed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4725 (if (string-equal gnus-nntp-server "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4726 (setq gnus-nntp-server (system-name)))
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 853
diff changeset
4727 (cond ((string= gnus-nntp-server "::")
716
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
4728 (require 'nnspool)
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
4729 (gnus-define-access-method 'nnspool)
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
4730 (message "Looking up local news spool..."))
f11e7af7c0d9 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 711
diff changeset
4731 ((string-match ":" gnus-nntp-server)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4732 ;; :DIRECTORY
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4733 (require 'mhspool)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4734 (gnus-define-access-method 'mhspool)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4735 (message "Looking up private directory..."))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4736 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4737 (gnus-define-access-method 'nntp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4738 (message "Connecting to NNTP server on %s..." gnus-nntp-server)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4739 (run-hooks 'gnus-Open-server-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4740 (cond ((gnus-open-server gnus-nntp-server gnus-nntp-service))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4741 ((and (stringp (gnus-status-message))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4742 (> (length (gnus-status-message)) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4743 ;; Show valuable message if available.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4744 (error (gnus-status-message)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4745 (t (error "Cannot open NNTP server on %s" gnus-nntp-server)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4746 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4747
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4748 ;; Dummy functions used only once. Should return nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4749 (defun gnus-server-opened () nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4750 (defun gnus-close-server () nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4751
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4752 (defun gnus-define-access-method (method &optional access-methods)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4753 "Define access functions for the access METHOD.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4754 Methods defintion is taken from optional argument ACCESS-METHODS or
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4755 the variable gnus-access-methods."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4756 (let ((bindings
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4757 (cdr (assoc method (or access-methods gnus-access-methods)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4758 (if (null bindings)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4759 (error "Unknown access method: %s" method)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4760 ;; Should not use symbol-function here since overload does not work.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4761 (while bindings
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4762 (fset (car (car bindings)) (cdr (car bindings)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4763 (setq bindings (cdr bindings)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4764 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4765
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4766 (defun gnus-select-newsgroup (group &optional show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4767 "Select newsgroup GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4768 If optional argument SHOW-ALL is non-nil, all of articles in the group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4769 are selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4770 (if (gnus-request-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4771 (let ((articles nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4772 (setq gnus-newsgroup-name group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4773 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4774 (gnus-uncompress-sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4775 (nthcdr 2 (gnus-gethash group gnus-unread-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4776 (cond (show-all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4777 ;; Select all active articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4778 (setq articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4779 (gnus-uncompress-sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4780 (nthcdr 2 (gnus-gethash group gnus-active-hashtb)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4781 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4782 ;; Select unread articles only.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4783 (setq articles gnus-newsgroup-unreads)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4784 ;; Require confirmation if selecting large newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4785 (setq gnus-newsgroup-unselected nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4786 (if (not (numberp gnus-large-newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4787 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4788 (let ((selected nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4789 (number (length articles)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4790 (if (> number gnus-large-newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4791 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4792 (condition-case ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4793 (let ((input
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4794 (read-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4795 (format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4796 "How many articles from %s (default %d): "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4797 gnus-newsgroup-name number))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4798 (setq selected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4799 (if (string-equal input "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4800 number (string-to-int input))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4801 (quit
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4802 (setq selected 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4803 (cond ((and (> selected 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4804 (< selected number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4805 ;; Select last N articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4806 (setq articles (nthcdr (- number selected) articles)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4807 ((and (< selected 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4808 (< (- 0 selected) number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4809 ;; Select first N articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4810 (setq selected (- 0 selected))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4811 (setq articles (copy-sequence articles))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4812 (setcdr (nthcdr (1- selected) articles) nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4813 ((zerop selected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4814 (setq articles nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4815 ;; Otherwise select all.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4816 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4817 ;; Get unselected unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4818 (setq gnus-newsgroup-unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4819 (gnus-set-difference gnus-newsgroup-unreads articles))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4820 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4821 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4822 ;; Get headers list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4823 (setq gnus-newsgroup-headers (gnus-retrieve-headers articles))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4824 ;; UNREADS may contain expired articles, so we have to remove
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4825 ;; them from the list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4826 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4827 (gnus-intersection gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4828 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4829 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4830 (lambda (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4831 (nntp-header-number header)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4832 gnus-newsgroup-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4833 ;; Marked article must be a subset of unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4834 (setq gnus-newsgroup-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4835 (gnus-intersection (append gnus-newsgroup-unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4836 gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4837 (cdr (assoc group gnus-marked-assoc))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4838 ;; First and last article in this newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4839 (setq gnus-newsgroup-begin
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4840 (if gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4841 (nntp-header-number (car gnus-newsgroup-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4842 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4843 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4844 (setq gnus-newsgroup-end
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4845 (if gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4846 (nntp-header-number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4847 (gnus-last-element gnus-newsgroup-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4848 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4849 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4850 ;; File name that an article was saved last.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4851 (setq gnus-newsgroup-last-rmail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4852 (setq gnus-newsgroup-last-mail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4853 (setq gnus-newsgroup-last-folder nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4854 (setq gnus-newsgroup-last-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4855 ;; Reset article pointer etc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4856 (setq gnus-current-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4857 (setq gnus-current-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4858 (setq gnus-current-history nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4859 (setq gnus-have-all-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4860 (setq gnus-last-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4861 ;; GROUP is successfully selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4862 t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4863 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4864 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4865
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4866 (defun gnus-more-header-backward ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4867 "Find new header backward."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4868 (let ((first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4869 (car (nth 2 (gnus-gethash gnus-newsgroup-name gnus-active-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4870 (artnum gnus-newsgroup-begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4871 (header nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4872 (while (and (not header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4873 (> artnum first))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4874 (setq artnum (1- artnum))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4875 (setq header (car (gnus-retrieve-headers (list artnum)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4876 header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4877 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4878
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4879 (defun gnus-more-header-forward ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4880 "Find new header forward."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4881 (let ((last
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4882 (cdr (nth 2 (gnus-gethash gnus-newsgroup-name gnus-active-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4883 (artnum gnus-newsgroup-end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4884 (header nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4885 (while (and (not header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4886 (< artnum last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4887 (setq artnum (1+ artnum))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4888 (setq header (car (gnus-retrieve-headers (list artnum)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4889 header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4890 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4891
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4892 (defun gnus-extend-newsgroup (header &optional backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4893 "Extend newsgroup selection with HEADER.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4894 Optional argument BACKWARD means extend toward backward."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4895 (if header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4896 (let ((artnum (nntp-header-number header)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4897 (setq gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4898 (if backward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4899 (cons header gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4900 (append gnus-newsgroup-headers (list header))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4901 ;; We have to update unreads and unselected, but don't have to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4902 ;; care about gnus-newsgroup-marked.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4903 (if (memq artnum gnus-newsgroup-unselected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4904 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4905 (cons artnum gnus-newsgroup-unreads)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4906 (setq gnus-newsgroup-unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4907 (delq artnum gnus-newsgroup-unselected))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4908 (setq gnus-newsgroup-begin (min gnus-newsgroup-begin artnum))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4909 (setq gnus-newsgroup-end (max gnus-newsgroup-end artnum))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4910 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4911
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4912 (defun gnus-mark-article-as-read (article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4913 "Remember that ARTICLE is marked as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4914 ;; Remove from unread and marked list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4915 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4916 (delq article gnus-newsgroup-unreads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4917 (setq gnus-newsgroup-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4918 (delq article gnus-newsgroup-marked)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4919
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4920 (defun gnus-mark-article-as-unread (article &optional clear-mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4921 "Remember that ARTICLE is marked as unread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4922 Optional argument CLEAR-MARK means ARTICLE should not be remembered
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4923 that it was marked as read once."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4924 ;; Add to unread list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4925 (or (memq article gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4926 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4927 (cons article gnus-newsgroup-unreads)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4928 ;; If CLEAR-MARK is non-nil, the article must be removed from marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4929 ;; list. Otherwise, it must be added to the list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4930 (if clear-mark
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4931 (setq gnus-newsgroup-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4932 (delq article gnus-newsgroup-marked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4933 (or (memq article gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4934 (setq gnus-newsgroup-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4935 (cons article gnus-newsgroup-marked)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4936
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4937 (defun gnus-clear-system ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4938 "Clear all variables and buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4939 ;; Clear GNUS variables.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4940 (let ((variables gnus-variable-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4941 (while variables
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4942 (set (car variables) nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4943 (setq variables (cdr variables))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4944 ;; Clear other internal variables.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4945 (setq gnus-active-hashtb nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4946 (setq gnus-unread-hashtb nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4947 ;; Kill the startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4948 (and gnus-current-startup-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4949 (get-file-buffer gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4950 (kill-buffer (get-file-buffer gnus-current-startup-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4951 (setq gnus-current-startup-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4952 ;; Kill GNUS buffers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4953 (let ((buffers gnus-buffer-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4954 (while buffers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4955 (if (get-buffer (car buffers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4956 (kill-buffer (car buffers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4957 (setq buffers (cdr buffers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4958 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4959
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4960 (defun gnus-configure-windows (action)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4961 "Configure GNUS windows according to the next ACTION.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4962 The ACTION is either a symbol, such as `SelectNewsgroup', or a
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4963 configuration list such as `(1 1 2)'. If ACTION is not a list,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4964 configuration list is got from the variable gnus-window-configuration."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4965 (let* ((windows
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4966 (if (listp action)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4967 action (car (cdr (assq action gnus-window-configuration)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4968 (grpwin (get-buffer-window gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4969 (subwin (get-buffer-window gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4970 (artwin (get-buffer-window gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4971 (winsum nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4972 (height nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4973 (grpheight 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4974 (subheight 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4975 (artheight 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4976 (if (or (null windows) ;No configuration is specified.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4977 (and (eq (null grpwin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4978 (zerop (nth 0 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4979 (eq (null subwin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4980 (zerop (nth 1 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4981 (eq (null artwin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4982 (zerop (nth 2 windows)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4983 ;; No need to change window configuration.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4984 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4985 (select-window (or grpwin subwin artwin (selected-window)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4986 ;; First of all, compute the height of each window.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4987 (cond (gnus-use-full-window
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4988 ;; Take up the entire screen.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4989 (delete-other-windows)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4990 (setq height (window-height (selected-window))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4991 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4992 (setq height (+ (if grpwin (window-height grpwin) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4993 (if subwin (window-height subwin) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4994 (if artwin (window-height artwin) 0)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4995 ;; The Newsgroup buffer exits always. So, use it to extend the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4996 ;; Group window so as to get enough window space.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4997 (switch-to-buffer gnus-Group-buffer 'norecord)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4998 (and (get-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4999 (delete-windows-on gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5000 (and (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5001 (delete-windows-on gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5002 ;; Compute expected window height.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5003 (setq winsum (apply (function +) windows))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5004 (if (not (zerop (nth 0 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5005 (setq grpheight (max window-min-height
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5006 (/ (* height (nth 0 windows)) winsum))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5007 (if (not (zerop (nth 1 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5008 (setq subheight (max window-min-height
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5009 (/ (* height (nth 1 windows)) winsum))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5010 (if (not (zerop (nth 2 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5011 (setq artheight (max window-min-height
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5012 (/ (* height (nth 2 windows)) winsum))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5013 (setq height (+ grpheight subheight artheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5014 (enlarge-window (max 0 (- height (window-height (selected-window)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5015 ;; Then split the window.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5016 (and (not (zerop artheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5017 (or (not (zerop grpheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5018 (not (zerop subheight)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5019 (split-window-vertically (+ grpheight subheight)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5020 (and (not (zerop grpheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5021 (not (zerop subheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5022 (split-window-vertically grpheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5023 ;; Then select buffers in each window.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5024 (and (not (zerop grpheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5025 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5026 (switch-to-buffer gnus-Group-buffer 'norecord)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5027 (other-window 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5028 (and (not (zerop subheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5029 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5030 (switch-to-buffer gnus-Subject-buffer 'norecord)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5031 (other-window 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5032 (and (not (zerop artheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5033 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5034 ;; If Article buffer does not exist, it will be created
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5035 ;; and initialized.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5036 (gnus-Article-setup-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5037 (switch-to-buffer gnus-Article-buffer 'norecord)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5038 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5039 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5040
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5041 (defun gnus-find-header-by-number (headers number)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5042 "Return a header which is a element of HEADERS and has NUMBER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5043 (let ((found nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5044 (while (and headers (not found))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5045 ;; We cannot use `=' to accept non-numeric NUMBER.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5046 (if (eq number (nntp-header-number (car headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5047 (setq found (car headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5048 (setq headers (cdr headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5049 found
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5050 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5051
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5052 (defun gnus-find-header-by-id (headers id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5053 "Return a header which is a element of HEADERS and has Message-ID."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5054 (let ((found nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5055 (while (and headers (not found))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5056 (if (string-equal id (nntp-header-id (car headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5057 (setq found (car headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5058 (setq headers (cdr headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5059 found
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5060 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5061
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5062 (defun gnus-version ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5063 "Version numbers of this version of GNUS."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5064 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5065 (cond ((and (boundp 'mhspool-version) (boundp 'nnspool-version))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5066 (message "%s; %s; %s; %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5067 gnus-version nntp-version nnspool-version mhspool-version))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5068 ((boundp 'mhspool-version)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5069 (message "%s; %s; %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5070 gnus-version nntp-version mhspool-version))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5071 ((boundp 'nnspool-version)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5072 (message "%s; %s; %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5073 gnus-version nntp-version nnspool-version))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5074 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5075 (message "%s; %s" gnus-version nntp-version))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5076
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5077 (defun gnus-Info-find-node ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5078 "Find Info documentation of GNUS."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5079 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5080 (require 'info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5081 ;; Enlarge info window if needed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5082 (cond ((eq major-mode 'gnus-Group-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5083 (gnus-configure-windows '(1 0 0)) ;Take all windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5084 (pop-to-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5085 ((eq major-mode 'gnus-Subject-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5086 (gnus-configure-windows '(0 1 0)) ;Take all windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5087 (pop-to-buffer gnus-Subject-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5088 (Info-goto-node (cdr (assq major-mode gnus-Info-nodes))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5089
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5090 (defun gnus-overload-functions (&optional overloads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5091 "Overload functions specified by optional argument OVERLOADS.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5092 If nothing is specified, use the variable gnus-overload-functions."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5093 (let ((defs nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5094 (overloads (or overloads gnus-overload-functions)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5095 (while overloads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5096 (setq defs (car overloads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5097 (setq overloads (cdr overloads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5098 ;; Load file before overloading function if necessary. Make
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5099 ;; sure we cannot use `requre' always.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5100 (and (not (fboundp (car defs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5101 (car (cdr (cdr defs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5102 (load (car (cdr (cdr defs))) nil 'nomessage))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5103 (fset (car defs) (car (cdr defs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5104 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5105
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5106 (defun gnus-make-threads (newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5107 "Make conversation threads tree from NEWSGROUP-HEADERS."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5108 (let ((headers newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5109 (h nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5110 (d nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5111 (roots nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5112 (dependencies nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5113 ;; Make message dependency alist.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5114 (while headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5115 (setq h (car headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5116 (setq headers (cdr headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5117 ;; Ignore invalid headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5118 (if (vectorp h) ;Depends on nntp.el.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5119 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5120 ;; Ignore broken references, e.g "<123@a.b.c".
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5121 (setq d (and (nntp-header-references h)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5122 (string-match "\\(<[^<>]+>\\)[^>]*$"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5123 (nntp-header-references h))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5124 (gnus-find-header-by-id
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5125 newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5126 (substring (nntp-header-references h)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5127 (match-beginning 1) (match-end 1)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5128 ;; Check subject equality.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5129 (or gnus-thread-ignore-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5130 (null d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5131 (string-equal (gnus-simplify-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5132 (nntp-header-subject h) 're)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5133 (gnus-simplify-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5134 (nntp-header-subject d) 're))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5135 ;; H should be a thread root.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5136 (setq d nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5137 ;; H depends on D.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5138 (setq dependencies
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5139 (cons (cons h d) dependencies))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5140 ;; H is a thread root.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5141 (if (null d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5142 (setq roots (cons h roots)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5143 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5144 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5145 ;; Make complete threads from the roots.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5146 ;; Note: dependencies are in reverse order, but
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5147 ;; gnus-make-threads-1 processes it in reverse order again. So,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5148 ;; we don't have to worry about it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5149 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5150 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5151 (lambda (root)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5152 (gnus-make-threads-1 root dependencies))) (nreverse roots))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5153 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5154
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5155 (defun gnus-make-threads-1 (parent dependencies)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5156 (let ((children nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5157 (d nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5158 (depends dependencies))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5159 ;; Find children.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5160 (while depends
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5161 (setq d (car depends))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5162 (setq depends (cdr depends))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5163 (and (cdr d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5164 (eq (nntp-header-id parent) (nntp-header-id (cdr d)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5165 (setq children (cons (car d) children))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5166 ;; Go down.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5167 (cons parent
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5168 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5169 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5170 (lambda (child)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5171 (gnus-make-threads-1 child dependencies))) children))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5172 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5173
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5174 (defun gnus-narrow-to-page (&optional arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5175 "Make text outside current page invisible except for page delimiter.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5176 A numeric arg specifies to move forward or backward by that many pages,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5177 thus showing a page other than the one point was originally in."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5178 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5179 (setq arg (if arg (prefix-numeric-value arg) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5180 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5181 (forward-page -1) ;Beginning of current page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5182 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5183 (if (> arg 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5184 (forward-page arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5185 (if (< arg 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5186 (forward-page (1- arg))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5187 ;; Find the end of the page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5188 (forward-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5189 ;; If we stopped due to end of buffer, stay there.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5190 ;; If we stopped after a page delimiter, put end of restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5191 ;; at the beginning of that line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5192 ;; These are commented out.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5193 ;; (if (save-excursion (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5194 ;; (looking-at page-delimiter))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5195 ;; (beginning-of-line))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5196 (narrow-to-region (point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5197 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5198 ;; Find the top of the page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5199 (forward-page -1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5200 ;; If we found beginning of buffer, stay there.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5201 ;; If extra text follows page delimiter on same line,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5202 ;; include it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5203 ;; Otherwise, show text starting with following line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5204 (if (and (eolp) (not (bobp)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5205 (forward-line 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5206 (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5207 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5208
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5209 (defun gnus-last-element (list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5210 "Return last element of LIST."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5211 (let ((last nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5212 (while list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5213 (if (null (cdr list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5214 (setq last (car list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5215 (setq list (cdr list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5216 last
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5217 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5218
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5219 (defun gnus-set-difference (list1 list2)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5220 "Return a list of elements of LIST1 that do not appear in LIST2."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5221 (let ((list1 (copy-sequence list1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5222 (while list2
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5223 (setq list1 (delq (car list2) list1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5224 (setq list2 (cdr list2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5225 list1
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5226 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5227
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5228 (defun gnus-intersection (list1 list2)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5229 "Return a list of elements that appear in both LIST1 and LIST2."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5230 (let ((result nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5231 (while list2
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5232 (if (memq (car list2) list1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5233 (setq result (cons (car list2) result)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5234 (setq list2 (cdr list2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5235 result
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5236 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5237
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5238
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5239 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5240 ;;; Get information about active articles, already read articles, and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5241 ;;; still unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5242 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5243
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5244 ;; GNUS internal format of gnus-newsrc-assoc and gnus-killed-assoc:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5245 ;; (("general" t (1 . 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5246 ;; ("misc" t (1 . 10) (12 . 15))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5247 ;; ("test" nil (1 . 99)) ...)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5248 ;; GNUS internal format of gnus-marked-assoc:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5249 ;; (("general" 1 2 3)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5250 ;; ("misc" 2) ...)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5251 ;; GNUS internal format of gnus-active-hashtb:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5252 ;; (("general" t (1 . 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5253 ;; ("misc" t (1 . 10))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5254 ;; ("test" nil (1 . 99)) ...)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5255 ;; GNUS internal format of gnus-unread-hashtb:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5256 ;; (("general" 1 (1 . 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5257 ;; ("misc" 14 (1 . 10) (12 . 15))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5258 ;; ("test" 99 (1 . 99)) ...)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5259
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5260 (defun gnus-setup-news-info (&optional rawfile)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5261 "Setup news information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5262 If optional argument RAWFILE is non-nil, force to read raw startup file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5263 (let ((init (not (and gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5264 gnus-active-hashtb
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5265 gnus-unread-hashtb
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5266 (not rawfile)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5267 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5268 ;; We have to clear some variables to re-initialize news info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5269 (if init
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5270 (setq gnus-newsrc-assoc nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5271 gnus-active-hashtb nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5272 gnus-unread-hashtb nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5273 (if init
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5274 (gnus-read-newsrc-file rawfile))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5275 (gnus-read-active-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5276 (gnus-expire-marked-articles)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5277 (gnus-get-unread-articles)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5278 ;; Check new newsgroups and subscribe them.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5279 (if init
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5280 (let ((new-newsgroups (gnus-find-new-newsgroups)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5281 (while new-newsgroups
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5282 (funcall gnus-subscribe-newsgroup-method (car new-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5283 (setq new-newsgroups (cdr new-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5284 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5285 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5286
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5287 (defun gnus-subscribe-newsgroup (newsgroup &optional next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5288 "Subscribe new NEWSGROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5289 If optional argument NEXT is non-nil, it is inserted before NEXT."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5290 (gnus-insert-newsgroup (list newsgroup t) next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5291 (message "Newsgroup %s is subscribed" newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5292
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5293 (defun gnus-add-newsgroup (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5294 "Subscribe new NEWSGROUP safely and put it at top."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5295 (and (null (assoc newsgroup gnus-newsrc-assoc)) ;Really new?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5296 (gnus-gethash newsgroup gnus-active-hashtb) ;Really exist?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5297 (gnus-insert-newsgroup (or (assoc newsgroup gnus-killed-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5298 (list newsgroup t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5299 (car (car gnus-newsrc-assoc)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5300
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5301 (defun gnus-find-new-newsgroups ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5302 "Looking for new newsgroups and return names.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5303 `-n' option of options line in .newsrc file is recognized."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5304 (let ((group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5305 (new-newsgroups nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5306 (mapatoms
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5307 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5308 (lambda (sym)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5309 (setq group (symbol-name sym))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5310 ;; Taking account of `-n' option.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5311 (and (or (null gnus-newsrc-options-n-no)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5312 (not (string-match gnus-newsrc-options-n-no group))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5313 (and gnus-newsrc-options-n-yes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5314 (string-match gnus-newsrc-options-n-yes group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5315 (null (assoc group gnus-killed-assoc)) ;Ignore killed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5316 (null (assoc group gnus-newsrc-assoc)) ;Really new.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5317 ;; Find new newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5318 (setq new-newsgroups
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5319 (cons group new-newsgroups)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5320 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5321 gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5322 ;; Return new newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5323 new-newsgroups
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5324 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5325
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5326 (defun gnus-kill-newsgroup (group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5327 "Kill GROUP from gnus-newsrc-assoc, .newsrc and gnus-unread-hashtb."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5328 (let ((info (assoc group gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5329 (if (null info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5330 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5331 ;; Delete from gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5332 (setq gnus-newsrc-assoc (delq info gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5333 ;; Add to gnus-killed-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5334 (setq gnus-killed-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5335 (cons info
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5336 (delq (assoc group gnus-killed-assoc) gnus-killed-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5337 ;; Clear unread hashtable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5338 ;; Thanks cwitty@csli.Stanford.EDU (Carl Witty).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5339 (gnus-sethash group nil gnus-unread-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5340 ;; Then delete from .newsrc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5341 (gnus-update-newsrc-buffer group 'delete)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5342 ;; Return the deleted newsrc entry.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5343 info
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5344 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5345
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5346 (defun gnus-insert-newsgroup (info &optional next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5347 "Insert newsrc INFO entry before NEXT.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5348 If optional argument NEXT is nil, appended to the last."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5349 (if (null info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5350 (error "Invalid argument: %s" info))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5351 (let* ((group (car info)) ;Newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5352 (range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5353 (gnus-difference-of-range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5354 (nth 2 (gnus-gethash group gnus-active-hashtb)) (nthcdr 2 info))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5355 ;; Check duplication.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5356 (if (assoc group gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5357 (error "Duplicated: %s" group))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5358 ;; Insert to gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5359 (if (string-equal next (car (car gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5360 (setq gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5361 (cons info gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5362 (let ((found nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5363 (rest gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5364 (tail (cons nil gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5365 ;; Seach insertion point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5366 (while (and (not found) rest)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5367 (if (string-equal next (car (car rest)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5368 (setq found t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5369 (setq rest (cdr rest))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5370 (setq tail (cdr tail))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5371 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5372 ;; Find it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5373 (setcdr tail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5374 (setq gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5375 (append gnus-newsrc-assoc (cons info rest)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5376 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5377 ;; Delete from gnus-killed-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5378 (setq gnus-killed-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5379 (delq (assoc group gnus-killed-assoc) gnus-killed-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5380 ;; Then insert to .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5381 (gnus-update-newsrc-buffer group nil next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5382 ;; Add to gnus-unread-hashtb.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5383 (gnus-sethash group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5384 (cons group ;Newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5385 (cons (gnus-number-of-articles range) range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5386 gnus-unread-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5387 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5388
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5389 (defun gnus-check-killed-newsgroups ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5390 "Check consistency between gnus-newsrc-assoc and gnus-killed-assoc."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5391 (let ((group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5392 (new-killed nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5393 (old-killed gnus-killed-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5394 (while old-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5395 (setq group (car (car old-killed)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5396 (and (or (null gnus-newsrc-options-n-no)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5397 (not (string-match gnus-newsrc-options-n-no group))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5398 (and gnus-newsrc-options-n-yes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5399 (string-match gnus-newsrc-options-n-yes group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5400 (null (assoc group gnus-newsrc-assoc)) ;No duplication.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5401 ;; Subscribed in options line and not in gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5402 (setq new-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5403 (cons (car old-killed) new-killed)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5404 (setq old-killed (cdr old-killed))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5405 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5406 (setq gnus-killed-assoc (nreverse new-killed))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5407 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5408
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5409 (defun gnus-check-bogus-newsgroups (&optional confirm)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5410 "Delete bogus newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5411 If optional argument CONFIRM is non-nil, confirm deletion of newsgroups."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5412 (let ((group nil) ;Newsgroup name temporary used.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5413 (old-newsrc gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5414 (new-newsrc nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5415 (bogus nil) ;List of bogus newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5416 (old-killed gnus-killed-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5417 (new-killed nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5418 (old-marked gnus-marked-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5419 (new-marked nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5420 (message "Checking bogus newsgroups...")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5421 ;; Update gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5422 (while old-newsrc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5423 (setq group (car (car old-newsrc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5424 (if (or (gnus-gethash group gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5425 (and confirm
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5426 (not (y-or-n-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5427 (format "Delete bogus newsgroup: %s " group)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5428 ;; Active newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5429 (setq new-newsrc (cons (car old-newsrc) new-newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5430 ;; Found a bogus newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5431 (setq bogus (cons group bogus)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5432 (setq old-newsrc (cdr old-newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5433 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5434 (setq gnus-newsrc-assoc (nreverse new-newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5435 ;; Update gnus-killed-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5436 ;; The killed newsgroups are deleted without any confirmations.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5437 (while old-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5438 (setq group (car (car old-killed)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5439 (and (gnus-gethash group gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5440 (null (assoc group gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5441 ;; Active and really killed newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5442 (setq new-killed (cons (car old-killed) new-killed)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5443 (setq old-killed (cdr old-killed))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5444 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5445 (setq gnus-killed-assoc (nreverse new-killed))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5446 ;; Remove BOGUS from .newsrc file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5447 (while bogus
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5448 (gnus-update-newsrc-buffer (car bogus) 'delete)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5449 (setq bogus (cdr bogus)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5450 ;; Update gnus-marked-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5451 (while old-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5452 (setq group (car (car old-marked)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5453 (if (and (cdr (car old-marked)) ;Non-empty?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5454 (assoc group gnus-newsrc-assoc)) ;Not bogus?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5455 (setq new-marked (cons (car old-marked) new-marked)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5456 (setq old-marked (cdr old-marked)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5457 (setq gnus-marked-assoc new-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5458 (message "Checking bogus newsgroups... done")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5459 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5460
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5461 (defun gnus-get-unread-articles ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5462 "Compute diffs between active and read articles."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5463 (let ((read gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5464 (group-info nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5465 (group-name nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5466 (active nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5467 (range nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5468 (message "Checking new news...")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5469 (or gnus-unread-hashtb
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5470 (setq gnus-unread-hashtb (gnus-make-hashtable)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5471 (while read
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5472 (setq group-info (car read)) ;About one newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5473 (setq group-name (car group-info))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5474 (setq active (nth 2 (gnus-gethash group-name gnus-active-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5475 (if (and gnus-octive-hashtb
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5476 ;; Is nothing changed?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5477 (equal active
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5478 (nth 2 (gnus-gethash group-name gnus-octive-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5479 ;; Is this newsgroup in the unread hash table?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5480 (gnus-gethash group-name gnus-unread-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5481 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5482 nil ;Nothing to do.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5483 (setq range (gnus-difference-of-range active (nthcdr 2 group-info)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5484 (gnus-sethash group-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5485 (cons group-name ;Group name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5486 (cons (gnus-number-of-articles range)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5487 range)) ;Range of unread articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5488 gnus-unread-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5489 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5490 (setq read (cdr read))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5491 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5492 (message "Checking new news... done")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5493 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5494
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5495 (defun gnus-expire-marked-articles ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5496 "Check expired article which is marked as unread."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5497 (let ((marked-assoc gnus-marked-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5498 (updated-assoc nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5499 (marked nil) ;Current marked info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5500 (articles nil) ;List of marked articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5501 (updated nil) ;List of real marked.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5502 (begin nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5503 (while marked-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5504 (setq marked (car marked-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5505 (setq articles (cdr marked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5506 (setq updated nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5507 (setq begin
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5508 (car (nth 2 (gnus-gethash (car marked) gnus-active-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5509 (while (and begin articles)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5510 (if (>= (car articles) begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5511 ;; This article is still active.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5512 (setq updated (cons (car articles) updated)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5513 (setq articles (cdr articles)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5514 (if updated
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5515 (setq updated-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5516 (cons (cons (car marked) updated) updated-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5517 (setq marked-assoc (cdr marked-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5518 (setq gnus-marked-assoc updated-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5519 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5520
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5521 (defun gnus-mark-as-read-by-xref
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5522 (group headers unreads &optional subscribed-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5523 "Mark articles as read using cross references and return updated newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5524 Arguments are GROUP, HEADERS, UNREADS, and optional SUBSCRIBED-ONLY."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5525 (let ((xref-list nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5526 (header nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5527 (xrefs nil) ;One Xref: field info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5528 (xref nil) ;(NEWSGROUP . ARTICLE)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5529 (gname nil) ;Newsgroup name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5530 (article nil)) ;Article number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5531 (while headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5532 (setq header (car headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5533 (if (memq (nntp-header-number header) unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5534 ;; This article is not yet marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5535 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5536 (setq xrefs (gnus-parse-xref-field (nntp-header-xref header)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5537 ;; For each cross reference info. in one Xref: field.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5538 (while xrefs
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5539 (setq xref (car xrefs))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5540 (setq gname (car xref)) ;Newsgroup name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5541 (setq article (cdr xref)) ;Article number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5542 (or (string-equal group gname) ;Ignore current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5543 ;; Ignore unsubscribed newsgroup if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5544 (and subscribed-only
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5545 (not (nth 1 (assoc gname gnus-newsrc-assoc))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5546 ;; Ignore article marked as unread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5547 (memq article (cdr (assoc gname gnus-marked-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5548 (let ((group-xref (assoc gname xref-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5549 (if group-xref
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5550 (if (memq article (cdr group-xref))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5551 nil ;Alread marked.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5552 (setcdr group-xref (cons article (cdr group-xref))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5553 ;; Create new assoc entry for GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5554 (setq xref-list (cons (list gname article) xref-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5555 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5556 (setq xrefs (cdr xrefs))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5557 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5558 (setq headers (cdr headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5559 ;; Mark cross referenced articles as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5560 (gnus-mark-xrefed-as-read xref-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5561 ;;(message "%s %s" (prin1-to-string unreads) (prin1-to-string xref-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5562 ;; Return list of updated group name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5563 (mapcar (function car) xref-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5564 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5565
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5566 (defun gnus-parse-xref-field (xref-value)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5567 "Parse Xref: field value, and return list of `(group . article-id)'."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5568 (let ((xref-list nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5569 (xref-value (or xref-value "")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5570 ;; Remove server host name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5571 (if (string-match "^[ \t]*[^ \t,]+[ \t,]+\\(.*\\)$" xref-value)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5572 (setq xref-value (substring xref-value (match-beginning 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5573 (setq xref-value nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5574 ;; Process each xref info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5575 (while xref-value
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5576 (if (string-match
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5577 "^[ \t,]*\\([^ \t,]+\\):\\([0-9]+\\)[^0-9]*" xref-value)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5578 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5579 (setq xref-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5580 (cons
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5581 (cons
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5582 ;; Group name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5583 (substring xref-value (match-beginning 1) (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5584 ;; Article-ID
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5585 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5586 (substring xref-value (match-beginning 2) (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5587 xref-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5588 (setq xref-value (substring xref-value (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5589 (setq xref-value nil)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5590 ;; Return alist.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5591 xref-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5592 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5593
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5594 (defun gnus-mark-xrefed-as-read (xrefs)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5595 "Update unread article information using XREFS alist."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5596 (let ((group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5597 (idlist nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5598 (unread nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5599 (while xrefs
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5600 (setq group (car (car xrefs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5601 (setq idlist (cdr (car xrefs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5602 (setq unread (gnus-uncompress-sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5603 (nthcdr 2 (gnus-gethash group gnus-unread-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5604 (while idlist
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5605 (setq unread (delq (car idlist) unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5606 (setq idlist (cdr idlist)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5607 (gnus-update-unread-articles group unread 'ignore)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5608 (setq xrefs (cdr xrefs))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5609 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5610
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5611 (defun gnus-update-unread-articles (group unread-list marked-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5612 "Update unread articles of GROUP using UNREAD-LIST and MARKED-LIST."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5613 (let ((active (nth 2 (gnus-gethash group gnus-active-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5614 (unread (gnus-gethash group gnus-unread-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5615 (if (or (null active) (null unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5616 ;; Ignore unknown newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5617 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5618 ;; Update gnus-unread-hashtb.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5619 (if unread-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5620 (setcdr (cdr unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5621 (gnus-compress-sequence unread-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5622 ;; All of the articles are read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5623 (setcdr (cdr unread) '((0 . 0))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5624 ;; Number of unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5625 (setcar (cdr unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5626 (gnus-number-of-articles (nthcdr 2 unread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5627 ;; Update gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5628 (if (> (car active) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5629 ;; Articles from 1 to N are not active.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5630 (setq active (cons 1 (cdr active))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5631 (setcdr (cdr (assoc group gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5632 (gnus-difference-of-range active (nthcdr 2 unread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5633 ;; Update .newsrc buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5634 (gnus-update-newsrc-buffer group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5635 ;; Update gnus-marked-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5636 (if (listp marked-list) ;Includes NIL.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5637 (let ((marked (assoc group gnus-marked-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5638 (cond (marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5639 (setcdr marked marked-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5640 (marked-list ;Non-NIL.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5641 (setq gnus-marked-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5642 (cons (cons group marked-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5643 gnus-marked-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5644 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5645 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5646
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5647 (defun gnus-read-active-file ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5648 "Get active file from NNTP server."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5649 (message "Reading active file...")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5650 (if (gnus-request-list) ;Get active file from server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5651 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5652 (set-buffer nntp-server-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5653 ;; Save OLD active info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5654 (setq gnus-octive-hashtb gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5655 (setq gnus-active-hashtb (gnus-make-hashtable))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5656 (gnus-active-to-gnus-format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5657 (message "Reading active file... done"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5658 (error "Cannot read active file from NNTP server.")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5659
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5660 (defun gnus-active-to-gnus-format ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5661 "Convert active file format to internal format."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5662 ;; Delete unnecessary lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5663 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5664 (delete-matching-lines "^to\\..*$")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5665 ;; Store active file in hashtable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5666 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5667 (while
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5668 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5669 "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([ymn]\\).*$"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5670 nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5671 (gnus-sethash
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5672 (buffer-substring (match-beginning 1) (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5673 (list (buffer-substring (match-beginning 1) (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5674 (string-equal
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5675 "y" (buffer-substring (match-beginning 4) (match-end 4)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5676 (cons (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5677 (buffer-substring (match-beginning 3) (match-end 3)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5678 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5679 (buffer-substring (match-beginning 2) (match-end 2)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5680 gnus-active-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5681
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5682 (defun gnus-read-newsrc-file (&optional rawfile)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5683 "Read startup FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5684 If optional argument RAWFILE is non-nil, the raw startup file is read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5685 (setq gnus-current-startup-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5686 (let* ((file (expand-file-name gnus-startup-file nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5687 (real-file (concat file "-" gnus-nntp-server)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5688 (if (file-exists-p real-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5689 real-file file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5690 ;; Reset variables which may be included in the quick startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5691 (let ((variables gnus-variable-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5692 (while variables
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5693 (set (car variables) nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5694 (setq variables (cdr variables))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5695 (let* ((newsrc-file gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5696 (quick-file (concat newsrc-file ".el"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5697 (quick-loaded nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5698 (newsrc-mod (nth 5 (file-attributes newsrc-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5699 (quick-mod (nth 5 (file-attributes quick-file))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5700 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5701 ;; Prepare .newsrc buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5702 (set-buffer (find-file-noselect newsrc-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5703 ;; It is not so good idea turning off undo.
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 853
diff changeset
5704 ;;(buffer-disable-undo (current-buffer))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5705 ;; Load quick .newsrc to restore gnus-marked-assoc and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5706 ;; gnus-killed-assoc even if gnus-newsrc-assoc is out of date.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5707 (condition-case nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5708 (setq quick-loaded (load quick-file t t t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5709 (error nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5710 (cond ((and (not rawfile) ;Not forced to read the raw file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5711 (or (and (fboundp 'file-newer-than-file-p)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5712 (file-newer-than-file-p quick-file newsrc-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5713 (and newsrc-mod quick-mod
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5714 ;; .newsrc.el is newer than .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5715 ;; Some older version does not support function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5716 ;; `file-newer-than-file-p'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5717 (or (< (car newsrc-mod) (car quick-mod))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5718 (and (= (car newsrc-mod) (car quick-mod))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5719 (<= (nth 1 newsrc-mod) (nth 1 quick-mod))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5720 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5721 quick-loaded
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5722 gnus-newsrc-assoc ;Really loaded?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5723 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5724 ;; We don't have to read the raw startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5725 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5726 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5727 ;; Since .newsrc file is newer than quick file, read it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5728 (message "Reading %s..." newsrc-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5729 (gnus-newsrc-to-gnus-format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5730 (gnus-check-killed-newsgroups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5731 (message "Reading %s... Done" newsrc-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5732 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5733
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5734 (defun gnus-make-newsrc-file (file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5735 "Make server dependent file name by catenating FILE and server host name."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5736 (let* ((file (expand-file-name file nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5737 (real-file (concat file "-" gnus-nntp-server)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5738 (if (file-exists-p real-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5739 real-file file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5740 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5741
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5742 (defun gnus-newsrc-to-gnus-format ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5743 "Parse current buffer as .newsrc file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5744 (let ((newsgroup nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5745 (subscribe nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5746 (ranges nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5747 (subrange nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5748 (read-list nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5749 ;; We have to re-initialize these variable (except for
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5750 ;; gnus-marked-assoc and gnus-killed-assoc) because quick startup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5751 ;; file may contain bogus values.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5752 (setq gnus-newsrc-options nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5753 (setq gnus-newsrc-options-n-yes nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5754 (setq gnus-newsrc-options-n-no nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5755 (setq gnus-newsrc-assoc nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5756 ;; Save options line to variable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5757 ;; Lines beginning with white spaces are treated as continuation
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5758 ;; line. Refer man page of newsrc(5).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5759 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5760 (if (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5761 "^[ \t]*options[ \t]*\\(.*\\(\n[ \t]+.*\\)*\\)[ \t]*$" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5762 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5763 ;; Save entire options line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5764 (setq gnus-newsrc-options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5765 (buffer-substring (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5766 ;; Compile "-n" option.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5767 (if (string-match "\\(^\\|[ \t\n]\\)-n" gnus-newsrc-options)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5768 (let ((yes-and-no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5769 (gnus-parse-n-options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5770 (substring gnus-newsrc-options (match-end 0)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5771 (setq gnus-newsrc-options-n-yes (car yes-and-no))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5772 (setq gnus-newsrc-options-n-no (cdr yes-and-no))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5773 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5774 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5775 ;; Parse body of .newsrc file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5776 ;; Options line continuation lines must be also considered here.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5777 ;; Before supporting continuation lines, " newsgroup ! 1-5" was
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5778 ;; okay, but now it is invalid. It should be "newsgroup! 1-5".
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5779 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5780 ;; Due to overflows in regex.c, change the following regexp:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5781 ;; "^\\([^:! \t\n]+\\)\\([:!]\\)[ \t]*\\(.*\\)$"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5782 ;; Suggested by composer@bucsf.bu.edu (Jeff Kellem).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5783 (while (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5784 "^\\([^:! \t\n]+\\)\\([:!]\\)[ \t]*\\(\\(...\\)*.*\\)$" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5785 (setq newsgroup (buffer-substring (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5786 ;; Check duplications of newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5787 ;; Note: Checking the duplications takes very long time.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5788 (if (assoc newsgroup gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5789 (message "Ignore duplicated newsgroup: %s" newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5790 (setq subscribe
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5791 (string-equal
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5792 ":" (buffer-substring (match-beginning 2) (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5793 (setq ranges (buffer-substring (match-beginning 3) (match-end 3)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5794 (setq read-list nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5795 (while (string-match "^[, \t]*\\([0-9-]+\\)" ranges)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5796 (setq subrange (substring ranges (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5797 (setq ranges (substring ranges (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5798 (cond ((string-match "^\\([0-9]+\\)-\\([0-9]+\\)$" subrange)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5799 (setq read-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5800 (cons
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5801 (cons (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5802 (substring subrange
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5803 (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5804 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5805 (substring subrange
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5806 (match-beginning 2) (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5807 read-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5808 ((string-match "^[0-9]+$" subrange)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5809 (setq read-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5810 (cons (cons (string-to-int subrange)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5811 (string-to-int subrange))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5812 read-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5813 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5814 (ding) (message "Ignoring bogus lines of %s" newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5815 (sit-for 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5816 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5817 (setq gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5818 (cons (cons newsgroup (cons subscribe (nreverse read-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5819 gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5820 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5821 (setq gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5822 (nreverse gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5823 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5824
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5825 (defun gnus-parse-n-options (options)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5826 "Parse -n NEWSGROUPS options and return a cons of YES and NO regexps."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5827 (let ((yes nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5828 (no nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5829 (yes-or-no nil) ;`!' or not.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5830 (newsgroup nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5831 ;; Parse each newsgroup description such as "comp.all". Commas
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5832 ;; and white spaces can be a newsgroup separator.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5833 (while
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5834 (string-match "^[ \t\n,]*\\(!?\\)\\([^--- \t\n,][^ \t\n,]*\\)" options)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5835 (setq yes-or-no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5836 (substring options (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5837 (setq newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5838 (regexp-quote
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5839 (substring options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5840 (match-beginning 2) (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5841 (setq options (substring options (match-end 2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5842 ;; Rewrite "all" to ".+" not ".*". ".+" requires at least one
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5843 ;; character.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5844 (while (string-match "\\(^\\|\\\\[.]\\)all\\(\\\\[.]\\|$\\)" newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5845 (setq newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5846 (concat (substring newsgroup 0 (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5847 ".+"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5848 (substring newsgroup (match-beginning 2)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5849 (cond ((string-equal yes-or-no "!")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5850 (setq no (cons newsgroup no)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5851 ((string-equal newsgroup ".+")) ;Ignore `all'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5852 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5853 (setq yes (cons newsgroup yes)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5854 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5855 ;; Make a cons of regexps from parsing result.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5856 (cons (if yes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5857 (concat "^\\("
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5858 (apply (function concat)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5859 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5860 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5861 (lambda (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5862 (concat newsgroup "\\|")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5863 (cdr yes)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5864 (car yes) "\\)"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5865 (if no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5866 (concat "^\\("
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5867 (apply (function concat)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5868 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5869 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5870 (lambda (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5871 (concat newsgroup "\\|")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5872 (cdr no)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5873 (car no) "\\)")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5874 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5875
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5876 (defun gnus-save-newsrc-file ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5877 "Save to .newsrc FILE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5878 ;; Note: We cannot save .newsrc file if all newsgroups are removed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5879 ;; from the variable gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5880 (and (or gnus-newsrc-assoc gnus-killed-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5881 gnus-current-startup-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5882 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5883 ;; A buffer containing .newsrc file may be deleted.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5884 (set-buffer (find-file-noselect gnus-current-startup-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5885 (if (not (buffer-modified-p))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5886 (message "(No changes need to be saved)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5887 (message "Saving %s..." gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5888 (let ((make-backup-files t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5889 (version-control nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5890 (require-final-newline t)) ;Don't ask even if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5891 ;; Make backup file of master newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5892 ;; You can stop or change version control of backup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5893 ;; Suggested by jason@violet.berkeley.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5894 (run-hooks 'gnus-Save-newsrc-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5895 (save-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5896 ;; Quickly loadable .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5897 (set-buffer (get-buffer-create " *GNUS-newsrc*"))
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 853
diff changeset
5898 (buffer-disable-undo (current-buffer))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5899 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5900 (gnus-gnus-to-quick-newsrc-format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5901 (let ((make-backup-files nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5902 (version-control nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5903 (require-final-newline t)) ;Don't ask even if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5904 (write-file (concat gnus-current-startup-file ".el")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5905 (kill-buffer (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5906 (message "Saving %s... Done" gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5907 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5908 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5909
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5910 (defun gnus-update-newsrc-buffer (group &optional delete next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5911 "Incrementally update .newsrc buffer about GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5912 If optional second argument DELETE is non-nil, delete the group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5913 If optional third argument NEXT is non-nil, inserted before it."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5914 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5915 ;; Taking account of the killed startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5916 ;; Suggested by tale@pawl.rpi.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5917 (set-buffer (or (get-file-buffer gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5918 (find-file-noselect gnus-current-startup-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5919 ;; Options line continuation lines must be also considered here.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5920 ;; Before supporting continuation lines, " newsgroup ! 1-5" was
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5921 ;; okay, but now it is invalid. It should be "newsgroup! 1-5".
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5922 (let ((deleted nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5923 (buffer-read-only nil)) ;May be not modifiable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5924 ;; Delete ALL entries which match for GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5925 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5926 (while (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5927 (concat "^" (regexp-quote group) "[:!]") nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5928 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5929 (delete-region (point) (progn (forward-line 1) (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5930 (setq deleted t) ;Old entry is deleted.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5931 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5932 (if delete
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5933 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5934 ;; Insert group entry.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5935 (let ((newsrc (assoc group gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5936 (if (null newsrc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5937 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5938 ;; Find insertion point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5939 (cond (deleted nil) ;Insert here.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5940 ((and (stringp next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5941 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5942 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5943 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5944 (concat "^" (regexp-quote next) "[:!]") nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5945 (beginning-of-line))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5946 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5947 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5948 (or (bolp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5949 (insert "\n"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5950 ;; Insert after options line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5951 (if (looking-at "^[ \t]*options\\([ \t]\\|$\\)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5952 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5953 (forward-line 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5954 ;; Skip continuation lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5955 (while (and (not (eobp))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5956 (looking-at "^[ \t]+"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5957 (forward-line 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5958 (insert group ;Group name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5959 (if (nth 1 newsrc) ": " "! ")) ;Subscribed?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5960 (gnus-ranges-to-newsrc-format (nthcdr 2 newsrc)) ;Read articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5961 (insert "\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5962 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5963 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5964
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5965 (defun gnus-gnus-to-quick-newsrc-format ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5966 "Insert GNUS variables such as `gnus-newsrc-assoc' in Lisp format."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5967 (insert ";; GNUS internal format of .newsrc.\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5968 (insert ";; Touch .newsrc instead if you think to remove this file.\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5969 (let ((variable nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5970 (variables gnus-variable-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5971 ;; Temporary rebind to make changes invisible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5972 (gnus-killed-assoc gnus-killed-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5973 ;; Remove duplicated or unsubscribed newsgroups in gnus-killed-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5974 (gnus-check-killed-newsgroups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5975 ;; Then, insert lisp expressions.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5976 (while variables
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5977 (setq variable (car variables))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5978 (and (boundp variable)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5979 (symbol-value variable)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5980 (insert "(setq " (symbol-name variable) " '"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5981 (prin1-to-string (symbol-value variable))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5982 ")\n"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5983 (setq variables (cdr variables)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5984 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5985
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5986 (defun gnus-ranges-to-newsrc-format (ranges)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5987 "Insert ranges of read articles."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5988 (let ((range nil)) ;Range is a pair of BEGIN and END.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5989 (while ranges
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5990 (setq range (car ranges))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5991 (setq ranges (cdr ranges))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5992 (cond ((= (car range) (cdr range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5993 (if (= (car range) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5994 (setq ranges nil) ;No unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5995 (insert (int-to-string (car range)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5996 (if ranges (insert ","))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5997 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5998 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5999 (insert (int-to-string (car range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6000 "-"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6001 (int-to-string (cdr range)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6002 (if ranges (insert ","))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6003 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6004 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6005
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6006 (defun gnus-compress-sequence (numbers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6007 "Convert list of sorted numbers to ranges."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6008 (let* ((numbers (sort (copy-sequence numbers) (function <)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6009 (first (car numbers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6010 (last (car numbers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6011 (result nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6012 (while numbers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6013 (cond ((= last (car numbers)) nil) ;Omit duplicated number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6014 ((= (1+ last) (car numbers)) ;Still in sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6015 (setq last (car numbers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6016 (t ;End of one sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6017 (setq result (cons (cons first last) result))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6018 (setq first (car numbers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6019 (setq last (car numbers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6020 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6021 (setq numbers (cdr numbers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6022 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6023 (nreverse (cons (cons first last) result))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6024 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6025
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6026 (defun gnus-uncompress-sequence (ranges)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6027 "Expand compressed format of sequence."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6028 (let ((first nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6029 (last nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6030 (result nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6031 (while ranges
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6032 (setq first (car (car ranges)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6033 (setq last (cdr (car ranges)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6034 (while (< first last)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6035 (setq result (cons first result))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6036 (setq first (1+ first)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6037 (setq result (cons first result))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6038 (setq ranges (cdr ranges))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6039 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6040 (nreverse result)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6041 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6042
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6043 (defun gnus-number-of-articles (range)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6044 "Compute number of articles from RANGE `((beg1 . end1) (beg2 . end2) ...)'."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6045 (let ((count 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6046 (while range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6047 (if (/= (cdr (car range)) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6048 ;; If end1 is 0, it must be skipped. Usually no articles in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6049 ;; this group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6050 (setq count (+ count 1 (- (cdr (car range)) (car (car range))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6051 (setq range (cdr range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6052 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6053 count ;Result
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6054 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6055
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6056 (defun gnus-difference-of-range (src obj)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6057 "Compute (SRC - OBJ) on range.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6058 Range of SRC is expressed as `(beg . end)'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6059 Range of OBJ is expressed as `((beg1 . end1) (beg2 . end2) ...)."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6060 (let ((beg (car src))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6061 (end (cdr src))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6062 (range nil)) ;This is result.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6063 ;; Src may be nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6064 (while (and src obj)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6065 (let ((beg1 (car (car obj)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6066 (end1 (cdr (car obj))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6067 (cond ((> beg end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6068 (setq obj nil)) ;Terminate loop
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6069 ((< beg beg1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6070 (setq range (cons (cons beg (min (1- beg1) end)) range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6071 (setq beg (1+ end1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6072 ((>= beg beg1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6073 (setq beg (max beg (1+ end1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6074 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6075 (setq obj (cdr obj)) ;Next OBJ
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6076 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6077 ;; Src may be nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6078 (if (and src (<= beg end))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6079 (setq range (cons (cons beg end) range)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6080 ;; Result
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6081 (if range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6082 (nreverse range)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6083 (list (cons 0 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6084 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6085
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6086
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6087 ;;Local variables:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6088 ;;eval: (put 'gnus-eval-in-buffer-window 'lisp-indent-function 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6089 ;;end:
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 257
diff changeset
6090
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 257
diff changeset
6091 (provide 'gnus)
660
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
6092
08eb386dd0f3 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
6093 ;;; gnus.el ends here