annotate lisp/=gnus.el @ 383:4f7094a6b826

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Mon, 12 Aug 1991 12:12:28 +0000
parents e5ba2ba35226
children 4cd7543be581
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 ;;; GNUS: an NNTP-based News Reader for GNU Emacs
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 ;; Copyright (C) 1987, 1988, 1989 Fujitsu Laboratories LTD.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3 ;; Copyright (C) 1987, 1988, 1989, 1990 Masanobu UMEDA
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 ;; $Header: gnus.el,v 3.13 90/03/23 13:24:27 umerin Locked $
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 ;; This file is part of GNU Emacs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; GNU Emacs is distributed in the hope that it will be useful,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 ;; but WITHOUT ANY WARRANTY. No author or distributor
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;; accepts responsibility to anyone for the consequences of using it
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; or for whether it serves any particular purpose or works at all,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 ;; unless he says so in writing. Refer to the GNU Emacs General Public
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; License for full details.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; Everyone is granted permission to copy, modify and redistribute
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; GNU Emacs, but only under the conditions described in the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; GNU Emacs General Public License. A copy of this license is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; supposed to have been given to you along with GNU Emacs so you
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 ;; can know your rights and responsibilities. It should be in a
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; file named COPYING. Among other things, the copyright notice
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 ;; and this notice must be preserved on all copies.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 ;; GNUS Mailing List:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 ;; There are two mailing lists for GNUS lovers in the world:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 ;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 ;; info-gnus@flab.fujitsu.co.jp, and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;; info-gnus-english@tut.cis.ohio-state.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ;; They are intended to exchange useful information about GNUS, such
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 ;; as bug fixes, useful hooks, and extensions. The major difference
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 ;; between the lists is what the official language is. Both Japanese
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 ;; and English are available in info-gnus, while English is only
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 ;; available in info-gnus-english. There is no need to subscribe to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 ;; info-gnus if you cannot read Japanese messages, because most of the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 ;; discussion and important announcements will be sent to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ;; info-gnus-english. Moreover, if you can read gnu.emacs.gnus
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 ;; newsgroup of USENET, you need not, either. info-gnus-english and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 ;; gnu.emacs.gnus are linked each other.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 ;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 ;; Please send subscription request to:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 ;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 ;; info-gnus-request@flab.fujitsu.co.jp, or
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 ;; info-gnus-english-request@cis.ohio-state.edu
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 ;; TO DO:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 ;; (1) Incremental update of active info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 ;; (2) GNUS own poster.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 ;; (3) Multi-GNUS (Talking to many hosts same time).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 ;; (4) Asynchronous transmission of large messages.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (provide 'gnus)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 (require 'nntp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 (require 'mail-utils)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 (defvar gnus-nntp-server (or (getenv "NNTPSERVER") gnus-default-nntp-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 "The name of the host running NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 If it is a string such as `:DIRECTORY', the user's private DIRECTORY
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 is used as a news spool.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 Initialized from the NNTPSERVER environment variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 (defvar gnus-signature-file "~/.signature"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 "*Your .signature file. Use `.signature-DISTRIBUTION' instead if exists.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (defvar gnus-use-cross-reference t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 "Specifies what to do with cross references (Xref: field).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 If nil, ignore cross references. If t, mark articles as read in subscribed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 newsgroups. Otherwise, mark articles as read in all newsgroups.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 (defvar gnus-use-followup-to t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 "*Specifies what to do with Followup-To: field.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 If nil, ignore followup-to: field. If t, use its value execpt for
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 `poster'. Otherewise, if not nil nor t, always use its value.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 (defvar gnus-large-newsgroup 50
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 "*The number of articles which indicates a large newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 If the number of articles in a newsgroup is greater than the value,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 confirmation is required for selecting the newsgroup.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 (defvar gnus-author-copy (getenv "AUTHORCOPY")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 "*Filename for saving a copy of an article posted using FCC: field.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 Initialized from the AUTHORCOPY environment variable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 Articles are saved using a function specified by the the variable
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 `gnus-author-copy-saver' (`rmail-output' is the default) if a file name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 is given. Instead, if the first character of the name is `|', the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 contents of the article is piped out to the named program. It is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 possible to save an article in an MH folder as follows:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (setq gnus-author-copy \"|/usr/local/lib/mh/rcvstore +Article\")")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (defvar gnus-author-copy-saver (function rmail-output)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 "*A function called with a file name to save an author copy to.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 The default function is `rmail-output' which saves in Unix mailbox format.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 (defvar gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 (not (memq system-type '(usg-unix-v xenix)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 "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
98 to save articles to. If nil, the directory form of a newsgroup is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 used instead.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 (defvar gnus-article-save-directory (getenv "SAVEDIR")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 "*The directory in which to save articles; defaults to ~/News.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 Initialized from the SAVEDIR environment variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 (defvar gnus-default-article-saver (function gnus-Subject-save-in-rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 "A function used to save articles in your favorite format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 The function must be interactively callable (in other words, it must
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 be an Emacs command).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 GNUS provides the following functions:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 gnus-Subject-save-in-rmail (in Rmail format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 gnus-Subject-save-in-mail (in Unix mail format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 gnus-Subject-save-in-folder (in an MH folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 gnus-Subject-save-in-file (in article format).")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 (defvar gnus-rmail-save-name (function gnus-plain-save-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 "A function generating a file name to save articles in Rmail format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 (defvar gnus-mail-save-name (function gnus-plain-save-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 "A function generating a file name to save articles in Unix mail format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 (defvar gnus-folder-save-name (function gnus-folder-save-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 "A function generating a file name to save articles in MH folder.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 (defvar gnus-file-save-name (function gnus-numeric-save-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 "A function generating a file name to save articles in article format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 (defvar gnus-kill-file-name "KILL"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 "File name of a KILL file.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 (defvar gnus-default-distribution "local"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 "*Use this value as distribution if no distribution is specified.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 (defvar gnus-novice-user t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 "*Non-nil means that you are a novice to USENET.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 If non-nil, verbose messages may be displayed or your confirmation
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 may be required.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 (defvar gnus-interactive-post t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 "*Newsgroup, subject, and distribution will be asked for if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 (defvar gnus-user-login-name nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 "*The login name of the user.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 Uses USER and LOGNAME environment variables if undefined.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 (defvar gnus-user-full-name nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 "*The full name of the user.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 Uses from the NAME environment variable if undefined.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 (defvar gnus-show-threads t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 "*Show conversation threads in Subject Mode if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 (defvar gnus-thread-hide-subject t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 "*Non-nil means hide subjects for thread subtrees.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 (defvar gnus-thread-hide-subtree nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 "*Non-nil means hide thread subtrees initially.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 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
163 hand or by using `gnus-Select-article-hook' to show hidden threads.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 (defvar gnus-thread-hide-killed t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 "*Non-nil means hide killed thread subtrees automatically.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 (defvar gnus-thread-ignore-subject nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 "*Don't take care of subject differences, but only references if non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 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
171
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 (defvar gnus-thread-indent-level 4
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 "Indentation of thread subtrees.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 (defvar gnus-ignored-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 "^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
177 "Regexp matching headers not to display in messages.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 (defvar gnus-show-all-headers nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 "*Show all headers of an article if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 (defvar gnus-save-all-headers nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 "*Save all headers of an article if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 (defvar gnus-optional-headers (function gnus-optional-lines-and-from)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 "A function generating a optional string displayed in GNUS Subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 mode buffer. The function is called with an article HEADER. The
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 result must be a string excluding `[' and `]'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 (defvar gnus-auto-extend-newsgroup t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 "*Extend visible articles to forward and backward if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 (defvar gnus-auto-select-first t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 "*Select the first unread article automagically if non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 If you want to prevent automatic selection of the first unread article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 in some newsgroups, set the variable to nil in `gnus-Select-group-hook'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 or `gnus-Apply-kill-hook'.")
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-select-next t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 "*Select the next newsgroup automagically if non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 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
202 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
203 nor t, GNUS will select the following unread newsgroup. Especially, if
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 the value is the symbol `quietly', the next unread newsgroup will be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 selected without any confirmations.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 (defvar gnus-auto-select-same nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 "*Select the next article with the same subject automagically if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 (defvar gnus-auto-center-subject t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 "*Always center the current subject in GNUS Subject mode window if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 (defvar gnus-break-pages t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 "*Break an article into pages if non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 Page delimiter is specified by the variable `gnus-page-delimiter'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (defvar gnus-page-delimiter "^\^L"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 "*Regexp describing line-beginnings that separate pages of news article.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 (defvar gnus-digest-show-summary t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 "*Show a summary of undigestified messages if non-nil.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 (defvar gnus-digest-separator "^Subject:[ \t]"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 "*Regexp that separates messages in a digest article.")
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-use-full-window t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 "*Non-nil means to take up the entire screen of Emacs.")
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-window-configuration
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 '((SelectNewsgroup (0 1 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 (ExitNewsgroup (1 0 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 (SelectArticle (0 3 10))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 (ExpandSubject (0 1 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 "Specify window configurations for each action.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 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
236 G, S, and A are the relative height of Group, Subject, and Article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 windows, respectively. ACTION is `SelectNewsgroup', `ExitNewsgroup',
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 `SelectArticle', or `ExpandSubject'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 (defvar gnus-mail-reply-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 (function gnus-mail-reply-using-mail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 "A function to compose reply mail.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 The function `gnus-mail-reply-using-mail' uses usual the sendmail mail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 program. The function `gnus-mail-reply-using-mhe' uses the mh-e mail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 program. You can use yet another program by customizing this variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 (defvar gnus-mail-other-window-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 (function gnus-mail-other-window-using-mail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 "A function to compose mail in other window.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 The function `gnus-mail-other-window-using-mail' uses usual sendmail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 mail program. The function `gnus-mail-other-window-using-mhe' uses mh-e
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 mail program. You can use yet another program by customizing this variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 (defvar gnus-subscribe-newsgroup-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 (lambda (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 (gnus-subscribe-newsgroup newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 (car (car gnus-newsrc-assoc)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 "A function called with a newsgroup name when it is created.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 (defvar gnus-Group-mode-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 "A hook for GNUS Group Mode.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (defvar gnus-Subject-mode-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 "A hook for GNUS Subject Mode.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 (defvar gnus-Article-mode-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 "A hook for GNUS Article Mode.")
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-Kill-file-mode-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 "A hook for GNUS KILL File 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-Open-server-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 "A hook called just before opening connection to news server.")
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-Startup-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 "A hook called at start up time.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 This hook is called after GNUS is connected to the NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 So, it is possible to change the behavior of GNUS according to the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 selected NNTP server.")
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-Group-prepare-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 "A hook called after newsgroup list is created in the Newsgroup buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 If you want to modify the Newsgroup buffer, you can use this hook.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 (defvar gnus-Subject-prepare-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 "A hook called after subject list is created in the Subject buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 If you want to modify the Subject buffer, you can use this hook.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 (defvar gnus-Article-prepare-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 "A hook called after an article is prepared in the Article buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 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
293
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 (defvar gnus-Select-group-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 "A hook called when a newsgroup is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 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
297 can use the following 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 (setq gnus-Select-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 ;; First of all, sort by date.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 (gnus-sort-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 '(lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 (gnus-date-lessp (gnus-header-date a)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 (gnus-header-date b))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 ;; Then sort by subject string ignoring `Re:'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 ;; If case-fold-search is non-nil, case of letters is ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 (gnus-sort-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 '(lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 (gnus-string-lessp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 (gnus-simplify-subject (gnus-header-subject a) 're)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 (gnus-simplify-subject (gnus-header-subject b) 're)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 )))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 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
316 command does, you can use the following hook:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 (setq gnus-Select-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 (mapcar (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 (lambda (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 (nntp-set-header-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 (gnus-simplify-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 (gnus-header-subject header) 're-only))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 gnus-newsgroup-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 In some newsgroups author name is meaningless. It is possible to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 prevent listing author names in the GNUS Subject buffer as follows:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 (setq gnus-Select-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 (cond ((string-equal \"comp.sources.unix\" gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 (setq gnus-optional-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 (function gnus-optional-lines)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 (setq gnus-optional-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 (function gnus-optional-lines-and-from))))))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 (defvar gnus-Select-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 (function (lambda () (gnus-Subject-show-thread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 "Hook called when an article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 The default hook automatically shows conversation thread subtrees
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 of the selected article as follows:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 (setq gnus-Select-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 (gnus-Subject-show-thread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 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
351 use the following hook:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 (setq gnus-Select-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 (gnus-Subject-show-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 (cond ((string-equal \"comp.sys.sun\" gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 (gnus-Subject-rmail-digest))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 ((and (string-equal \"comp.text\" gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 (string-match \"^TeXhax Digest\"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 (gnus-header-subject gnus-current-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 (gnus-Subject-rmail-digest)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 ))))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 (defvar gnus-Select-digest-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 (lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 ;; Reply-To: is required by `undigestify-rmail-message'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 (or (mail-position-on-field "Reply-to" t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 (mail-position-on-field "Reply-to")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 (insert (gnus-fetch-field "From"))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 "A hook called when reading digest messages using Rmail.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 This hook can be used to modify incomplete digest articles as follows
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 (this is the default):
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376 (setq gnus-Select-digest-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 ;; Reply-To: is required by `undigestify-rmail-message'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 (or (mail-position-on-field \"Reply-to\" t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 (mail-position-on-field \"Reply-to\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 (insert (gnus-fetch-field \"From\"))))))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 (defvar gnus-Rmail-digest-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 "A hook called when reading digest messages using Rmail.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 This hook is intended to customize Rmail mode for reading digest articles.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388 (defvar gnus-Apply-kill-hook (function gnus-apply-kill-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 "A hook called when a newsgroup is selected and subject list is prepared.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 This hook is intended to apply a KILL file to the selected newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 The function `gnus-apply-kill-file' is called defaultly.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 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
394 newsgroups, we recommend you use a lighter hook function. For
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395 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
396 a string `rmgroup' in subject in newsgroup `control', you can use the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 following hook:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 (setq gnus-Apply-kill-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
400 '(lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
401 (cond ((string-match \"control\" gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 (gnus-kill \"Subject\" \"rmgroup\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
403 (gnus-expunge \"X\")))))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405 (defvar gnus-Mark-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
406 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
407 (lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 (or (memq gnus-current-article gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 (gnus-Subject-mark-as-read gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 (gnus-Subject-set-current-mark "+")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 "A hook called when an article is selected for the first time.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 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
413 If you'd like to mark as unread (-) instead, use the following hook:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 (setq gnus-Mark-article-hook
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 (gnus-Subject-mark-as-unread gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 (gnus-Subject-set-current-mark \"+\")))")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 (defvar gnus-Inews-article-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421 "A hook called before posting an article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422 If you'd like to run a special encoding program, use this 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 (defvar gnus-Exit-group-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 "A hook called when exiting (not quitting) Subject mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 If your machine is so slow that exiting from Subject mode takes a
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427 long time, set the variable `gnus-newsgroup-headers' to nil. This
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
428 inhibits marking articles as read using cross-reference information.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 (defvar gnus-Suspend-gnus-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 "A hook called when suspending (not exiting) GNUS.")
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-gnus-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
434 "A hook called when exiting (not suspending) GNUS.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436 (defvar gnus-Save-newsrc-hook nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 "A hook called when saving the newsrc file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438 This hook is called before saving .newsrc file.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440 (defvar gnus-your-domain nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
441 "*Your domain name without your host name like: \"stars.flab.Fujitsu.CO.JP\"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442 The environment variable DOMAINNAME is used instead if defined. If
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443 the function `system-name' returns the full internet name, there is no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444 need to define this variable.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
445
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 (defvar gnus-your-organization nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447 "*Your organization like: \"Fujitsu Laboratories Ltd., Kawasaki, Japan.\"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448 The `ORGANIZATION' environment variable is used instead if defined.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
449
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
450 (defvar gnus-use-generic-from nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451 "*If nil, prepend local host name to the defined domain in the From:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
452 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
453
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
454 (defvar gnus-use-generic-path nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 "*If nil, use the NNTP server name in the Path: field; if stringp,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456 use this; if non-nil, use no host name (user name only)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 ;; Internal variables.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 (defconst gnus-version "GNUS 3.13"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461 "Version numbers of this version of GNUS.")
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-Info-nodes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
464 '((gnus-Group-mode . "(gnus)Newsgroup Commands")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
465 (gnus-Subject-mode . "(gnus)Subject Commands")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466 (gnus-Article-mode . "(gnus)Article Commands")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467 (gnus-Kill-file-mode . "(gnus)KILL File")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
468 (gnus-Browse-killed-mode . "(gnus)Maintenance"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469 "Assoc list of major modes and related Info nodes.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471 (defvar gnus-access-methods
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 '((nntp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473 (gnus-retrieve-headers . nntp-retrieve-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474 (gnus-open-server . nntp-open-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 (gnus-close-server . nntp-close-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 (gnus-server-opened . nntp-server-opened)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477 (gnus-status-message . nntp-status-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
478 (gnus-request-article . nntp-request-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479 (gnus-request-group . nntp-request-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
480 (gnus-request-list . nntp-request-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481 (gnus-request-post . nntp-request-post))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
482 (nnspool
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
483 (gnus-retrieve-headers . nnspool-retrieve-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484 (gnus-open-server . nnspool-open-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485 (gnus-close-server . nnspool-close-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
486 (gnus-server-opened . nnspool-server-opened)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 (gnus-status-message . nnspool-status-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488 (gnus-request-article . nnspool-request-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
489 (gnus-request-group . nnspool-request-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
490 (gnus-request-list . nnspool-request-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
491 (gnus-request-post . nnspool-request-post))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
492 (mhspool
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
493 (gnus-retrieve-headers . mhspool-retrieve-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
494 (gnus-open-server . mhspool-open-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
495 (gnus-close-server . mhspool-close-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
496 (gnus-server-opened . mhspool-server-opened)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
497 (gnus-status-message . mhspool-status-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498 (gnus-request-article . mhspool-request-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
499 (gnus-request-group . mhspool-request-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
500 (gnus-request-list . mhspool-request-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
501 (gnus-request-post . mhspool-request-post)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
502 "Access method for NNTP, nnspool, and mhspool.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
503
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
504 (defvar gnus-Group-buffer "*Newsgroup*")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505 (defvar gnus-Subject-buffer "*Subject*")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
506 (defvar gnus-Article-buffer "*Article*")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507 (defvar gnus-Digest-buffer "GNUS Digest")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
508 (defvar gnus-Digest-summary-buffer "GNUS Digest-summary")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
509
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
510 (defvar gnus-buffer-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
511 (list gnus-Group-buffer gnus-Subject-buffer gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
512 gnus-Digest-buffer gnus-Digest-summary-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
513 "GNUS buffer names which should be killed when exiting.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
514
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
515 (defvar gnus-variable-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
516 '(gnus-newsrc-options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
517 gnus-newsrc-options-n-yes gnus-newsrc-options-n-no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
518 gnus-newsrc-assoc gnus-killed-assoc gnus-marked-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
519 "GNUS variables saved in the quick startup file.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
520
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
521 (defvar gnus-overload-functions
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
522 '((news-inews gnus-inews-news "rnewspost")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
523 (caesar-region gnus-caesar-region "rnews"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
524 "Functions overloaded by gnus.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
525 It is a list of `(original overload &optional file)'.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
526
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
527 (defvar gnus-newsrc-options nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
528 "Options line in the .newsrc 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-newsrc-options-n-yes nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
531 "Regexp representing subscribed newsgroups.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
532
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
533 (defvar gnus-newsrc-options-n-no nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
534 "Regexp representing unsubscribed newsgroups.")
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-assoc nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
537 "Assoc list of read articles.")
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-killed-assoc nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
540 "Assoc list of newsgroups removed from `gnus-newsrc-assoc'.")
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-marked-assoc nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
543 "Assoc list of articles marked as unread.")
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-unread-hashtb nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
546 "Hashtable of unread 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-active-hashtb nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
549 "Hashtable of active articles.")
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-octive-hashtb nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
552 "Hashtable of OLD active articles.")
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-current-startup-file nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
555 "Startup file for the current host.")
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-last-search-regexp nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
558 "Default regexp for article search command.")
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-last-shell-command nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
561 "Default shell command on article.")
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-have-all-newsgroups nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
564
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
565 (defvar gnus-newsgroup-name nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
566 (defvar gnus-newsgroup-begin nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
567 (defvar gnus-newsgroup-end nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
568 (defvar gnus-newsgroup-last-rmail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
569 (defvar gnus-newsgroup-last-mail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
570 (defvar gnus-newsgroup-last-folder nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571 (defvar gnus-newsgroup-last-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
572
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
573 (defvar gnus-newsgroup-unreads nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
574 "List of unread articles in the current newsgroup.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
575
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
576 (defvar gnus-newsgroup-unselected nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577 "List of unselected unread articles in the current newsgroup.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579 (defvar gnus-newsgroup-marked nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580 "List of marked articles in the current newsgroup (a subset of unread art).")
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-headers nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
583 "List of article headers 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-current-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
586 (defvar gnus-current-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
587 (defvar gnus-current-history nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
588 (defvar gnus-have-all-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
589 (defvar gnus-last-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
590 (defvar gnus-current-kill-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
591
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
592 ;; Save window configuration.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
593 (defvar gnus-winconf-kill-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
594
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
595 (defvar gnus-Group-mode-map nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
596 (defvar gnus-Subject-mode-map nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
597 (defvar gnus-Article-mode-map nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
598 (defvar gnus-Kill-file-mode-map nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
599
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
600 (defvar rmail-last-file (expand-file-name "~/XMBOX"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
601 (defvar rmail-last-rmail-file (expand-file-name "~/XNEWS"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
602
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
603 ;; Define GNUS Subsystems.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604 (autoload 'gnus-Group-post-news "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
605 "Post an article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
606 (autoload 'gnus-Subject-post-news "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
607 "Post an article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
608 (autoload 'gnus-Subject-post-reply "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
609 "Post a reply article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
610 (autoload 'gnus-Subject-post-reply-with-original "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
611 "Post a reply article with original article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
612 (autoload 'gnus-Subject-cancel-article "gnuspost"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
613 "Cancel an article you posted." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
614
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
615 (autoload 'gnus-Subject-mail-reply "gnusmail"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
616 "Reply mail to news author." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
617 (autoload 'gnus-Subject-mail-reply-with-original "gnusmail"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
618 "Reply mail to news author with original article." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
619 (autoload 'gnus-Subject-mail-other-window "gnusmail"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
620 "Compose mail in other window." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
621
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
622 (autoload 'gnus-Group-kill-group "gnusmisc"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
623 "Kill newsgroup on current line." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
624 (autoload 'gnus-Group-yank-group "gnusmisc"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
625 "Yank the last killed newsgroup on current line." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
626 (autoload 'gnus-Browse-killed-groups "gnusmisc"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
627 "Browse the killed newsgroups." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
628
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
629 (autoload 'rmail-output "rmailout"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
630 "Append this message to Unix mail file named FILE-NAME." t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
631 (autoload 'mail-position-on-field "sendmail")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
632 (autoload 'mh-find-path "mh-e")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
633 (autoload 'mh-prompt-for-folder "mh-e")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
634
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
635 (put 'gnus-Group-mode 'mode-class 'special)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
636 (put 'gnus-Subject-mode 'mode-class 'special)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
637 (put 'gnus-Article-mode 'mode-class 'special)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
638
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
639
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
640 ;;(put 'gnus-eval-in-buffer-window 'lisp-indent-function 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
641
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
642 (defmacro gnus-eval-in-buffer-window (buffer &rest forms)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
643 "Pop to BUFFER, evaluate FORMS, and then returns to original window."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
644 (` (let ((GNUSStartBufferWindow (selected-window)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
645 (unwind-protect
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
646 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
647 (pop-to-buffer (, buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
648 (,@ forms))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
649 (select-window GNUSStartBufferWindow)))))
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-make-hashtable ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
652 '(make-abbrev-table))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
653
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
654 (defmacro gnus-gethash (string hashtable)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
655 "Get hash value of STRING in HASHTABLE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
656 ;;(` (symbol-value (abbrev-symbol (, string) (, hashtable))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
657 (` (abbrev-expansion (, string) (, hashtable))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
658
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
659 (defmacro gnus-sethash (string value hashtable)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
660 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
661 ;; We cannot use define-abbrev since it only accepts string as value.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
662 (` (set (intern (, string) (, hashtable)) (, value))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
663
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
664 ;; 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
665 ;; to put them here, but many users got troubled with the old
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
666 ;; definitions in nntp.elc. These codes are NNTP 3.10 version.
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 nntp-header-number (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
669 "Return article number in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
670 (` (aref (, header) 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
671
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
672 (defmacro nntp-set-header-number (header number)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
673 "Set article number of HEADER to NUMBER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
674 (` (aset (, header) 0 (, number))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
675
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
676 (defmacro nntp-header-subject (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
677 "Return subject string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
678 (` (aref (, header) 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
679
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
680 (defmacro nntp-set-header-subject (header subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
681 "Set article subject of HEADER to SUBJECT."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
682 (` (aset (, header) 1 (, subject))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
683
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
684 (defmacro nntp-header-from (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
685 "Return author string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
686 (` (aref (, header) 2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
687
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
688 (defmacro nntp-set-header-from (header from)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
689 "Set article author of HEADER to FROM."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
690 (` (aset (, header) 2 (, from))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
691
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
692 (defmacro nntp-header-xref (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
693 "Return xref string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
694 (` (aref (, header) 3)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
695
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
696 (defmacro nntp-set-header-xref (header xref)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
697 "Set article xref of HEADER to xref."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
698 (` (aset (, header) 3 (, xref))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
699
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
700 (defmacro nntp-header-lines (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
701 "Return lines in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
702 (` (aref (, header) 4)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
703
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
704 (defmacro nntp-set-header-lines (header lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
705 "Set article lines of HEADER to LINES."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
706 (` (aset (, header) 4 (, lines))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
707
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
708 (defmacro nntp-header-date (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
709 "Return date in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
710 (` (aref (, header) 5)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
711
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
712 (defmacro nntp-set-header-date (header date)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
713 "Set article date of HEADER to DATE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
714 (` (aset (, header) 5 (, date))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
715
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
716 (defmacro nntp-header-id (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
717 "Return Id in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
718 (` (aref (, header) 6)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
719
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
720 (defmacro nntp-set-header-id (header id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
721 "Set article Id of HEADER to ID."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
722 (` (aset (, header) 6 (, id))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
723
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
724 (defmacro nntp-header-references (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
725 "Return references in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
726 (` (aref (, header) 7)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
727
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
728 (defmacro nntp-set-header-references (header ref)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
729 "Set article references of HEADER to REF."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
730 (` (aset (, header) 7 (, ref))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
731
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
732
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
733 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
734 ;;; GNUS Group Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
735 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
736
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
737 (if gnus-Group-mode-map
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
738 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
739 (setq gnus-Group-mode-map (make-keymap))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
740 (suppress-keymap gnus-Group-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
741 (define-key gnus-Group-mode-map " " 'gnus-Group-read-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
742 (define-key gnus-Group-mode-map "=" 'gnus-Group-select-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
743 (define-key gnus-Group-mode-map "j" 'gnus-Group-jump-to-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
744 (define-key gnus-Group-mode-map "n" 'gnus-Group-next-unread-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
745 (define-key gnus-Group-mode-map "p" 'gnus-Group-prev-unread-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
746 (define-key gnus-Group-mode-map "\177" 'gnus-Group-prev-unread-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
747 (define-key gnus-Group-mode-map "N" 'gnus-Group-next-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
748 (define-key gnus-Group-mode-map "P" 'gnus-Group-prev-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
749 (define-key gnus-Group-mode-map "\C-n" 'gnus-Group-next-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
750 (define-key gnus-Group-mode-map "\C-p" 'gnus-Group-prev-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
751 (define-key gnus-Group-mode-map "\r" 'next-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
752 (define-key gnus-Group-mode-map "/" 'isearch-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
753 (define-key gnus-Group-mode-map "<" 'beginning-of-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
754 (define-key gnus-Group-mode-map ">" 'end-of-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
755 (define-key gnus-Group-mode-map "u" 'gnus-Group-unsubscribe-current-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
756 (define-key gnus-Group-mode-map "U" 'gnus-Group-unsubscribe-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
757 (define-key gnus-Group-mode-map "c" 'gnus-Group-catch-up)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
758 (define-key gnus-Group-mode-map "C" 'gnus-Group-catch-up-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
759 (define-key gnus-Group-mode-map "l" 'gnus-Group-list-groups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
760 (define-key gnus-Group-mode-map "L" 'gnus-Group-list-all-groups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
761 (define-key gnus-Group-mode-map "g" 'gnus-Group-get-new-news)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
762 (define-key gnus-Group-mode-map "R" 'gnus-Group-restart)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
763 (define-key gnus-Group-mode-map "b" 'gnus-Group-check-bogus-groups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
764 (define-key gnus-Group-mode-map "r" 'gnus-Group-restrict-groups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
765 (define-key gnus-Group-mode-map "a" 'gnus-Group-post-news)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
766 (define-key gnus-Group-mode-map "\ek" 'gnus-Group-edit-local-kill)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
767 (define-key gnus-Group-mode-map "\eK" 'gnus-Group-edit-global-kill)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
768 (define-key gnus-Group-mode-map "\C-k" 'gnus-Group-kill-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
769 (define-key gnus-Group-mode-map "\C-y" 'gnus-Group-yank-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
770 (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
771 (define-key gnus-Group-mode-map "V" 'gnus-version)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
772 (define-key gnus-Group-mode-map "x" 'gnus-Group-force-update)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
773 (define-key gnus-Group-mode-map "s" 'gnus-Group-force-update)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
774 (define-key gnus-Group-mode-map "z" 'gnus-Group-suspend)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
775 (define-key gnus-Group-mode-map "q" 'gnus-Group-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
776 (define-key gnus-Group-mode-map "Q" 'gnus-Group-quit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
777 (define-key gnus-Group-mode-map "?" 'gnus-Group-describe-briefly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
778 (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
779
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
780 (defun gnus-Group-mode ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
781 "Major mode for reading network news.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
782 All normal editing commands are turned off.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
783 Instead, these commands are available:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
784 \\{gnus-Group-mode-map}
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
785
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
786 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
787 host is specified. It is also possible to choose another NNTP server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
788 even when the default server is defined by giving a prefix argument to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
789 the command `\\[gnus]'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
790
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
791 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
792 private directory `~/Mail' is used as a news spool. This makes it
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
793 possible to read mail stored in MH folders or articles saved by GNUS.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
794 File names of mail or articles must consist of only numeric
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
795 characters. Otherwise, they are ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
796
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
797 If there is a file named `~/.newsrc-SERVER', it is used as the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
798 startup file instead of standard one when talking to SERVER. It is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
799 possible to talk to many hosts by using different startup files for
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
800 each.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
801
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
802 Option `-n' of the options line in the startup file is recognized
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
803 properly the same as the Bnews system. For example, if the options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
804 line is `options -n !talk talk.rumors', newsgroups under the `talk'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
805 hierarchy except for `talk.rumors' are ignored while checking new
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
806 newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
807
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
808 If there is a file named `~/.signature-DISTRIBUTION', it is used as
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
809 signature file instead of standard one when posting a news in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
810 DISTRIBUTION.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
811
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
812 If an Info file generated from `gnus.texinfo' is installed, you can
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
813 read an appropriate Info node of the Info file according to the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
814 current major mode of GNUS by \\[gnus-Info-find-node].
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
815
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
816 The variable `gnus-version', `nntp-version', `nnspool-version', and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
817 `mhspool-version' have the version numbers of this version of gnus.el,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
818 nntp.el, nnspool.el, and mhspoo.el, respectively.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
819
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
820 User customizable variables:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
821 gnus-nntp-server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
822 Specifies the name of the host running the NNTP server. If its
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
823 value is a string such as `:DIRECTORY', the user's private
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
824 DIRECTORY is used as a news spool. The variable is initialized
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
825 from the NNTPSERVER environment variable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
826
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
827 gnus-nntp-service
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
828 Specifies a NNTP service name. It is usually \"nntp\" or 119. Nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
829 forces GNUS to use a local news spool if the variable
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
830 `gnus-nntp-server' is set to the local host name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
831
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
832 gnus-startup-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
833 Specifies a startup file (.newsrc). If there is a file named
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
834 `.newsrc-SERVER', it's used instead when talking to SERVER. I
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
835 recommend you to use the server specific file, if you'd like to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
836 talk to many servers. Especially if you'd like to read your
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
837 private directory, the name of the file must be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
838 `.newsrc-:DIRECTORY'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
839
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
840 gnus-signature-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
841 Specifies a signature file (.signature). If there is a file named
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
842 `.signature-DISTRIBUTION', it's used instead when posting an
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
843 article in DISTRIBUTION. Set the variable to nil to prevent
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
844 appending the file automatically. If you use an NNTP inews which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
845 comes with the NNTP package, you may have to set the variable to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
846 nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
847
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
848 gnus-use-cross-reference
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
849 Specifies what to do with cross references (Xref: field). If it
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
850 is nil, cross references are ignored. If it is t, articles in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
851 subscribed newsgroups are only marked as read. Otherwise, if it
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
852 is not nil nor t, articles in all newsgroups are marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
853
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
854 gnus-use-followup-to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
855 Specifies what to do with followup-to: field. If it is nil, its
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
856 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
857 newsgroups. Especially, if it is t and field value is `poster',
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
858 your confirmation is required.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
859
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
860 gnus-author-copy
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
861 Specifies a file name to save a copy of article you posted using
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
862 FCC: field. If the first character of the value is `|', the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
863 contents of the article is piped out to a program specified by the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
864 rest of the value. The variable is initialized from the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
865 AUTHORCOPY environment variable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
866
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
867 gnus-author-copy-saver
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
868 Specifies a function to save an author copy. The function is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
869 called with a file name. The default function `rmail-output'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
870 saves in Unix mail format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
871
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
872 gnus-kill-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
873 Use specified file name as a KILL file (default to `KILL').
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
874
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
875 gnus-novice-user
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
876 Non-nil means that you are a novice to USENET. If non-nil,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
877 verbose messages may be displayed or your confirmations may be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
878 required.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
879
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
880 gnus-interactive-post
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
881 Non-nil means that newsgroup, subject and distribution are asked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
882 for interactively when posting a new article.
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-use-full-window
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
885 Non-nil means to take up the entire screen of Emacs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
886
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
887 gnus-window-configuration
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
888 Specifies the configuration of Group, Subject, and Article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
889 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
890 the relative height of Group, Subject, and Article windows,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
891 respectively. ACTION is `SelectNewsgroup', `ExitNewsgroup',
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
892 `SelectArticle', or `ExpandSubject'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
893
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
894 gnus-subscribe-newsgroup-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
895 Specifies a function called with a newsgroup name when new
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
896 newsgroup is found. The default definition adds new newsgroup at
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
897 the beginning of other newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
898
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
899 Various hooks for customization:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
900 gnus-Group-mode-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
901 Entry to this mode calls the value with no arguments, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
902 value is non-nil. This hook is called before GNUS is connected to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
903 the NNTP server. So, you can change or define the NNTP server in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
904 this hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
905
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
906 gnus-Startup-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
907 Called with no arguments after the NNTP server is selected. It is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
908 possible to change the behavior of GNUS or initialize the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
909 variables according to the selected NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911 gnus-Group-prepare-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 Called with no arguments after a newsgroup list is created in the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
913 Newsgroup buffer, if that value is non-nil.
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-Save-newsrc-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
916 Called with no arguments when saving newsrc file if that value is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917 non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
918
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
919 gnus-Inews-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
920 Called with no arguments when posting an article if that value is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
921 non-nil. This hook is called just before posting an article, while
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
922 `news-inews-hook' is called before preparing article headers. If
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
923 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
924
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
925 gnus-Suspend-gnus-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
926 Called with no arguments when suspending (not exiting) GNUS, if
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
927 that value is non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
928
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
929 gnus-Exit-gnus-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
930 Called with no arguments when exiting (not suspending) GNUS, if
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
931 that value is non-nil."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
932 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
933 (kill-all-local-variables)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934 ;; Gee. Why don't you upgrade?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
935 (cond ((boundp 'mode-line-modified)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
936 (setq mode-line-modified "--- "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937 ((listp (default-value 'mode-line-format))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938 (setq mode-line-format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
939 (cons "--- " (cdr (default-value 'mode-line-format)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
940 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
941 (setq mode-line-format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
942 "--- GNUS: List of Newsgroups %[(%m)%]----%3p-%-")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
943 (setq major-mode 'gnus-Group-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
944 (setq mode-name "Newsgroup")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
945 (setq mode-line-buffer-identification "GNUS: List of Newsgroups")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
946 (setq mode-line-process nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 (use-local-map gnus-Group-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
948 (buffer-flush-undo (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
949 (setq buffer-read-only t) ;Disable modification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
950 (run-hooks 'gnus-Group-mode-hook))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
951
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
952 ;;;###autoload
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
953 (defun gnus (&optional confirm)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
954 "Read network news.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
955 If optional argument CONFIRM is non-nil, ask NNTP server."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
956 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
957 (unwind-protect
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
958 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
959 (switch-to-buffer (get-buffer-create gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
960 (gnus-Group-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
961 (gnus-start-news-server confirm))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
962 (if (not (gnus-server-opened))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
963 (gnus-Group-quit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
964 ;; NNTP server is successfully open.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
965 (setq mode-line-process (format " {%s}" gnus-nntp-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
966 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
967 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
968 (gnus-Group-startup-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
969 (sit-for 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
970 (run-hooks 'gnus-Startup-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
971 (gnus-setup-news-info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
972 (if gnus-novice-user
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973 (gnus-Group-describe-briefly)) ;Show brief help message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 (gnus-Group-list-groups nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
975 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
977 (defun gnus-Group-startup-message ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
978 "Insert startup message in current buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
979 ;; Insert the message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
980 (insert "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
981 GNUS Version 3.13
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
982
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
983 NNTP-based News Reader for GNU Emacs
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 If you have any trouble with this software, please let me
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
987 know. I will fix your problems in the next release.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
988
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
989 Comments, suggestions, and bug fixes are welcome.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
990
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
991 Masanobu UMEDA
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
992 umerin@tc.Nagasaki.GO.JP")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
993 ;; And then hack it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
994 ;; 57 is the longest line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
995 (indent-rigidly (point-min) (point-max) (/ (max (- (window-width) 57) 0) 2))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
996 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
997 ;; +4 is fuzzy factor.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
998 (insert-char ?\n (/ (max (- (window-height) 18) 0) 2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
999
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1000 (defun gnus-Group-list-groups (show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1001 "List newsgroups in the Newsgroup buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002 If argument SHOW-ALL is non-nil, unsubscribed groups are also listed."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1003 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004 (let ((last-group ;Current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005 (gnus-Group-group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006 (next-group ;Next possible newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1007 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1008 (gnus-Group-search-forward nil nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1009 (gnus-Group-group-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1010 (prev-group ;Previous possible newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1011 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1012 (gnus-Group-search-forward t nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1013 (gnus-Group-group-name))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1014 (gnus-Group-prepare show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1015 (if (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1016 (message "No news is good news")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1017 ;; Go to last newsgroup if possible. If cannot, try next and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1018 ;; previous. If all fail, go to first unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1019 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1020 (or (and last-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1021 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1022 (concat "^.+: " (regexp-quote last-group) "$") nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1023 (and next-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1024 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1025 (concat "^.+: " (regexp-quote next-group) "$") nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1026 (and prev-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1027 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1028 (concat "^.+: " (regexp-quote prev-group) "$") nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1029 (re-search-forward "^[ \t]+[1-9][0-9]*:" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1030 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1031 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1032 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1033 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1034
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1035 (defun gnus-Group-prepare (&optional all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1036 "Prepare list of newsgroups in current buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1037 If optional argument ALL is non-nil, unsubscribed groups are also listed."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1038 (let ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1039 (newsrc gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1040 (group-info nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1041 (group-name nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1042 (unread-count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1043 ;; This specifies the format of Group buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1044 (cntl "%s%s%5d: %s\n"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1045 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1046 ;; List newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1047 (while newsrc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1048 (setq group-info (car newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1049 (setq group-name (car group-info))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1050 (setq unread-count (nth 1 (gnus-gethash group-name gnus-unread-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1051 (if (or all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1052 (and (nth 1 group-info) ;Subscribed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1053 (> unread-count 0))) ;There are unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1054 ;; Yes, I can use gnus-Group-prepare-line, but this is faster.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1055 (insert
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1056 (format cntl
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1057 ;; Subscribed or not.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1058 (if (nth 1 group-info) " " "U")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1059 ;; Has new news?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1060 (if (and (> unread-count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1061 (>= 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1062 (- unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1063 (length
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1064 (cdr (assoc group-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1065 gnus-marked-assoc))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1066 "*" " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1067 ;; Number of unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1068 unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1069 ;; Newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1070 group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1071 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1072 (setq newsrc (cdr newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1073 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1074 (setq gnus-have-all-newsgroups all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1075 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1076 (run-hooks 'gnus-Group-prepare-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1077 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1078
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1079 (defun gnus-Group-prepare-line (info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1080 "Return a string for the Newsgroup buffer from INFO.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1081 INFO is an element of gnus-newsrc-assoc or gnus-killed-assoc."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1082 (let* ((group-name (car info))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1083 (unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1084 (or (nth 1 (gnus-gethash group-name gnus-unread-hashtb))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1085 ;; Not in hash table, so compute it now.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1086 (gnus-number-of-articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1087 (gnus-difference-of-range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1088 (nth 2 (gnus-gethash group-name gnus-active-hashtb))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1089 (nthcdr 2 info)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1090 ;; This specifies the format of Group buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1091 (cntl "%s%s%5d: %s\n"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1092 (format cntl
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1093 ;; Subscribed or not.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1094 (if (nth 1 info) " " "U")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1095 ;; Has new news?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1096 (if (and (> unread-count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1097 (>= 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1098 (- unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1099 (length
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1100 (cdr (assoc group-name gnus-marked-assoc))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1101 "*" " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1102 ;; Number of unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1103 unread-count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1104 ;; Newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1105 group-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1106 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1107
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1108 (defun gnus-Group-update-group (group &optional visible-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1109 "Update newsgroup info of GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1110 If optional argument VISIBLE-ONLY is non-nil, non displayed group is ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1111 (let ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1112 (visible nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1113 ;; Buffer may be narrowed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1114 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1115 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1116 ;; Search point to modify.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1117 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1118 (if (re-search-forward (concat "^.+: " (regexp-quote group) "$") nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1119 ;; GROUP is listed in current buffer. So, delete old line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1120 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1121 (setq visible t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1122 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1123 (delete-region (point) (progn (forward-line 1) (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1124 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1125 (if (or visible (not visible-only))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1126 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1127 (insert (gnus-Group-prepare-line (assoc group gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1128 (forward-line -1) ;Move point on that line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1129 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1130 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1131
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1132 ;; GNUS Group mode command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1133
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1134 (defun gnus-Group-group-name ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1135 "Get newsgroup name around point."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1136 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1137 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1138 (if (looking-at ".[* \t]*[0-9]+:[ \t]+\\([^ \t\n]+\\)$")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1139 (buffer-substring (match-beginning 1) (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1140 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1141
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1142 (defun gnus-Group-read-group (all &optional no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1143 "Read news in this newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1144 If argument ALL is non-nil, already read articles become readable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1145 If optional argument NO-ARTICLE is non-nil, no article body is displayed."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1146 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1147 (let ((group (gnus-Group-group-name))) ;Newsgroup name to read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1148 (if group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1149 (gnus-Subject-read-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1150 group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1151 (or all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1152 ;;(not (nth 1 (assoc group gnus-newsrc-assoc))) ;Unsubscribed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1153 (zerop
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1154 (nth 1 (gnus-gethash group gnus-unread-hashtb)))) ;No unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1155 no-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1156 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1157 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1158
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1159 (defun gnus-Group-select-group (all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1160 "Select this newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1161 No article is selected automatically.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1162 If argument ALL is non-nil, already read articles become readable."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1163 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1164 (gnus-Group-read-group all t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1165
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1166 (defun gnus-Group-jump-to-group (group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1167 "Jump to newsgroup GROUP."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1168 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1169 (list (completing-read "Newsgroup: " gnus-newsrc-assoc nil 'require-match)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1170 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1171 (or (re-search-forward (concat "^.+: " (regexp-quote group) "$") nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1172 (if (assoc group gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1173 ;; Add GROUP entry, then seach again.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1174 (gnus-Group-update-group group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1175 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1176 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1177 (search-forward ":" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1178
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1179 (defun gnus-Group-search-forward (backward any-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1180 "Search for newsgroup forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1181 If first argument BACKWARD is non-nil, search backward instead.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1182 If second argument ANY-GROUP is non-nil, unsubscribed or empty
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1183 group may be selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1184 (let ((func (if backward 're-search-backward 're-search-forward))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1185 (regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1186 (format "^%s[ \t]*\\(%s\\):"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1187 (if any-group ".." " [ \t]")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1188 (if any-group "[0-9]+" "[1-9][0-9]*")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1189 (found nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1190 (if backward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1191 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1192 (end-of-line))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1193 (setq found (funcall func regexp nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1194 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1195 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1196 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1197 ;; Return T if found.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1198 found
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1199 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1200
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1201 (defun gnus-Group-next-group (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1202 "Go to next N'th newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1203 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1204 (while (and (> n 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1205 (gnus-Group-search-forward nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1206 (setq n (1- n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1207 (or (gnus-Group-search-forward nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1208 (message "No more newsgroups")))
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-unread-group (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1211 "Go to next N'th unread 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 nil))
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 nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1217 (message "No more unread 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-prev-group (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1220 "Go to previous N'th 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 t t))
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 t t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1226 (message "No more 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-unread-group (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1229 "Go to previous N'th unread 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 nil))
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 nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1235 (message "No more unread 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-catch-up (all &optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1238 "Mark all articles not marked as unread in current newsgroup as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1239 If prefix argument ALL is non-nil, all articles are marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1240 Cross references (Xref: field) of articles are ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1241 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1242 (let* ((group (gnus-Group-group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1243 (marked (if (not all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1244 (cdr (assoc group gnus-marked-assoc)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1245 (and group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1246 (or quietly
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1247 (y-or-n-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1248 (if all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1249 "Do you really want to mark everything as read? "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1250 "Delete all articles not marked as read? ")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1251 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1252 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1253 ;; Any marked articles will be preserved.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1254 (gnus-update-unread-articles group marked marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1255 (gnus-Group-update-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1256 (gnus-Group-next-group 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1257 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1258
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1259 (defun gnus-Group-catch-up-all (&optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1260 "Mark all articles in current newsgroup as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1261 Cross references (Xref: field) of articles are ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1262 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1263 (gnus-Group-catch-up t quietly))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1264
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1265 (defun gnus-Group-unsubscribe-current-group ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1266 "Toggle subscribe from/to unsubscribe current group."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1267 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1268 (gnus-Group-unsubscribe-group (gnus-Group-group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1269 (gnus-Group-next-group 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1270
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1271 (defun gnus-Group-unsubscribe-group (group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1272 "Toggle subscribe from/to unsubscribe GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1273 New newsgroup is added to .newsrc automatically."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1274 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1275 (list (completing-read "Newsgroup: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1276 gnus-active-hashtb nil 'require-match)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1277 (let ((newsrc (assoc group gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1278 (cond ((not (null newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1279 ;; Toggle subscription flag.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1280 (setcar (nthcdr 1 newsrc) (not (nth 1 newsrc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1281 (gnus-update-newsrc-buffer group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1282 (gnus-Group-update-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1283 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1284 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1285 (search-forward ":" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1286 ((and (stringp group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1287 (gnus-gethash group gnus-active-hashtb))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1288 ;; Add new newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1289 (gnus-add-newsgroup group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1290 (gnus-Group-update-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1291 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1292 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1293 (search-forward ":" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1294 (t (error "No such newsgroup: %s" group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1295 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1296
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1297 (defun gnus-Group-list-all-groups ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1298 "List all of newsgroups in the Newsgroup buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1299 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1300 (gnus-Group-list-groups t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1301
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1302 (defun gnus-Group-get-new-news ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1303 "Get newly arrived articles. In fact, read the active file again."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1304 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1305 (gnus-setup-news-info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1306 (gnus-Group-list-groups gnus-have-all-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1307
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1308 (defun gnus-Group-restart ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1309 "Force GNUS to read the raw startup file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1310 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1311 (gnus-save-newsrc-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1312 (gnus-setup-news-info t) ;Force to read the raw startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1313 (gnus-Group-list-groups gnus-have-all-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1314
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1315 (defun gnus-Group-check-bogus-groups ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1316 "Check bogus newsgroups."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1317 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1318 (gnus-check-bogus-newsgroups t) ;Require confirmation.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1319 (gnus-Group-list-groups gnus-have-all-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1320
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1321 (defun gnus-Group-restrict-groups (start end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1322 "Restrict visible newsgroups to the current region (START and END).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1323 Type \\[widen] to remove restriction."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1324 (interactive "r")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1325 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1326 (narrow-to-region (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1327 (goto-char start)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1328 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1329 (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1330 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1331 (goto-char end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1332 (forward-line 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1333 (point))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1334 (message (substitute-command-keys "Type \\[widen] to remove restriction")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1335
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1336 (defun gnus-Group-edit-global-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1337 "Edit a global KILL file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1338 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1339 (setq gnus-current-kill-article nil) ;No articles selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1340 (gnus-Kill-file-edit-file nil) ;Nil stands for global KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1341 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1342 (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1343 "Editing a global KILL file (Type \\[gnus-Kill-file-exit] to exit)")))
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-local-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1346 "Edit a local 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 (gnus-Group-group-name))
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 local 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-force-update ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1355 "Update .newsrc 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 (gnus-save-newsrc-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1358
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1359 (defun gnus-Group-suspend ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1360 "Suspend the current GNUS session.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1361 In fact, cleanup buffers except for Group Mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1362 The hook `gnus-Suspend-gnus-hook' is called before actually suspending."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1363 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1364 (run-hooks 'gnus-Suspend-gnus-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1365 ;; Kill GNUS buffers except for Group Mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1366 (let ((buffers gnus-buffer-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1367 (while buffers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1368 (and (not (eq (car buffers) gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1369 (get-buffer (car buffers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1370 (kill-buffer (car buffers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1371 (setq buffers (cdr buffers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1372 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1373 (bury-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1374
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1375 (defun gnus-Group-exit ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1376 "Quit reading news after updating .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1377 The hook `gnus-Exit-gnus-hook' is called before actually quitting."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1378 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1379 (if (or noninteractive ;For gnus-batch-kill
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1380 (zerop (buffer-size)) ;No news is good news.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1381 (not (gnus-server-opened)) ;NNTP connection closed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1382 (y-or-n-p "Are you sure you want to quit reading news? "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1383 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1384 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1385 (run-hooks 'gnus-Exit-gnus-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1386 (gnus-save-newsrc-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1387 (gnus-clear-system)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1388 (gnus-close-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1389 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1390
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1391 (defun gnus-Group-quit ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1392 "Quit reading news without updating .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1393 The hook `gnus-Exit-gnus-hook' is called before actually quitting."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1394 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1395 (if (or (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1396 (not (gnus-server-opened))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1397 (yes-or-no-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1398 (format "Quit reading news without saving %s? "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1399 (file-name-nondirectory gnus-current-startup-file))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1400 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1401 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1402 (run-hooks 'gnus-Exit-gnus-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1403 (gnus-clear-system)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1404 (gnus-close-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1405 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1406
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1407 (defun gnus-Group-describe-briefly ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1408 "Describe Group mode commands briefly."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1409 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1410 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1411 (concat
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1412 (substitute-command-keys "\\[gnus-Group-read-group]:Select ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1413 (substitute-command-keys "\\[gnus-Group-next-unread-group]:Forward ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1414 (substitute-command-keys "\\[gnus-Group-prev-unread-group]:Backward ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1415 (substitute-command-keys "\\[gnus-Group-exit]:Exit ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1416 (substitute-command-keys "\\[gnus-Info-find-node]:Run Info ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1417 (substitute-command-keys "\\[gnus-Group-describe-briefly]:This help")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1418 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1419
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1420
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1421 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1422 ;;; GNUS Subject Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1423 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1424
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1425 (if gnus-Subject-mode-map
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1426 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1427 (setq gnus-Subject-mode-map (make-keymap))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1428 (suppress-keymap gnus-Subject-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1429 (define-key gnus-Subject-mode-map " " 'gnus-Subject-next-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1430 (define-key gnus-Subject-mode-map "\177" 'gnus-Subject-prev-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1431 (define-key gnus-Subject-mode-map "\r" 'gnus-Subject-scroll-up)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1432 (define-key gnus-Subject-mode-map "n" 'gnus-Subject-next-unread-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1433 (define-key gnus-Subject-mode-map "p" 'gnus-Subject-prev-unread-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1434 (define-key gnus-Subject-mode-map "N" 'gnus-Subject-next-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1435 (define-key gnus-Subject-mode-map "P" 'gnus-Subject-prev-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1436 (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
1437 (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
1438 ;;(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
1439 ;;(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
1440 (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
1441 (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
1442 (define-key gnus-Subject-mode-map "\C-n" 'gnus-Subject-next-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1443 (define-key gnus-Subject-mode-map "\C-p" 'gnus-Subject-prev-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1444 (define-key gnus-Subject-mode-map "\en" 'gnus-Subject-next-unread-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1445 (define-key gnus-Subject-mode-map "\ep" 'gnus-Subject-prev-unread-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1446 ;;(define-key gnus-Subject-mode-map "\C-cn" 'gnus-Subject-next-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1447 ;;(define-key gnus-Subject-mode-map "\C-cp" 'gnus-Subject-prev-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1448 (define-key gnus-Subject-mode-map "." 'gnus-Subject-first-unread-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1449 (define-key gnus-Subject-mode-map "/" 'isearch-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1450 (define-key gnus-Subject-mode-map "s" 'gnus-Subject-isearch-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1451 (define-key gnus-Subject-mode-map "\es" 'gnus-Subject-search-article-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1452 (define-key gnus-Subject-mode-map "\eS" 'gnus-Subject-search-article-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1453 (define-key gnus-Subject-mode-map "<" 'gnus-Subject-beginning-of-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1454 (define-key gnus-Subject-mode-map ">" 'gnus-Subject-end-of-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1455 (define-key gnus-Subject-mode-map "j" 'gnus-Subject-goto-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1456 (define-key gnus-Subject-mode-map "J" 'gnus-Subject-goto-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1457 (define-key gnus-Subject-mode-map "l" 'gnus-Subject-goto-last-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1458 (define-key gnus-Subject-mode-map "^" 'gnus-Subject-refer-parent-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1459 (define-key gnus-Subject-mode-map "\er" 'gnus-Subject-refer-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1460 (define-key gnus-Subject-mode-map "u" 'gnus-Subject-mark-as-unread-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1461 (define-key gnus-Subject-mode-map "U" 'gnus-Subject-mark-as-unread-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1462 (define-key gnus-Subject-mode-map "d" 'gnus-Subject-mark-as-read-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1463 (define-key gnus-Subject-mode-map "D" 'gnus-Subject-mark-as-read-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1464 (define-key gnus-Subject-mode-map "\eu" 'gnus-Subject-clear-mark-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1465 (define-key gnus-Subject-mode-map "\eU" 'gnus-Subject-clear-mark-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1466 (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
1467 (define-key gnus-Subject-mode-map "\C-k" 'gnus-Subject-kill-same-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1468 (define-key gnus-Subject-mode-map "\e\C-t" 'gnus-Subject-toggle-threads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1469 (define-key gnus-Subject-mode-map "\e\C-s" 'gnus-Subject-show-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1470 (define-key gnus-Subject-mode-map "\e\C-h" 'gnus-Subject-hide-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1471 (define-key gnus-Subject-mode-map "\e\C-f" 'gnus-Subject-next-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1472 (define-key gnus-Subject-mode-map "\e\C-b" 'gnus-Subject-prev-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1473 (define-key gnus-Subject-mode-map "\e\C-u" 'gnus-Subject-up-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1474 (define-key gnus-Subject-mode-map "\e\C-d" 'gnus-Subject-down-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1475 (define-key gnus-Subject-mode-map "\e\C-k" 'gnus-Subject-kill-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1476 (define-key gnus-Subject-mode-map "&" 'gnus-Subject-execute-command)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1477 ;;(define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1478 ;;(define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1479 (define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up-and-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1480 ;;(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
1481 (define-key gnus-Subject-mode-map "\C-t" 'gnus-Subject-toggle-truncation)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1482 (define-key gnus-Subject-mode-map "x" 'gnus-Subject-delete-marked-as-read)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1483 (define-key gnus-Subject-mode-map "X" 'gnus-Subject-delete-marked-with)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1484 (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
1485 (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
1486 (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
1487 (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
1488 (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
1489 (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
1490 (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
1491 (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
1492 (define-key gnus-Subject-mode-map "=" 'gnus-Subject-expand-window)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1493 (define-key gnus-Subject-mode-map "G" 'gnus-Subject-reselect-current-group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1494 (define-key gnus-Subject-mode-map "w" 'gnus-Subject-stop-page-breaking)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1495 (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
1496 (define-key gnus-Subject-mode-map "g" 'gnus-Subject-show-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1497 (define-key gnus-Subject-mode-map "t" 'gnus-Subject-toggle-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1498 (define-key gnus-Subject-mode-map "v" 'gnus-Subject-show-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1499 (define-key gnus-Subject-mode-map "\C-d" 'gnus-Subject-rmail-digest)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1500 (define-key gnus-Subject-mode-map "a" 'gnus-Subject-post-news)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1501 (define-key gnus-Subject-mode-map "f" 'gnus-Subject-post-reply)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1502 (define-key gnus-Subject-mode-map "F" 'gnus-Subject-post-reply-with-original)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1503 (define-key gnus-Subject-mode-map "C" 'gnus-Subject-cancel-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1504 (define-key gnus-Subject-mode-map "r" 'gnus-Subject-mail-reply)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1505 (define-key gnus-Subject-mode-map "R" 'gnus-Subject-mail-reply-with-original)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1506 (define-key gnus-Subject-mode-map "m" 'gnus-Subject-mail-other-window)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1507 (define-key gnus-Subject-mode-map "o" 'gnus-Subject-save-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1508 (define-key gnus-Subject-mode-map "\C-o" 'gnus-Subject-save-in-mail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1509 (define-key gnus-Subject-mode-map "|" 'gnus-Subject-pipe-output)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1510 (define-key gnus-Subject-mode-map "\ek" 'gnus-Subject-edit-local-kill)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1511 (define-key gnus-Subject-mode-map "\eK" 'gnus-Subject-edit-global-kill)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1512 (define-key gnus-Subject-mode-map "V" 'gnus-version)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1513 (define-key gnus-Subject-mode-map "q" 'gnus-Subject-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1514 (define-key gnus-Subject-mode-map "Q" 'gnus-Subject-quit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1515 (define-key gnus-Subject-mode-map "?" 'gnus-Subject-describe-briefly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1516 (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
1517
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1518 (defun gnus-Subject-mode ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1519 "Major mode for reading articles in this newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1520 All normal editing commands are turned off.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1521 Instead, these commands are available:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1522 \\{gnus-Subject-mode-map}
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1523
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1524 User customizable variables:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1525 gnus-large-newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1526 The number of articles which indicates a large newsgroup. If the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1527 number of articles in a newsgroup is greater than the value, the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1528 number of articles to be selected is asked for. If the given value
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1529 N is positive, the last N articles is selected. If N is negative,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1530 the first N articles are selected. An empty string means to select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1531 all articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1532
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1533 gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1534 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
1535 to save articles to. If it's nil, the directory form of a
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1536 newsgroup is used instead.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1537
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1538 gnus-default-article-saver
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1539 Specifies your favorite article saver which is interactively
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1540 funcallable. Following functions are available:
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-Subject-save-in-rmail (in Rmail format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1543 gnus-Subject-save-in-mail (in Unix mail format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1544 gnus-Subject-save-in-folder (in MH folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1545 gnus-Subject-save-in-file (in article format).
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-rmail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1548 gnus-mail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1549 gnus-folder-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1550 gnus-file-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1551 Specifies a function generating a file name to save articles in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1552 specified format. The function is called with NEWSGROUP, HEADERS,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1553 and optional LAST-FILE. Access macros to the headers are defined
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1554 as nntp-header-FIELD, and functions are defined as `gnus-header-FIELD'.
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-article-save-directory
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1557 Specifies a directory name to save articles to using the commands
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1558 `gnus-Subject-save-in-rmail', `gnus-Subject-save-in-mail' and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1559 `gnus-Subject-save-in-file'. The variable is initialized from the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1560 SAVEDIR environment variable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1561
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1562 gnus-show-all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1563 Non-nil means that all headers of an article are shown.
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-save-all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1566 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
1567
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1568 gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1569 Non-nil means that conversation threads are shown in tree structure.
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-thread-hide-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1572 Non-nil means that subjects for thread subtrees are hidden.
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-thread-hide-subtree
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1575 Non-nil means that thread subtrees are hidden initially.
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-thread-hide-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1578 Non-nil means that killed thread subtrees are hidden automatically.
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-ignore-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1581 Non-nil means that subject differences are ignored in constructing
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1582 thread trees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1583
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1584 gnus-thread-indent-level
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1585 Indentation of thread subtrees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1586
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1587 gnus-optional-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1588 Specifies a function which generates an optional string displayed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1589 in the Subject buffer. The function is called with an article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1590 HEADERS. The result must be a string excluding `[' and `]'. The
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1591 default function returns a string like NNN:AUTHOR, where NNN is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1592 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
1593 author.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1594
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1595 gnus-auto-extend-newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1596 Non-nil means visible articles are extended to forward and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1597 backward automatically if possible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1598
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1599 gnus-auto-select-first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1600 Non-nil means the first unread article is selected automagically
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1601 when a newsgroup is selected normally (by gnus-Group-read-group).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1602 If you'd like to prevent automatic selection of the first unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1603 article in some newsgroups, set the variable to nil in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1604 gnus-Select-group-hook or gnus-Apply-kill-hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1605
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1606 gnus-auto-select-next
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1607 Non-nil means the next newsgroup is selected automagically at the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1608 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
1609 empty (no unread articles), GNUS will exit Subject mode and go
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1610 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
1611 exit Subject mode but select the following unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1612 Especially, if the value is the symbol `quietly', the next unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1613 newsgroup will be selected without any confirmations.
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-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1616 Non-nil means an article with the same subject as the current
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1617 article is selected automagically like `rn -S'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1618
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1619 gnus-auto-center-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1620 Non-nil means the point of Subject Mode window is always kept
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1621 centered.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1622
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1623 gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1624 Non-nil means an article is broken into pages at page delimiters.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1625 This may not work with some versions of GNU Emacs earlier than
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1626 version 18.50.
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-page-delimiter
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1629 Specifies a regexp describing line-beginnings that separate pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1630 of news article.
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-more-message is obsolete. overlay-arrow-string interfares
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1633 with other subsystems, such as dbx mode.]
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1634
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1635 gnus-digest-show-summary
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1636 Non-nil means that a summary of digest messages is shown when
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1637 reading a digest article using `gnus-Subject-rmail-digest' command.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1638
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1639 gnus-digest-separator
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1640 Specifies a regexp separating messages in a digest article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1641
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1642 gnus-mail-reply-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1643 gnus-mail-other-window-method
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1644 Specifies a function to begin composing mail message using
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1645 commands gnus-Subject-mail-reply and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1646 gnus-Subject-mail-other-window. Functions
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1647 gnus-mail-reply-using-mail and gnus-mail-reply-using-mhe are
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1648 available for the value of gnus-mail-reply-method. And functions
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1649 gnus-mail-other-window-using-mail and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1650 gnus-mail-other-window-using-mhe are available for the value of
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1651 gnus-mail-other-window-method.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1652
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1653 Various hooks for customization:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1654 gnus-Subject-mode-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1655 Entry to this mode calls the value with no arguments, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1656 value is non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1657
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1658 gnus-Select-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1659 Called with no arguments when newsgroup is selected, if that value
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1660 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
1661 documentation of this variable for more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1662
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1663 gnus-Subject-prepare-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1664 Called with no arguments after a subject list is created in the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1665 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
1666 the buffer, you can use this hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1667
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1668 gnus-Select-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1669 Called with no arguments when an article is selected, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1670 value is non-nil. See the documentation of this variable for
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1671 more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1672
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1673 gnus-Select-digest-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1674 Called with no arguments when reading digest messages using Rmail,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1675 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
1676 article so that Rmail can work with it. See the documentation of
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1677 the variable for more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1678
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1679 gnus-Rmail-digest-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1680 Called with no arguments when reading digest messages using Rmail,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1681 if that value is non-nil. This hook is intended to customize Rmail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1682 mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1683
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1684 gnus-Apply-kill-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1685 Called with no arguments when a newsgroup is selected and the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1686 Subject buffer is prepared. This hook is intended to apply a KILL
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1687 file to the selected newsgroup. The format of KILL file is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1688 completely different from that of version 3.8. You have to rewrite
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1689 them in the new format. See the documentation of Kill file mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1690 for more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1691
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1692 gnus-Mark-article-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1693 Called with no arguments when an article is selected at the first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1694 time. The hook is intended to mark an article as read (or unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1695 automatically when it is selected. See the documentation of the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1696 variable for more information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1697
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1698 gnus-Exit-group-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1699 Called with no arguments when exiting the current newsgroup, if
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1700 that value is non-nil. If your machine is so slow that exiting
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1701 from Subject mode takes very long time, inhibit marking articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1702 as read using cross-references by setting the variable
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1703 `gnus-newsgroup-headers' to nil in this hook."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1704 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1705 (kill-all-local-variables)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1706 ;; Gee. Why don't you upgrade?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1707 (cond ((boundp 'mode-line-modified)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1708 (setq mode-line-modified "--- "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1709 ((listp (default-value 'mode-line-format))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1710 (setq mode-line-format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1711 (cons "--- " (cdr (default-value 'mode-line-format))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1712 (make-local-variable 'global-mode-string)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1713 (setq global-mode-string nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1714 (setq major-mode 'gnus-Subject-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1715 (setq mode-name "Subject")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1716 ;;(setq mode-line-process '(" " gnus-newsgroup-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1717 (make-local-variable 'minor-mode-alist)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1718 (or (assq 'gnus-show-threads minor-mode-alist)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1719 (setq minor-mode-alist
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1720 (cons (list 'gnus-show-threads " Thread") minor-mode-alist)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1721 (gnus-Subject-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1722 (use-local-map gnus-Subject-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1723 (buffer-flush-undo (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1724 (setq buffer-read-only t) ;Disable modification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1725 (setq truncate-lines t) ;Stop line folding
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1726 (setq selective-display t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1727 (setq selective-display-ellipses t) ;Display `...'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1728 ;;(setq case-fold-search t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1729 (run-hooks 'gnus-Subject-mode-hook))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1730
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1731 (defun gnus-Subject-setup-buffer ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1732 "Initialize subject display buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1733 (if (get-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1734 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1735 (set-buffer (get-buffer-create gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1736 (gnus-Subject-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1737 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1738
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1739 (defun gnus-Subject-read-group (group &optional show-all no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1740 "Start reading news in newsgroup GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1741 If optional first argument SHOW-ALL is non-nil, already read articles are
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1742 also listed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1743 If optional second argument NO-ARTICLE is non-nil, no article is selected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1744 initially."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1745 (message "Retrieving newsgroup: %s..." group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1746 (if (gnus-select-newsgroup group show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1747 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1748 ;; Don't switch-to-buffer to prevent displaying old contents
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1749 ;; of the buffer until new subjects list is created.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1750 ;; Suggested by Juha Heinanen <jh@tut.fi>
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1751 (gnus-Subject-setup-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1752 ;; You can change the order of subjects in this hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1753 (run-hooks 'gnus-Select-group-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1754 (gnus-Subject-prepare)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1755 ;; Function `gnus-apply-kill-file' must be called in this hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1756 (run-hooks 'gnus-Apply-kill-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1757 (if (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1758 ;; This newsgroup is empty.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1759 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1760 (gnus-Subject-catch-up-and-exit nil t) ;Without confirmations.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1761 (message "No unread news"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1762 ;; Hide conversation thread subtrees. We cannot do this in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1763 ;; gnus-Subject-prepare-hook since kill processing may not
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1764 ;; work with hidden articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1765 (and gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1766 gnus-thread-hide-subtree
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1767 (gnus-Subject-hide-all-threads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1768 ;; Show first unread article if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1769 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1770 (if (and (not no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1771 gnus-auto-select-first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1772 (gnus-Subject-first-unread-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1773 ;; Window is configured automatically.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1774 ;; Current buffer may be changed as a result of hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1775 ;; evaluation, especially by gnus-Subject-rmail-digest
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1776 ;; command, so we should adjust cursor point carefully.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1777 (if (eq (current-buffer) (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1778 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1779 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1780 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1781 (search-forward ":" nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1782 (gnus-configure-windows 'SelectNewsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1783 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1784 (gnus-Subject-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1785 ;; I sometime get confused with the old Article buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1786 (if (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1787 (if (get-buffer-window gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1788 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1789 (set-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1790 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1791 (erase-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1792 (kill-buffer gnus-Article-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1793 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1794 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1795 (search-forward ":" nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1796 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1797 ;; Cannot select newsgroup GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1798 (if (gnus-gethash group gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1799 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1800 ;; If NNTP is used, nntp_access file may not be installed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1801 ;; properly. Otherwise, may be active file problem.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1802 (ding)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1803 (message "Cannot select %s. May be security or active file problem." group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1804 (sit-for 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1805 ;; Check bogus newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1806 ;; We must be in Group Mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1807 (gnus-Group-check-bogus-groups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1808 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1809
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1810 (defun gnus-Subject-prepare ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1811 "Prepare subject list of current newsgroup in Subject mode buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1812 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1813 ;; Note: The next codes are not actually used because the user who
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1814 ;; want it can define them in gnus-Select-group-hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1815 ;; Print verbose messages if too many articles are selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1816 ;; (and (numberp gnus-large-newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1817 ;; (> (length gnus-newsgroup-headers) gnus-large-newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1818 ;; (message "Preparing headers..."))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1819 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1820 (gnus-Subject-prepare-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1821 (if gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1822 (gnus-make-threads gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1823 gnus-newsgroup-headers) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1824 ;; Erase header retrieval message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1825 (message "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1826 ;; Call hooks for modifying Subject mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1827 ;; Suggested by sven@tde.LTH.Se (Sven Mattisson).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1828 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1829 (run-hooks 'gnus-Subject-prepare-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1830 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1831
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1832 ;; Basic ideas by Paul Dworkin <paul@media-lab.media.mit.edu>
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1833
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1834 (defun gnus-Subject-prepare-threads (threads level)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1835 "Prepare Subject buffer from THREADS and indentation LEVEL.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1836 THREADS is a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...]).'"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1837 (let ((thread nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1838 (header nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1839 (number nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1840 ;; `M Indent NUM: [OPT] SUBJECT'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1841 (cntl (format "%%s %%s%%%dd: [%%s] %%s\n"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1842 (length (prin1-to-string gnus-newsgroup-end)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1843 (while threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1844 (setq thread (car threads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1845 (setq threads (cdr threads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1846 ;; If thread is a cons, hierarchical threads is given.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1847 ;; Otherwise, thread itself is header.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1848 (if (consp thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1849 (setq header (car thread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1850 (setq header thread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1851 ;; Print valid header only.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1852 (if (vectorp header) ;Depends on nntp.el.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1853 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1854 (setq number (nntp-header-number header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1855 (insert
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1856 (format cntl
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1857 ;; Read or not.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1858 (cond ((memq number gnus-newsgroup-marked) "-")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1859 ((memq number gnus-newsgroup-unreads) " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1860 (t "D"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1861 ;; Thread level.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1862 (make-string (* level gnus-thread-indent-level) ? )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1863 ;; Article number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1864 number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1865 ;; Optional headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1866 (or (and gnus-optional-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1867 (funcall gnus-optional-headers header)) "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1868 ;; Its subject string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1869 (concat (if (or (zerop level)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1870 (not gnus-thread-hide-subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1871 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1872 (make-string (window-width) ? ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1873 (nntp-header-subject header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1874 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1875 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1876 ;; Print subthreads.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1877 (and (consp thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1878 (cdr thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1879 (gnus-Subject-prepare-threads (cdr thread) (1+ level)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1880 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1881
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1882 (defun gnus-Subject-set-mode-line ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1883 "Set Subject mode line string."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1884 ;; The value must be a string to escape %-constructs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1885 (let ((subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1886 (if gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1887 (nntp-header-subject gnus-current-headers) gnus-newsgroup-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1888 (setq mode-line-buffer-identification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1889 (concat "GNUS: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1890 subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1891 ;; Enough spaces to pad subject to 17 positions.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1892 (make-string (max 0 (- 17 (length subject))) ? ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1893 (set-buffer-modified-p t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1894
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1895 ;; GNUS Subject mode command.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1896
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1897 (defun gnus-Subject-search-group (&optional backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1898 "Search for next unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1899 If optional argument BACKWARD is non-nil, search backward instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1900 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1901 (set-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1902 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1903 ;; We don't want to alter current point of Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1904 (if (gnus-Group-search-forward backward nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1905 (gnus-Group-group-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1906 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1907
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1908 (defun gnus-Subject-search-subject (backward unread subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1909 "Search for article forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1910 If first argument BACKWARD is non-nil, search backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1911 If second argument UNREAD is non-nil, only unread article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1912 If third argument SUBJECT is non-nil, the article which has
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1913 the same subject will be searched for."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1914 (let ((func (if backward 're-search-backward 're-search-forward))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1915 (article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1916 ;; We have to take care of hidden lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1917 (regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1918 (format "^%s[ \t]+\\([0-9]+\\):.\\[[^]\r\n]*\\][ \t]+%s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1919 ;;(if unread " " ".")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1920 (cond ((eq unread t) " ") (unread "[ ---]") (t "."))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1921 (if subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1922 (concat "\\([Rr][Ee]:[ \t]+\\)*"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1923 (regexp-quote (gnus-simplify-subject subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1924 ;; Ignore words in parentheses.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1925 "\\([ \t]*([^\r\n]*)\\)*[ \t]*\\(\r\\|$\\)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1926 "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1927 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1928 (if backward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1929 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1930 (end-of-line))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1931 (if (funcall func regexp nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1932 (setq article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1933 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1934 (buffer-substring (match-beginning 1) (match-end 1)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1935 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1936 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1937 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1938 ;; This is the result.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1939 article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1940 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1941
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1942 (defun gnus-Subject-search-forward (&optional unread subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1943 "Search for article forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1944 If first optional argument UNREAD is non-nil, only unread article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1945 If second optional argument SUBJECT is non-nil, the article which has
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1946 the same subject will be searched for."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1947 (gnus-Subject-search-subject nil unread subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1948
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1949 (defun gnus-Subject-search-backward (&optional unread subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1950 "Search for article backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1951 If first optional argument UNREAD is non-nil, only unread article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1952 If second optional argument SUBJECT is non-nil, the article which has
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1953 the same subject will be searched for."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1954 (gnus-Subject-search-subject t unread subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1955
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1956 (defun gnus-Subject-article-number ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1957 "Article number around point. If nothing, return current number."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1958 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1959 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1960 (if (looking-at ".[ \t]+\\([0-9]+\\):")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1961 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1962 (buffer-substring (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1963 ;; If search fail, return current article number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1964 gnus-current-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1965 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1966
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1967 (defun gnus-Subject-subject-string ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1968 "Return current subject string or nil if nothing."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1969 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1970 ;; It is possible to implement this function using
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1971 ;; `gnus-Subject-article-number' and `gnus-newsgroup-headers'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1972 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1973 ;; We have to take care of hidden lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1974 (if (looking-at ".[ \t]+[0-9]+:.\\[[^]\r\n]*\\][ \t]+\\([^\r\n]*\\)[\r\n]")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1975 (buffer-substring (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1976 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1977
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1978 (defun gnus-Subject-goto-subject (article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1979 "Move point to ARTICLE's subject."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1980 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1981 (list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1982 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1983 (completing-read "Article number: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1984 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1985 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1986 (lambda (headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1987 (list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1988 (int-to-string (nntp-header-number headers)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1989 gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1990 nil 'require-match))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1991 (let ((current (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1992 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1993 (or (and article (re-search-forward (format "^.[ \t]+%d:" article) nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1994 (progn (goto-char current) nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1995 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1996
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1997 (defun gnus-Subject-recenter ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1998 "Center point in Subject mode window."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1999 ;; Scroll window so as to cursor comes center of Subject mode window
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2000 ;; only when article is displayed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2001 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2002 ;; Recenter only when requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2003 ;; Suggested by popovich@park.cs.columbia.edu
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2004 (and gnus-auto-center-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2005 (get-buffer-window gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2006 (< (/ (- (window-height) 1) 2)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2007 (count-lines (point) (point-max)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2008 (recenter (/ (- (window-height) 2) 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2009
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2010 ;; Walking around Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2011
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2012 (defun gnus-Subject-jump-to-group (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2013 "Move point to NEWSGROUP in Group mode buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2014 ;; Keep update point of Group mode buffer if visible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2015 (if (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2016 (get-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2017 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2018 ;; Take care of tree window mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2019 (if (get-buffer-window gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2020 (pop-to-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2021 (gnus-Group-jump-to-group newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2022 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2023 ;; Take care of tree window mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2024 (if (get-buffer-window gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2025 (pop-to-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2026 (set-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2027 (gnus-Group-jump-to-group newsgroup))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2028
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2029 (defun gnus-Subject-next-group (no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2030 "Exit current newsgroup and then select next unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2031 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2032 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2033 ;; Make sure Group mode buffer point is on current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2034 (gnus-Subject-jump-to-group gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2035 (let ((group (gnus-Subject-search-group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2036 (if (null group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2037 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2038 (message "Exiting %s..." gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2039 (gnus-Subject-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2040 (message ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2041 (message "Selecting %s..." group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2042 (gnus-Subject-exit t) ;Exit Subject mode temporary.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2043 ;; We are now in Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2044 ;; Make sure Group mode buffer point is on GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2045 (gnus-Subject-jump-to-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2046 (gnus-Subject-read-group group nil no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2047 (or (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2048 (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2049 (eq gnus-auto-select-next t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2050 ;; Expected newsgroup has nothing to read since the articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2051 ;; are marked as read by cross-referencing. So, try next
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2052 ;; newsgroup. (Make sure we are in Group mode buffer now.)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2053 (and (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2054 (get-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2055 (gnus-Group-group-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2056 (gnus-Subject-read-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2057 (gnus-Group-group-name) nil no-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2058 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2059 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2060
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2061 (defun gnus-Subject-prev-group (no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2062 "Exit current newsgroup and then select previous unread newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2063 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2064 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2065 ;; Make sure Group mode buffer point is on current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2066 (gnus-Subject-jump-to-group gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2067 (let ((group (gnus-Subject-search-group t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2068 (if (null group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2069 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2070 (message "Exiting %s..." gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2071 (gnus-Subject-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2072 (message ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2073 (message "Selecting %s..." group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2074 (gnus-Subject-exit t) ;Exit Subject mode temporary.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2075 ;; We are now in Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2076 ;; We have to adjust point of Group mode buffer because current
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2077 ;; point is moved to next unread newsgroup by exiting.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2078 (gnus-Subject-jump-to-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2079 (gnus-Subject-read-group group nil no-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2080 (or (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2081 (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2082 (eq gnus-auto-select-next t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2083 ;; Expected newsgroup has nothing to read since the articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2084 ;; are marked as read by cross-referencing. So, try next
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2085 ;; newsgroup. (Make sure we are in Group mode buffer now.)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2086 (and (eq (current-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2087 (get-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2088 (gnus-Subject-search-group t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2089 (gnus-Subject-read-group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2090 (gnus-Subject-search-group t) nil no-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2091 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2092 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2093
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2094 ;; Walking around subject lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2095
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2096 (defun gnus-Subject-next-subject (n &optional unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2097 "Go to next N'th subject line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2098 If optional argument UNREAD is non-nil, only unread article is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2099 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2100 (while (and (> n 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2101 (gnus-Subject-search-forward unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2102 (setq n (1- n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2103 (cond ((gnus-Subject-search-forward unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2104 (gnus-Subject-recenter))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2105 (unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2106 (message "No more unread articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2107 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2108 (message "No more articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2109 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2110
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2111 (defun gnus-Subject-next-unread-subject (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2112 "Go to next N'th unread subject line."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2113 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2114 (gnus-Subject-next-subject n t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2115
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2116 (defun gnus-Subject-prev-subject (n &optional unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2117 "Go to previous N'th subject line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2118 If optional argument UNREAD is non-nil, only unread article is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2119 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2120 (while (and (> n 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2121 (gnus-Subject-search-backward unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2122 (setq n (1- n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2123 (cond ((gnus-Subject-search-backward unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2124 (gnus-Subject-recenter))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2125 (unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2126 (message "No more unread articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2127 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2128 (message "No more articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2129 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2130
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2131 (defun gnus-Subject-prev-unread-subject (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2132 "Go to previous N'th unread subject line."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2133 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2134 (gnus-Subject-prev-subject n t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2135
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2136 ;; Walking around subject lines with displaying articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2137
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2138 (defun gnus-Subject-expand-window ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2139 "Expand Subject window to show headers full window."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2140 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2141 (gnus-configure-windows 'ExpandSubject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2142 (pop-to-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2143
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2144 (defun gnus-Subject-display-article (article &optional all-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2145 "Display ARTICLE in Article buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2146 (if (null article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2147 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2148 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2149 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2150 (gnus-Article-prepare article all-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2151 (gnus-Subject-recenter)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2152 (gnus-Subject-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2153 (run-hooks 'gnus-Select-article-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2154 ;; Successfully display article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2155 t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2156 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2157
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2158 (defun gnus-Subject-select-article (&optional all-headers force)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2159 "Select the current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2160 Optional argument ALL-HEADERS is non-nil, show all headers."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2161 (let ((article (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2162 (if (or (null gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2163 (/= article gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2164 (and force (not (eq all-headers gnus-have-all-headers))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2165 ;; The selected subject is different from that of the current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2166 (gnus-Subject-display-article article all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2167 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2168 (pop-to-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2169 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2170
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2171 (defun gnus-Subject-set-current-mark (&optional current-mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2172 "Put `+' at the current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2173 Optional argument specifies CURRENT-MARK instead of `+'."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2174 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2175 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2176 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2177 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2178 ;; First of all clear mark at last article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2179 (if (re-search-forward "^.[ \t]+[0-9]+:[^ \t]" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2180 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2181 (delete-char -1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2182 (insert " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2183 (goto-char (point-min))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2184 (if (re-search-forward (format "^.[ \t]+%d:" gnus-current-article) nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2185 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2186 (delete-char 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2187 (insert (or current-mark "+"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2188 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2189
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2190 (defun gnus-Subject-next-article (unread &optional subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2191 "Select article after current one.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2192 If argument UNREAD is non-nil, only unread article is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2193 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2194 (let ((header nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2195 (cond ((gnus-Subject-display-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2196 (gnus-Subject-search-forward unread subject)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2197 ((and subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2198 gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2199 (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2200 gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2201 (memq this-command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2202 '(gnus-Subject-next-unread-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2203 gnus-Subject-next-page
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2204 gnus-Subject-kill-same-subject-and-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2205 ;;gnus-Subject-next-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2206 ;;gnus-Subject-next-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2207 ;;gnus-Subject-next-unread-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2208 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2209 ;; Wrap article pointer if there are unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2210 ;; Hook function, such as gnus-Subject-rmail-digest, may
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2211 ;; change current buffer, so need check.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2212 (let ((buffer (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2213 (last-point (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2214 ;; No more articles with same subject, so jump to the first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2215 ;; unread article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2216 (gnus-Subject-first-unread-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2217 ;;(and (eq buffer (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2218 ;; (= (point) last-point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2219 ;; ;; Ignore given SUBJECT, and try again.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2220 ;; (gnus-Subject-next-article unread nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2221 (and (eq buffer (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2222 (< (point) last-point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2223 (message "Wrapped"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2224 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2225 ((and (not unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2226 gnus-auto-extend-newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2227 (setq header (gnus-more-header-forward)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2228 ;; Extend to next article if possible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2229 ;; Basic ideas by himacdonald@watdragon.waterloo.edu
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2230 (gnus-extend-newsgroup header nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2231 ;; Threads feature must be turned off.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2232 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2233 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2234 (gnus-Subject-prepare-threads (list header) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2235 (gnus-Subject-goto-article gnus-newsgroup-end))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2236 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2237 ;; Select next newsgroup automatically if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2238 (let ((cmd (string-to-char (this-command-keys)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2239 (group (gnus-Subject-search-group))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2240 (auto-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2241 (and gnus-auto-select-next
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2242 ;;(null (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2243 ;; gnus-newsgroup-marked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2244 (memq this-command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2245 '(gnus-Subject-next-unread-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2246 gnus-Subject-next-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2247 gnus-Subject-next-page
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2248 gnus-Subject-next-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2249 gnus-Subject-next-unread-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2250 gnus-Subject-kill-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2251 gnus-Subject-kill-same-subject-and-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2252 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2253 ;; Ignore characters typed ahead.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2254 (not (input-pending-p))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2255 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2256 (message "No more%s articles%s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2257 (if unread " unread" "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2258 (if (and auto-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2259 (not (eq gnus-auto-select-next 'quietly)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2260 (if group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2261 (format " (Type %s to %s [%d])"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2262 (key-description (char-to-string cmd))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2263 group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2264 (nth 1 (gnus-gethash group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2265 gnus-unread-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2266 (format " (Type %s to exit %s)"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2267 (key-description (char-to-string cmd))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2268 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2269 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2270 ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2271 ;; Select next unread newsgroup automagically.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2272 (cond ((and auto-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2273 (eq gnus-auto-select-next 'quietly))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2274 ;; Select quietly.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2275 (gnus-Subject-next-group nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2276 (auto-select
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2277 ;; Confirm auto selection.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2278 (let ((char (read-char)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2279 (if (= char cmd)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2280 (gnus-Subject-next-group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2281 (setq unread-command-char char))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2282 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2283 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2284 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2285
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2286 (defun gnus-Subject-next-unread-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2287 "Select unread article after current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2288 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2289 (gnus-Subject-next-article t (and gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2290 (gnus-Subject-subject-string))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2291
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2292 (defun gnus-Subject-prev-article (unread &optional subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2293 "Select article before current one.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2294 If argument UNREAD is non-nil, only unread article is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2295 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2296 (let ((header nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2297 (cond ((gnus-Subject-display-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2298 (gnus-Subject-search-backward unread subject)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2299 ((and subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2300 gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2301 (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2302 gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2303 (memq this-command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2304 '(gnus-Subject-prev-unread-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2305 ;;gnus-Subject-prev-page
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2306 ;;gnus-Subject-prev-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2307 ;;gnus-Subject-prev-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2308 ;;gnus-Subject-prev-unread-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2309 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2310 ;; Ignore given SUBJECT, and try again.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2311 (gnus-Subject-prev-article unread nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2312 (unread
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2313 (message "No more unread articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2314 ((and gnus-auto-extend-newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2315 (setq header (gnus-more-header-backward)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2316 ;; Extend to previous article if possible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2317 ;; Basic ideas by himacdonald@watdragon.waterloo.edu
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2318 (gnus-extend-newsgroup header t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2319 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2320 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2321 (gnus-Subject-prepare-threads (list header) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2322 (gnus-Subject-goto-article gnus-newsgroup-begin))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2323 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2324 (message "No more articles"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2325 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2326
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2327 (defun gnus-Subject-prev-unread-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2328 "Select unred article before current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2329 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2330 (gnus-Subject-prev-article t (and gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2331 (gnus-Subject-subject-string))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2332
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2333 (defun gnus-Subject-next-page (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2334 "Show next page of selected article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2335 If end of artile, select next article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2336 Argument LINES specifies lines to be scrolled up."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2337 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2338 (let ((article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2339 (endp nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2340 (if (or (null gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2341 (/= article gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2342 ;; Selected subject is different from current article's.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2343 (gnus-Subject-display-article article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2344 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2345 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2346 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2347 (setq endp (gnus-Article-next-page lines)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2348 (cond ((and endp lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2349 (message "End of message"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2350 ((and endp (null lines))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2351 (gnus-Subject-next-unread-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2352 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2353
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2354 (defun gnus-Subject-prev-page (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2355 "Show previous page of selected article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2356 Argument LINES specifies lines to be scrolled down."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2357 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2358 (let ((article (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2359 (if (or (null gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2360 (/= article gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2361 ;; Selected subject is different from current article's.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2362 (gnus-Subject-display-article article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2363 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2364 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2365 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2366 (gnus-Article-prev-page lines))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2367 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2368
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2369 (defun gnus-Subject-scroll-up (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2370 "Scroll up (or down) one line current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2371 Argument LINES specifies lines to be scrolled up (or down if negative)."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2372 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2373 (gnus-Subject-select-article)
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 (cond ((> lines 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2376 (if (gnus-Article-next-page lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2377 (message "End of message")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2378 ((< lines 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2379 (gnus-Article-prev-page (- 0 lines))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2380 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2381
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2382 (defun gnus-Subject-next-same-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2383 "Select next article which has the same subject as current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2384 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2385 (gnus-Subject-next-article nil (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2386
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2387 (defun gnus-Subject-prev-same-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2388 "Select previous article which has the same subject as current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2389 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2390 (gnus-Subject-prev-article nil (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2391
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2392 (defun gnus-Subject-next-unread-same-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2393 "Select next unread article which has the same subject as current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2394 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2395 (gnus-Subject-next-article t (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2396
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2397 (defun gnus-Subject-prev-unread-same-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2398 "Select previous unread article which has the same subject as current one."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2399 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2400 (gnus-Subject-prev-article t (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2401
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2402 (defun gnus-Subject-refer-parent-article (child)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2403 "Refer parent article of current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2404 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
2405 using internally maintained articles history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2406 NOTE: This command may not work with nnspool.el."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2407 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2408 (gnus-Subject-select-article t t) ;Request all headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2409 (let ((referenced-id nil)) ;Message-id of parent or child article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2410 (if child
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2411 ;; Go back to child article using history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2412 (gnus-Subject-refer-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2413 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2414 ;; Look for parent Message-ID.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2415 ;; We cannot use gnus-current-headers to get references
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2416 ;; because we may be looking at parent or refered article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2417 (let ((references (gnus-fetch-field "References")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2418 ;; Get the last message-id in the references.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2419 (and references
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2420 (string-match "\\(<[^<>]+>\\)[^>]*\\'" references)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2421 (setq referenced-id
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2422 (substring references
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2423 (match-beginning 1) (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2424 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2425 (if (stringp referenced-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2426 (gnus-Subject-refer-article referenced-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2427 (error "No more parents"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2428 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2429
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2430 (defun gnus-Subject-refer-article (message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2431 "Refer article specified by MESSAGE-ID.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2432 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
2433 internally maintained articles history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2434 NOTE: This command may not work with nnspool.el."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2435 (interactive "sMessage-ID: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2436 ;; Make sure that this command depends on the fact that article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2437 ;; related information is not updated when an article is retrieved
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2438 ;; by Message-ID.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2439 (gnus-Subject-select-article t t) ;Request all headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2440 (if (and (stringp message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2441 (> (length message-id) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2442 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2443 ;; Construct the correct Message-ID if necessary.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2444 ;; Suggested by tale@pawl.rpi.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2445 (or (string-match "^<" message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2446 (setq message-id (concat "<" message-id)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2447 (or (string-match ">$" message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2448 (setq message-id (concat message-id ">")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2449 ;; Push current message-id on history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2450 ;; We cannot use gnus-current-headers to get current
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2451 ;; message-id because we may be looking at parent or refered
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2452 ;; article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2453 (let ((current (gnus-fetch-field "Message-ID")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2454 (or (equal current message-id) ;Nothing to do.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2455 (equal current (car gnus-current-history))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2456 (setq gnus-current-history
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2457 (cons current gnus-current-history)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2458 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2459 ;; Pop message-id from history.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2460 (setq message-id (car gnus-current-history))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2461 (setq gnus-current-history (cdr gnus-current-history)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2462 (if (stringp message-id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2463 ;; Retrieve article by message-id. This may not work with nnspool.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2464 (gnus-Article-prepare message-id t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2465 (error "No such references"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2466 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2467
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2468 (defun gnus-Subject-next-digest (nth)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2469 "Move to head of NTH next digested message."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2470 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2471 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2472 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2473 (gnus-Article-next-digest (or nth 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2474 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2475
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2476 (defun gnus-Subject-prev-digest (nth)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2477 "Move to head of NTH previous digested message."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2478 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2479 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2480 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2481 (gnus-Article-prev-digest (or nth 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2482 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2483
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2484 (defun gnus-Subject-first-unread-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2485 "Select first unread article. Return non-nil if successfully selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2486 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2487 (let ((begin (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2488 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2489 (if (re-search-forward "^ [ \t]+[0-9]+:" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2490 (gnus-Subject-display-article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2491 ;; If there is no unread articles, stay there.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2492 (goto-char begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2493 ;;(gnus-Subject-display-article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2494 (message "No more unread articles")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2495 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2496 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2497 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2498
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2499 (defun gnus-Subject-isearch-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2500 "Do incremental search forward on current article."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2501 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2502 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2503 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2504 (call-interactively 'isearch-forward)
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 (defun gnus-Subject-search-article-forward (regexp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2508 "Search for an article containing REGEXP forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2509 `gnus-Select-article-hook' is not called during the search."
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 (list (read-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2512 (concat "Search forward (regexp): "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2513 (if gnus-last-search-regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2514 (concat "(default " gnus-last-search-regexp ") "))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2515 (if (string-equal regexp "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2516 (setq regexp (or gnus-last-search-regexp ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2517 (setq gnus-last-search-regexp regexp))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2518 (if (gnus-Subject-search-article regexp nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2519 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2520 (recenter 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2521 ;;(sit-for 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2522 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2523 (error "Search failed: \"%s\"" regexp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2524 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2525
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2526 (defun gnus-Subject-search-article-backward (regexp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2527 "Search for an article containing REGEXP backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2528 `gnus-Select-article-hook' is not called during the search."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2529 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2530 (list (read-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2531 (concat "Search backward (regexp): "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2532 (if gnus-last-search-regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2533 (concat "(default " gnus-last-search-regexp ") "))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2534 (if (string-equal regexp "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2535 (setq regexp (or gnus-last-search-regexp ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2536 (setq gnus-last-search-regexp regexp))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2537 (if (gnus-Subject-search-article regexp t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2538 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2539 (recenter 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2540 ;;(sit-for 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2541 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2542 (error "Search failed: \"%s\"" regexp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2543 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2544
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2545 (defun gnus-Subject-search-article (regexp &optional backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2546 "Search for an article containing REGEXP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2547 Optional argument BACKWARD means do search for backward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2548 `gnus-Select-article-hook' is not called during the search."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2549 (let ((gnus-Select-article-hook nil) ;Disable hook.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2550 (gnus-Mark-article-hook nil) ;Inhibit marking as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2551 (re-search
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2552 (if backward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2553 (function re-search-backward) (function re-search-forward)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2554 (found nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2555 (last nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2556 ;; Hidden thread subtrees must be searched for ,too.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2557 (gnus-Subject-show-all-threads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2558 ;; First of all, search current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2559 ;; We don't want to read article again from NNTP server nor reset
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2560 ;; current point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2561 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2562 (message "Searching article: %d..." gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2563 (setq last gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2564 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2565 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2566 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2567 ;; Begin search from current point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2568 (setq found (funcall re-search regexp nil t))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2569 ;; Then search next articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2570 (while (and (not found)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2571 (gnus-Subject-display-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2572 (gnus-Subject-search-subject backward nil nil)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2573 (message "Searching article: %d..." gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2574 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2575 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2576 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2577 (goto-char (if backward (point-max) (point-min)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2578 (setq found (funcall re-search regexp nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2579 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2580 (message "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2581 ;; Adjust article pointer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2582 (or (eq last gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2583 (setq gnus-last-article last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2584 ;; Return T if found such article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2585 found
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2586 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2587
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2588 (defun gnus-Subject-execute-command (field regexp command &optional backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2589 "If FIELD of article header matches REGEXP, execute COMMAND string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2590 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
2591 If optional (prefix) argument BACKWARD is non-nil, do backward instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2592 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2593 (list (let ((completion-ignore-case t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2594 (completing-read "Field name: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2595 '(("Number")("Subject")("From")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2596 ("Lines")("Date")("Id")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2597 ("Xref")("References"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2598 nil 'require-match))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2599 (read-string "Regexp: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2600 (read-key-sequence "Command: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2601 current-prefix-arg))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2602 ;; Hidden thread subtrees must be searched for ,too.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2603 (gnus-Subject-show-all-threads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2604 ;; We don't want to change current point nor window configuration.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2605 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2606 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2607 (message "Executing %s..." (key-description command))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2608 ;; We'd like to execute COMMAND interactively so as to give arguments.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2609 (gnus-execute field regexp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2610 (` (lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2611 (call-interactively '(, (key-binding command)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2612 backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2613 (message "Executing %s... done" (key-description command)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2614
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2615 (defun gnus-Subject-beginning-of-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2616 "Go to beginning of article body"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2617 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2618 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2619 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2620 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2621 (beginning-of-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2622 (if gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2623 (gnus-narrow-to-page))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2624 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2625
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2626 (defun gnus-Subject-end-of-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2627 "Go to end of article body"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2628 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2629 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2630 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2631 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2632 (end-of-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2633 (if gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2634 (gnus-narrow-to-page))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2635 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2636
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2637 (defun gnus-Subject-goto-article (article &optional all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2638 "Read ARTICLE if exists.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2639 Optional argument ALL-HEADERS means all headers are shown."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2640 (interactive
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2641 (list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2642 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2643 (completing-read "Article number: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2644 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2645 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2646 (lambda (headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2647 (list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2648 (int-to-string (nntp-header-number headers)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2649 gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2650 nil 'require-match))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2651 (if (gnus-Subject-goto-subject article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2652 (gnus-Subject-display-article article all-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2653
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2654 (defun gnus-Subject-goto-last-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2655 "Go to last subject line."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2656 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2657 (if gnus-last-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2658 (gnus-Subject-goto-article gnus-last-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2659
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2660 (defun gnus-Subject-show-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2661 "Force to show current article."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2662 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2663 ;; The following is a trick to force to read the current article again.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2664 (setq gnus-have-all-headers (not gnus-have-all-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2665 (gnus-Subject-select-article (not gnus-have-all-headers) t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2666
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2667 (defun gnus-Subject-toggle-header (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2668 "Show original header if pruned header currently shown, or vice versa.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2669 With arg, show original header iff arg is positive."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2670 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2671 ;; Variable gnus-show-all-headers must be NIL to toggle really.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2672 (let ((gnus-show-all-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2673 (all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2674 (if (null arg) (not gnus-have-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2675 (> (prefix-numeric-value arg) 0))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2676 (gnus-Subject-select-article all-headers t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2677
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2678 (defun gnus-Subject-show-all-headers ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2679 "Show original article header."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2680 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2681 (gnus-Subject-select-article t t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2682
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2683 (defun gnus-Subject-stop-page-breaking ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2684 "Stop page breaking by linefeed temporary (Widen article buffer)."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2685 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2686 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2687 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2688 (widen)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2689
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2690 (defun gnus-Subject-kill-same-subject-and-select (unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2691 "Mark articles which has the same subject as read, and then select next.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2692 If argument UNMARK is positive, remove any kinds of marks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2693 If argument UNMARK is negative, mark articles as unread instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2694 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2695 (if unmark
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2696 (setq unmark (prefix-numeric-value unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2697 (let ((count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2698 (gnus-Subject-mark-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2699 (gnus-Subject-subject-string) unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2700 ;; Select next unread article. If auto-select-same mode, should
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2701 ;; select the first unread article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2702 (gnus-Subject-next-article t (and gnus-auto-select-same
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2703 (gnus-Subject-subject-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2704 (message "%d articles are marked as %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2705 count (if unmark "unread" "read"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2706 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2707
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2708 (defun gnus-Subject-kill-same-subject (unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2709 "Mark articles which has the same subject as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2710 If argument UNMARK is positive, remove any kinds of marks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2711 If argument UNMARK is negative, mark articles as unread instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2712 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2713 (if unmark
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2714 (setq unmark (prefix-numeric-value unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2715 (let ((count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2716 (gnus-Subject-mark-same-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2717 (gnus-Subject-subject-string) unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2718 ;; If marked as read, go to next unread subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2719 (if (null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2720 ;; Go to next unread subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2721 (gnus-Subject-next-subject 1 t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2722 (message "%d articles are marked as %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2723 count (if unmark "unread" "read"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2724 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2725
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2726 (defun gnus-Subject-mark-same-subject (subject &optional unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2727 "Mark articles with same SUBJECT as read, and return marked number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2728 If optional argument UNMARK is positive, remove any kinds of marks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2729 If optional argument UNMARK is negative, mark articles as unread instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2730 (let ((count 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2731 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2732 (cond ((null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2733 (gnus-Subject-mark-as-read nil "K"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2734 ((> unmark 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2735 (gnus-Subject-mark-as-unread nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2736 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2737 (gnus-Subject-mark-as-unread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2738 (while (and subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2739 (gnus-Subject-search-forward nil subject))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2740 (cond ((null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2741 (gnus-Subject-mark-as-read nil "K"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2742 ((> unmark 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2743 (gnus-Subject-mark-as-unread nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2744 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2745 (gnus-Subject-mark-as-unread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2746 (setq count (1+ count))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2747 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2748 ;; Hide killed thread subtrees. Does not work properly always.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2749 ;;(and (null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2750 ;; gnus-thread-hide-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2751 ;; (gnus-Subject-hide-thread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2752 ;; Return number of articles marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2753 count
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2754 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2755
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2756 (defun gnus-Subject-mark-as-unread-forward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2757 "Mark current article as unread, and then go forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2758 Argument COUNT specifies number of articles marked as unread."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2759 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2760 (while (> count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2761 (gnus-Subject-mark-as-unread nil nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2762 (gnus-Subject-next-subject 1 nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2763 (setq count (1- count))))
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-backward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2766 "Mark current article as unread, and then go backward.
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-prev-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 (&optional article clear-mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2775 "Mark current article as unread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2776 Optional first argument ARTICLE specifies article number to be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2777 marked as unread. Optional second argument CLEAR-MARK removes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2778 any kind of mark."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2779 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2780 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2781 ;; First of all, show hidden thread subtrees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2782 (gnus-Subject-show-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2783 (let* ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2784 (current (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2785 (article (or article current)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2786 (gnus-mark-article-as-unread article clear-mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2787 (if (or (eq article current)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2788 (gnus-Subject-goto-subject article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2789 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2790 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2791 (delete-char 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2792 (insert (if clear-mark " " "-"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2793 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2794
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2795 (defun gnus-Subject-mark-as-read-forward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2796 "Mark current article as read, and then go forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2797 Argument COUNT specifies number of articles marked as read"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2798 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2799 (while (> count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2800 (gnus-Subject-mark-as-read)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2801 (gnus-Subject-next-subject 1 'unread-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2802 (setq count (1- count))))
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-backward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2805 "Mark current article as read, and then go backward.
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-prev-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 (&optional article mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2814 "Mark current article as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2815 Optional first argument ARTICLE specifies article number to be marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2816 Optional second argument MARK specifies a string inserted at beginning of line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2817 Any kind of string (length 1) except for a space and `-' is ok."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2818 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2819 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2820 ;; First of all, show hidden thread subtrees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2821 (gnus-Subject-show-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2822 (let* ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2823 (mark (or mark "D")) ;Default mark is `D'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2824 (current (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2825 (article (or article current)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2826 (gnus-mark-article-as-read article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2827 (if (or (eq article current)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2828 (gnus-Subject-goto-subject article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2829 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2830 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2831 (delete-char 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2832 (insert mark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2833 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2834
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2835 (defun gnus-Subject-clear-mark-forward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2836 "Remove current article's mark, and go forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2837 Argument COUNT specifies number of articles unmarked"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2838 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2839 (while (> count 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2840 (gnus-Subject-mark-as-unread nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2841 (gnus-Subject-next-subject 1 nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2842 (setq count (1- count))))
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-backward (count)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2845 "Remove current article's mark, and go backward.
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-prev-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-delete-marked-as-read ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2854 "Delete lines which are marked as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2855 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2856 (if gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2857 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2858 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2859 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2860 (delete-non-matching-lines "^[ ---]"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2861 ;; Adjust point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2862 (if (eobp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2863 (gnus-Subject-prev-subject 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2864 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2865 (search-forward ":" nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2866 ;; It is not so good idea to make the buffer empty.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2867 (message "All articles are marked as read")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2868 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2869
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2870 (defun gnus-Subject-delete-marked-with (marks)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2871 "Delete lines which are marked with MARKS (e.g. \"DK\")."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2872 (interactive "sMarks: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2873 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2874 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2875 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2876 (delete-matching-lines (concat "^[" marks "]")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2877 ;; Adjust point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2878 (or (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2879 (if (eobp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2880 (gnus-Subject-prev-subject 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2881 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2882 (search-forward ":" nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2883 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2884
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2885 ;; Thread-based commands.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2886
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2887 (defun gnus-Subject-toggle-threads (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2888 "Toggle showing conversation threads.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2889 With arg, turn showing conversation threads on iff arg is positive."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2890 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2891 (let ((current (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2892 (setq gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2893 (if (null arg) (not gnus-show-threads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2894 (> (prefix-numeric-value arg) 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2895 (gnus-Subject-prepare)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2896 (gnus-Subject-goto-subject current)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2897 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2898
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2899 (defun gnus-Subject-show-all-threads ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2900 "Show all thread subtrees."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2901 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2902 (if gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2903 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2904 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2905 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)
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-thread ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2909 "Show 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 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2915 (beginning-of-line) (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2916 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2917 (end-of-line) (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2918 ?\^M ?\n t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2919 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2920
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2921 (defun gnus-Subject-hide-all-threads ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2922 "Hide all thread subtrees."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2923 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2924 (if gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2925 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2926 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2927 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2928 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2929 (let ((level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2930 (gnus-Subject-hide-thread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2931 (while (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2932 (and (>= level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2933 (gnus-Subject-hide-thread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2934 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2935
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2936 (defun gnus-Subject-hide-thread ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2937 "Hide thread subtrees."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2938 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2939 (if gnus-show-threads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2940 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2941 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2942 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2943 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2944 (let ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2945 (init (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2946 (last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2947 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2948 (while (and (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2949 (< level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2950 ;; Interested in lower levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2951 (if (< level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2952 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2953 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2954 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2955 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2956 (subst-char-in-region init last ?\n ?\^M t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2957 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2958
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2959 (defun gnus-Subject-next-thread (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2960 "Go to the same level next thread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2961 Argument N specifies the number of threads."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2962 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2963 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2964 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2965 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2966 (let ((init (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2967 (last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2968 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2969 (while (and (> n 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2970 (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2971 (<= level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2972 ;; We have to skip lower levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2973 (if (= level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2974 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2975 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2976 (setq n (1- n))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2977 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2978 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2979 ;; Return non-nil if successfully move to the next.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2980 (prog1 (not (= init last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2981 (goto-char last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2982 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2983
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2984 (defun gnus-Subject-prev-thread (n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2985 "Go to the same level previous thread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2986 Argument N specifies the number of threads."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2987 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2988 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2989 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2990 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2991 (let ((init (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2992 (last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2993 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2994 (while (and (> n 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2995 (gnus-Subject-search-backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2996 (<= level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2997 ;; We have to skip lower levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2998 (if (= level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2999 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3000 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3001 (setq n (1- n))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3002 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3003 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3004 ;; Return non-nil if successfully move to the previous.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3005 (prog1 (not (= init last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3006 (goto-char last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3007 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3008
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3009 (defun gnus-Subject-down-thread (d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3010 "Go downward current thread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3011 Argument D specifies the depth goes down."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3012 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3013 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3014 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3015 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3016 (let ((last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3017 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3018 (while (and (> d 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3019 (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3020 (<= level (current-column))) ;<= can be <. Which do you like?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3021 ;; We have to skip the same levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3022 (if (< level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3023 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3024 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3025 (setq level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3026 (setq d (1- d))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3027 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3028 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3029 (goto-char last)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3030 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3031
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3032 (defun gnus-Subject-up-thread (d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3033 "Go upward current thread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3034 Argument D specifies the depth goes up."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3035 (interactive "p")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3036 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3037 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3038 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3039 (let ((last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3040 (level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3041 (while (and (> d 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3042 (gnus-Subject-search-backward))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3043 ;; We have to skip the same levels.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3044 (if (> level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3045 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3046 (setq last (point))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3047 (setq level (current-column))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3048 (setq d (1- d))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3049 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3050 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3051 (goto-char last)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3052 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3053
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3054 (defun gnus-Subject-kill-thread (unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3055 "Mark articles under current thread as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3056 If argument UNMARK is positive, remove any kinds of marks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3057 If argument UNMARK is negative, mark articles as unread instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3058 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3059 (if unmark
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3060 (setq unmark (prefix-numeric-value unmark)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3061 ;; Adjust cursor point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3062 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3063 (search-forward ":" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3064 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3065 (let ((level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3066 ;; Mark current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3067 (cond ((null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3068 (gnus-Subject-mark-as-read nil "K"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3069 ((> unmark 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3070 (gnus-Subject-mark-as-unread nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3071 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3072 (gnus-Subject-mark-as-unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3073 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3074 ;; Mark following articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3075 (while (and (gnus-Subject-search-forward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3076 (< level (current-column)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3077 (cond ((null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3078 (gnus-Subject-mark-as-read nil "K"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3079 ((> unmark 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3080 (gnus-Subject-mark-as-unread nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3081 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3082 (gnus-Subject-mark-as-unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3083 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3084 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3085 ;; Hide killed subtrees.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3086 (and (null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3087 gnus-thread-hide-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3088 (gnus-Subject-hide-thread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3089 ;; If marked as read, go to next unread subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3090 (if (null unmark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3091 ;; Go to next unread subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3092 (gnus-Subject-next-subject 1 t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3093 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3094
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3095 (defun gnus-Subject-toggle-truncation (arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3096 "Toggle truncation of subject lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3097 With ARG, turn line truncation on iff ARG is positive."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3098 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3099 (setq truncate-lines
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3100 (if (null arg) (not truncate-lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3101 (> (prefix-numeric-value arg) 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3102 (redraw-display))
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-sort-by-number (reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3105 "Sort subject display buffer by article number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3106 Argument REVERSE means reverse order."
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 (gnus-Subject-sort-subjects
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3109 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3110 (lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3111 (< (nntp-header-number a) (nntp-header-number b))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3112 reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3113 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3114
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3115 (defun gnus-Subject-sort-by-author (reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3116 "Sort subject display buffer by author name alphabetically.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3117 If case-fold-search is non-nil, case of letters is ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3118 Argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3119 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3120 (gnus-Subject-sort-subjects
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3121 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3122 (lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3123 (gnus-string-lessp (nntp-header-from a) (nntp-header-from b))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3124 reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3125 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3126
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3127 (defun gnus-Subject-sort-by-subject (reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3128 "Sort subject display buffer by subject alphabetically. `Re:'s are ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3129 If case-fold-search is non-nil, case of letters is ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3130 Argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3131 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3132 (gnus-Subject-sort-subjects
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3133 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3134 (lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3135 (gnus-string-lessp
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3136 (gnus-simplify-subject (nntp-header-subject a) 're-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3137 (gnus-simplify-subject (nntp-header-subject b) 're-only))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3138 reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3139 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3140
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3141 (defun gnus-Subject-sort-by-date (reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3142 "Sort subject display buffer by posted date.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3143 Argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3144 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3145 (gnus-Subject-sort-subjects
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3146 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3147 (lambda (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3148 (gnus-date-lessp (nntp-header-date a) (nntp-header-date b))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3149 reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3150 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3151
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3152 (defun gnus-Subject-sort-subjects (predicate &optional reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3153 "Sort subject display buffer by PREDICATE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3154 Optional argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3155 (let ((current (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3156 (gnus-sort-headers predicate reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3157 (gnus-Subject-prepare)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3158 (gnus-Subject-goto-subject current)
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-reselect-current-group (show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3162 "Once exit and then reselect the current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3163 Prefix argument SHOW-ALL means to select all articles."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3164 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3165 (let ((current-subject (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3166 (gnus-Subject-exit t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3167 ;; We have to adjust the point of Group mode buffer because the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3168 ;; current point was moved to the next unread newsgroup by
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3169 ;; exiting.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3170 (gnus-Subject-jump-to-group gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3171 (gnus-Group-read-group show-all t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3172 (gnus-Subject-goto-subject current-subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3173 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3174
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3175 (defun gnus-Subject-caesar-message (rotnum)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3176 "Caesar rotates all letters of current message by 13/47 places.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3177 With prefix arg, specifies the number of places to rotate each letter forward.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3178 Caesar rotates Japanese letters by 47 places in any case."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3179 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3180 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3181 (gnus-overload-functions)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3182 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3183 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3184 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3185 ;; We don't want to jump to the beginning of the message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3186 ;; `save-excursion' does not do its job.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3187 (move-to-window-line 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3188 (let ((last (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3189 (news-caesar-buffer-body rotnum)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3190 (goto-char last)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3191 (recenter 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3192 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3193 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3194
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3195 (defun gnus-Subject-rmail-digest ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3196 "Run RMAIL on current digest article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3197 `gnus-Select-digest-hook' will be called with no arguments, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3198 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
3199 can work with it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3200
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3201 `gnus-Rmail-digest-hook' will be called with no arguments, if that value
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3202 is non-nil. The hook is intended to customize Rmail mode."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3203 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3204 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3205 (require 'rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3206 (let ((artbuf gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3207 (digbuf (get-buffer-create gnus-Digest-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3208 (mail-header-separator ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3209 (set-buffer digbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3210 (buffer-flush-undo (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3211 (setq buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3212 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3213 (insert-buffer-substring artbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3214 (run-hooks 'gnus-Select-digest-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3215 (gnus-convert-article-to-rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3216 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3217 ;; Rmail initializations.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3218 (rmail-insert-rmail-file-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3219 (rmail-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3220 (rmail-set-message-counters)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3221 (rmail-show-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3222 (condition-case ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3223 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3224 (undigestify-rmail-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3225 (rmail-expunge) ;Delete original message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3226 ;; File name is meaningless but `save-buffer' requires it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3227 (setq buffer-file-name "GNUS Digest")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3228 (setq mode-line-buffer-identification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3229 (concat "Digest: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3230 (nntp-header-subject gnus-current-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3231 ;; There is no need to write this buffer to a file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3232 (make-local-variable 'write-file-hooks)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3233 (setq write-file-hooks
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3234 (list (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3235 (lambda ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3236 (set-buffer-modified-p nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3237 (message "(No changes need to be saved)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3238 'no-need-to-write-this-buffer))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3239 ;; Default file name saving digest messages.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3240 (setq rmail-last-rmail-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3241 (funcall gnus-rmail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3242 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3243 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3244 gnus-newsgroup-last-rmail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3245 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3246 (setq rmail-last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3247 (funcall gnus-mail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3248 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3249 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3250 gnus-newsgroup-last-mail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3251 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3252 ;; Prevent generating new buffer named ***<N> each time.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3253 (setq rmail-summary-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3254 (get-buffer-create gnus-Digest-summary-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3255 (run-hooks 'gnus-Rmail-digest-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3256 ;; Take all windows safely.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3257 (gnus-configure-windows '(1 0 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3258 (pop-to-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3259 ;; Use Subject and Article windows for Digest summary and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3260 ;; Digest buffers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3261 (if gnus-digest-show-summary
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3262 (let ((gnus-Subject-buffer gnus-Digest-summary-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3263 (gnus-Article-buffer gnus-Digest-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3264 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3265 (pop-to-buffer gnus-Digest-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3266 (rmail-summary)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3267 (pop-to-buffer gnus-Digest-summary-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3268 (message (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3269 "Type \\[rmail-summary-quit] to return to GNUS")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3270 (let ((gnus-Subject-buffer gnus-Digest-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3271 (gnus-configure-windows 'ExpandSubject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3272 (pop-to-buffer gnus-Digest-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3273 (message (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3274 "Type \\[rmail-quit] to return to GNUS")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3275 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3276 ;; Move the buffers to the end of buffer list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3277 (bury-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3278 (bury-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3279 (bury-buffer gnus-Digest-summary-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3280 (bury-buffer gnus-Digest-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3281 (error (set-buffer-modified-p nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3282 (kill-buffer digbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3283 ;; This command should not signal an error because the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3284 ;; command is called from hooks.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3285 (ding) (message "Article is not a digest")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3286 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3287
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3288 (defun gnus-Subject-save-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3289 "Save this article using default saver function.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3290 Variable `gnus-default-article-saver' specifies the saver function."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3291 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3292 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3293 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3294 (if gnus-default-article-saver
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3295 (call-interactively gnus-default-article-saver)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3296 (error "No default saver is defined.")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3297
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3298 (defun gnus-Subject-save-in-rmail (&optional filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3299 "Append this article to Rmail file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3300 Optional argument FILENAME specifies file name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3301 Directory to save to is default to `gnus-article-save-directory' which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3302 is initialized from the SAVEDIR environment variable."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3303 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3304 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3305 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3306 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3307 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3308 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3309 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3310 (let ((default-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3311 (funcall gnus-rmail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3312 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3313 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3314 gnus-newsgroup-last-rmail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3315 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3316 (or filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3317 (setq filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3318 (read-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3319 (concat "Save article in Rmail file: (default "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3320 (file-name-nondirectory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3321 ") ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3322 (file-name-directory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3323 default-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3324 (gnus-make-directory (file-name-directory filename))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3325 (gnus-output-to-rmail filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3326 ;; Remember the directory name to save articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3327 (setq gnus-newsgroup-last-rmail filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3328 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3329 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3330
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3331 (defun gnus-Subject-save-in-mail (&optional filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3332 "Append this article to Unix mail file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3333 Optional argument FILENAME specifies file name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3334 Directory to save to is default to `gnus-article-save-directory' which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3335 is initialized from the SAVEDIR environment variable."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3336 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3337 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3338 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3339 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3340 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3341 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3342 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3343 (let ((default-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3344 (funcall gnus-mail-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3345 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3346 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3347 gnus-newsgroup-last-mail
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3348 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3349 (or filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3350 (setq filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3351 (read-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3352 (concat "Save article in Unix mail file: (default "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3353 (file-name-nondirectory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3354 ") ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3355 (file-name-directory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3356 default-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3357 (gnus-make-directory (file-name-directory filename))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3358 (rmail-output filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3359 ;; Remember the directory name to save articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3360 (setq gnus-newsgroup-last-mail filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3361 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3362 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3363
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3364 (defun gnus-Subject-save-in-file (&optional filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3365 "Append this article to file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3366 Optional argument FILENAME specifies file name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3367 Directory to save to is default to `gnus-article-save-directory' which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3368 is initialized from the SAVEDIR environment variable."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3369 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3370 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3371 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3372 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3373 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3374 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3375 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3376 (let ((default-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3377 (funcall gnus-file-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3378 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3379 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3380 gnus-newsgroup-last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3381 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3382 (or filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3383 (setq filename
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3384 (read-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3385 (concat "Save article in file: (default "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3386 (file-name-nondirectory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3387 ") ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3388 (file-name-directory default-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3389 default-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3390 (gnus-make-directory (file-name-directory filename))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3391 (gnus-output-to-file filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3392 ;; Remember the directory name to save articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3393 (setq gnus-newsgroup-last-file filename)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3394 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3395 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3396
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3397 (defun gnus-Subject-save-in-folder (&optional folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3398 "Save this article to MH folder (using `rcvstore' in MH library).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3399 Optional argument FOLDER specifies folder name."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3400 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3401 (gnus-Subject-select-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3402 (not (null gnus-save-all-headers)) gnus-save-all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3403 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3404 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3405 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3406 ;; Thanks to yuki@flab.Fujitsu.JUNET and ohm@kaba.junet.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3407 (mh-find-path)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3408 (let ((folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3409 (or folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3410 (mh-prompt-for-folder "Save article in"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3411 (funcall gnus-folder-save-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3412 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3413 gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3414 gnus-newsgroup-last-folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3415 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3416 t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3417 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3418 (errbuf (get-buffer-create " *GNUS rcvstore*")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3419 (unwind-protect
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3420 (call-process-region (point-min) (point-max)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3421 (expand-file-name "rcvstore" mh-lib)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3422 nil errbuf nil folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3423 (set-buffer errbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3424 (if (zerop (buffer-size))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3425 (message "Article saved in folder: %s" folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3426 (message "%s" (buffer-string)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3427 (kill-buffer errbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3428 (setq gnus-newsgroup-last-folder folder))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3429 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3430 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3431
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3432 (defun gnus-Subject-pipe-output ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3433 "Pipe this article to subprocess."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3434 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3435 ;; Ignore `gnus-save-all-headers' since this is not save command.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3436 (gnus-Subject-select-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3437 (gnus-eval-in-buffer-window gnus-Article-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3438 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3439 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3440 (let ((command (read-string "Shell command on article: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3441 gnus-last-shell-command)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3442 (if (string-equal command "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3443 (setq command gnus-last-shell-command))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3444 (shell-command-on-region (point-min) (point-max) command nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3445 (setq gnus-last-shell-command command)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3446 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3447 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3448
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3449 (defun gnus-Subject-catch-up (all &optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3450 "Mark all articles not marked as unread in this newsgroup as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3451 If prefix argument ALL is non-nil, all articles are marked as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3452 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3453 (if (or quietly
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3454 (y-or-n-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3455 (if all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3456 "Do you really want to mark everything as read? "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3457 "Delete all articles not marked as unread? ")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3458 (let ((unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3459 (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3460 (if (not all) gnus-newsgroup-marked))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3461 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3462 (while unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3463 (gnus-Subject-mark-as-read (car unmarked) "C")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3464 (setq unmarked (cdr unmarked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3465 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3466 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3467
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3468 (defun gnus-Subject-catch-up-all (&optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3469 "Mark all articles in this newsgroup as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3470 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3471 (gnus-Subject-catch-up t quietly))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3472
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3473 (defun gnus-Subject-catch-up-and-exit (all &optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3474 "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
3475 If prefix argument ALL is non-nil, all articles are marked as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3476 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3477 (if (or quietly
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3478 (y-or-n-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3479 (if all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3480 "Do you really want to mark everything as read? "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3481 "Delete all articles not marked as unread? ")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3482 (let ((unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3483 (gnus-set-difference gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3484 (if (not all) gnus-newsgroup-marked))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3485 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3486 (while unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3487 (gnus-mark-article-as-read (car unmarked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3488 (setq unmarked (cdr unmarked)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3489 ;; Select next newsgroup or exit.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3490 (cond ((eq gnus-auto-select-next 'quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3491 ;; Select next newsgroup quietly.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3492 (gnus-Subject-next-group nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3493 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3494 (gnus-Subject-exit)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3495 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3496
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3497 (defun gnus-Subject-catch-up-all-and-exit (&optional quietly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3498 "Mark all articles in this newsgroup as read, and then exit."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3499 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3500 (gnus-Subject-catch-up-and-exit t quietly))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3501
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3502 (defun gnus-Subject-edit-global-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3503 "Edit a global KILL file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3504 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3505 (setq gnus-current-kill-article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3506 (gnus-Kill-file-edit-file nil) ;Nil stands for global KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3507 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3508 (substitute-command-keys
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3509 "Editing a global KILL file (Type \\[gnus-Kill-file-exit] to exit)")))
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-local-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3512 "Edit a local KILL file applied to the current newsgroup."
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 gnus-newsgroup-name)
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 local 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-exit (&optional temporary)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3521 "Exit reading current newsgroup, and then return to group selection mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3522 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
3523 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3524 (let ((updated nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3525 (gnus-newsgroup-headers gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3526 (gnus-newsgroup-unreads gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3527 (gnus-newsgroup-unselected gnus-newsgroup-unselected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3528 (gnus-newsgroup-marked gnus-newsgroup-marked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3529 ;; Important internal variables are save, so we can reenter
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3530 ;; Subject Mode buffer even if hook changes them.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3531 (run-hooks 'gnus-Exit-group-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3532 (gnus-update-unread-articles gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3533 (append gnus-newsgroup-unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3534 gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3535 gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3536 ;; T means ignore unsubscribed newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3537 (if gnus-use-cross-reference
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3538 (setq updated
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3539 (gnus-mark-as-read-by-xref gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3540 gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3541 gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3542 (eq gnus-use-cross-reference t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3543 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3544 ;; Do not switch windows but change the buffer to work.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3545 (set-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3546 ;; Update cross referenced group info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3547 (while updated
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3548 (gnus-Group-update-group (car updated) t) ;Ignore invisible group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3549 (setq updated (cdr updated)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3550 (gnus-Group-update-group gnus-newsgroup-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3551 ;; Make sure where I was, and go to next newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3552 (gnus-Group-jump-to-group gnus-newsgroup-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3553 (gnus-Group-next-unread-group 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3554 (if temporary
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3555 ;; If exiting temporary, caller should adjust Group mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3556 ;; buffer point by itself.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3557 nil ;Nothing to do.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3558 ;; Return to Group mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3559 (if (get-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3560 (bury-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3561 (if (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3562 (bury-buffer gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3563 (gnus-configure-windows 'ExitNewsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3564 (pop-to-buffer gnus-Group-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3565
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3566 (defun gnus-Subject-quit ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3567 "Quit reading current newsgroup without updating read article info."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3568 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3569 (if (y-or-n-p "Do you really wanna quit reading this group? ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3570 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3571 (message "") ;Erase "Yes or No" question.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3572 ;; Return to Group selection mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3573 (if (get-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3574 (bury-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3575 (if (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3576 (bury-buffer gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3577 (gnus-configure-windows 'ExitNewsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3578 (pop-to-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3579 (gnus-Group-jump-to-group gnus-newsgroup-name) ;Make sure where I was.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3580 (gnus-Group-next-group 1) ;(gnus-Group-next-unread-group 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3581 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3582
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3583 (defun gnus-Subject-describe-briefly ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3584 "Describe Subject mode commands briefly."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3585 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3586 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3587 (concat
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3588 (substitute-command-keys "\\[gnus-Subject-next-page]:Select ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3589 (substitute-command-keys "\\[gnus-Subject-next-unread-article]:Forward ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3590 (substitute-command-keys "\\[gnus-Subject-prev-unread-article]:Backward ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3591 (substitute-command-keys "\\[gnus-Subject-exit]:Exit ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3592 (substitute-command-keys "\\[gnus-Info-find-node]:Run Info ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3593 (substitute-command-keys "\\[gnus-Subject-describe-briefly]:This help")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3594 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3595
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3596
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3597 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3598 ;;; GNUS Article Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3599 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3600
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3601 (if gnus-Article-mode-map
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3602 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3603 (setq gnus-Article-mode-map (make-keymap))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3604 (suppress-keymap gnus-Article-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3605 (define-key gnus-Article-mode-map " " 'gnus-Article-next-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3606 (define-key gnus-Article-mode-map "\177" 'gnus-Article-prev-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3607 (define-key gnus-Article-mode-map "r" 'gnus-Article-refer-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3608 (define-key gnus-Article-mode-map "o" 'gnus-Article-pop-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3609 (define-key gnus-Article-mode-map "h" 'gnus-Article-show-subjects)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3610 (define-key gnus-Article-mode-map "s" 'gnus-Article-show-subjects)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3611 (define-key gnus-Article-mode-map "?" 'gnus-Article-describe-briefly)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3612 (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
3613
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3614 (defun gnus-Article-mode ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3615 "Major mode for browsing through an article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3616 All normal editing commands are turned off.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3617 Instead, these commands are available:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3618 \\{gnus-Article-mode-map}
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3619
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3620 Various hooks for customization:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3621 gnus-Article-mode-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3622 Entry to this mode calls the value with no arguments, if that
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3623 value is non-nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3624
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3625 gnus-Article-prepare-hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3626 Called with no arguments after an article is prepared for reading,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3627 if that value is non-nil."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3628 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3629 (kill-all-local-variables)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3630 ;; Gee. Why don't you upgrade?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3631 (cond ((boundp 'mode-line-modified)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3632 (setq mode-line-modified "--- "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3633 ((listp (default-value 'mode-line-format))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3634 (setq mode-line-format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3635 (cons "--- " (cdr (default-value 'mode-line-format))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3636 (make-local-variable 'global-mode-string)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3637 (setq global-mode-string nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3638 (setq major-mode 'gnus-Article-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3639 (setq mode-name "Article")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3640 (gnus-Article-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3641 (use-local-map gnus-Article-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3642 (make-local-variable 'page-delimiter)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3643 (setq page-delimiter gnus-page-delimiter)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3644 (make-local-variable 'mail-header-separator)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3645 (setq mail-header-separator "") ;For caesar function.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3646 (buffer-flush-undo (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3647 (setq buffer-read-only t) ;Disable modification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3648 (run-hooks 'gnus-Article-mode-hook))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3649
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3650 (defun gnus-Article-setup-buffer ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3651 "Initialize Article mode buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3652 (or (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3653 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3654 (set-buffer (get-buffer-create gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3655 (gnus-Article-mode))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3656 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3657
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3658 (defun gnus-Article-prepare (article &optional all-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3659 "Prepare ARTICLE in Article mode buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3660 If optional argument ALL-HEADERS is non-nil, all headers are inserted."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3661 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3662 (set-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3663 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3664 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3665 (if (gnus-request-article article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3666 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3667 ;; Prepare article buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3668 (insert-buffer-substring nntp-server-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3669 (setq gnus-have-all-headers (or all-headers gnus-show-all-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3670 (if (and (numberp article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3671 (not (eq article gnus-current-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3672 ;; Seems me that a new article is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3673 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3674 ;; gnus-current-article must be an article number.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3675 (setq gnus-last-article gnus-current-article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3676 (setq gnus-current-article article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3677 (setq gnus-current-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3678 (gnus-find-header-by-number gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3679 gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3680 ;; Clear articles history only when articles are
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3681 ;; retrieved by article numbers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3682 (setq gnus-current-history nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3683 (run-hooks 'gnus-Mark-article-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3684 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3685 ;; Hooks for modifying contents of the article. This hook
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3686 ;; must be called before being narrowed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3687 (run-hooks 'gnus-Article-prepare-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3688 ;; Delete unnecessary headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3689 (or gnus-have-all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3690 (gnus-Article-delete-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3691 ;; Do page break.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3692 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3693 (if gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3694 (gnus-narrow-to-page))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3695 ;; Next function must be called after setting
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3696 ;; `gnus-current-article' variable and narrowed to page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3697 (gnus-Article-set-mode-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3698 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3699 (if (numberp article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3700 (gnus-Subject-mark-as-read article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3701 (ding) (message "No such article (may be canceled)"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3702 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3703
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3704 (defun gnus-Article-show-all-headers ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3705 "Show all article headers in Article mode buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3706 (or gnus-have-all-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3707 (gnus-Article-prepare gnus-current-article t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3708
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3709 ;;(defun gnus-Article-set-mode-line ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3710 ;; "Set Article mode line string."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3711 ;; (setq mode-line-buffer-identification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3712 ;; (list 17
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3713 ;; (format "GNUS: %s {%d-%d} %d"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3714 ;; gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3715 ;; gnus-newsgroup-begin
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3716 ;; gnus-newsgroup-end
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3717 ;; gnus-current-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3718 ;; )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3719 ;; (set-buffer-modified-p t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3720
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3721 (defun gnus-Article-set-mode-line ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3722 "Set Article mode line string."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3723 (let ((unmarked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3724 (- (length gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3725 (length (gnus-intersection
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3726 gnus-newsgroup-unreads gnus-newsgroup-marked))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3727 (unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3728 (- (length gnus-newsgroup-unselected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3729 (length (gnus-intersection
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3730 gnus-newsgroup-unselected gnus-newsgroup-marked)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3731 (setq mode-line-buffer-identification
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3732 (list 17
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3733 (format "GNUS: %s{%d} %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3734 gnus-newsgroup-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3735 gnus-current-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3736 ;; This is proposed by tale@pawl.rpi.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3737 (cond ((and (zerop unmarked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3738 (zerop unselected))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3739 " ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3740 ((zerop unselected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3741 (format "%d more" unmarked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3742 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3743 (format "%d(+%d) more" unmarked unselected)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3744 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3745 (set-buffer-modified-p t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3746
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3747 (defun gnus-Article-delete-headers ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3748 "Delete unnecessary headers."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3749 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3750 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3751 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3752 (narrow-to-region (point-min)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3753 (progn (search-forward "\n\n" nil 'move) (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3754 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3755 (and (stringp gnus-ignored-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3756 (while (re-search-forward gnus-ignored-headers nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3757 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3758 (delete-region (point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3759 (progn (re-search-forward "\n[^ \t]")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3760 (forward-char -1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3761 (point)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3762 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3763
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3764 ;; Working on article's buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3765
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3766 (defun gnus-Article-next-page (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3767 "Show next page of current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3768 If end of article, return non-nil. Otherwise return nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3769 Argument LINES specifies lines to be scrolled up."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3770 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3771 (move-to-window-line -1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3772 ;; Fixed by enami@ptgd.sony.co.jp (enami tsugutomo)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3773 (if (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3774 (end-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3775 (and (pos-visible-in-window-p) ;Not continuation line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3776 (eobp)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3777 ;; Nothing in this page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3778 (if (or (not gnus-break-pages)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3779 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3780 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3781 (widen) (forward-line 1) (eobp)))) ;Real end-of-buffer?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3782 t ;Nothing more.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3783 (gnus-narrow-to-page 1) ;Go to next page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3784 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3785 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3786 ;; More in this page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3787 (condition-case ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3788 (scroll-up lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3789 (end-of-buffer
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3790 ;; Long lines may cause an end-of-buffer error.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3791 (goto-char (point-max))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3792 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3793 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3794
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3795 (defun gnus-Article-prev-page (lines)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3796 "Show previous page of current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3797 Argument LINES specifies lines to be scrolled down."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3798 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3799 (move-to-window-line 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3800 (if (and gnus-break-pages
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3801 (bobp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3802 (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3803 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3804 (gnus-narrow-to-page -1) ;Go to previous page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3805 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3806 (recenter -1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3807 (scroll-down lines)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3808
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3809 (defun gnus-Article-next-digest (nth)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3810 "Move to head of NTH next digested message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3811 Set mark at end of digested message."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3812 ;; Stop page breaking in digest mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3813 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3814 (end-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3815 ;; Skip NTH - 1 digest.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3816 ;; Suggested by Khalid Sattar <admin@cs.exeter.ac.uk>.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3817 ;; Digest separator is customizable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3818 ;; Suggested by Skip Montanaro <montanaro@sprite.crd.ge.com>.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3819 (while (and (> nth 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3820 (re-search-forward gnus-digest-separator nil 'move))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3821 (setq nth (1- nth)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3822 (if (re-search-forward gnus-digest-separator nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3823 (let ((begin (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3824 ;; Search for end of this message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3825 (end-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3826 (if (re-search-forward gnus-digest-separator nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3827 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3828 (search-backward "\n\n") ;This may be incorrect.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3829 (forward-line 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3830 (goto-char (point-max)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3831 (push-mark) ;Set mark at end of digested message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3832 (goto-char begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3833 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3834 ;; Show From: and Subject: fields.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3835 (recenter 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3836 (message "End of message")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3837 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3838
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3839 (defun gnus-Article-prev-digest (nth)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3840 "Move to head of NTH previous digested message."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3841 ;; Stop page breaking in digest mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3842 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3843 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3844 ;; Skip NTH - 1 digest.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3845 ;; Suggested by Khalid Sattar <admin@cs.exeter.ac.uk>.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3846 ;; Digest separator is customizable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3847 ;; Suggested by Skip Montanaro <montanaro@sprite.crd.ge.com>.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3848 (while (and (> nth 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3849 (re-search-backward gnus-digest-separator nil 'move))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3850 (setq nth (1- nth)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3851 (if (re-search-backward gnus-digest-separator nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3852 (let ((begin (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3853 ;; Search for end of this message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3854 (end-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3855 (if (re-search-forward gnus-digest-separator nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3856 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3857 (search-backward "\n\n") ;This may be incorrect.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3858 (forward-line 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3859 (goto-char (point-max)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3860 (push-mark) ;Set mark at end of digested message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3861 (goto-char begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3862 ;; Show From: and Subject: fields.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3863 (recenter 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3864 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3865 (message "Top of message")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3866 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3867
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3868 (defun gnus-Article-refer-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3869 "Read article specified by message-id around point."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3870 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3871 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3872 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3873 (re-search-forward ">" nil t) ;Move point to end of "<....>".
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3874 (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3875 (let ((message-id
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3876 (buffer-substring (match-beginning 1) (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3877 (set-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3878 (gnus-Subject-refer-article message-id))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3879 (error "No references around point"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3880 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3881
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3882 (defun gnus-Article-pop-article ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3883 "Pop up article history."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3884 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3885 (save-window-excursion
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 nil)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3888
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3889 (defun gnus-Article-show-subjects ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3890 "Reconfigure windows to show headers."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3891 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3892 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3893 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3894 (gnus-Subject-goto-subject gnus-current-article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3895
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3896 (defun gnus-Article-describe-briefly ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3897 "Describe Article mode commands briefly."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3898 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3899 (message
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3900 (concat
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3901 (substitute-command-keys "\\[gnus-Article-next-page]:Next page ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3902 (substitute-command-keys "\\[gnus-Article-prev-page]:Prev page ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3903 (substitute-command-keys "\\[gnus-Article-show-subjects]:Show headers ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3904 (substitute-command-keys "\\[gnus-Info-find-node]:Run Info ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3905 (substitute-command-keys "\\[gnus-Article-describe-briefly]:This help")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3906 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3907
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3908
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3909 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3910 ;;; GNUS KILL-File Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3911 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3912
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3913 (if gnus-Kill-file-mode-map
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3914 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3915 (setq gnus-Kill-file-mode-map (copy-keymap emacs-lisp-mode-map))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3916 (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
3917 (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
3918 (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
3919 (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
3920 (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
3921 (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
3922
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3923 (defun gnus-Kill-file-mode ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3924 "Major mode for editing KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3925
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3926 In addition to Emacs-Lisp Mode, the following commands are available:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3927
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3928 \\[gnus-Kill-file-kill-by-subject] Insert KILL command for current subject.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3929 \\[gnus-Kill-file-kill-by-author] Insert KILL command for current author.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3930 \\[gnus-Kill-file-apply-buffer] Apply current buffer to selected newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3931 \\[gnus-Kill-file-apply-last-sexp] Apply sexp before point to selected newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3932 \\[gnus-Kill-file-exit] Save file and exit editing KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3933 \\[gnus-Info-find-node] Read Info about 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 A KILL file contains lisp expressions to be applied to a selected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3936 newsgroup. The purpose is to mark articles as read on the basis of
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3937 some set of regexps. A global KILL file is applied to every newsgroup,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3938 and a local KILL file is applied to a specified newsgroup. Since a
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3939 global KILL file is applied to every newsgroup, for better performance
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3940 use a local one.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3941
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3942 A KILL file can contain any kind of Emacs lisp expressions expected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3943 to be evaluated in the Subject buffer. Writing lisp programs for this
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3944 purpose is not so easy because the internal working of GNUS must be
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3945 well-known. For this reason, GNUS provides a general function which
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3946 does this easily for non-Lisp programmers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3947
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3948 The `gnus-kill' function executes commands available in Subject Mode
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3949 by their key sequences. `gnus-kill' should be called with FIELD,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3950 REGEXP and optional COMMAND and ALL. FIELD is a string representing
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3951 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
3952 entire article body is searched for. REGEXP is a string which is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3953 compared with FIELD value. COMMAND is a string representing a valid
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3954 key sequence in Subject Mode or Lisp expression. COMMAND is default to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3955 '(gnus-Subject-mark-as-read nil \"X\"). Make sure that COMMAND is
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3956 executed in the Subject buffer. If the second optional argument ALL
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3957 is non-nil, the COMMAND is applied to articles which are already
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3958 marked as read or unread. Articles which are marked are skipped over
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3959 by default.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3960
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3961 For example, if you want to mark articles of which subjects contain
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3962 the string `AI' as read, a possible KILL file may look like:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3963
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3964 (gnus-kill \"Subject\" \"AI\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3965
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3966 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
3967 the following expression:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3968
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3969 (gnus-kill \"Subject\" \"AI\" \"d\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3970
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3971 In this example it is assumed that the command
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3972 `gnus-Subject-mark-as-read-forward' is assigned to `d' in Subject Mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3973
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3974 It is possible to delete unnecessary headers which are marked with
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3975 `X' in a KILL file as follows:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3976
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3977 (gnus-expunge \"X\")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3978
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3979 If the Subject buffer is empty after applying KILL files, GNUS will
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3980 exit the selected newsgroup normally. If headers which are marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3981 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
3982 which are marked as read in the previous GNUS sessions. Marks other
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3983 than `D' should be used for articles which should really be deleted.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3984
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3985 Entry to this mode calls emacs-lisp-mode-hook and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3986 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
3987 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3988 (kill-all-local-variables)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3989 (use-local-map gnus-Kill-file-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3990 (set-syntax-table emacs-lisp-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3991 (setq major-mode 'gnus-Kill-file-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3992 (setq mode-name "KILL-File")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3993 (lisp-mode-variables nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3994 (run-hooks 'emacs-lisp-mode-hook 'gnus-Kill-file-mode-hook))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3995
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3996 (defun gnus-Kill-file-edit-file (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3997 "Begin editing a KILL file of NEWSGROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3998 If NEWSGROUP is nil, the global KILL file is selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3999 (interactive "sNewsgroup: ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4000 (let ((file (gnus-newsgroup-kill-file newsgroup)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4001 (gnus-make-directory (file-name-directory file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4002 ;; Save current window configuration if this is first invocation.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4003 (or (and (get-file-buffer file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4004 (get-buffer-window (get-file-buffer file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4005 (setq gnus-winconf-kill-file (current-window-configuration)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4006 ;; Hack windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4007 (let ((buffer (find-file-noselect file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4008 (cond ((get-buffer-window buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4009 (pop-to-buffer buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4010 ((eq major-mode 'gnus-Group-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4011 (gnus-configure-windows '(1 0 0)) ;Take all windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4012 (pop-to-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4013 (let ((gnus-Subject-buffer buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4014 (gnus-configure-windows '(1 1 0)) ;Split into two.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4015 (pop-to-buffer buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4016 ((eq major-mode 'gnus-Subject-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4017 (gnus-configure-windows 'SelectArticle)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4018 (pop-to-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4019 (bury-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4020 (switch-to-buffer buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4021 (t ;No good rules.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4022 (find-file-other-window file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4023 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4024 (gnus-Kill-file-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4025 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4026
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4027 (defun gnus-Kill-file-kill-by-subject ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4028 "Insert KILL command for current subject."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4029 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4030 (insert
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4031 (format "(gnus-kill \"Subject\" %s)\n"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4032 (prin1-to-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4033 (if gnus-current-kill-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4034 (regexp-quote
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4035 (nntp-header-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4036 (gnus-find-header-by-number gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4037 gnus-current-kill-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4038 "")))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4039
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4040 (defun gnus-Kill-file-kill-by-author ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4041 "Insert KILL command for current author."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4042 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4043 (insert
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4044 (format "(gnus-kill \"From\" %s)\n"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4045 (prin1-to-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4046 (if gnus-current-kill-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4047 (regexp-quote
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4048 (nntp-header-from
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4049 (gnus-find-header-by-number gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4050 gnus-current-kill-article)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4051 "")))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4052
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4053 (defun gnus-Kill-file-apply-buffer ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4054 "Apply current buffer to current newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4055 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4056 (if (and gnus-current-kill-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4057 (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4058 ;; Assume newsgroup is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4059 (let ((string (concat "(progn \n" (buffer-string) "\n)" )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4060 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4061 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4062 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4063 (eval (car (read-from-string string))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4064 (ding) (message "No newsgroup is selected.")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4065
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4066 (defun gnus-Kill-file-apply-last-sexp ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4067 "Apply sexp before point in current buffer to current newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4068 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4069 (if (and gnus-current-kill-article
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4070 (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4071 ;; Assume newsgroup is selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4072 (let ((string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4073 (buffer-substring
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4074 (save-excursion (forward-sexp -1) (point)) (point))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4075 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4076 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4077 (pop-to-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4078 (eval (car (read-from-string string))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4079 (ding) (message "No newsgroup is selected.")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4080
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4081 (defun gnus-Kill-file-exit ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4082 "Save a KILL file, then return to the previous buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4083 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4084 (save-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4085 (let ((killbuf (current-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4086 ;; We don't want to return to Article buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4087 (and (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4088 (bury-buffer (get-buffer gnus-Article-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4089 ;; Delete the KILL file windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4090 (delete-windows-on killbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4091 ;; Restore last window configuration if available.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4092 (and gnus-winconf-kill-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4093 (set-window-configuration gnus-winconf-kill-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4094 (setq gnus-winconf-kill-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4095 ;; Kill the KILL file buffer. Suggested by tale@pawl.rpi.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4096 (kill-buffer killbuf)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4097
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4098
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4099 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4100 ;;; Utility functions
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4101 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4102
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4103 ;; Basic ideas by emv@math.lsa.umich.edu (Edward Vielmetti)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4104
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4105 (defun gnus-batch-kill ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4106 "Run batched KILL.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4107 Usage: emacs -batch -l gnus -f gnus-batch-kill NEWSGROUP ..."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4108 (if (not noninteractive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4109 (error "gnus-batch-kill is to be used only with -batch"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4110 (let* ((group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4111 (subscribed nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4112 (newsrc nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4113 (yes-and-no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4114 (gnus-parse-n-options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4115 (apply (function concat)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4116 (mapcar (function (lambda (g) (concat g " ")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4117 command-line-args-left))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4118 (yes (car yes-and-no))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4119 (no (cdr yes-and-no))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4120 ;; Disable verbose message.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4121 (gnus-novice-user nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4122 (gnus-large-newsgroup nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4123 (nntp-large-newsgroup nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4124 ;; Eat all arguments.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4125 (setq command-line-args-left nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4126 ;; Startup GNUS.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4127 (gnus)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4128 ;; Apply kills to specified newsgroups in command line arguments.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4129 (setq newsrc (copy-sequence gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4130 (while newsrc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4131 (setq group (car (car newsrc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4132 (setq subscribed (nth 1 (car newsrc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4133 (setq newsrc (cdr newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4134 (if (and subscribed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4135 (not (zerop (nth 1 (gnus-gethash group gnus-unread-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4136 (if yes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4137 (string-match yes group) t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4138 (or (null no)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4139 (not (string-match no group))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4140 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4141 (gnus-Subject-read-group group nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4142 (if (eq (current-buffer) (get-buffer gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4143 (gnus-Subject-exit t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4144 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4145 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4146 ;; Finally, exit Emacs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4147 (set-buffer gnus-Group-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4148 (gnus-Group-exit)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4149 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4150
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4151 (defun gnus-Numeric-save-name (newsgroup headers &optional last-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4152 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4153 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
4154 Otherwise, it is like ~/News/news/group/num."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4155 (let ((default
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4156 (expand-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4157 (concat (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4158 (capitalize newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4159 (gnus-newsgroup-directory-form newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4160 "/" (int-to-string (nntp-header-number headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4161 (or gnus-article-save-directory "~/News"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4162 (if (and last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4163 (string-equal (file-name-directory default)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4164 (file-name-directory last-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4165 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4166 default
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4167 (or last-file default))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4168
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4169 (defun gnus-numeric-save-name (newsgroup headers &optional last-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4170 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4171 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
4172 Otherwise, it is like ~/News/news/group/num."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4173 (let ((default
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4174 (expand-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4175 (concat (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4176 newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4177 (gnus-newsgroup-directory-form newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4178 "/" (int-to-string (nntp-header-number headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4179 (or gnus-article-save-directory "~/News"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4180 (if (and last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4181 (string-equal (file-name-directory default)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4182 (file-name-directory last-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4183 (string-match "^[0-9]+$" (file-name-nondirectory last-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4184 default
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4185 (or last-file default))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4186
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4187 (defun gnus-Plain-save-name (newsgroup headers &optional last-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4188 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4189 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
4190 Otherwise, it is like ~/News/news/group/news."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4191 (or last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4192 (expand-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4193 (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4194 (capitalize newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4195 (concat (gnus-newsgroup-directory-form newsgroup) "/news"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4196 (or gnus-article-save-directory "~/News"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4197
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4198 (defun gnus-plain-save-name (newsgroup headers &optional last-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4199 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4200 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
4201 Otherwise, it is like ~/News/news/group/news."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4202 (or last-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4203 (expand-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4204 (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4205 newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4206 (concat (gnus-newsgroup-directory-form newsgroup) "/news"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4207 (or gnus-article-save-directory "~/News"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4208
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4209 (defun gnus-Folder-save-name (newsgroup headers &optional last-folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4210 "Generate folder name from NEWSGROUP, HEADERS, and optional LAST-FOLDER.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4211 If variable `gnus-use-long-file-name' is nil, it is +News.group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4212 Otherwise, it is like +news/group."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4213 (or last-folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4214 (concat "+"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4215 (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4216 (capitalize newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4217 (gnus-newsgroup-directory-form newsgroup)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4218
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4219 (defun gnus-folder-save-name (newsgroup headers &optional last-folder)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4220 "Generate folder name from NEWSGROUP, HEADERS, and optional LAST-FOLDER.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4221 If variable `gnus-use-long-file-name' is nil, it is +news.group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4222 Otherwise, it is like +news/group."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4223 (or last-folder
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4224 (concat "+"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4225 (if gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4226 newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4227 (gnus-newsgroup-directory-form newsgroup)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4228
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4229 (defun gnus-apply-kill-file ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4230 "Apply KILL file to the current newsgroup."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4231 ;; Apply the global KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4232 (load (gnus-newsgroup-kill-file nil) t nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4233 ;; And then apply the local KILL file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4234 (load (gnus-newsgroup-kill-file gnus-newsgroup-name) t nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4235
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4236 (defun gnus-Newsgroup-kill-file (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4237 "Return the name of a KILL file of NEWSGROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4238 If NEWSGROUP is nil, return the global KILL file instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4239 (cond ((or (null newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4240 (string-equal newsgroup ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4241 ;; The global KILL file is placed at top of the directory.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4242 (expand-file-name gnus-kill-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4243 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4244 (gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4245 ;; Append ".KILL" to capitalized newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4246 (expand-file-name (concat (capitalize newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4247 "." gnus-kill-file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4248 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4249 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4250 ;; Place "KILL" under the hierarchical directory.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4251 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4252 "/" gnus-kill-file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4253 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4254 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4255
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4256 (defun gnus-newsgroup-kill-file (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4257 "Return the name of a KILL file of NEWSGROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4258 If NEWSGROUP is nil, return the global KILL file instead."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4259 (cond ((or (null newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4260 (string-equal newsgroup ""))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4261 ;; The global KILL file is placed at top of the directory.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4262 (expand-file-name gnus-kill-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4263 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4264 (gnus-use-long-file-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4265 ;; Append ".KILL" to newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4266 (expand-file-name (concat newsgroup "." gnus-kill-file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4267 (or gnus-article-save-directory "~/News")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4268 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4269 ;; Place "KILL" under the hierarchical directory.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4270 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4271 "/" 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 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4274
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4275 (defun gnus-newsgroup-directory-form (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4276 "Make hierarchical directory name from NEWSGROUP name."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4277 (let ((newsgroup (substring newsgroup 0)) ;Copy string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4278 (len (length newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4279 (idx 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4280 ;; Replace all occurence of `.' with `/'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4281 (while (< idx len)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4282 (if (= (aref newsgroup idx) ?.)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4283 (aset newsgroup idx ?/))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4284 (setq idx (1+ idx)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4285 newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4286 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4287
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4288 (defun gnus-make-directory (directory)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4289 "Make DIRECTORY recursively."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4290 (let ((directory (expand-file-name directory default-directory)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4291 (or (file-exists-p directory)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4292 (gnus-make-directory-1 "" directory))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4293 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4294
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4295 (defun gnus-make-directory-1 (head tail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4296 (cond ((string-match "^/\\([^/]+\\)" tail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4297 (setq head
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4298 (concat (file-name-as-directory head)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4299 (substring tail (match-beginning 1) (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4300 (or (file-exists-p head)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4301 (call-process "mkdir" nil nil nil head))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4302 (gnus-make-directory-1 head (substring tail (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4303 ((string-equal tail "") t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4304 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4305
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4306 (defun gnus-simplify-subject (subject &optional re-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4307 "Remove `Re:' and words in parentheses.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4308 If optional argument RE-ONLY is non-nil, strip `Re:' only."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4309 (let ((case-fold-search t)) ;Ignore case.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4310 ;; Remove `Re:' and `Re^N:'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4311 (if (string-match "\\`\\(re\\(\\^[0-9]+\\)?:[ \t]+\\)+" subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4312 (setq subject (substring subject (match-end 0))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4313 ;; Remove words in parentheses from end.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4314 (or re-only
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4315 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4316 (setq subject (substring subject 0 (match-beginning 0)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4317 ;; Return subject string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4318 subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4319 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4320
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4321 (defun gnus-optional-lines-and-from (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4322 "Return a string like `NNN:AUTHOR' from HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4323 (let ((name-length (length "umerin@photon")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4324 (substring (format "%3d:%s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4325 ;; Lines of the article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4326 ;; Suggested by dana@bellcore.com.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4327 (nntp-header-lines header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4328 ;; Its author.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4329 (concat (mail-strip-quoted-names
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4330 (nntp-header-from header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4331 (make-string name-length ? )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4332 ;; 4 stands for length of `NNN:'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4333 0 (+ 4 name-length))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4334
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4335 (defun gnus-optional-lines (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4336 "Return a string like `NNN' from HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4337 (format "%4d" (nntp-header-lines header)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4338
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4339 (defun gnus-sort-headers (predicate &optional reverse)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4340 "Sort current group headers by PREDICATE safely.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4341 *Safely* means C-g quitting is disabled during sorting.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4342 Optional argument REVERSE means reverse order."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4343 (let ((inhibit-quit t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4344 (setq gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4345 (if reverse
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4346 (nreverse (sort (nreverse gnus-newsgroup-headers) predicate))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4347 (sort gnus-newsgroup-headers predicate)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4348 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4349
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4350 (defun gnus-string-lessp (a b)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4351 "Return T if first arg string is less than second in lexicographic order.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4352 If case-fold-search is non-nil, case of letters is ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4353 (if case-fold-search
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4354 (string-lessp (downcase a) (downcase b)) (string-lessp a b)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4355
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4356 (defun gnus-date-lessp (date1 date2)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4357 "Return T if DATE1 is earlyer than DATE2."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4358 (string-lessp (gnus-comparable-date date1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4359 (gnus-comparable-date date2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4360
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4361 (defun gnus-comparable-date (date)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4362 "Make comparable string by string-lessp from DATE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4363 (let ((month '(("JAN" . " 1")("FEB" . " 2")("MAR" . " 3")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4364 ("APR" . " 4")("MAY" . " 5")("JUN" . " 6")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4365 ("JUL" . " 7")("AUG" . " 8")("SEP" . " 9")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4366 ("OCT" . "10")("NOV" . "11")("DEC" . "12")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4367 (date (or date "")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4368 ;; Can understand the following styles:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4369 ;; (1) 14 Apr 89 03:20:12 GMT
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4370 ;; (2) Fri, 17 Mar 89 4:01:33 GMT
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4371 (if (string-match
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4372 "\\([0-9]+\\) \\([^ ,]+\\) \\([0-9]+\\) \\([0-9:]+\\)" date)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4373 (concat
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4374 ;; Year
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4375 (substring date (match-beginning 3) (match-end 3))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4376 ;; Month
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4377 (cdr
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4378 (assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4379 (upcase (substring date (match-beginning 2) (match-end 2))) month))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4380 ;; Day
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4381 (format "%2d" (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4382 (substring date
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4383 (match-beginning 1) (match-end 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4384 ;; Time
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4385 (substring date (match-beginning 4) (match-end 4)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4386 ;; Cannot understand DATE string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4387 date
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4388 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4389 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4390
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4391 (defun gnus-fetch-field (field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4392 "Return the value of the header FIELD of current article."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4393 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4394 (save-restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4395 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4396 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4397 (narrow-to-region (point-min)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4398 (progn (search-forward "\n\n" nil 'move) (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4399 (mail-fetch-field field))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4400
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4401 (fset 'gnus-expunge 'gnus-Subject-delete-marked-with)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4402
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4403 (defun gnus-kill (field regexp &optional command all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4404 "If FIELD of an article matches REGEXP, execute COMMAND.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4405 Optional third argument COMMAND is default to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4406 (gnus-Subject-mark-as-read nil \"X\").
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4407 If optional fourth argument ALL is non-nil, articles marked are also applied
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4408 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
4409 COMMAND must be a lisp expression or a string representing a key sequence."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4410 ;; We don't want to change current point nor window configuration.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4411 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4412 (save-window-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4413 ;; Selected window must be Subject mode buffer to execute
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4414 ;; keyboard macros correctly. See command_loop_1.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4415 (switch-to-buffer gnus-Subject-buffer 'norecord)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4416 (goto-char (point-min)) ;From the beginning.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4417 (if (null command)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4418 (setq command '(gnus-Subject-mark-as-read nil "X")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4419 (gnus-execute field regexp command nil (not all))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4420 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4421
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4422 (defun gnus-execute (field regexp form &optional backward ignore-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4423 "If FIELD of article header matches REGEXP, execute lisp FORM (or a string).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4424 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
4425 If optional fifth argument BACKWARD is non-nil, do backward instead.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4426 If optional sixth argument IGNORE-MARKED is non-nil, articles which are
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4427 marked as read or unread are ignored."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4428 (let ((function nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4429 (header nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4430 (article nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4431 (if (string-equal field "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4432 (setq field nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4433 (if (null field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4434 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4435 (or (stringp field)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4436 (setq field (symbol-name field)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4437 ;; Get access function of header filed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4438 (setq function (intern-soft (concat "gnus-header-" (downcase field))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4439 (if (and function (fboundp function))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4440 (setq function (symbol-function function))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4441 (error "Unknown header field: \"%s\"" field)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4442 ;; Make FORM funcallable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4443 (if (and (listp form) (not (eq (car form) 'lambda)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4444 (setq form (list 'lambda nil form)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4445 ;; Starting from the current article.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4446 (or (and ignore-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4447 ;; Articles marked as read and unread should be ignored.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4448 (setq article (gnus-Subject-article-number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4449 (or (not (memq article gnus-newsgroup-unreads)) ;Marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4450 (memq article gnus-newsgroup-marked) ;Marked as unread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4451 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4452 (gnus-execute-1 function regexp form))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4453 (while (gnus-Subject-search-subject backward ignore-marked nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4454 (gnus-execute-1 function regexp form))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4455 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4456
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4457 (defun gnus-execute-1 (function regexp form)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4458 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4459 ;; The point of Subject mode buffer must be saved during execution.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4460 (let ((article (gnus-Subject-article-number)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4461 (if (null article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4462 nil ;Nothing to do.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4463 (if function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4464 ;; Compare with header field.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4465 (let ((header (gnus-find-header-by-number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4466 gnus-newsgroup-headers article))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4467 (value nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4468 (and header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4469 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4470 (setq value (funcall function header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4471 ;; Number (Lines:) or symbol must be converted to string.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4472 (or (stringp value)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4473 (setq value (prin1-to-string value)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4474 (string-match regexp value))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4475 (if (stringp form) ;Keyboard macro.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4476 (execute-kbd-macro form)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4477 (funcall form))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4478 ;; Search article body.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4479 (let ((gnus-current-article nil) ;Save article pointer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4480 (gnus-last-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4481 (gnus-break-pages nil) ;No need to break pages.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4482 (gnus-Mark-article-hook nil)) ;Inhibit marking as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4483 (message "Searching for article: %d..." article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4484 (gnus-Article-setup-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4485 (gnus-Article-prepare article t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4486 (if (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4487 (set-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4488 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4489 (re-search-forward regexp nil t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4490 (if (stringp form) ;Keyboard macro.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4491 (execute-kbd-macro form)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4492 (funcall form))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4493 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4494 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4495
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4496 ;;; caesar-region written by phr@prep.ai.mit.edu Nov 86
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4497 ;;; modified by tower@prep Nov 86
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4498 ;;; Modified by umerin@flab.flab.Fujitsu.JUNET for ROT47.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4499
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4500 (defun gnus-caesar-region (&optional n)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4501 "Caesar rotation of region by N, default 13, for decrypting netnews.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4502 ROT47 will be performed for Japanese text in any case."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4503 (interactive (if current-prefix-arg ; Was there a prefix arg?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4504 (list (prefix-numeric-value current-prefix-arg))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4505 (list nil)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4506 (cond ((not (numberp n)) (setq n 13))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4507 ((< n 0) (setq n (- 26 (% (- n) 26))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4508 (t (setq n (% n 26)))) ;canonicalize N
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4509 (if (not (zerop n)) ; no action needed for a rot of 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4510 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4511 (if (or (not (boundp 'caesar-translate-table))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4512 (/= (aref caesar-translate-table ?a) (+ ?a n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4513 (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4514 (message "Building caesar-translate-table...")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4515 (setq caesar-translate-table (make-vector 256 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4516 (while (< i 256)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4517 (aset caesar-translate-table i i)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4518 (setq i (1+ i)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4519 (setq lower (concat lower lower) upper (upcase lower) i 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4520 (while (< i 26)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4521 (aset caesar-translate-table (+ ?a i) (aref lower (+ i n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4522 (aset caesar-translate-table (+ ?A i) (aref upper (+ i n)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4523 (setq i (1+ i)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4524 ;; ROT47 for Japanese text.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4525 ;; Thanks to ichikawa@flab.fujitsu.junet.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4526 (setq i 161)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4527 (let ((t1 (logior ?O 128))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4528 (t2 (logior ?! 128))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4529 (t3 (logior ?~ 128)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4530 (while (< i 256)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4531 (aset caesar-translate-table i
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4532 (let ((v (aref caesar-translate-table i)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4533 (if (<= v t1) (if (< v t2) v (+ v 47))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4534 (if (<= v t3) (- v 47) v))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4535 (setq i (1+ i))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4536 (message "Building caesar-translate-table... done")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4537 (let ((from (region-beginning))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4538 (to (region-end))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4539 (i 0) str len)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4540 (setq str (buffer-substring from to))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4541 (setq len (length str))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4542 (while (< i len)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4543 (aset str i (aref caesar-translate-table (aref str i)))
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 (goto-char from)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4546 (delete-region from to)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4547 (insert str)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4548
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4549 ;; Functions accessing headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4550 ;; Functions are more convenient than macros in some case.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4551
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4552 (defun gnus-header-number (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4553 "Return article number in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4554 (nntp-header-number header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4555
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4556 (defun gnus-header-subject (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4557 "Return subject string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4558 (nntp-header-subject header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4559
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4560 (defun gnus-header-from (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4561 "Return author string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4562 (nntp-header-from header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4563
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4564 (defun gnus-header-xref (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4565 "Return xref string in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4566 (nntp-header-xref header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4567
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4568 (defun gnus-header-lines (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4569 "Return lines in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4570 (nntp-header-lines header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4571
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4572 (defun gnus-header-date (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4573 "Return date in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4574 (nntp-header-date header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4575
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4576 (defun gnus-header-id (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4577 "Return Id in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4578 (nntp-header-id header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4579
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4580 (defun gnus-header-references (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4581 "Return references in HEADER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4582 (nntp-header-references header))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4583
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4584
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4585 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4586 ;;; Article savers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4587 ;;;
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-output-to-rmail (file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4590 "Append the current article to an Rmail file named FILE-NAME."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4591 (require 'rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4592 ;; Most of these codes are borrowed from rmailout.el.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4593 (setq file-name (expand-file-name file-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4594 (setq rmail-last-rmail-file file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4595 (let ((artbuf (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4596 (tmpbuf (get-buffer-create " *GNUS-output*")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4597 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4598 (or (get-file-buffer file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4599 (file-exists-p file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4600 (if (yes-or-no-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4601 (concat "\"" file-name "\" does not exist, create it? "))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4602 (let ((file-buffer (create-file-buffer file-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4603 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4604 (set-buffer file-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4605 (rmail-insert-rmail-file-header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4606 (let ((require-final-newline nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4607 (write-region (point-min) (point-max) file-name t 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4608 (kill-buffer file-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4609 (error "Output file does not exist")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4610 (set-buffer tmpbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4611 (buffer-flush-undo (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4612 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4613 (insert-buffer-substring artbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4614 (gnus-convert-article-to-rmail)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4615 ;; Decide whether to append to a file or to an Emacs buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4616 (let ((outbuf (get-file-buffer file-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4617 (if (not outbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4618 (append-to-file (point-min) (point-max) file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4619 ;; File has been visited, in buffer OUTBUF.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4620 (set-buffer outbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4621 (let ((buffer-read-only nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4622 (msg (and (boundp 'rmail-current-message)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4623 rmail-current-message)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4624 ;; If MSG is non-nil, buffer is in RMAIL mode.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4625 (if msg
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4626 (progn (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4627 (narrow-to-region (point-max) (point-max))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4628 (insert-buffer-substring tmpbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4629 (if msg
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4630 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4631 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4632 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4633 (search-backward "\^_")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4634 (narrow-to-region (point) (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4635 (goto-char (1+ (point-min)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4636 (rmail-count-new-messages t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4637 (rmail-show-message msg))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4638 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4639 (kill-buffer tmpbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4640 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4641
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4642 (defun gnus-output-to-file (file-name)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4643 "Append the current article to a file named FILE-NAME."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4644 (setq file-name (expand-file-name file-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4645 (let ((artbuf (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4646 (tmpbuf (get-buffer-create " *GNUS-output*")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4647 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4648 (set-buffer tmpbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4649 (buffer-flush-undo (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4650 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4651 (insert-buffer-substring artbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4652 ;; Append newline at end of the buffer as separator, and then
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4653 ;; save it to file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4654 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4655 (insert "\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4656 (append-to-file (point-min) (point-max) file-name))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4657 (kill-buffer tmpbuf)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4658 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4659
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4660 (defun gnus-convert-article-to-rmail ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4661 "Convert article in current buffer to Rmail message format."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4662 (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4663 ;; Convert article directly into Babyl format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4664 ;; Suggested by Rob Austein <sra@lcs.mit.edu>
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4665 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4666 (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4667 (while (search-forward "\n\^_" nil t) ;single char
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4668 (replace-match "\n^_")) ;2 chars: "^" and "_"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4669 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4670 (insert "\^_")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4671
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4672 ;;(defun gnus-convert-article-to-rmail ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4673 ;; "Convert article in current buffer to Rmail message format."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4674 ;; (let ((buffer-read-only nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4675 ;; ;; Insert special header of Unix mail.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4676 ;; (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4677 ;; (insert "From "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4678 ;; (or (mail-strip-quoted-names (mail-fetch-field "from"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4679 ;; "unknown")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4680 ;; " " (current-time-string) "\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4681 ;; ;; Stop quoting `From' since this seems unnecessary in most cases.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4682 ;; ;; ``Quote'' "\nFrom " as "\n>From "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4683 ;; ;;(while (search-forward "\nFrom " nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4684 ;; ;; (forward-char -5)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4685 ;; ;; (insert ?>))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4686 ;; ;; Convert article to babyl format.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4687 ;; (rmail-convert-to-babyl-format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4688 ;; ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4689
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4690
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4691 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4692 ;;; Internal functions.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4693 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4694
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4695 (defun gnus-start-news-server (&optional confirm)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4696 "Open network stream to remote NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4697 If optional argument CONFIRM is non-nil, ask you host that NNTP server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4698 is running even if it is defined.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4699 Run gnus-Open-server-hook just before opening news server."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4700 (if (gnus-server-opened)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4701 ;; Stream is already opened.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4702 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4703 ;; Open NNTP server.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4704 (if (or confirm
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4705 (null gnus-nntp-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4706 (if (and (boundp 'gnus-secondary-servers) gnus-secondary-servers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4707 ;; Read server name with completion.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4708 (setq gnus-nntp-server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4709 (completing-read "NNTP server: "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4710 (cons (list gnus-nntp-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4711 gnus-secondary-servers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4712 nil nil gnus-nntp-server))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4713 (setq gnus-nntp-server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4714 (read-string "NNTP server: " gnus-nntp-server))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4715 ;; If no server name is given, local host is assumed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4716 (if (string-equal gnus-nntp-server "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4717 (setq gnus-nntp-server (system-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4718 (cond ((string-match ":" gnus-nntp-server)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4719 ;; :DIRECTORY
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4720 (require 'mhspool)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4721 (gnus-define-access-method 'mhspool)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4722 (message "Looking up private directory..."))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4723 ((and (null gnus-nntp-service)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4724 (string-equal gnus-nntp-server (system-name)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4725 (require 'nnspool)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4726 (gnus-define-access-method 'nnspool)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4727 (message "Looking up local news spool..."))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4728 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4729 (gnus-define-access-method 'nntp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4730 (message "Connecting to NNTP server on %s..." gnus-nntp-server)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4731 (run-hooks 'gnus-Open-server-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4732 (cond ((gnus-open-server gnus-nntp-server gnus-nntp-service))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4733 ((and (stringp (gnus-status-message))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4734 (> (length (gnus-status-message)) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4735 ;; Show valuable message if available.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4736 (error (gnus-status-message)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4737 (t (error "Cannot open NNTP server on %s" gnus-nntp-server)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4738 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4739
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4740 ;; Dummy functions used only once. Should return nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4741 (defun gnus-server-opened () nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4742 (defun gnus-close-server () nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4743
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4744 (defun gnus-define-access-method (method &optional access-methods)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4745 "Define access functions for the access METHOD.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4746 Methods defintion is taken from optional argument ACCESS-METHODS or
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4747 the variable gnus-access-methods."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4748 (let ((bindings
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4749 (cdr (assoc method (or access-methods gnus-access-methods)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4750 (if (null bindings)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4751 (error "Unknown access method: %s" method)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4752 ;; Should not use symbol-function here since overload does not work.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4753 (while bindings
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4754 (fset (car (car bindings)) (cdr (car bindings)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4755 (setq bindings (cdr bindings)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4756 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4757
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4758 (defun gnus-select-newsgroup (group &optional show-all)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4759 "Select newsgroup GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4760 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
4761 are selected."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4762 (if (gnus-request-group group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4763 (let ((articles nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4764 (setq gnus-newsgroup-name group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4765 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4766 (gnus-uncompress-sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4767 (nthcdr 2 (gnus-gethash group gnus-unread-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4768 (cond (show-all
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4769 ;; Select all active articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4770 (setq articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4771 (gnus-uncompress-sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4772 (nthcdr 2 (gnus-gethash group gnus-active-hashtb)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4773 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4774 ;; Select unread articles only.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4775 (setq articles gnus-newsgroup-unreads)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4776 ;; Require confirmation if selecting large newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4777 (setq gnus-newsgroup-unselected nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4778 (if (not (numberp gnus-large-newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4779 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4780 (let ((selected nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4781 (number (length articles)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4782 (if (> number gnus-large-newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4783 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4784 (condition-case ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4785 (let ((input
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4786 (read-string
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4787 (format
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4788 "How many articles from %s (default %d): "
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4789 gnus-newsgroup-name number))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4790 (setq selected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4791 (if (string-equal input "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4792 number (string-to-int input))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4793 (quit
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4794 (setq selected 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4795 (cond ((and (> selected 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4796 (< selected number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4797 ;; Select last N articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4798 (setq articles (nthcdr (- number selected) articles)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4799 ((and (< selected 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4800 (< (- 0 selected) number))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4801 ;; Select first N articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4802 (setq selected (- 0 selected))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4803 (setq articles (copy-sequence articles))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4804 (setcdr (nthcdr (1- selected) articles) nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4805 ((zerop selected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4806 (setq articles nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4807 ;; Otherwise select all.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4808 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4809 ;; Get unselected unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4810 (setq gnus-newsgroup-unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4811 (gnus-set-difference gnus-newsgroup-unreads articles))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4812 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4813 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4814 ;; Get headers list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4815 (setq gnus-newsgroup-headers (gnus-retrieve-headers articles))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4816 ;; UNREADS may contain expired articles, so we have to remove
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4817 ;; them from the list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4818 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4819 (gnus-intersection gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4820 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4821 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4822 (lambda (header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4823 (nntp-header-number header)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4824 gnus-newsgroup-headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4825 ;; Marked article must be a subset of unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4826 (setq gnus-newsgroup-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4827 (gnus-intersection (append gnus-newsgroup-unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4828 gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4829 (cdr (assoc group gnus-marked-assoc))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4830 ;; First and last article in this newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4831 (setq gnus-newsgroup-begin
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4832 (if gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4833 (nntp-header-number (car gnus-newsgroup-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4834 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4835 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4836 (setq gnus-newsgroup-end
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4837 (if gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4838 (nntp-header-number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4839 (gnus-last-element gnus-newsgroup-headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4840 0
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4841 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4842 ;; File name that an article was saved last.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4843 (setq gnus-newsgroup-last-rmail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4844 (setq gnus-newsgroup-last-mail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4845 (setq gnus-newsgroup-last-folder nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4846 (setq gnus-newsgroup-last-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4847 ;; Reset article pointer etc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4848 (setq gnus-current-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4849 (setq gnus-current-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4850 (setq gnus-current-history nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4851 (setq gnus-have-all-headers nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4852 (setq gnus-last-article nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4853 ;; GROUP is successfully selected.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4854 t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4855 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4856 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4857
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4858 (defun gnus-more-header-backward ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4859 "Find new header backward."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4860 (let ((first
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4861 (car (nth 2 (gnus-gethash gnus-newsgroup-name gnus-active-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4862 (artnum gnus-newsgroup-begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4863 (header nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4864 (while (and (not header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4865 (> artnum first))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4866 (setq artnum (1- artnum))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4867 (setq header (car (gnus-retrieve-headers (list artnum)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4868 header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4869 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4870
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4871 (defun gnus-more-header-forward ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4872 "Find new header forward."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4873 (let ((last
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4874 (cdr (nth 2 (gnus-gethash gnus-newsgroup-name gnus-active-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4875 (artnum gnus-newsgroup-end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4876 (header nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4877 (while (and (not header)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4878 (< artnum last))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4879 (setq artnum (1+ artnum))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4880 (setq header (car (gnus-retrieve-headers (list artnum)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4881 header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4882 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4883
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4884 (defun gnus-extend-newsgroup (header &optional backward)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4885 "Extend newsgroup selection with HEADER.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4886 Optional argument BACKWARD means extend toward backward."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4887 (if header
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4888 (let ((artnum (nntp-header-number header)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4889 (setq gnus-newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4890 (if backward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4891 (cons header gnus-newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4892 (append gnus-newsgroup-headers (list header))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4893 ;; We have to update unreads and unselected, but don't have to
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4894 ;; care about gnus-newsgroup-marked.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4895 (if (memq artnum gnus-newsgroup-unselected)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4896 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4897 (cons artnum gnus-newsgroup-unreads)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4898 (setq gnus-newsgroup-unselected
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4899 (delq artnum gnus-newsgroup-unselected))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4900 (setq gnus-newsgroup-begin (min gnus-newsgroup-begin artnum))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4901 (setq gnus-newsgroup-end (max gnus-newsgroup-end artnum))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4902 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4903
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4904 (defun gnus-mark-article-as-read (article)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4905 "Remember that ARTICLE is marked as read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4906 ;; Remove from unread and marked list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4907 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4908 (delq article gnus-newsgroup-unreads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4909 (setq gnus-newsgroup-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4910 (delq article gnus-newsgroup-marked)))
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-unread (article &optional clear-mark)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4913 "Remember that ARTICLE is marked as unread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4914 Optional argument CLEAR-MARK means ARTICLE should not be remembered
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4915 that it was marked as read once."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4916 ;; Add to unread list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4917 (or (memq article gnus-newsgroup-unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4918 (setq gnus-newsgroup-unreads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4919 (cons article gnus-newsgroup-unreads)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4920 ;; If CLEAR-MARK is non-nil, the article must be removed from marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4921 ;; list. Otherwise, it must be added to the list.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4922 (if clear-mark
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4923 (setq gnus-newsgroup-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4924 (delq article gnus-newsgroup-marked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4925 (or (memq article gnus-newsgroup-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4926 (setq gnus-newsgroup-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4927 (cons article gnus-newsgroup-marked)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4928
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4929 (defun gnus-clear-system ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4930 "Clear all variables and buffer."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4931 ;; Clear GNUS variables.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4932 (let ((variables gnus-variable-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4933 (while variables
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4934 (set (car variables) nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4935 (setq variables (cdr variables))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4936 ;; Clear other internal variables.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4937 (setq gnus-active-hashtb nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4938 (setq gnus-unread-hashtb nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4939 ;; Kill the startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4940 (and gnus-current-startup-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4941 (get-file-buffer gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4942 (kill-buffer (get-file-buffer gnus-current-startup-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4943 (setq gnus-current-startup-file nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4944 ;; Kill GNUS buffers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4945 (let ((buffers gnus-buffer-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4946 (while buffers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4947 (if (get-buffer (car buffers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4948 (kill-buffer (car buffers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4949 (setq buffers (cdr buffers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4950 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4951
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4952 (defun gnus-configure-windows (action)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4953 "Configure GNUS windows according to the next ACTION.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4954 The ACTION is either a symbol, such as `SelectNewsgroup', or a
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4955 configuration list such as `(1 1 2)'. If ACTION is not a list,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4956 configuration list is got from the variable gnus-window-configuration."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4957 (let* ((windows
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4958 (if (listp action)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4959 action (car (cdr (assq action gnus-window-configuration)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4960 (grpwin (get-buffer-window gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4961 (subwin (get-buffer-window gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4962 (artwin (get-buffer-window gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4963 (winsum nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4964 (height nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4965 (grpheight 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4966 (subheight 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4967 (artheight 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4968 (if (or (null windows) ;No configuration is specified.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4969 (and (eq (null grpwin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4970 (zerop (nth 0 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4971 (eq (null subwin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4972 (zerop (nth 1 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4973 (eq (null artwin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4974 (zerop (nth 2 windows)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4975 ;; No need to change window configuration.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4976 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4977 (select-window (or grpwin subwin artwin (selected-window)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4978 ;; First of all, compute the height of each window.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4979 (cond (gnus-use-full-window
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4980 ;; Take up the entire screen.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4981 (delete-other-windows)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4982 (setq height (window-height (selected-window))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4983 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4984 (setq height (+ (if grpwin (window-height grpwin) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4985 (if subwin (window-height subwin) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4986 (if artwin (window-height artwin) 0)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4987 ;; The Newsgroup buffer exits always. So, use it to extend the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4988 ;; Group window so as to get enough window space.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4989 (switch-to-buffer gnus-Group-buffer 'norecord)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4990 (and (get-buffer gnus-Subject-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4991 (delete-windows-on gnus-Subject-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4992 (and (get-buffer gnus-Article-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4993 (delete-windows-on gnus-Article-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4994 ;; Compute expected window height.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4995 (setq winsum (apply (function +) windows))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4996 (if (not (zerop (nth 0 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4997 (setq grpheight (max window-min-height
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4998 (/ (* height (nth 0 windows)) winsum))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4999 (if (not (zerop (nth 1 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5000 (setq subheight (max window-min-height
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5001 (/ (* height (nth 1 windows)) winsum))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5002 (if (not (zerop (nth 2 windows)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5003 (setq artheight (max window-min-height
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5004 (/ (* height (nth 2 windows)) winsum))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5005 (setq height (+ grpheight subheight artheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5006 (enlarge-window (max 0 (- height (window-height (selected-window)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5007 ;; Then split the window.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5008 (and (not (zerop artheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5009 (or (not (zerop grpheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5010 (not (zerop subheight)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5011 (split-window-vertically (+ grpheight subheight)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5012 (and (not (zerop grpheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5013 (not (zerop subheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5014 (split-window-vertically grpheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5015 ;; Then select buffers in each window.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5016 (and (not (zerop grpheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5017 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5018 (switch-to-buffer gnus-Group-buffer 'norecord)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5019 (other-window 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5020 (and (not (zerop subheight))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5021 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5022 (switch-to-buffer gnus-Subject-buffer 'norecord)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5023 (other-window 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5024 (and (not (zerop artheight))
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 ;; If Article buffer does not exist, it will be created
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5027 ;; and initialized.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5028 (gnus-Article-setup-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5029 (switch-to-buffer gnus-Article-buffer 'norecord)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5030 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5031 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5032
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5033 (defun gnus-find-header-by-number (headers number)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5034 "Return a header which is a element of HEADERS and has NUMBER."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5035 (let ((found nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5036 (while (and headers (not found))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5037 ;; We cannot use `=' to accept non-numeric NUMBER.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5038 (if (eq number (nntp-header-number (car headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5039 (setq found (car headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5040 (setq headers (cdr headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5041 found
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5042 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5043
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5044 (defun gnus-find-header-by-id (headers id)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5045 "Return a header which is a element of HEADERS and has Message-ID."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5046 (let ((found nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5047 (while (and headers (not found))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5048 (if (string-equal id (nntp-header-id (car headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5049 (setq found (car headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5050 (setq headers (cdr headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5051 found
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5052 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5053
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5054 (defun gnus-version ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5055 "Version numbers of this version of GNUS."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5056 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5057 (cond ((and (boundp 'mhspool-version) (boundp 'nnspool-version))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5058 (message "%s; %s; %s; %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5059 gnus-version nntp-version nnspool-version mhspool-version))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5060 ((boundp 'mhspool-version)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5061 (message "%s; %s; %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5062 gnus-version nntp-version mhspool-version))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5063 ((boundp 'nnspool-version)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5064 (message "%s; %s; %s"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5065 gnus-version nntp-version nnspool-version))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5066 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5067 (message "%s; %s" gnus-version nntp-version))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5068
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5069 (defun gnus-Info-find-node ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5070 "Find Info documentation of GNUS."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5071 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5072 (require 'info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5073 ;; Enlarge info window if needed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5074 (cond ((eq major-mode 'gnus-Group-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5075 (gnus-configure-windows '(1 0 0)) ;Take all windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5076 (pop-to-buffer gnus-Group-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5077 ((eq major-mode 'gnus-Subject-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5078 (gnus-configure-windows '(0 1 0)) ;Take all windows.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5079 (pop-to-buffer gnus-Subject-buffer)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5080 (Info-goto-node (cdr (assq major-mode gnus-Info-nodes))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5081
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5082 (defun gnus-overload-functions (&optional overloads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5083 "Overload functions specified by optional argument OVERLOADS.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5084 If nothing is specified, use the variable gnus-overload-functions."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5085 (let ((defs nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5086 (overloads (or overloads gnus-overload-functions)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5087 (while overloads
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5088 (setq defs (car overloads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5089 (setq overloads (cdr overloads))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5090 ;; Load file before overloading function if necessary. Make
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5091 ;; sure we cannot use `requre' always.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5092 (and (not (fboundp (car defs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5093 (car (cdr (cdr defs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5094 (load (car (cdr (cdr defs))) nil 'nomessage))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5095 (fset (car defs) (car (cdr defs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5096 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5097
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5098 (defun gnus-make-threads (newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5099 "Make conversation threads tree from NEWSGROUP-HEADERS."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5100 (let ((headers newsgroup-headers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5101 (h nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5102 (d nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5103 (roots nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5104 (dependencies nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5105 ;; Make message dependency alist.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5106 (while headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5107 (setq h (car headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5108 (setq headers (cdr headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5109 ;; Ignore invalid headers.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5110 (if (vectorp h) ;Depends on nntp.el.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5111 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5112 ;; Ignore broken references, e.g "<123@a.b.c".
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5113 (setq d (and (nntp-header-references h)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5114 (string-match "\\(<[^<>]+>\\)[^>]*$"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5115 (nntp-header-references h))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5116 (gnus-find-header-by-id
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5117 newsgroup-headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5118 (substring (nntp-header-references h)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5119 (match-beginning 1) (match-end 1)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5120 ;; Check subject equality.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5121 (or gnus-thread-ignore-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5122 (null d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5123 (string-equal (gnus-simplify-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5124 (nntp-header-subject h) 're)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5125 (gnus-simplify-subject
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5126 (nntp-header-subject d) 're))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5127 ;; H should be a thread root.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5128 (setq d nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5129 ;; H depends on D.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5130 (setq dependencies
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5131 (cons (cons h d) dependencies))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5132 ;; H is a thread root.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5133 (if (null d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5134 (setq roots (cons h roots)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5135 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5136 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5137 ;; Make complete threads from the roots.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5138 ;; Note: dependencies are in reverse order, but
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5139 ;; gnus-make-threads-1 processes it in reverse order again. So,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5140 ;; we don't have to worry about it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5141 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5142 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5143 (lambda (root)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5144 (gnus-make-threads-1 root dependencies))) (nreverse roots))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5145 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5146
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5147 (defun gnus-make-threads-1 (parent dependencies)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5148 (let ((children nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5149 (d nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5150 (depends dependencies))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5151 ;; Find children.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5152 (while depends
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5153 (setq d (car depends))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5154 (setq depends (cdr depends))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5155 (and (cdr d)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5156 (eq (nntp-header-id parent) (nntp-header-id (cdr d)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5157 (setq children (cons (car d) children))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5158 ;; Go down.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5159 (cons parent
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5160 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5161 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5162 (lambda (child)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5163 (gnus-make-threads-1 child dependencies))) children))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5164 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5165
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5166 (defun gnus-narrow-to-page (&optional arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5167 "Make text outside current page invisible except for page delimiter.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5168 A numeric arg specifies to move forward or backward by that many pages,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5169 thus showing a page other than the one point was originally in."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5170 (interactive "P")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5171 (setq arg (if arg (prefix-numeric-value arg) 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5172 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5173 (forward-page -1) ;Beginning of current page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5174 (widen)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5175 (if (> arg 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5176 (forward-page arg)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5177 (if (< arg 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5178 (forward-page (1- arg))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5179 ;; Find the end of the page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5180 (forward-page)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5181 ;; If we stopped due to end of buffer, stay there.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5182 ;; If we stopped after a page delimiter, put end of restriction
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5183 ;; at the beginning of that line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5184 ;; These are commented out.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5185 ;; (if (save-excursion (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5186 ;; (looking-at page-delimiter))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5187 ;; (beginning-of-line))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5188 (narrow-to-region (point)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5189 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5190 ;; Find the top of the page.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5191 (forward-page -1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5192 ;; If we found beginning of buffer, stay there.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5193 ;; If extra text follows page delimiter on same line,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5194 ;; include it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5195 ;; Otherwise, show text starting with following line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5196 (if (and (eolp) (not (bobp)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5197 (forward-line 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5198 (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5199 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5200
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5201 (defun gnus-last-element (list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5202 "Return last element of LIST."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5203 (let ((last nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5204 (while list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5205 (if (null (cdr list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5206 (setq last (car list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5207 (setq list (cdr list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5208 last
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5209 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5210
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5211 (defun gnus-set-difference (list1 list2)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5212 "Return a list of elements of LIST1 that do not appear in LIST2."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5213 (let ((list1 (copy-sequence list1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5214 (while list2
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5215 (setq list1 (delq (car list2) list1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5216 (setq list2 (cdr list2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5217 list1
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5218 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5219
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5220 (defun gnus-intersection (list1 list2)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5221 "Return a list of elements that appear in both LIST1 and LIST2."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5222 (let ((result nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5223 (while list2
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5224 (if (memq (car list2) list1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5225 (setq result (cons (car list2) result)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5226 (setq list2 (cdr list2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5227 result
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5228 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5229
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5230
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5231 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5232 ;;; Get information about active articles, already read articles, and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5233 ;;; still unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5234 ;;;
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5235
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5236 ;; GNUS internal format of gnus-newsrc-assoc and gnus-killed-assoc:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5237 ;; (("general" t (1 . 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5238 ;; ("misc" t (1 . 10) (12 . 15))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5239 ;; ("test" nil (1 . 99)) ...)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5240 ;; GNUS internal format of gnus-marked-assoc:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5241 ;; (("general" 1 2 3)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5242 ;; ("misc" 2) ...)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5243 ;; GNUS internal format of gnus-active-hashtb:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5244 ;; (("general" t (1 . 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5245 ;; ("misc" t (1 . 10))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5246 ;; ("test" nil (1 . 99)) ...)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5247 ;; GNUS internal format of gnus-unread-hashtb:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5248 ;; (("general" 1 (1 . 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5249 ;; ("misc" 14 (1 . 10) (12 . 15))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5250 ;; ("test" 99 (1 . 99)) ...)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5251
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5252 (defun gnus-setup-news-info (&optional rawfile)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5253 "Setup news information.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5254 If optional argument RAWFILE is non-nil, force to read raw startup file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5255 (let ((init (not (and gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5256 gnus-active-hashtb
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5257 gnus-unread-hashtb
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5258 (not rawfile)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5259 ))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5260 ;; We have to clear some variables to re-initialize news info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5261 (if init
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5262 (setq gnus-newsrc-assoc nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5263 gnus-active-hashtb nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5264 gnus-unread-hashtb nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5265 (if init
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5266 (gnus-read-newsrc-file rawfile))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5267 (gnus-read-active-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5268 (gnus-expire-marked-articles)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5269 (gnus-get-unread-articles)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5270 ;; Check new newsgroups and subscribe them.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5271 (if init
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5272 (let ((new-newsgroups (gnus-find-new-newsgroups)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5273 (while new-newsgroups
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5274 (funcall gnus-subscribe-newsgroup-method (car new-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5275 (setq new-newsgroups (cdr new-newsgroups))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5276 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5277 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5278
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5279 (defun gnus-subscribe-newsgroup (newsgroup &optional next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5280 "Subscribe new NEWSGROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5281 If optional argument NEXT is non-nil, it is inserted before NEXT."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5282 (gnus-insert-newsgroup (list newsgroup t) next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5283 (message "Newsgroup %s is subscribed" newsgroup))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5284
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5285 (defun gnus-add-newsgroup (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5286 "Subscribe new NEWSGROUP safely and put it at top."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5287 (and (null (assoc newsgroup gnus-newsrc-assoc)) ;Really new?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5288 (gnus-gethash newsgroup gnus-active-hashtb) ;Really exist?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5289 (gnus-insert-newsgroup (or (assoc newsgroup gnus-killed-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5290 (list newsgroup t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5291 (car (car gnus-newsrc-assoc)))))
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-find-new-newsgroups ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5294 "Looking for new newsgroups and return names.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5295 `-n' option of options line in .newsrc file is recognized."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5296 (let ((group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5297 (new-newsgroups nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5298 (mapatoms
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5299 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5300 (lambda (sym)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5301 (setq group (symbol-name sym))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5302 ;; Taking account of `-n' option.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5303 (and (or (null gnus-newsrc-options-n-no)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5304 (not (string-match gnus-newsrc-options-n-no group))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5305 (and gnus-newsrc-options-n-yes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5306 (string-match gnus-newsrc-options-n-yes group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5307 (null (assoc group gnus-killed-assoc)) ;Ignore killed.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5308 (null (assoc group gnus-newsrc-assoc)) ;Really new.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5309 ;; Find new newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5310 (setq new-newsgroups
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5311 (cons group new-newsgroups)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5312 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5313 gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5314 ;; Return new newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5315 new-newsgroups
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5316 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5317
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5318 (defun gnus-kill-newsgroup (group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5319 "Kill GROUP from gnus-newsrc-assoc, .newsrc and gnus-unread-hashtb."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5320 (let ((info (assoc group gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5321 (if (null info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5322 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5323 ;; Delete from gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5324 (setq gnus-newsrc-assoc (delq info gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5325 ;; Add to gnus-killed-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5326 (setq gnus-killed-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5327 (cons info
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5328 (delq (assoc group gnus-killed-assoc) gnus-killed-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5329 ;; Clear unread hashtable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5330 ;; Thanks cwitty@csli.Stanford.EDU (Carl Witty).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5331 (gnus-sethash group nil gnus-unread-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5332 ;; Then delete from .newsrc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5333 (gnus-update-newsrc-buffer group 'delete)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5334 ;; Return the deleted newsrc entry.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5335 info
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5336 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5337
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5338 (defun gnus-insert-newsgroup (info &optional next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5339 "Insert newsrc INFO entry before NEXT.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5340 If optional argument NEXT is nil, appended to the last."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5341 (if (null info)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5342 (error "Invalid argument: %s" info))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5343 (let* ((group (car info)) ;Newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5344 (range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5345 (gnus-difference-of-range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5346 (nth 2 (gnus-gethash group gnus-active-hashtb)) (nthcdr 2 info))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5347 ;; Check duplication.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5348 (if (assoc group gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5349 (error "Duplicated: %s" group))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5350 ;; Insert to gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5351 (if (string-equal next (car (car gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5352 (setq gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5353 (cons info gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5354 (let ((found nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5355 (rest gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5356 (tail (cons nil gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5357 ;; Seach insertion point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5358 (while (and (not found) rest)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5359 (if (string-equal next (car (car rest)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5360 (setq found t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5361 (setq rest (cdr rest))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5362 (setq tail (cdr tail))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5363 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5364 ;; Find it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5365 (setcdr tail nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5366 (setq gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5367 (append gnus-newsrc-assoc (cons info rest)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5368 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5369 ;; Delete from gnus-killed-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5370 (setq gnus-killed-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5371 (delq (assoc group gnus-killed-assoc) gnus-killed-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5372 ;; Then insert to .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5373 (gnus-update-newsrc-buffer group nil next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5374 ;; Add to gnus-unread-hashtb.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5375 (gnus-sethash group
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5376 (cons group ;Newsgroup name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5377 (cons (gnus-number-of-articles range) range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5378 gnus-unread-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5379 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5380
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5381 (defun gnus-check-killed-newsgroups ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5382 "Check consistency between gnus-newsrc-assoc and gnus-killed-assoc."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5383 (let ((group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5384 (new-killed nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5385 (old-killed gnus-killed-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5386 (while old-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5387 (setq group (car (car old-killed)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5388 (and (or (null gnus-newsrc-options-n-no)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5389 (not (string-match gnus-newsrc-options-n-no group))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5390 (and gnus-newsrc-options-n-yes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5391 (string-match gnus-newsrc-options-n-yes group)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5392 (null (assoc group gnus-newsrc-assoc)) ;No duplication.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5393 ;; Subscribed in options line and not in gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5394 (setq new-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5395 (cons (car old-killed) new-killed)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5396 (setq old-killed (cdr old-killed))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5397 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5398 (setq gnus-killed-assoc (nreverse new-killed))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5399 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5400
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5401 (defun gnus-check-bogus-newsgroups (&optional confirm)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5402 "Delete bogus newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5403 If optional argument CONFIRM is non-nil, confirm deletion of newsgroups."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5404 (let ((group nil) ;Newsgroup name temporary used.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5405 (old-newsrc gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5406 (new-newsrc nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5407 (bogus nil) ;List of bogus newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5408 (old-killed gnus-killed-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5409 (new-killed nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5410 (old-marked gnus-marked-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5411 (new-marked nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5412 (message "Checking bogus newsgroups...")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5413 ;; Update gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5414 (while old-newsrc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5415 (setq group (car (car old-newsrc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5416 (if (or (gnus-gethash group gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5417 (and confirm
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5418 (not (y-or-n-p
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5419 (format "Delete bogus newsgroup: %s " group)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5420 ;; Active newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5421 (setq new-newsrc (cons (car old-newsrc) new-newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5422 ;; Found a bogus newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5423 (setq bogus (cons group bogus)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5424 (setq old-newsrc (cdr old-newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5425 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5426 (setq gnus-newsrc-assoc (nreverse new-newsrc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5427 ;; Update gnus-killed-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5428 ;; The killed newsgroups are deleted without any confirmations.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5429 (while old-killed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5430 (setq group (car (car old-killed)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5431 (and (gnus-gethash group gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5432 (null (assoc group gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5433 ;; Active and really killed newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5434 (setq new-killed (cons (car old-killed) new-killed)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5435 (setq old-killed (cdr old-killed))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5436 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5437 (setq gnus-killed-assoc (nreverse new-killed))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5438 ;; Remove BOGUS from .newsrc file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5439 (while bogus
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5440 (gnus-update-newsrc-buffer (car bogus) 'delete)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5441 (setq bogus (cdr bogus)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5442 ;; Update gnus-marked-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5443 (while old-marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5444 (setq group (car (car old-marked)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5445 (if (and (cdr (car old-marked)) ;Non-empty?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5446 (assoc group gnus-newsrc-assoc)) ;Not bogus?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5447 (setq new-marked (cons (car old-marked) new-marked)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5448 (setq old-marked (cdr old-marked)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5449 (setq gnus-marked-assoc new-marked)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5450 (message "Checking bogus newsgroups... done")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5451 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5452
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5453 (defun gnus-get-unread-articles ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5454 "Compute diffs between active and read articles."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5455 (let ((read gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5456 (group-info nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5457 (group-name nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5458 (active nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5459 (range nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5460 (message "Checking new news...")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5461 (or gnus-unread-hashtb
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5462 (setq gnus-unread-hashtb (gnus-make-hashtable)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5463 (while read
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5464 (setq group-info (car read)) ;About one newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5465 (setq group-name (car group-info))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5466 (setq active (nth 2 (gnus-gethash group-name gnus-active-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5467 (if (and gnus-octive-hashtb
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5468 ;; Is nothing changed?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5469 (equal active
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5470 (nth 2 (gnus-gethash group-name gnus-octive-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5471 ;; Is this newsgroup in the unread hash table?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5472 (gnus-gethash group-name gnus-unread-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5473 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5474 nil ;Nothing to do.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5475 (setq range (gnus-difference-of-range active (nthcdr 2 group-info)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5476 (gnus-sethash group-name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5477 (cons group-name ;Group name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5478 (cons (gnus-number-of-articles range)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5479 range)) ;Range of unread articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5480 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 (setq read (cdr read))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5483 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5484 (message "Checking new news... done")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5485 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5486
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5487 (defun gnus-expire-marked-articles ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5488 "Check expired article which is marked as unread."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5489 (let ((marked-assoc gnus-marked-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5490 (updated-assoc nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5491 (marked nil) ;Current marked info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5492 (articles nil) ;List of marked articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5493 (updated nil) ;List of real marked.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5494 (begin nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5495 (while marked-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5496 (setq marked (car marked-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5497 (setq articles (cdr marked))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5498 (setq updated nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5499 (setq begin
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5500 (car (nth 2 (gnus-gethash (car marked) gnus-active-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5501 (while (and begin articles)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5502 (if (>= (car articles) begin)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5503 ;; This article is still active.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5504 (setq updated (cons (car articles) updated)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5505 (setq articles (cdr articles)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5506 (if updated
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5507 (setq updated-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5508 (cons (cons (car marked) updated) updated-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5509 (setq marked-assoc (cdr marked-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5510 (setq gnus-marked-assoc updated-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5511 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5512
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5513 (defun gnus-mark-as-read-by-xref
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5514 (group headers unreads &optional subscribed-only)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5515 "Mark articles as read using cross references and return updated newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5516 Arguments are GROUP, HEADERS, UNREADS, and optional SUBSCRIBED-ONLY."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5517 (let ((xref-list nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5518 (header nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5519 (xrefs nil) ;One Xref: field info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5520 (xref nil) ;(NEWSGROUP . ARTICLE)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5521 (gname nil) ;Newsgroup name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5522 (article nil)) ;Article number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5523 (while headers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5524 (setq header (car headers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5525 (if (memq (nntp-header-number header) unreads)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5526 ;; This article is not yet marked as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5527 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5528 (setq xrefs (gnus-parse-xref-field (nntp-header-xref header)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5529 ;; For each cross reference info. in one Xref: field.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5530 (while xrefs
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5531 (setq xref (car xrefs))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5532 (setq gname (car xref)) ;Newsgroup name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5533 (setq article (cdr xref)) ;Article number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5534 (or (string-equal group gname) ;Ignore current newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5535 ;; Ignore unsubscribed newsgroup if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5536 (and subscribed-only
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5537 (not (nth 1 (assoc gname gnus-newsrc-assoc))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5538 ;; Ignore article marked as unread.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5539 (memq article (cdr (assoc gname gnus-marked-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5540 (let ((group-xref (assoc gname xref-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5541 (if group-xref
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5542 (if (memq article (cdr group-xref))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5543 nil ;Alread marked.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5544 (setcdr group-xref (cons article (cdr group-xref))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5545 ;; Create new assoc entry for GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5546 (setq xref-list (cons (list gname article) xref-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5547 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5548 (setq xrefs (cdr xrefs))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5549 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5550 (setq headers (cdr headers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5551 ;; Mark cross referenced articles as read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5552 (gnus-mark-xrefed-as-read xref-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5553 ;;(message "%s %s" (prin1-to-string unreads) (prin1-to-string xref-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5554 ;; Return list of updated group name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5555 (mapcar (function car) xref-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5556 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5557
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5558 (defun gnus-parse-xref-field (xref-value)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5559 "Parse Xref: field value, and return list of `(group . article-id)'."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5560 (let ((xref-list nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5561 (xref-value (or xref-value "")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5562 ;; Remove server host name.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5563 (if (string-match "^[ \t]*[^ \t,]+[ \t,]+\\(.*\\)$" xref-value)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5564 (setq xref-value (substring xref-value (match-beginning 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5565 (setq xref-value nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5566 ;; Process each xref info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5567 (while xref-value
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5568 (if (string-match
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5569 "^[ \t,]*\\([^ \t,]+\\):\\([0-9]+\\)[^0-9]*" xref-value)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5570 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5571 (setq xref-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5572 (cons
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5573 (cons
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5574 ;; Group name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5575 (substring xref-value (match-beginning 1) (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5576 ;; Article-ID
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5577 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5578 (substring xref-value (match-beginning 2) (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5579 xref-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5580 (setq xref-value (substring xref-value (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5581 (setq xref-value nil)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5582 ;; Return alist.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5583 xref-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5584 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5585
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5586 (defun gnus-mark-xrefed-as-read (xrefs)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5587 "Update unread article information using XREFS alist."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5588 (let ((group nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5589 (idlist nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5590 (unread nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5591 (while xrefs
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5592 (setq group (car (car xrefs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5593 (setq idlist (cdr (car xrefs)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5594 (setq unread (gnus-uncompress-sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5595 (nthcdr 2 (gnus-gethash group gnus-unread-hashtb))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5596 (while idlist
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5597 (setq unread (delq (car idlist) unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5598 (setq idlist (cdr idlist)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5599 (gnus-update-unread-articles group unread 'ignore)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5600 (setq xrefs (cdr xrefs))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5601 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5602
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5603 (defun gnus-update-unread-articles (group unread-list marked-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5604 "Update unread articles of GROUP using UNREAD-LIST and MARKED-LIST."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5605 (let ((active (nth 2 (gnus-gethash group gnus-active-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5606 (unread (gnus-gethash group gnus-unread-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5607 (if (or (null active) (null unread))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5608 ;; Ignore unknown newsgroup.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5609 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5610 ;; Update gnus-unread-hashtb.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5611 (if unread-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5612 (setcdr (cdr unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5613 (gnus-compress-sequence unread-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5614 ;; All of the articles are read.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5615 (setcdr (cdr unread) '((0 . 0))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5616 ;; Number of unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5617 (setcar (cdr unread)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5618 (gnus-number-of-articles (nthcdr 2 unread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5619 ;; Update gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5620 (if (> (car active) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5621 ;; Articles from 1 to N are not active.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5622 (setq active (cons 1 (cdr active))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5623 (setcdr (cdr (assoc group gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5624 (gnus-difference-of-range active (nthcdr 2 unread)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5625 ;; Update .newsrc buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5626 (gnus-update-newsrc-buffer group)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5627 ;; Update gnus-marked-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5628 (if (listp marked-list) ;Includes NIL.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5629 (let ((marked (assoc group gnus-marked-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5630 (cond (marked
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5631 (setcdr marked marked-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5632 (marked-list ;Non-NIL.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5633 (setq gnus-marked-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5634 (cons (cons group marked-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5635 gnus-marked-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5636 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5637 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5638
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5639 (defun gnus-read-active-file ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5640 "Get active file from NNTP server."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5641 (message "Reading active file...")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5642 (if (gnus-request-list) ;Get active file from server
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5643 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5644 (set-buffer nntp-server-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5645 ;; Save OLD active info.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5646 (setq gnus-octive-hashtb gnus-active-hashtb)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5647 (setq gnus-active-hashtb (gnus-make-hashtable))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5648 (gnus-active-to-gnus-format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5649 (message "Reading active file... done"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5650 (error "Cannot read active file from NNTP server.")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5651
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5652 (defun gnus-active-to-gnus-format ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5653 "Convert active file format to internal format."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5654 ;; Delete unnecessary lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5655 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5656 (delete-matching-lines "^to\\..*$")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5657 ;; Store active file in hashtable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5658 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5659 (while
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5660 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5661 "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([ymn]\\).*$"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5662 nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5663 (gnus-sethash
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5664 (buffer-substring (match-beginning 1) (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5665 (list (buffer-substring (match-beginning 1) (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5666 (string-equal
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5667 "y" (buffer-substring (match-beginning 4) (match-end 4)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5668 (cons (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5669 (buffer-substring (match-beginning 3) (match-end 3)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5670 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5671 (buffer-substring (match-beginning 2) (match-end 2)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5672 gnus-active-hashtb)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5673
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5674 (defun gnus-read-newsrc-file (&optional rawfile)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5675 "Read startup FILE.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5676 If optional argument RAWFILE is non-nil, the raw startup file is read."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5677 (setq gnus-current-startup-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5678 (let* ((file (expand-file-name gnus-startup-file nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5679 (real-file (concat file "-" gnus-nntp-server)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5680 (if (file-exists-p real-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5681 real-file file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5682 ;; Reset variables which may be included in the quick startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5683 (let ((variables gnus-variable-list))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5684 (while variables
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5685 (set (car variables) nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5686 (setq variables (cdr variables))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5687 (let* ((newsrc-file gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5688 (quick-file (concat newsrc-file ".el"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5689 (quick-loaded nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5690 (newsrc-mod (nth 5 (file-attributes newsrc-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5691 (quick-mod (nth 5 (file-attributes quick-file))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5692 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5693 ;; Prepare .newsrc buffer.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5694 (set-buffer (find-file-noselect newsrc-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5695 ;; It is not so good idea turning off undo.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5696 ;;(buffer-flush-undo (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5697 ;; Load quick .newsrc to restore gnus-marked-assoc and
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5698 ;; gnus-killed-assoc even if gnus-newsrc-assoc is out of date.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5699 (condition-case nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5700 (setq quick-loaded (load quick-file t t t))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5701 (error nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5702 (cond ((and (not rawfile) ;Not forced to read the raw file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5703 (or (and (fboundp 'file-newer-than-file-p)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5704 (file-newer-than-file-p quick-file newsrc-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5705 (and newsrc-mod quick-mod
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5706 ;; .newsrc.el is newer than .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5707 ;; Some older version does not support function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5708 ;; `file-newer-than-file-p'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5709 (or (< (car newsrc-mod) (car quick-mod))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5710 (and (= (car newsrc-mod) (car quick-mod))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5711 (<= (nth 1 newsrc-mod) (nth 1 quick-mod))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5712 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5713 quick-loaded
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5714 gnus-newsrc-assoc ;Really loaded?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5715 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5716 ;; We don't have to read the raw startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5717 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5718 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5719 ;; Since .newsrc file is newer than quick file, read it.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5720 (message "Reading %s..." newsrc-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5721 (gnus-newsrc-to-gnus-format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5722 (gnus-check-killed-newsgroups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5723 (message "Reading %s... Done" newsrc-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5724 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5725
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5726 (defun gnus-make-newsrc-file (file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5727 "Make server dependent file name by catenating FILE and server host name."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5728 (let* ((file (expand-file-name file nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5729 (real-file (concat file "-" gnus-nntp-server)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5730 (if (file-exists-p real-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5731 real-file 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-newsrc-to-gnus-format ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5735 "Parse current buffer as .newsrc file."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5736 (let ((newsgroup nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5737 (subscribe nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5738 (ranges nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5739 (subrange nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5740 (read-list nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5741 ;; We have to re-initialize these variable (except for
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5742 ;; gnus-marked-assoc and gnus-killed-assoc) because quick startup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5743 ;; file may contain bogus values.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5744 (setq gnus-newsrc-options nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5745 (setq gnus-newsrc-options-n-yes nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5746 (setq gnus-newsrc-options-n-no nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5747 (setq gnus-newsrc-assoc nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5748 ;; Save options line to variable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5749 ;; Lines beginning with white spaces are treated as continuation
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5750 ;; line. Refer man page of newsrc(5).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5751 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5752 (if (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5753 "^[ \t]*options[ \t]*\\(.*\\(\n[ \t]+.*\\)*\\)[ \t]*$" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5754 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5755 ;; Save entire options line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5756 (setq gnus-newsrc-options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5757 (buffer-substring (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5758 ;; Compile "-n" option.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5759 (if (string-match "\\(^\\|[ \t\n]\\)-n" gnus-newsrc-options)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5760 (let ((yes-and-no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5761 (gnus-parse-n-options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5762 (substring gnus-newsrc-options (match-end 0)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5763 (setq gnus-newsrc-options-n-yes (car yes-and-no))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5764 (setq gnus-newsrc-options-n-no (cdr yes-and-no))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5765 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5766 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5767 ;; Parse body of .newsrc file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5768 ;; Options line continuation lines must be also considered here.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5769 ;; Before supporting continuation lines, " newsgroup ! 1-5" was
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5770 ;; okay, but now it is invalid. It should be "newsgroup! 1-5".
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5771 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5772 ;; Due to overflows in regex.c, change the following regexp:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5773 ;; "^\\([^:! \t\n]+\\)\\([:!]\\)[ \t]*\\(.*\\)$"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5774 ;; Suggested by composer@bucsf.bu.edu (Jeff Kellem).
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5775 (while (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5776 "^\\([^:! \t\n]+\\)\\([:!]\\)[ \t]*\\(\\(...\\)*.*\\)$" nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5777 (setq newsgroup (buffer-substring (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5778 ;; Check duplications of newsgroups.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5779 ;; Note: Checking the duplications takes very long time.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5780 (if (assoc newsgroup gnus-newsrc-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5781 (message "Ignore duplicated newsgroup: %s" newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5782 (setq subscribe
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5783 (string-equal
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5784 ":" (buffer-substring (match-beginning 2) (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5785 (setq ranges (buffer-substring (match-beginning 3) (match-end 3)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5786 (setq read-list nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5787 (while (string-match "^[, \t]*\\([0-9-]+\\)" ranges)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5788 (setq subrange (substring ranges (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5789 (setq ranges (substring ranges (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5790 (cond ((string-match "^\\([0-9]+\\)-\\([0-9]+\\)$" subrange)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5791 (setq read-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5792 (cons
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5793 (cons (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5794 (substring subrange
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5795 (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5796 (string-to-int
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5797 (substring subrange
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5798 (match-beginning 2) (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5799 read-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5800 ((string-match "^[0-9]+$" subrange)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5801 (setq read-list
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5802 (cons (cons (string-to-int subrange)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5803 (string-to-int subrange))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5804 read-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5805 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5806 (ding) (message "Ignoring bogus lines of %s" newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5807 (sit-for 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5808 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5809 (setq gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5810 (cons (cons newsgroup (cons subscribe (nreverse read-list)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5811 gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5812 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5813 (setq gnus-newsrc-assoc
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5814 (nreverse gnus-newsrc-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5815 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5816
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5817 (defun gnus-parse-n-options (options)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5818 "Parse -n NEWSGROUPS options and return a cons of YES and NO regexps."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5819 (let ((yes nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5820 (no nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5821 (yes-or-no nil) ;`!' or not.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5822 (newsgroup nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5823 ;; Parse each newsgroup description such as "comp.all". Commas
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5824 ;; and white spaces can be a newsgroup separator.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5825 (while
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5826 (string-match "^[ \t\n,]*\\(!?\\)\\([^--- \t\n,][^ \t\n,]*\\)" options)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5827 (setq yes-or-no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5828 (substring options (match-beginning 1) (match-end 1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5829 (setq newsgroup
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5830 (regexp-quote
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5831 (substring options
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5832 (match-beginning 2) (match-end 2))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5833 (setq options (substring options (match-end 2)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5834 ;; Rewrite "all" to ".+" not ".*". ".+" requires at least one
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5835 ;; character.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5836 (while (string-match "\\(^\\|\\\\[.]\\)all\\(\\\\[.]\\|$\\)" newsgroup)
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 (concat (substring newsgroup 0 (match-end 1))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5839 ".+"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5840 (substring newsgroup (match-beginning 2)))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5841 (cond ((string-equal yes-or-no "!")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5842 (setq no (cons newsgroup no)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5843 ((string-equal newsgroup ".+")) ;Ignore `all'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5844 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5845 (setq yes (cons newsgroup yes)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5846 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5847 ;; Make a cons of regexps from parsing result.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5848 (cons (if yes
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5849 (concat "^\\("
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5850 (apply (function concat)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5851 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5852 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5853 (lambda (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5854 (concat newsgroup "\\|")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5855 (cdr yes)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5856 (car yes) "\\)"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5857 (if no
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5858 (concat "^\\("
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5859 (apply (function concat)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5860 (mapcar
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5861 (function
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5862 (lambda (newsgroup)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5863 (concat newsgroup "\\|")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5864 (cdr no)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5865 (car no) "\\)")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5866 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5867
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5868 (defun gnus-save-newsrc-file ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5869 "Save to .newsrc FILE."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5870 ;; Note: We cannot save .newsrc file if all newsgroups are removed
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5871 ;; from the variable gnus-newsrc-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5872 (and (or gnus-newsrc-assoc gnus-killed-assoc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5873 gnus-current-startup-file
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5874 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5875 ;; A buffer containing .newsrc file may be deleted.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5876 (set-buffer (find-file-noselect gnus-current-startup-file))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5877 (if (not (buffer-modified-p))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5878 (message "(No changes need to be saved)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5879 (message "Saving %s..." gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5880 (let ((make-backup-files t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5881 (version-control nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5882 (require-final-newline t)) ;Don't ask even if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5883 ;; Make backup file of master newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5884 ;; You can stop or change version control of backup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5885 ;; Suggested by jason@violet.berkeley.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5886 (run-hooks 'gnus-Save-newsrc-hook)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5887 (save-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5888 ;; Quickly loadable .newsrc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5889 (set-buffer (get-buffer-create " *GNUS-newsrc*"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5890 (buffer-flush-undo (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5891 (erase-buffer)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5892 (gnus-gnus-to-quick-newsrc-format)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5893 (let ((make-backup-files nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5894 (version-control nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5895 (require-final-newline t)) ;Don't ask even if requested.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5896 (write-file (concat gnus-current-startup-file ".el")))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5897 (kill-buffer (current-buffer))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5898 (message "Saving %s... Done" gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5899 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5900 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5901
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5902 (defun gnus-update-newsrc-buffer (group &optional delete next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5903 "Incrementally update .newsrc buffer about GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5904 If optional second argument DELETE is non-nil, delete the group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5905 If optional third argument NEXT is non-nil, inserted before it."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5906 (save-excursion
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5907 ;; Taking account of the killed startup file.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5908 ;; Suggested by tale@pawl.rpi.edu.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5909 (set-buffer (or (get-file-buffer gnus-current-startup-file)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5910 (find-file-noselect gnus-current-startup-file)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5911 ;; Options line continuation lines must be also considered here.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5912 ;; Before supporting continuation lines, " newsgroup ! 1-5" was
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5913 ;; okay, but now it is invalid. It should be "newsgroup! 1-5".
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5914 (let ((deleted nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5915 (buffer-read-only nil)) ;May be not modifiable.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5916 ;; Delete ALL entries which match for GROUP.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5917 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5918 (while (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5919 (concat "^" (regexp-quote group) "[:!]") nil t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5920 (beginning-of-line)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5921 (delete-region (point) (progn (forward-line 1) (point)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5922 (setq deleted t) ;Old entry is deleted.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5923 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5924 (if delete
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5925 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5926 ;; Insert group entry.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5927 (let ((newsrc (assoc group gnus-newsrc-assoc)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5928 (if (null newsrc)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5929 nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5930 ;; Find insertion point.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5931 (cond (deleted nil) ;Insert here.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5932 ((and (stringp next)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5933 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5934 (goto-char (point-min))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5935 (re-search-forward
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5936 (concat "^" (regexp-quote next) "[:!]") nil t)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5937 (beginning-of-line))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5938 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5939 (goto-char (point-max))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5940 (or (bolp)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5941 (insert "\n"))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5942 ;; Insert after options line.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5943 (if (looking-at "^[ \t]*options\\([ \t]\\|$\\)")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5944 (progn
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5945 (forward-line 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5946 ;; Skip continuation lines.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5947 (while (and (not (eobp))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5948 (looking-at "^[ \t]+"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5949 (forward-line 1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5950 (insert group ;Group name
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5951 (if (nth 1 newsrc) ": " "! ")) ;Subscribed?
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5952 (gnus-ranges-to-newsrc-format (nthcdr 2 newsrc)) ;Read articles
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5953 (insert "\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5954 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5955 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5956
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5957 (defun gnus-gnus-to-quick-newsrc-format ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5958 "Insert GNUS variables such as `gnus-newsrc-assoc' in Lisp format."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5959 (insert ";; GNUS internal format of .newsrc.\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5960 (insert ";; Touch .newsrc instead if you think to remove this file.\n")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5961 (let ((variable nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5962 (variables gnus-variable-list)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5963 ;; Temporary rebind to make changes invisible.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5964 (gnus-killed-assoc gnus-killed-assoc))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5965 ;; Remove duplicated or unsubscribed newsgroups in gnus-killed-assoc.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5966 (gnus-check-killed-newsgroups)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5967 ;; Then, insert lisp expressions.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5968 (while variables
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5969 (setq variable (car variables))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5970 (and (boundp variable)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5971 (symbol-value variable)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5972 (insert "(setq " (symbol-name variable) " '"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5973 (prin1-to-string (symbol-value variable))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5974 ")\n"))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5975 (setq variables (cdr variables)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5976 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5977
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5978 (defun gnus-ranges-to-newsrc-format (ranges)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5979 "Insert ranges of read articles."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5980 (let ((range nil)) ;Range is a pair of BEGIN and END.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5981 (while ranges
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5982 (setq range (car ranges))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5983 (setq ranges (cdr ranges))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5984 (cond ((= (car range) (cdr range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5985 (if (= (car range) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5986 (setq ranges nil) ;No unread articles.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5987 (insert (int-to-string (car range)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5988 (if ranges (insert ","))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5989 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5990 (t
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5991 (insert (int-to-string (car range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5992 "-"
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5993 (int-to-string (cdr range)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5994 (if ranges (insert ","))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5995 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5996 )))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5997
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5998 (defun gnus-compress-sequence (numbers)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5999 "Convert list of sorted numbers to ranges."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6000 (let* ((numbers (sort (copy-sequence numbers) (function <)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6001 (first (car numbers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6002 (last (car numbers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6003 (result nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6004 (while numbers
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6005 (cond ((= last (car numbers)) nil) ;Omit duplicated number
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6006 ((= (1+ last) (car numbers)) ;Still in sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6007 (setq last (car numbers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6008 (t ;End of one sequence
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6009 (setq result (cons (cons first last) result))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6010 (setq first (car numbers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6011 (setq last (car numbers)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6012 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6013 (setq numbers (cdr numbers))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6014 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6015 (nreverse (cons (cons first last) result))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6016 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6017
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6018 (defun gnus-uncompress-sequence (ranges)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6019 "Expand compressed format of sequence."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6020 (let ((first nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6021 (last nil)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6022 (result nil))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6023 (while ranges
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6024 (setq first (car (car ranges)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6025 (setq last (cdr (car ranges)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6026 (while (< first last)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6027 (setq result (cons first result))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6028 (setq first (1+ first)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6029 (setq result (cons first result))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6030 (setq ranges (cdr ranges))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6031 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6032 (nreverse result)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6033 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6034
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6035 (defun gnus-number-of-articles (range)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6036 "Compute number of articles from RANGE `((beg1 . end1) (beg2 . end2) ...)'."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6037 (let ((count 0))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6038 (while range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6039 (if (/= (cdr (car range)) 0)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6040 ;; If end1 is 0, it must be skipped. Usually no articles in
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6041 ;; this group.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6042 (setq count (+ count 1 (- (cdr (car range)) (car (car range))))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6043 (setq range (cdr range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6044 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6045 count ;Result
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6046 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6047
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6048 (defun gnus-difference-of-range (src obj)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6049 "Compute (SRC - OBJ) on range.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6050 Range of SRC is expressed as `(beg . end)'.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6051 Range of OBJ is expressed as `((beg1 . end1) (beg2 . end2) ...)."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6052 (let ((beg (car src))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6053 (end (cdr src))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6054 (range nil)) ;This is result.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6055 ;; Src may be nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6056 (while (and src obj)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6057 (let ((beg1 (car (car obj)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6058 (end1 (cdr (car obj))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6059 (cond ((> beg end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6060 (setq obj nil)) ;Terminate loop
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6061 ((< beg beg1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6062 (setq range (cons (cons beg (min (1- beg1) end)) range))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6063 (setq beg (1+ end1)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6064 ((>= beg beg1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6065 (setq beg (max beg (1+ end1))))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6066 )
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6067 (setq obj (cdr obj)) ;Next OBJ
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6068 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6069 ;; Src may be nil.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6070 (if (and src (<= beg end))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6071 (setq range (cons (cons beg end) range)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6072 ;; Result
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6073 (if range
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6074 (nreverse range)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6075 (list (cons 0 0)))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6076 ))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6077
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6078
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6079 ;;Local variables:
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6080 ;;eval: (put 'gnus-eval-in-buffer-window 'lisp-indent-function 1)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6081 ;;end: