aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/gnus.el3801
-rw-r--r--lisp/gnusmail.el106
-rw-r--r--lisp/gnusmisc.el218
-rw-r--r--lisp/gnuspost.el425
-rw-r--r--lisp/mhspool.el129
-rw-r--r--lisp/nnspool.el75
-rw-r--r--lisp/nntp.el101
7 files changed, 3049 insertions, 1806 deletions
diff --git a/lisp/gnus.el b/lisp/gnus.el
index 4859096721f..70ee3dd2ec3 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -1,9 +1,6 @@
1;;; gnus.el --- GNUS: an NNTP-based News Reader for GNU Emacs 1;;; GNUS: an NNTP-based News Reader for GNU Emacs
2 2;; Copyright (C) 1987, 1988, 1989, 1990, 1993 Free Software Foundation, Inc.
3;; Copyright (C) 1987, 1988, 1989, 1990 Free Software Foundation, Inc. 3;; $Header: gnus.el,v 3.15 93/05/10 19:49:20 umerin Locked $
4
5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6;; Keywords: news
7 4
8;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
9 6
@@ -23,6 +20,67 @@
23 20
24;;; Commentary: 21;;; Commentary:
25 22
23;; How to Install GNUS:
24;; (0) First of all, remove GNUS related OLD *.elc files (at least
25;; nntp.elc).
26;; (1) Unshar gnus.el, gnuspost.el, gnusmail.el, gnusmisc.el, and
27;; nntp.el.
28;; (2) byte-compile-file nntp.el, gnus.el, gnuspost.el, gnusmail.el,
29;; and gnusmisc.el. If you have a local news spool,
30;; byte-compile-file nnspool.el, too.
31;; (3) Define three environment variables in .login file as follows:
32;;
33;; setenv NNTPSERVER flab
34;; setenv DOMAINNAME "stars.flab.Fujitsu.CO.JP"
35;; setenv ORGANIZATION "Fujitsu Laboratories Ltd., Kawasaki, Japan."
36;;
37;; Or instead, define lisp variables in your .emacs, site-init.el,
38;; or default.el as follows:
39;;
40;; (setq gnus-nntp-server "flab")
41;; (setq gnus-local-domain "stars.flab.Fujitsu.CO.JP")
42;; (setq gnus-local-organization "Fujitsu Laboratories Ltd., ...")
43;;
44;; If the function (system-name) returns the full internet name,
45;; you don't have to define the domain.
46;;
47;; (4) You may have to define NNTP service name as number 119.
48;;
49;; (setq gnus-nntp-service 119)
50;;
51;; Or, if you'd like to use a local news spool directly in stead
52;; of NNTP, install nnspool.el and set the variable to nil as
53;; follows:
54;;
55;; (setq gnus-nntp-service nil)
56;;
57;; (5) If you'd like to use the GENERICFROM feature like the Bnews,
58;; define the variable as follows:
59;;
60;; (setq gnus-use-generic-from t)
61;;
62;; (6) Define autoload entries in .emacs file as follows:
63;;
64;; (autoload 'gnus "gnus" "Read network news." t)
65;; (autoload 'gnus-post-news "gnuspost" "Post a news." t)
66;;
67;; (7) Read nntp.el if you have problems with NNTP or kanji handling.
68;;
69;; (8) Install mhspool.el, tcp.el, and tcp.c if it is necessary.
70;;
71;; mhspool.el is a package for reading articles or mail in your
72;; private directory using GNUS.
73;;
74;; tcp.el and tcp.c are necessary if and only if your Emacs does
75;; not have the function `open-network-stream' which is used for
76;; communicating with NNTP server inside Emacs.
77;;
78;; (9) Install an Info file generated from the texinfo manual gnus.texinfo.
79;;
80;; If you are not allowed to create the Info file to the standard
81;; Info-directory, create it in your private directory and set the
82;; variable gnus-info-directory to that directory.
83
26;; GNUS Mailing List: 84;; GNUS Mailing List:
27;; There are two mailing lists for GNUS lovers in the world: 85;; There are two mailing lists for GNUS lovers in the world:
28;; 86;;
@@ -51,29 +109,31 @@
51;; (3) Multi-GNUS (Talking to many hosts same time). 109;; (3) Multi-GNUS (Talking to many hosts same time).
52;; (4) Asynchronous transmission of large messages. 110;; (4) Asynchronous transmission of large messages.
53 111
54;;; Code: 112(provide 'gnus)
55
56(require 'nntp) 113(require 'nntp)
57(require 'mail-utils) 114(require 'mail-utils)
58 115
59(defvar gnus-nntp-server (or (getenv "NNTPSERVER") 116(defvar gnus-nntp-server (getenv "NNTPSERVER")
60 (and (boundp 'gnus-default-nntp-server) 117 "*The name of the host running NNTP server.
61 gnus-default-nntp-server))
62 "The name of the host running NNTP server.
63If it is a string such as `:DIRECTORY', the user's private DIRECTORY 118If it is a string such as `:DIRECTORY', the user's private DIRECTORY
64is used as a news spool. 119is used as a news spool.
65Initialized from the NNTPSERVER environment variable.") 120Initialized from the NNTPSERVER environment variable.")
66 121
67(defvar gnus-nntp-service "nntp" 122(defvar gnus-nntp-service "nntp"
68 "The name of the network service for GNUS to use. Usually \"nntp\".") 123 "*NNTP service name (\"nntp\" or 119).
124Go to a local news spool if its value is nil.")
125
126(defvar gnus-startup-file "~/.newsrc"
127 "*Your .newsrc file. Use `.newsrc-SERVER' instead if exists.")
69 128
70(defvar gnus-signature-file "~/.signature" 129(defvar gnus-signature-file "~/.signature"
71 "*Your .signature file. Use `.signature-DISTRIBUTION' instead if exists.") 130 "*Your .signature file. Use `.signature-DISTRIBUTION' instead if exists.")
72 131
73(defvar gnus-use-cross-reference t 132(defvar gnus-use-cross-reference t
74 "Specifies what to do with cross references (Xref: field). 133 "*Specifies what to do with cross references (Xref: field).
75If nil, ignore cross references. If t, mark articles as read in subscribed 134If nil, ignore cross references. If t, mark articles as read in
76newsgroups. Otherwise, mark articles as read in all newsgroups.") 135subscribed newsgroups. Otherwise, if not nil nor t, mark articles as
136read in all newsgroups.")
77 137
78(defvar gnus-use-followup-to t 138(defvar gnus-use-followup-to t
79 "*Specifies what to do with Followup-To: field. 139 "*Specifies what to do with Followup-To: field.
@@ -86,16 +146,16 @@ If the number of articles in a newsgroup is greater than the value,
86confirmation is required for selecting the newsgroup.") 146confirmation is required for selecting the newsgroup.")
87 147
88(defvar gnus-author-copy (getenv "AUTHORCOPY") 148(defvar gnus-author-copy (getenv "AUTHORCOPY")
89 "*Filename for saving a copy of an article posted using FCC: field. 149 "*File name saving a copy of an article posted using FCC: field.
90Initialized from the AUTHORCOPY environment variable. 150Initialized from the AUTHORCOPY environment variable.
91 151
92Articles are saved using a function specified by the the variable 152Articles are saved using a function specified by the the variable
93`gnus-author-copy-saver' (`rmail-output' is the default) if a file name 153gnus-author-copy-saver (rmail-output is default) if a file name is
94is given. Instead, if the first character of the name is `|', the 154given. Instead, if the first character of the name is `|', the
95contents of the article is piped out to the named program. It is 155contents of the article is piped out to the named program. It is
96possible to save an article in an MH folder as follows: 156possible to save an article in an MH folder as follows:
97 157
98 (setq gnus-author-copy \"|/usr/local/lib/mh/rcvstore +Article\")") 158(setq gnus-author-copy \"|/usr/local/lib/mh/rcvstore +Article\")")
99 159
100(defvar gnus-author-copy-saver (function rmail-output) 160(defvar gnus-author-copy-saver (function rmail-output)
101 "*A function called with a file name to save an author copy to. 161 "*A function called with a file name to save an author copy to.
@@ -103,73 +163,78 @@ The default function is `rmail-output' which saves in Unix mailbox format.")
103 163
104(defvar gnus-use-long-file-name 164(defvar gnus-use-long-file-name
105 (not (memq system-type '(usg-unix-v xenix))) 165 (not (memq system-type '(usg-unix-v xenix)))
106 "Non-nil means that a newsgroup name is used as a default file name 166 "*Non-nil means that a newsgroup name is used as a default file name
107to save articles to. If nil, the directory form of a newsgroup is 167to save articles to. If it's nil, the directory form of a newsgroup is
108used instead.") 168used instead.")
109 169
110(defvar gnus-article-save-directory (getenv "SAVEDIR") 170(defvar gnus-article-save-directory (getenv "SAVEDIR")
111 "*The directory in which to save articles; defaults to ~/News. 171 "*A directory name to save articles to (default to ~/News).
112Initialized from the SAVEDIR environment variable.") 172Initialized from the SAVEDIR environment variable.")
113 173
114(defvar gnus-default-article-saver (function gnus-Subject-save-in-rmail) 174(defvar gnus-default-article-saver (function gnus-summary-save-in-rmail)
115 "A function used to save articles in your favorite format. 175 "*A function to save articles in your favorite format.
116The function must be interactively callable (in other words, it must 176The function must be interactively callable (in other words, it must
117be an Emacs command). 177be an Emacs command).
118 178
119GNUS provides the following functions: 179GNUS provides the following functions:
120 gnus-Subject-save-in-rmail (in Rmail format) 180 gnus-summary-save-in-rmail (in Rmail format)
121 gnus-Subject-save-in-mail (in Unix mail format) 181 gnus-summary-save-in-mail (in Unix mail format)
122 gnus-Subject-save-in-folder (in an MH folder) 182 gnus-summary-save-in-folder (in an MH folder)
123 gnus-Subject-save-in-file (in article format).") 183 gnus-summary-save-in-file (in article format).")
124 184
125(defvar gnus-rmail-save-name (function gnus-plain-save-name) 185(defvar gnus-rmail-save-name (function gnus-plain-save-name)
126 "A function generating a file name to save articles in Rmail format. 186 "*A function generating a file name to save articles in Rmail format.
127The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.") 187The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
128 188
129(defvar gnus-mail-save-name (function gnus-plain-save-name) 189(defvar gnus-mail-save-name (function gnus-plain-save-name)
130 "A function generating a file name to save articles in Unix mail format. 190 "*A function generating a file name to save articles in Unix mail format.
131The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.") 191The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
132 192
133(defvar gnus-folder-save-name (function gnus-folder-save-name) 193(defvar gnus-folder-save-name (function gnus-folder-save-name)
134 "A function generating a file name to save articles in MH folder. 194 "*A function generating a file name to save articles in MH folder.
135The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER.") 195The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER.")
136 196
137(defvar gnus-file-save-name (function gnus-numeric-save-name) 197(defvar gnus-file-save-name (function gnus-numeric-save-name)
138 "A function generating a file name to save articles in article format. 198 "*A function generating a file name to save articles in article format.
139The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.") 199The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
140 200
141(defvar gnus-kill-file-name "KILL" 201(defvar gnus-kill-file-name "KILL"
142 "File name of a KILL file.") 202 "*File name of a KILL file.")
143
144(defvar gnus-default-distribution "local"
145 "*Use this value as distribution if no distribution is specified.")
146 203
147(defvar gnus-novice-user t 204(defvar gnus-novice-user t
148 "*Non-nil means that you are a novice to USENET. 205 "*Non-nil means that you are a novice to USENET. If non-nil,
149If non-nil, verbose messages may be displayed or your confirmation 206verbose messages may be displayed or your confirmations may be required.")
150may be required.") 207
208(defvar gnus-interactive-catchup t
209 "*Require your confirmation when catching up a newsgroup if non-nil.")
151 210
152(defvar gnus-interactive-post t 211(defvar gnus-interactive-post t
153 "*Newsgroup, subject, and distribution will be asked for if non-nil.") 212 "*Newsgroup, subject, and distribution will be asked for if non-nil.")
154 213
214(defvar gnus-interactive-exit t
215 "*Require your confirmation when exiting gnus if non-nil.")
216
155(defvar gnus-user-login-name nil 217(defvar gnus-user-login-name nil
156 "*The login name of the user. 218 "*The login name of the user.
157Uses USER and LOGNAME environment variables if undefined.") 219Got from the USER and LOGNAME environment variable if undefined.")
158 220
159(defvar gnus-user-full-name nil 221(defvar gnus-user-full-name nil
160 "*The full name of the user. 222 "*The full name of the user.
161Uses from the NAME environment variable if undefined.") 223Got from the NAME environment variable if undefined.")
224
225(defvar gnus-show-mime nil
226 "*Show MIME message if non-nil.")
162 227
163(defvar gnus-show-threads t 228(defvar gnus-show-threads t
164 "*Show conversation threads in Subject Mode if non-nil.") 229 "*Show conversation threads in Summary Mode if non-nil.")
165 230
166(defvar gnus-thread-hide-subject t 231(defvar gnus-thread-hide-subject t
167 "*Non-nil means hide subjects for thread subtrees.") 232 "*Non-nil means hide subjects for thread subtrees.")
168 233
169(defvar gnus-thread-hide-subtree nil 234(defvar gnus-thread-hide-subtree nil
170 "*Non-nil means hide thread subtrees initially. 235 "*Non-nil means hide thread subtrees initially.
171If non-nil, you have to run the command `gnus-Subject-show-thread' by 236If non-nil, you have to run the command gnus-summary-show-thread by
172hand or by using `gnus-Select-article-hook' to show hidden threads.") 237hand or by using gnus-select-article-hook to show hidden threads.")
173 238
174(defvar gnus-thread-hide-killed t 239(defvar gnus-thread-hide-killed t
175 "*Non-nil means hide killed thread subtrees automatically.") 240 "*Non-nil means hide killed thread subtrees automatically.")
@@ -179,36 +244,50 @@ hand or by using `gnus-Select-article-hook' to show hidden threads.")
179If it is non-nil, some commands work with subjects do not work properly.") 244If it is non-nil, some commands work with subjects do not work properly.")
180 245
181(defvar gnus-thread-indent-level 4 246(defvar gnus-thread-indent-level 4
182 "Indentation of thread subtrees.") 247 "*Indentation of thread subtrees.")
248
249(defvar gnus-ignored-newsgroups "^to\\..*$"
250 "*A regular expression used to ignore uninterested newsgroups in the active file.
251Any lines in the active file matching this regular expression are
252removed from the newsgroup list before anything else is done to it,
253thus making them effectively invisible.")
183 254
184(defvar gnus-ignored-headers 255(defvar gnus-ignored-headers
185 "^Path:\\|^Posting-Version:\\|^Article-I.D.:\\|^Expires:\\|^Date-Received:\\|^References:\\|^Control:\\|^Xref:\\|^Lines:\\|^Posted:\\|^Relay-Version:\\|^Message-ID:\\|^Nf-ID:\\|^Nf-From:\\|^Approved:\\|^Sender:\\|^In-Reply-To:" 256 "^Path:\\|^Posting-Version:\\|^Article-I.D.:\\|^Expires:\\|^Date-Received:\\|^References:\\|^Control:\\|^Xref:\\|^Lines:\\|^Posted:\\|^Relay-Version:\\|^Message-ID:\\|^Nf-ID:\\|^Nf-From:\\|^Approved:\\|^Sender:"
186 "Regexp matching headers not to display in messages.") 257 "*All random fields within the header of a message.")
258
259(defvar gnus-required-headers
260 '(From Date Newsgroups Subject Message-ID Path Organization Distribution)
261 "*All required fields for articles you post.
262RFC977 and RFC1036 require From, Date, Newsgroups, Subject, Message-ID
263and Path fields. Organization, Distribution and Lines are optional.
264If you want GNUS not to insert some field, remove it from the
265variable.")
187 266
188(defvar gnus-show-all-headers nil 267(defvar gnus-show-all-headers nil
189 "*Show all headers of an article if non-nil.") 268 "*Show all headers of an article if non-nil.")
190 269
191(defvar gnus-save-all-headers nil 270(defvar gnus-save-all-headers t
192 "*Save all headers of an article if non-nil.") 271 "*Save all headers of an article if non-nil.")
193 272
194(defvar gnus-optional-headers (function gnus-optional-lines-and-from) 273(defvar gnus-optional-headers (function gnus-optional-lines-and-from)
195 "A function generating a optional string displayed in GNUS Subject 274 "*A function generating a optional string displayed in GNUS Summary
196mode buffer. The function is called with an article HEADER. The 275mode buffer. The function is called with an article HEADER. The
197result must be a string excluding `[' and `]'.") 276result must be a string excluding `[' and `]'.")
198 277
199(defvar gnus-auto-extend-newsgroup t 278(defvar gnus-auto-extend-newsgroup t
200 "*Extend visible articles to forward and backward if non-nil.") 279 "*Extend visible artciles to forward and backward if non-nil.")
201 280
202(defvar gnus-auto-select-first t 281(defvar gnus-auto-select-first t
203 "*Select the first unread article automagically if non-nil. 282 "*Select the first unread article automagically if non-nil.
204If you want to prevent automatic selection of the first unread article 283If you want to prevent automatic selection of the first unread article
205in some newsgroups, set the variable to nil in `gnus-Select-group-hook' 284in some newsgroups, set the variable to nil in gnus-select-group-hook
206or `gnus-Apply-kill-hook'.") 285or gnus-apply-kill-hook.")
207 286
208(defvar gnus-auto-select-next t 287(defvar gnus-auto-select-next t
209 "*Select the next newsgroup automagically if non-nil. 288 "*Select the next newsgroup automagically if non-nil.
210If the value is t and the next newsgroup is empty, GNUS will exit 289If the value is t and the next newsgroup is empty, GNUS will exit
211Subject mode and go back to Group mode. If the value is neither nil 290Summary mode and go back to Group mode. If the value is neither nil
212nor t, GNUS will select the following unread newsgroup. Especially, if 291nor t, GNUS will select the following unread newsgroup. Especially, if
213the value is the symbol `quietly', the next unread newsgroup will be 292the value is the symbol `quietly', the next unread newsgroup will be
214selected without any confirmations.") 293selected without any confirmations.")
@@ -216,8 +295,13 @@ selected without any confirmations.")
216(defvar gnus-auto-select-same nil 295(defvar gnus-auto-select-same nil
217 "*Select the next article with the same subject automagically if non-nil.") 296 "*Select the next article with the same subject automagically if non-nil.")
218 297
219(defvar gnus-auto-center-subject t 298(defvar gnus-auto-center-summary t
220 "*Always center the current subject in GNUS Subject mode window if non-nil.") 299 "*Always center the current summary in GNUS Summary window if non-nil.")
300
301(defvar gnus-auto-mail-to-author nil
302 "*Insert `To: author' of the article when following up if non-nil.
303Mail is sent using the function specified by the variable
304gnus-mail-send-method.")
221 305
222(defvar gnus-break-pages t 306(defvar gnus-break-pages t
223 "*Break an article into pages if non-nil. 307 "*Break an article into pages if non-nil.
@@ -236,141 +320,166 @@ Page delimiter is specified by the variable `gnus-page-delimiter'.")
236 "*Non-nil means to take up the entire screen of Emacs.") 320 "*Non-nil means to take up the entire screen of Emacs.")
237 321
238(defvar gnus-window-configuration 322(defvar gnus-window-configuration
239 '((SelectNewsgroup (0 1 0)) 323 '((summary (0 1 0))
240 (ExitNewsgroup (1 0 0)) 324 (newsgroups (1 0 0))
241 (SelectArticle (0 3 10)) 325 (article (0 3 10)))
242 (ExpandSubject (0 1 0))) 326 "*Specify window configurations for each action.
243 "Specify window configurations for each action. 327The format of the variable is a list of (ACTION (G S A)), where G, S,
244The format of the variable is a list of (ACTION (G S A)), where 328and A are the relative height of Group, Summary, and Article windows,
245G, S, and A are the relative height of Group, Subject, and Article 329respectively. ACTION is `summary', `newsgroups', or `article'.")
246windows, respectively. ACTION is `SelectNewsgroup', `ExitNewsgroup', 330
247`SelectArticle', or `ExpandSubject'.") 331(defvar gnus-show-mime-method (function metamail-buffer)
332 "*Function to process a MIME message.
333The function is expected to process current buffer as a MIME message.")
248 334
249(defvar gnus-mail-reply-method 335(defvar gnus-mail-reply-method
250 (function gnus-mail-reply-using-mail) 336 (function gnus-mail-reply-using-mail)
251 "A function to compose reply mail. 337 "*Function to compose reply mail.
252The function `gnus-mail-reply-using-mail' uses usual the sendmail mail 338The function gnus-mail-reply-using-mail uses usual sendmail mail
253program. The function `gnus-mail-reply-using-mhe' uses the mh-e mail 339program. The function gnus-mail-reply-using-mhe uses mh-e mail
254program. You can use yet another program by customizing this variable.") 340program. You can use yet another program by customizing this variable.")
255 341
342(defvar gnus-mail-forward-method
343 (function gnus-mail-forward-using-mail)
344 "*Function to forward current message to another user.
345The function gnus-mail-reply-using-mail uses usual sendmail mail
346program. You can use yet another program by customizing this variable.")
347
256(defvar gnus-mail-other-window-method 348(defvar gnus-mail-other-window-method
257 (function gnus-mail-other-window-using-mail) 349 (function gnus-mail-other-window-using-mail)
258 "A function to compose mail in other window. 350 "*Function to compose mail in other window.
259The function `gnus-mail-other-window-using-mail' uses usual sendmail 351The function gnus-mail-other-window-using-mail uses usual sendmail
260mail program. The function `gnus-mail-other-window-using-mhe' uses mh-e 352mail program. The function gnus-mail-other-window-using-mhe uses mh-e
261mail program. You can use yet another program by customizing this variable.") 353mail program. You can use yet another program by customizing this variable.")
262 354
355(defvar gnus-mail-send-method send-mail-function
356 "*Function to mail a message too which is being posted as an article.
357The message must have To: or Cc: field. The value of the variable
358send-mail-function is the default function which uses sendmail mail
359program.")
360
263(defvar gnus-subscribe-newsgroup-method 361(defvar gnus-subscribe-newsgroup-method
264 (function 362 (function gnus-subscribe-alphabetically)
265 (lambda (newsgroup) 363 "*Function called with a newsgroup name when new newsgroup is found.
266 (gnus-subscribe-newsgroup newsgroup 364The function gnus-subscribe-randomly inserts a new newsgroup a the
267 (car (car gnus-newsrc-assoc))))) 365beginning of newsgroups. The function gnus-subscribe-alphabetically
268 "A function called with a newsgroup name when it is created.") 366inserts it in strict alphabetic order. The function
367gnus-subscribe-hierarchically inserts it in hierarchical newsgroup
368order. The function gnus-subscribe-interactively asks for your decision.")
269 369
270(defvar gnus-Group-mode-hook nil 370(defvar gnus-group-mode-hook nil
271 "A hook for GNUS Group Mode.") 371 "*A hook for GNUS Group Mode.")
272 372
273(defvar gnus-Subject-mode-hook nil 373(defvar gnus-summary-mode-hook nil
274 "A hook for GNUS Subject Mode.") 374 "*A hook for GNUS Summary Mode.")
275 375
276(defvar gnus-Article-mode-hook nil 376(defvar gnus-article-mode-hook nil
277 "A hook for GNUS Article Mode.") 377 "*A hook for GNUS Article Mode.")
278 378
279(defvar gnus-Kill-file-mode-hook nil 379(defvar gnus-kill-file-mode-hook nil
280 "A hook for GNUS KILL File Mode.") 380 "*A hook for GNUS KILL File Mode.")
281 381
282(defvar gnus-Open-server-hook nil 382(defvar gnus-open-server-hook nil
283 "A hook called just before opening connection to news server.") 383 "*A hook called just before opening connection to news server.")
284 384
285(defvar gnus-Startup-hook nil 385(defvar gnus-startup-hook nil
286 "A hook called at start up time. 386 "*A hook called at start up time.
287This hook is called after GNUS is connected to the NNTP server. 387This hook is called after GNUS is connected to the NNTP server. So, it
288So, it is possible to change the behavior of GNUS according to the 388is possible to change the behavior of GNUS according to the selected
289selected NNTP server.") 389NNTP server.")
290 390
291(defvar gnus-Group-prepare-hook nil 391(defvar gnus-group-prepare-hook nil
292 "A hook called after newsgroup list is created in the Newsgroup buffer. 392 "*A hook called after newsgroup list is created in the Newsgroup buffer.
293If you want to modify the Newsgroup buffer, you can use this hook.") 393If you want to modify the Newsgroup buffer, you can use this hook.")
294 394
295(defvar gnus-Subject-prepare-hook nil 395(defvar gnus-summary-prepare-hook nil
296 "A hook called after subject list is created in the Subject buffer. 396 "*A hook called after summary list is created in the Summary buffer.
297If you want to modify the Subject buffer, you can use this hook.") 397If you want to modify the Summary buffer, you can use this hook.")
298 398
299(defvar gnus-Article-prepare-hook nil 399(defvar gnus-article-prepare-hook nil
300 "A hook called after an article is prepared in the Article buffer. 400 "*A hook called after an article is prepared in the Article buffer.
301If you want to run a special decoding program like nkf, use this hook.") 401If you want to run a special decoding program like nkf, use this hook.")
302 402
303(defvar gnus-Select-group-hook nil 403(defvar gnus-select-group-hook nil
304 "A hook called when a newsgroup is selected. 404 "*A hook called when a newsgroup is selected.
305If you want to sort Subject buffer by date and then by subject, you 405If you want to sort Summary buffer by date and then by subject, you
306can use the following hook: 406can use the following hook:
307 407
308(setq gnus-Select-group-hook 408(setq gnus-select-group-hook
309 '(lambda () 409 (function
410 (lambda ()
310 ;; First of all, sort by date. 411 ;; First of all, sort by date.
311 (gnus-sort-headers 412 (gnus-keysort-headers
312 '(lambda (a b) 413 (function string-lessp)
313 (gnus-date-lessp (gnus-header-date a) 414 (function
314 (gnus-header-date b)))) 415 (lambda (a)
416 (gnus-sortable-date (gnus-header-date a)))))
315 ;; Then sort by subject string ignoring `Re:'. 417 ;; Then sort by subject string ignoring `Re:'.
316 ;; If case-fold-search is non-nil, case of letters is ignored. 418 ;; If case-fold-search is non-nil, case of letters is ignored.
317 (gnus-sort-headers 419 (gnus-keysort-headers
318 '(lambda (a b) 420 (function string-lessp)
319 (gnus-string-lessp 421 (function
320 (gnus-simplify-subject (gnus-header-subject a) 're) 422 (lambda (a)
321 (gnus-simplify-subject (gnus-header-subject b) 're) 423 (if case-fold-search
322 ))))) 424 (downcase (gnus-simplify-subject (gnus-header-subject a) t))
323 425 (gnus-simplify-subject (gnus-header-subject a) t)))))
324If you'd like to simplify subjects like the `gnus-Subject-next-same-subject' 426 )))
325command does, you can use the following hook: 427
326 428If you'd like to simplify subjects like the
327(setq gnus-Select-group-hook 429`gnus-summary-next-same-subject' command does, you can use the
328 '(lambda () 430following hook:
431
432(setq gnus-select-group-hook
433 (function
434 (lambda ()
329 (mapcar (function 435 (mapcar (function
330 (lambda (header) 436 (lambda (header)
331 (nntp-set-header-subject 437 (nntp-set-header-subject
332 header 438 header
333 (gnus-simplify-subject 439 (gnus-simplify-subject
334 (gnus-header-subject header) 're-only)))) 440 (gnus-header-subject header) 're-only))))
335 gnus-newsgroup-headers))) 441 gnus-newsgroup-headers))))
336 442
337In some newsgroups author name is meaningless. It is possible to 443In some newsgroups author name is meaningless. It is possible to
338prevent listing author names in the GNUS Subject buffer as follows: 444prevent listing author names in GNUS Summary buffer as follows:
339 445
340(setq gnus-Select-group-hook 446(setq gnus-select-group-hook
341 '(lambda () 447 (function
448 (lambda ()
342 (cond ((string-equal \"comp.sources.unix\" gnus-newsgroup-name) 449 (cond ((string-equal \"comp.sources.unix\" gnus-newsgroup-name)
343 (setq gnus-optional-headers 450 (setq gnus-optional-headers
344 (function gnus-optional-lines))) 451 (function gnus-optional-lines)))
345 (t 452 (t
346 (setq gnus-optional-headers 453 (setq gnus-optional-headers
347 (function gnus-optional-lines-and-from))))))") 454 (function gnus-optional-lines-and-from)))))))")
348 455
349(defvar gnus-Select-article-hook 456(defvar gnus-select-article-hook
350 (function (lambda () (gnus-Subject-show-thread))) 457 (function (lambda () (gnus-summary-show-thread)))
351 "Hook called when an article is selected. 458 "*A hook called when an article is selected.
352The default hook automatically shows conversation thread subtrees 459The default hook shows conversation thread subtrees of the selected
353of the selected article as follows: 460article automatically as follows:
354 461
355(setq gnus-Select-article-hook 462(setq gnus-select-article-hook
356 '(lambda () 463 (function
357 (gnus-Subject-show-thread))) 464 (lambda ()
465 (gnus-summary-show-thread))))
358 466
359If you'd like to run RMAIL on a digest article automagically, you can 467If you'd like to run RMAIL on a digest article automagically, you can
360use the following hook: 468use the following hook:
361 469
362(setq gnus-Select-article-hook 470(setq gnus-select-article-hook
363 '(lambda () 471 (function
364 (gnus-Subject-show-thread) 472 (lambda ()
473 (gnus-summary-show-thread)
365 (cond ((string-equal \"comp.sys.sun\" gnus-newsgroup-name) 474 (cond ((string-equal \"comp.sys.sun\" gnus-newsgroup-name)
366 (gnus-Subject-rmail-digest)) 475 (gnus-summary-rmail-digest))
367 ((and (string-equal \"comp.text\" gnus-newsgroup-name) 476 ((and (string-equal \"comp.text\" gnus-newsgroup-name)
368 (string-match \"^TeXhax Digest\" 477 (string-match \"^TeXhax Digest\"
369 (gnus-header-subject gnus-current-headers))) 478 (gnus-header-subject gnus-current-headers)))
370 (gnus-Subject-rmail-digest) 479 (gnus-summary-rmail-digest)
371 ))))") 480 )))))")
372 481
373(defvar gnus-Select-digest-hook 482(defvar gnus-select-digest-hook
374 (function 483 (function
375 (lambda () 484 (lambda ()
376 ;; Reply-To: is required by `undigestify-rmail-message'. 485 ;; Reply-To: is required by `undigestify-rmail-message'.
@@ -378,84 +487,109 @@ use the following hook:
378 (progn 487 (progn
379 (mail-position-on-field "Reply-to") 488 (mail-position-on-field "Reply-to")
380 (insert (gnus-fetch-field "From")))))) 489 (insert (gnus-fetch-field "From"))))))
381 "A hook called when reading digest messages using Rmail. 490 "*A hook called when reading digest messages using Rmail.
382This hook can be used to modify incomplete digest articles as follows 491This hook can be used to modify incomplete digest articles as follows
383(this is the default): 492(this is the default):
384 493
385(setq gnus-Select-digest-hook 494(setq gnus-select-digest-hook
386 '(lambda () 495 (function
496 (lambda ()
387 ;; Reply-To: is required by `undigestify-rmail-message'. 497 ;; Reply-To: is required by `undigestify-rmail-message'.
388 (or (mail-position-on-field \"Reply-to\" t) 498 (or (mail-position-on-field \"Reply-to\" t)
389 (progn 499 (progn
390 (mail-position-on-field \"Reply-to\") 500 (mail-position-on-field \"Reply-to\")
391 (insert (gnus-fetch-field \"From\"))))))") 501 (insert (gnus-fetch-field \"From\")))))))")
392 502
393(defvar gnus-Rmail-digest-hook nil 503(defvar gnus-rmail-digest-hook nil
394 "A hook called when reading digest messages using Rmail. 504 "*A hook called when reading digest messages using Rmail.
395This hook is intended to customize Rmail mode for reading digest articles.") 505This hook is intended to customize Rmail mode for reading digest articles.")
396 506
397(defvar gnus-Apply-kill-hook (function gnus-apply-kill-file) 507(defvar gnus-apply-kill-hook (function gnus-apply-kill-file)
398 "A hook called when a newsgroup is selected and subject list is prepared. 508 "*A hook called when a newsgroup is selected and summary list is prepared.
399This hook is intended to apply a KILL file to the selected newsgroup. 509This hook is intended to apply a KILL file to the selected newsgroup.
400The function `gnus-apply-kill-file' is called defaultly. 510The function `gnus-apply-kill-file' is called defaultly.
401 511
402Since a general KILL file is too heavy to use for only a few 512Since a general KILL file is too heavy to use only for a few
403newsgroups, we recommend you use a lighter hook function. For 513newsgroups, I recommend you to use a lighter hook function. For
404example, if you'd like to apply a KILL file to articles which contains 514example, if you'd like to apply a KILL file to articles which contains
405a string `rmgroup' in subject in newsgroup `control', you can use the 515a string `rmgroup' in subject in newsgroup `control', you can use the
406following hook: 516following hook:
407 517
408(setq gnus-Apply-kill-hook 518(setq gnus-apply-kill-hook
409 '(lambda () 519 (function
520 (lambda ()
410 (cond ((string-match \"control\" gnus-newsgroup-name) 521 (cond ((string-match \"control\" gnus-newsgroup-name)
411 (gnus-kill \"Subject\" \"rmgroup\") 522 (gnus-kill \"Subject\" \"rmgroup\")
412 (gnus-expunge \"X\")))))") 523 (gnus-expunge \"X\"))))))")
413 524
414(defvar gnus-Mark-article-hook 525(defvar gnus-mark-article-hook
415 (function 526 (function
416 (lambda () 527 (lambda ()
417 (or (memq gnus-current-article gnus-newsgroup-marked) 528 (or (memq gnus-current-article gnus-newsgroup-marked)
418 (gnus-Subject-mark-as-read gnus-current-article)) 529 (gnus-summary-mark-as-read gnus-current-article))
419 (gnus-Subject-set-current-mark "+"))) 530 (gnus-summary-set-current-mark "+")))
420 "A hook called when an article is selected for the first time. 531 "*A hook called when an article is selected at the first time.
421The hook is intended to mark an article as read when it is selected. 532The hook is intended to mark an article as read (or unread)
422If you'd like to mark as unread (-) instead, use the following hook: 533automatically when it is selected.
423 534
424(setq gnus-Mark-article-hook 535If you'd like to mark as unread (-) instead, use the following hook:
425 '(lambda ()
426 (gnus-Subject-mark-as-unread gnus-current-article)
427 (gnus-Subject-set-current-mark \"+\")))")
428
429(defvar gnus-Inews-article-hook nil
430 "A hook called before posting an article.
431If you'd like to run a special encoding program, use this hook.")
432 536
433(defvar gnus-Exit-group-hook nil 537(setq gnus-mark-article-hook
434 "A hook called when exiting (not quitting) Subject mode. 538 (function
435If your machine is so slow that exiting from Subject mode takes a 539 (lambda ()
436long time, set the variable `gnus-newsgroup-headers' to nil. This 540 (gnus-summary-mark-as-unread gnus-current-article)
541 (gnus-summary-set-current-mark \"+\"))))")
542
543(defvar gnus-prepare-article-hook (function gnus-inews-insert-signature)
544 "*A hook called after preparing body, but before preparing header fields.
545The default hook (gnus-inews-insert-signature) inserts a signature
546file specified by the variable gnus-signature-file.")
547
548(defvar gnus-inews-article-hook (function gnus-inews-do-fcc)
549 "*A hook called before finally posting an article.
550The default hook (gnus-inews-do-fcc) does FCC processing (save article
551to a file).")
552
553(defvar gnus-exit-group-hook nil
554 "*A hook called when exiting (not quitting) Summary mode.
555If your machine is so slow that exiting from Summary mode takes very
556long time, set the variable gnus-use-cross-reference to nil. This
437inhibits marking articles as read using cross-reference information.") 557inhibits marking articles as read using cross-reference information.")
438 558
439(defvar gnus-Suspend-gnus-hook nil 559(defvar gnus-suspend-gnus-hook nil
440 "A hook called when suspending (not exiting) GNUS.") 560 "*A hook called when suspending (not exiting) GNUS.")
441 561
442(defvar gnus-Exit-gnus-hook nil 562(defvar gnus-exit-gnus-hook nil
443 "A hook called when exiting (not suspending) GNUS.") 563 "*A hook called when exiting (not suspending) GNUS.")
444 564
445(defvar gnus-Save-newsrc-hook nil 565(defvar gnus-save-newsrc-hook nil
446 "A hook called when saving the newsrc file. 566 "*A hook called when saving the newsrc file.
447This hook is called before saving .newsrc file.") 567This hook is called before saving .newsrc file.")
448 568
449(defvar gnus-your-domain nil 569
450 "*Your domain name without your host name like: \"stars.flab.Fujitsu.CO.JP\" 570;; Site dependent variables. You have to define these variables in
451The environment variable DOMAINNAME is used instead if defined. If 571;; site-init.el, default.el or your .emacs.
452the function `system-name' returns the full internet name, there is no 572
453need to define this variable.") 573(defvar gnus-local-timezone nil
454 574 "*Local time zone. Both styles, \"JST\" and +0900 are acceptable.
455(defvar gnus-your-organization nil 575If its value is non-nil, valid Date: field will be generated in terms
456 "*Your organization like: \"Fujitsu Laboratories Ltd., Kawasaki, Japan.\" 576of RFC822. In this case, timezone package must be installed.")
577
578(defvar gnus-local-domain nil
579 "*Local domain name without a host name like: \"stars.flab.Fujitsu.CO.JP\"
580The `DOMAINNAME' environment variable is used instead if defined. If
581the function (system-name) returns the full internet name, there is no
582need to define the name.")
583
584(defvar gnus-local-organization nil
585 "*Local organization like: \"Fujitsu Laboratories Ltd., Kawasaki, Japan.\"
457The `ORGANIZATION' environment variable is used instead if defined.") 586The `ORGANIZATION' environment variable is used instead if defined.")
458 587
588(defvar gnus-local-distributions '("local" "world")
589 "*List of distributions.
590The first element in the list is used as default. If distributions
591file is available, its content is also used.")
592
459(defvar gnus-use-generic-from nil 593(defvar gnus-use-generic-from nil
460 "*If nil, prepend local host name to the defined domain in the From: 594 "*If nil, prepend local host name to the defined domain in the From:
461field; if stringp, use this; if non-nil, strip of the local host name.") 595field; if stringp, use this; if non-nil, strip of the local host name.")
@@ -463,62 +597,73 @@ field; if stringp, use this; if non-nil, strip of the local host name.")
463(defvar gnus-use-generic-path nil 597(defvar gnus-use-generic-path nil
464 "*If nil, use the NNTP server name in the Path: field; if stringp, 598 "*If nil, use the NNTP server name in the Path: field; if stringp,
465use this; if non-nil, use no host name (user name only)") 599use this; if non-nil, use no host name (user name only)")
600
601(defvar gnus-info-directory Info-directory
602 "*A directory placing an Info file of GNUS.")
603
466 604
467;; Internal variables. 605;; Internal variables.
468 606
469(defconst gnus-version "GNUS 3.13" 607(defconst gnus-version "GNUS 3.15"
470 "Version numbers of this version of GNUS.") 608 "Version numbers of this version of GNUS.")
471 609
472(defvar gnus-Info-nodes 610(defvar gnus-info-nodes
473 '((gnus-Group-mode . "(gnus)Newsgroup Commands") 611 '((gnus-group-mode "(gnus)Newsgroup Commands")
474 (gnus-Subject-mode . "(gnus)Subject Commands") 612 (gnus-summary-mode "(gnus)Summary Commands")
475 (gnus-Article-mode . "(gnus)Article Commands") 613 (gnus-article-mode "(gnus)Article Commands")
476 (gnus-Kill-file-mode . "(gnus)KILL File") 614 (gnus-kill-file-mode "(gnus)KILL File")
477 (gnus-Browse-killed-mode . "(gnus)Maintenance")) 615 (gnus-browse-killed-mode "(gnus)Maintenance"))
478 "Assoc list of major modes and related Info nodes.") 616 "Assoc list of major modes and related Info nodes.")
479 617
618;; Alist syntax is different from that of 3.14.3.
480(defvar gnus-access-methods 619(defvar gnus-access-methods
481 '((nntp 620 '((nntp
482 (gnus-retrieve-headers . nntp-retrieve-headers) 621 (gnus-retrieve-headers nntp-retrieve-headers)
483 (gnus-open-server . nntp-open-server) 622 (gnus-open-server nntp-open-server)
484 (gnus-close-server . nntp-close-server) 623 (gnus-close-server nntp-close-server)
485 (gnus-server-opened . nntp-server-opened) 624 (gnus-server-opened nntp-server-opened)
486 (gnus-status-message . nntp-status-message) 625 (gnus-status-message nntp-status-message)
487 (gnus-request-article . nntp-request-article) 626 (gnus-request-article nntp-request-article)
488 (gnus-request-group . nntp-request-group) 627 (gnus-request-group nntp-request-group)
489 (gnus-request-list . nntp-request-list) 628 (gnus-request-list nntp-request-list)
490 (gnus-request-post . nntp-request-post)) 629 (gnus-request-list-newsgroups nntp-request-list-newsgroups)
630 (gnus-request-list-distributions nntp-request-list-distributions)
631 (gnus-request-post nntp-request-post))
491 (nnspool 632 (nnspool
492 (gnus-retrieve-headers . nnspool-retrieve-headers) 633 (gnus-retrieve-headers nnspool-retrieve-headers)
493 (gnus-open-server . nnspool-open-server) 634 (gnus-open-server nnspool-open-server)
494 (gnus-close-server . nnspool-close-server) 635 (gnus-close-server nnspool-close-server)
495 (gnus-server-opened . nnspool-server-opened) 636 (gnus-server-opened nnspool-server-opened)
496 (gnus-status-message . nnspool-status-message) 637 (gnus-status-message nnspool-status-message)
497 (gnus-request-article . nnspool-request-article) 638 (gnus-request-article nnspool-request-article)
498 (gnus-request-group . nnspool-request-group) 639 (gnus-request-group nnspool-request-group)
499 (gnus-request-list . nnspool-request-list) 640 (gnus-request-list nnspool-request-list)
500 (gnus-request-post . nnspool-request-post)) 641 (gnus-request-list-newsgroups nnspool-request-list-newsgroups)
642 (gnus-request-list-distributions nnspool-request-list-distributions)
643 (gnus-request-post nnspool-request-post))
501 (mhspool 644 (mhspool
502 (gnus-retrieve-headers . mhspool-retrieve-headers) 645 (gnus-retrieve-headers mhspool-retrieve-headers)
503 (gnus-open-server . mhspool-open-server) 646 (gnus-open-server mhspool-open-server)
504 (gnus-close-server . mhspool-close-server) 647 (gnus-close-server mhspool-close-server)
505 (gnus-server-opened . mhspool-server-opened) 648 (gnus-server-opened mhspool-server-opened)
506 (gnus-status-message . mhspool-status-message) 649 (gnus-status-message mhspool-status-message)
507 (gnus-request-article . mhspool-request-article) 650 (gnus-request-article mhspool-request-article)
508 (gnus-request-group . mhspool-request-group) 651 (gnus-request-group mhspool-request-group)
509 (gnus-request-list . mhspool-request-list) 652 (gnus-request-list mhspool-request-list)
510 (gnus-request-post . mhspool-request-post))) 653 (gnus-request-list-newsgroups mhspool-request-list-newsgroups)
654 (gnus-request-list-distributions mhspool-request-list-distributions)
655 (gnus-request-post mhspool-request-post)))
511 "Access method for NNTP, nnspool, and mhspool.") 656 "Access method for NNTP, nnspool, and mhspool.")
512 657
513(defvar gnus-Group-buffer "*Newsgroup*") 658(defvar gnus-group-buffer "*Newsgroup*")
514(defvar gnus-Subject-buffer "*Subject*") 659(defvar gnus-summary-buffer "*Summary*")
515(defvar gnus-Article-buffer "*Article*") 660(defvar gnus-article-buffer "*Article*")
516(defvar gnus-Digest-buffer "GNUS Digest") 661(defvar gnus-digest-buffer "GNUS Digest")
517(defvar gnus-Digest-summary-buffer "GNUS Digest-summary") 662(defvar gnus-digest-summary-buffer "GNUS Digest-summary")
518 663
519(defvar gnus-buffer-list 664(defvar gnus-buffer-list
520 (list gnus-Group-buffer gnus-Subject-buffer gnus-Article-buffer 665 (list gnus-group-buffer gnus-summary-buffer gnus-article-buffer
521 gnus-Digest-buffer gnus-Digest-summary-buffer) 666 gnus-digest-buffer gnus-digest-summary-buffer)
522 "GNUS buffer names which should be killed when exiting.") 667 "GNUS buffer names which should be killed when exiting.")
523 668
524(defvar gnus-variable-list 669(defvar gnus-variable-list
@@ -533,6 +678,8 @@ use this; if non-nil, use no host name (user name only)")
533 "Functions overloaded by gnus. 678 "Functions overloaded by gnus.
534It is a list of `(original overload &optional file)'.") 679It is a list of `(original overload &optional file)'.")
535 680
681(defvar gnus-distribution-list nil)
682
536(defvar gnus-newsrc-options nil 683(defvar gnus-newsrc-options nil
537 "Options line in the .newsrc file.") 684 "Options line in the .newsrc file.")
538 685
@@ -543,13 +690,25 @@ It is a list of `(original overload &optional file)'.")
543 "Regexp representing unsubscribed newsgroups.") 690 "Regexp representing unsubscribed newsgroups.")
544 691
545(defvar gnus-newsrc-assoc nil 692(defvar gnus-newsrc-assoc nil
546 "Assoc list of read articles.") 693 "Assoc list of read articles.
694gnus-newsrc-hashtb should be kept so that both hold the same information.")
695
696(defvar gnus-newsrc-hashtb nil
697 "Hashtable of gnus-newsrc-assoc.")
547 698
548(defvar gnus-killed-assoc nil 699(defvar gnus-killed-assoc nil
549 "Assoc list of newsgroups removed from `gnus-newsrc-assoc'.") 700 "Assoc list of newsgroups removed from gnus-newsrc-assoc.
701gnus-killed-hashtb should be kept so that both hold the same information.")
702
703(defvar gnus-killed-hashtb nil
704 "Hashtable of gnus-killed-assoc.")
550 705
551(defvar gnus-marked-assoc nil 706(defvar gnus-marked-assoc nil
552 "Assoc list of articles marked as unread.") 707 "Assoc list of articles marked as unread.
708gnus-marked-hashtb should be kept so that both hold the same information.")
709
710(defvar gnus-marked-hashtb nil
711 "Hashtable of gnus-marked-assoc.")
553 712
554(defvar gnus-unread-hashtb nil 713(defvar gnus-unread-hashtb nil
555 "Hashtable of unread articles.") 714 "Hashtable of unread articles.")
@@ -589,51 +748,70 @@ It is a list of `(original overload &optional file)'.")
589 "List of marked articles in the current newsgroup (a subset of unread art).") 748 "List of marked articles in the current newsgroup (a subset of unread art).")
590 749
591(defvar gnus-newsgroup-headers nil 750(defvar gnus-newsgroup-headers nil
592 "List of article headers in the current newsgroup.") 751 "List of article headers in the current newsgroup.
752If the variable is modified (added or deleted), the function
753gnus-clear-hashtables-for-newsgroup-headers must be called to clear
754the hash tables.")
755(defvar gnus-newsgroup-headers-hashtb-by-id nil)
756(defvar gnus-newsgroup-headers-hashtb-by-number nil)
593 757
594(defvar gnus-current-article nil) 758(defvar gnus-current-article nil)
595(defvar gnus-current-headers nil) 759(defvar gnus-current-headers nil)
596(defvar gnus-current-history nil) 760(defvar gnus-current-history nil)
597(defvar gnus-have-all-headers nil) 761(defvar gnus-have-all-headers nil "Must be either T or NIL.")
598(defvar gnus-last-article nil) 762(defvar gnus-last-article nil)
599(defvar gnus-current-kill-article nil) 763(defvar gnus-current-kill-article nil)
600 764
601;; Save window configuration. 765;; Save window configuration.
602(defvar gnus-winconf-kill-file nil) 766(defvar gnus-winconf-kill-file nil)
603 767
604(defvar gnus-Group-mode-map nil) 768(defvar gnus-group-mode-map nil)
605(defvar gnus-Subject-mode-map nil) 769(defvar gnus-summary-mode-map nil)
606(defvar gnus-Article-mode-map nil) 770(defvar gnus-article-mode-map nil)
607(defvar gnus-Kill-file-mode-map nil) 771(defvar gnus-kill-file-mode-map nil)
608 772
609(defvar rmail-last-file (expand-file-name "~/XMBOX")) 773(defvar rmail-last-file (expand-file-name "~/XMBOX"))
610(defvar rmail-last-rmail-file (expand-file-name "~/XNEWS")) 774(defvar rmail-last-rmail-file (expand-file-name "~/XNEWS"))
611 775
612;; Define GNUS Subsystems. 776;; Define GNUS Subsystems.
613(autoload 'gnus-Group-post-news "gnuspost" 777(autoload 'gnus-group-post-news "gnuspost"
614 "Post an article." t) 778 "Post an article." t)
615(autoload 'gnus-Subject-post-news "gnuspost" 779(autoload 'gnus-summary-post-news "gnuspost"
616 "Post an article." t) 780 "Post an article." t)
617(autoload 'gnus-Subject-post-reply "gnuspost" 781(autoload 'gnus-summary-followup "gnuspost"
618 "Post a reply article." t) 782 "Post a reply article." t)
619(autoload 'gnus-Subject-post-reply-with-original "gnuspost" 783(autoload 'gnus-summary-followup-with-original "gnuspost"
620 "Post a reply article with original article." t) 784 "Post a reply article with original article." t)
621(autoload 'gnus-Subject-cancel-article "gnuspost" 785(autoload 'gnus-summary-cancel-article "gnuspost"
622 "Cancel an article you posted." t) 786 "Cancel an article you posted." t)
623 787
624(autoload 'gnus-Subject-mail-reply "gnusmail" 788(autoload 'gnus-summary-reply "gnusmail"
625 "Reply mail to news author." t) 789 "Reply mail to news author." t)
626(autoload 'gnus-Subject-mail-reply-with-original "gnusmail" 790(autoload 'gnus-summary-reply-with-original "gnusmail"
627 "Reply mail to news author with original article." t) 791 "Reply mail to news author with original article." t)
628(autoload 'gnus-Subject-mail-other-window "gnusmail" 792(autoload 'gnus-summary-mail-forward "gnusmail"
793 "Forward the current message to another user." t)
794(autoload 'gnus-summary-mail-other-window "gnusmail"
629 "Compose mail in other window." t) 795 "Compose mail in other window." t)
630 796
631(autoload 'gnus-Group-kill-group "gnusmisc" 797(autoload 'gnus-group-kill-group "gnusmisc"
632 "Kill newsgroup on current line." t) 798 "Kill newsgroup on current line." t)
633(autoload 'gnus-Group-yank-group "gnusmisc" 799(autoload 'gnus-group-yank-group "gnusmisc"
634 "Yank the last killed newsgroup on current line." t) 800 "Yank the last killed newsgroup on current line." t)
635(autoload 'gnus-Browse-killed-groups "gnusmisc" 801(autoload 'gnus-group-kill-region "gnusmisc"
636 "Browse the killed newsgroups." t) 802 "Kill newsgroups in current region." t)
803(autoload 'gnus-group-transpose-groups "gnusmisc"
804 "Exchange current newsgroup and previous newsgroup." t)
805(autoload 'gnus-list-killed-groups "gnusmisc"
806 "List the killed newsgroups." t)
807(autoload 'gnus-gmt-to-local "gnusmisc"
808 "Rewrite Date field in GMT to local in current buffer.")
809
810(autoload 'metamail-buffer "metamail"
811 "Process current buffer through 'metamail'." t)
812
813(autoload 'timezone-make-sortable-date "timezone")
814(autoload 'timezone-parse-date "timezone")
637 815
638(autoload 'rmail-output "rmailout" 816(autoload 'rmail-output "rmailout"
639 "Append this message to Unix mail file named FILE-NAME." t) 817 "Append this message to Unix mail file named FILE-NAME." t)
@@ -641,12 +819,12 @@ It is a list of `(original overload &optional file)'.")
641(autoload 'mh-find-path "mh-e") 819(autoload 'mh-find-path "mh-e")
642(autoload 'mh-prompt-for-folder "mh-e") 820(autoload 'mh-prompt-for-folder "mh-e")
643 821
644(put 'gnus-Group-mode 'mode-class 'special) 822(put 'gnus-group-mode 'mode-class 'special)
645(put 'gnus-Subject-mode 'mode-class 'special) 823(put 'gnus-summary-mode 'mode-class 'special)
646(put 'gnus-Article-mode 'mode-class 'special) 824(put 'gnus-article-mode 'mode-class 'special)
647 825
648 826
649;;(put 'gnus-eval-in-buffer-window 'lisp-indent-function 1) 827;;(put 'gnus-eval-in-buffer-window 'lisp-indent-hook 1)
650 828
651(defmacro gnus-eval-in-buffer-window (buffer &rest forms) 829(defmacro gnus-eval-in-buffer-window (buffer &rest forms)
652 "Pop to BUFFER, evaluate FORMS, and then returns to original window." 830 "Pop to BUFFER, evaluate FORMS, and then returns to original window."
@@ -657,13 +835,16 @@ It is a list of `(original overload &optional file)'.")
657 (,@ forms)) 835 (,@ forms))
658 (select-window GNUSStartBufferWindow))))) 836 (select-window GNUSStartBufferWindow)))))
659 837
660(defmacro gnus-make-hashtable () 838(defmacro gnus-make-hashtable (&optional hashsize)
661 '(make-abbrev-table)) 839 "Make a hash table (default and minimum size is 200).
840Optional argument HASHSIZE specifies the table size."
841 (` (make-vector (, (if hashsize (` (max (, hashsize) 200)) 200)) 0)))
662 842
663(defmacro gnus-gethash (string hashtable) 843(defmacro gnus-gethash (string hashtable)
664 "Get hash value of STRING in HASHTABLE." 844 "Get hash value of STRING in HASHTABLE."
665 ;;(` (symbol-value (abbrev-symbol (, string) (, hashtable)))) 845 ;;(` (symbol-value (abbrev-symbol (, string) (, hashtable))))
666 (` (abbrev-expansion (, string) (, hashtable)))) 846 ;;(` (abbrev-expansion (, string) (, hashtable)))
847 (` (symbol-value (intern-soft (, string) (, hashtable)))))
667 848
668(defmacro gnus-sethash (string value hashtable) 849(defmacro gnus-sethash (string value hashtable)
669 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE." 850 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
@@ -743,54 +924,91 @@ It is a list of `(original overload &optional file)'.")
743;;; GNUS Group Mode 924;;; GNUS Group Mode
744;;; 925;;;
745 926
746(if gnus-Group-mode-map 927(if gnus-group-mode-map
747 nil 928 nil
748 (setq gnus-Group-mode-map (make-keymap)) 929 (setq gnus-group-mode-map (make-keymap))
749 (suppress-keymap gnus-Group-mode-map) 930 (suppress-keymap gnus-group-mode-map)
750 (define-key gnus-Group-mode-map " " 'gnus-Group-read-group) 931 (define-key gnus-group-mode-map " " 'gnus-group-read-group)
751 (define-key gnus-Group-mode-map "=" 'gnus-Group-select-group) 932 (define-key gnus-group-mode-map "=" 'gnus-group-select-group)
752 (define-key gnus-Group-mode-map "j" 'gnus-Group-jump-to-group) 933 (define-key gnus-group-mode-map "j" 'gnus-group-jump-to-group)
753 (define-key gnus-Group-mode-map "n" 'gnus-Group-next-unread-group) 934 (define-key gnus-group-mode-map "n" 'gnus-group-next-unread-group)
754 (define-key gnus-Group-mode-map "p" 'gnus-Group-prev-unread-group) 935 (define-key gnus-group-mode-map "p" 'gnus-group-prev-unread-group)
755 (define-key gnus-Group-mode-map "\177" 'gnus-Group-prev-unread-group) 936 (define-key gnus-group-mode-map "\177" 'gnus-group-prev-unread-group)
756 (define-key gnus-Group-mode-map "N" 'gnus-Group-next-group) 937 (define-key gnus-group-mode-map "N" 'gnus-group-next-group)
757 (define-key gnus-Group-mode-map "P" 'gnus-Group-prev-group) 938 (define-key gnus-group-mode-map "P" 'gnus-group-prev-group)
758 (define-key gnus-Group-mode-map "\C-n" 'gnus-Group-next-group) 939 (define-key gnus-group-mode-map "\C-n" 'gnus-group-next-group)
759 (define-key gnus-Group-mode-map "\C-p" 'gnus-Group-prev-group) 940 (define-key gnus-group-mode-map "\C-p" 'gnus-group-prev-group)
760 (define-key gnus-Group-mode-map "\r" 'next-line) 941 (define-key gnus-group-mode-map "\r" 'next-line)
761 (define-key gnus-Group-mode-map "/" 'isearch-forward) 942 ;;(define-key gnus-group-mode-map "/" 'isearch-forward)
762 (define-key gnus-Group-mode-map "<" 'beginning-of-buffer) 943 (define-key gnus-group-mode-map "<" 'beginning-of-buffer)
763 (define-key gnus-Group-mode-map ">" 'end-of-buffer) 944 (define-key gnus-group-mode-map ">" 'end-of-buffer)
764 (define-key gnus-Group-mode-map "u" 'gnus-Group-unsubscribe-current-group) 945 (define-key gnus-group-mode-map "u" 'gnus-group-unsubscribe-current-group)
765 (define-key gnus-Group-mode-map "U" 'gnus-Group-unsubscribe-group) 946 (define-key gnus-group-mode-map "U" 'gnus-group-unsubscribe-group)
766 (define-key gnus-Group-mode-map "c" 'gnus-Group-catch-up) 947 (define-key gnus-group-mode-map "c" 'gnus-group-catchup)
767 (define-key gnus-Group-mode-map "C" 'gnus-Group-catch-up-all) 948 (define-key gnus-group-mode-map "C" 'gnus-group-catchup-all)
768 (define-key gnus-Group-mode-map "l" 'gnus-Group-list-groups) 949 (define-key gnus-group-mode-map "l" 'gnus-group-list-groups)
769 (define-key gnus-Group-mode-map "L" 'gnus-Group-list-all-groups) 950 (define-key gnus-group-mode-map "L" 'gnus-group-list-all-groups)
770 (define-key gnus-Group-mode-map "g" 'gnus-Group-get-new-news) 951 (define-key gnus-group-mode-map "g" 'gnus-group-get-new-news)
771 (define-key gnus-Group-mode-map "R" 'gnus-Group-restart) 952 (define-key gnus-group-mode-map "R" 'gnus-group-restart)
772 (define-key gnus-Group-mode-map "b" 'gnus-Group-check-bogus-groups) 953 (define-key gnus-group-mode-map "b" 'gnus-group-check-bogus-groups)
773 (define-key gnus-Group-mode-map "r" 'gnus-Group-restrict-groups) 954 (define-key gnus-group-mode-map "r" 'gnus-group-restrict-groups)
774 (define-key gnus-Group-mode-map "a" 'gnus-Group-post-news) 955 (define-key gnus-group-mode-map "a" 'gnus-group-post-news)
775 (define-key gnus-Group-mode-map "\ek" 'gnus-Group-edit-local-kill) 956 (define-key gnus-group-mode-map "\ek" 'gnus-group-edit-local-kill)
776 (define-key gnus-Group-mode-map "\eK" 'gnus-Group-edit-global-kill) 957 (define-key gnus-group-mode-map "\eK" 'gnus-group-edit-global-kill)
777 (define-key gnus-Group-mode-map "\C-k" 'gnus-Group-kill-group) 958 (define-key gnus-group-mode-map "\C-k" 'gnus-group-kill-group)
778 (define-key gnus-Group-mode-map "\C-y" 'gnus-Group-yank-group) 959 (define-key gnus-group-mode-map "\C-y" 'gnus-group-yank-group)
779 (define-key gnus-Group-mode-map "\C-c\C-y" 'gnus-Browse-killed-groups) 960 (define-key gnus-group-mode-map "\C-w" 'gnus-group-kill-region)
780 (define-key gnus-Group-mode-map "V" 'gnus-version) 961 (define-key gnus-group-mode-map "\C-x\C-t" 'gnus-group-transpose-groups)
781 (define-key gnus-Group-mode-map "x" 'gnus-Group-force-update) 962 (define-key gnus-group-mode-map "\C-c\C-l" 'gnus-list-killed-groups)
782 (define-key gnus-Group-mode-map "s" 'gnus-Group-force-update) 963 (define-key gnus-group-mode-map "V" 'gnus-version)
783 (define-key gnus-Group-mode-map "z" 'gnus-Group-suspend) 964 ;;(define-key gnus-group-mode-map "x" 'gnus-group-force-update)
784 (define-key gnus-Group-mode-map "q" 'gnus-Group-exit) 965 (define-key gnus-group-mode-map "s" 'gnus-group-force-update)
785 (define-key gnus-Group-mode-map "Q" 'gnus-Group-quit) 966 (define-key gnus-group-mode-map "z" 'gnus-group-suspend)
786 (define-key gnus-Group-mode-map "?" 'gnus-Group-describe-briefly) 967 (define-key gnus-group-mode-map "q" 'gnus-group-exit)
787 (define-key gnus-Group-mode-map "\C-c\C-i" 'gnus-Info-find-node)) 968 (define-key gnus-group-mode-map "Q" 'gnus-group-quit)
788 969 (define-key gnus-group-mode-map "?" 'gnus-group-describe-briefly)
789(defun gnus-Group-mode () 970 (define-key gnus-group-mode-map "\C-c\C-i" 'gnus-info-find-node))
971
972(defun gnus-group-mode ()
790 "Major mode for reading network news. 973 "Major mode for reading network news.
791All normal editing commands are turned off. 974All normal editing commands are turned off.
792Instead, these commands are available: 975Instead, these commands are available:
793\\{gnus-Group-mode-map} 976
977SPC Read articles in this newsgroup.
978= Select this newsgroup.
979j Move to the specified newsgroup.
980n Move to the next unread newsgroup.
981p Move to the previous unread newsgroup.
982C-n Move to the next newsgroup.
983C-p Move to the previous newsgroup.
984< Move point to the beginning of this buffer.
985> Move point to the end of this buffer.
986u Unsubscribe from (subscribe to) this newsgroup.
987U Unsubscribe from (subscribe to) the specified newsgroup.
988c Mark all articles as read, preserving marked articles.
989C Mark all articles in this newsgroup as read.
990l Revert this buffer.
991L List all newsgroups.
992g Get new news.
993R Force to read the raw .newsrc file and get new news.
994b Check bogus newsgroups.
995r Restrict visible newsgroups to the current region.
996a Post a new article.
997ESC k Edit a local KILL file applied to this newsgroup.
998ESC K Edit a global KILL file applied to all newsgroups.
999C-k Kill this newsgroup.
1000C-y Yank killed newsgroup here.
1001C-w Kill newsgroups in current region (excluding current point).
1002C-x C-t Exchange this newsgroup and previous newsgroup.
1003C-c C-l list killed newsgroups.
1004s Save .newsrc file.
1005z Suspend reading news.
1006q Quit reading news.
1007Q Quit reading news without saving .newsrc file.
1008V Show the version number of this GNUS.
1009? Describe Group Mode commands briefly.
1010C-h m Describe Group Mode.
1011C-c C-i Read Info about Group Mode.
794 1012
795 The name of the host running NNTP server is asked for if no default 1013 The name of the host running NNTP server is asked for if no default
796host is specified. It is also possible to choose another NNTP server 1014host is specified. It is also possible to choose another NNTP server
@@ -820,7 +1038,7 @@ DISTRIBUTION.
820 1038
821 If an Info file generated from `gnus.texinfo' is installed, you can 1039 If an Info file generated from `gnus.texinfo' is installed, you can
822read an appropriate Info node of the Info file according to the 1040read an appropriate Info node of the Info file according to the
823current major mode of GNUS by \\[gnus-Info-find-node]. 1041current major mode of GNUS by \\[gnus-info-find-node].
824 1042
825 The variable `gnus-version', `nntp-version', `nnspool-version', and 1043 The variable `gnus-version', `nntp-version', `nnspool-version', and
826`mhspool-version' have the version numbers of this version of gnus.el, 1044`mhspool-version' have the version numbers of this version of gnus.el,
@@ -830,27 +1048,27 @@ User customizable variables:
830 gnus-nntp-server 1048 gnus-nntp-server
831 Specifies the name of the host running the NNTP server. If its 1049 Specifies the name of the host running the NNTP server. If its
832 value is a string such as `:DIRECTORY', the user's private 1050 value is a string such as `:DIRECTORY', the user's private
833 DIRECTORY is used as a news spool. If its value is `::', then 1051 DIRECTORY is used as a news spool. The variable is initialized
834 the local news spool on the current machine is used directly. 1052 from the NNTPSERVER environment variable.
835 The `NNTPSERVER' environment variable specifies the initial value
836 for this variable.
837 1053
838 gnus-nntp-service 1054 gnus-nntp-service
839 Specifies a NNTP service name. It is usually \"nntp\". 1055 Specifies a NNTP service name. It is usually \"nntp\" or 119.
1056 Nil forces GNUS to use a local news spool if the variable
1057 `gnus-nntp-server' is set to the local host name.
840 1058
841 gnus-startup-file 1059 gnus-startup-file
842 Specifies a startup file (.newsrc). If there is a file named 1060 Specifies a startup file (.newsrc). If there is a file named
843 `.newsrc-SERVER', it's used instead when talking to SERVER. I 1061 `.newsrc-SERVER', it's used instead when talking to SERVER. I
844 recommend you to use the server specific file, if you'd like to 1062 recommend you to use the server specific file, if you'd like to
845 talk to many servers. Especially if you'd like to read your 1063 talk to many servers. Especially if you'd like to read your
846 private directory, the name of the file must be 1064 private directory, the name of the file must be
847 `.newsrc-:DIRECTORY'. 1065 `.newsrc-:DIRECTORY'.
848 1066
849 gnus-signature-file 1067 gnus-signature-file
850 Specifies a signature file (.signature). If there is a file named 1068 Specifies a signature file (.signature). If there is a file named
851 `.signature-DISTRIBUTION', it's used instead when posting an 1069 `.signature-DISTRIBUTION', it's used instead when posting an
852 article in DISTRIBUTION. Set the variable to nil to prevent 1070 article in DISTRIBUTION. Set the variable to nil to prevent
853 appending the file automatically. If you use an NNTP inews which 1071 appending the file automatically. If you use an NNTP inews which
854 comes with the NNTP package, you may have to set the variable to 1072 comes with the NNTP package, you may have to set the variable to
855 nil. 1073 nil.
856 1074
@@ -894,48 +1112,54 @@ User customizable variables:
894 Non-nil means to take up the entire screen of Emacs. 1112 Non-nil means to take up the entire screen of Emacs.
895 1113
896 gnus-window-configuration 1114 gnus-window-configuration
897 Specifies the configuration of Group, Subject, and Article 1115 Specifies the configuration of Group, Summary, and Article
898 windows. It is a list of (ACTION (G S A)), where G, S, and A are 1116 windows. It is a list of (ACTION (G S A)), where G, S, and A are
899 the relative height of Group, Subject, and Article windows, 1117 the relative height of Group, Summary, and Article windows,
900 respectively. ACTION is `SelectNewsgroup', `ExitNewsgroup', 1118 respectively. ACTION is `summary', `newsgroups', or `article'.
901 `SelectArticle', or `ExpandSubject'.
902 1119
903 gnus-subscribe-newsgroup-method 1120 gnus-subscribe-newsgroup-method
904 Specifies a function called with a newsgroup name when new 1121 Specifies a function called with a newsgroup name when new
905 newsgroup is found. The default definition adds new newsgroup at 1122 newsgroup is found. The default definition adds new newsgroup at
906 the beginning of other newsgroups. 1123 the beginning of other newsgroups.
907 1124
1125 And more and more. Please refer to texinfo documentation.
1126
908Various hooks for customization: 1127Various hooks for customization:
909 gnus-Group-mode-hook 1128 gnus-group-mode-hook
910 Entry to this mode calls the value with no arguments, if that 1129 Entry to this mode calls the value with no arguments, if that
911 value is non-nil. This hook is called before GNUS is connected to 1130 value is non-nil. This hook is called before GNUS is connected to
912 the NNTP server. So, you can change or define the NNTP server in 1131 the NNTP server. So, you can change or define the NNTP server in
913 this hook. 1132 this hook.
914 1133
915 gnus-Startup-hook 1134 gnus-startup-hook
916 Called with no arguments after the NNTP server is selected. It is 1135 Called with no arguments after the NNTP server is selected. It is
917 possible to change the behavior of GNUS or initialize the 1136 possible to change the behavior of GNUS or initialize the
918 variables according to the selected NNTP server. 1137 variables according to the selected NNTP server.
919 1138
920 gnus-Group-prepare-hook 1139 gnus-group-prepare-hook
921 Called with no arguments after a newsgroup list is created in the 1140 Called with no arguments after a newsgroup list is created in the
922 Newsgroup buffer, if that value is non-nil. 1141 Newsgroup buffer, if that value is non-nil.
923 1142
924 gnus-Save-newsrc-hook 1143 gnus-save-newsrc-hook
925 Called with no arguments when saving newsrc file if that value is 1144 Called with no arguments when saving newsrc file if that value is
926 non-nil. 1145 non-nil.
927 1146
928 gnus-Inews-article-hook 1147 gnus-prepare-article-hook
1148 Called with no arguments after preparing message body, but before
1149 preparing header fields which is automatically generated if that
1150 value is non-nil. The default hook (gnus-inews-insert-signature)
1151 inserts a signature file.
1152
1153 gnus-inews-article-hook
929 Called with no arguments when posting an article if that value is 1154 Called with no arguments when posting an article if that value is
930 non-nil. This hook is called just before posting an article, while 1155 non-nil. This hook is called just before posting an article. The
931 `news-inews-hook' is called before preparing article headers. If 1156 default hook does FCC (save an article to the specified file).
932 you'd like to convert kanji code of the article, this hook is recommended.
933 1157
934 gnus-Suspend-gnus-hook 1158 gnus-suspend-gnus-hook
935 Called with no arguments when suspending (not exiting) GNUS, if 1159 Called with no arguments when suspending (not exiting) GNUS, if
936 that value is non-nil. 1160 that value is non-nil.
937 1161
938 gnus-Exit-gnus-hook 1162 gnus-exit-gnus-hook
939 Called with no arguments when exiting (not suspending) GNUS, if 1163 Called with no arguments when exiting (not suspending) GNUS, if
940 that value is non-nil." 1164 that value is non-nil."
941 (interactive) 1165 (interactive)
@@ -949,14 +1173,14 @@ Various hooks for customization:
949 (t 1173 (t
950 (setq mode-line-format 1174 (setq mode-line-format
951 "--- GNUS: List of Newsgroups %[(%m)%]----%3p-%-"))) 1175 "--- GNUS: List of Newsgroups %[(%m)%]----%3p-%-")))
952 (setq major-mode 'gnus-Group-mode) 1176 (setq major-mode 'gnus-group-mode)
953 (setq mode-name "Newsgroup") 1177 (setq mode-name "Newsgroup")
954 (setq mode-line-buffer-identification "GNUS: List of Newsgroups") 1178 (setq mode-line-buffer-identification "GNUS: List of Newsgroups")
955 (setq mode-line-process nil) 1179 (setq mode-line-process nil)
956 (use-local-map gnus-Group-mode-map) 1180 (use-local-map gnus-group-mode-map)
957 (buffer-disable-undo (current-buffer)) 1181 (buffer-flush-undo (current-buffer))
958 (setq buffer-read-only t) ;Disable modification 1182 (setq buffer-read-only t) ;Disable modification
959 (run-hooks 'gnus-Group-mode-hook)) 1183 (run-hooks 'gnus-group-mode-hook))
960 1184
961;;;###autoload 1185;;;###autoload
962(defun gnus (&optional confirm) 1186(defun gnus (&optional confirm)
@@ -965,29 +1189,29 @@ If optional argument CONFIRM is non-nil, ask NNTP server."
965 (interactive "P") 1189 (interactive "P")
966 (unwind-protect 1190 (unwind-protect
967 (progn 1191 (progn
968 (switch-to-buffer (get-buffer-create gnus-Group-buffer)) 1192 (switch-to-buffer (get-buffer-create gnus-group-buffer))
969 (gnus-Group-mode) 1193 (gnus-group-mode)
970 (gnus-start-news-server confirm)) 1194 (gnus-start-news-server confirm))
971 (if (not (gnus-server-opened)) 1195 (if (not (gnus-server-opened))
972 (gnus-Group-quit) 1196 (gnus-group-quit)
973 ;; NNTP server is successfully open. 1197 ;; NNTP server is successfully open.
974 (setq mode-line-process (format " {%s}" gnus-nntp-server)) 1198 (setq mode-line-process (format " {%s}" gnus-nntp-server))
975 (let ((buffer-read-only nil)) 1199 (let ((buffer-read-only nil))
976 (erase-buffer) 1200 (erase-buffer)
977 (gnus-Group-startup-message) 1201 (gnus-group-startup-message)
978 (sit-for 0)) 1202 (sit-for 0))
979 (run-hooks 'gnus-Startup-hook) 1203 (run-hooks 'gnus-startup-hook)
980 (gnus-setup-news-info) 1204 (gnus-setup-news)
981 (if gnus-novice-user 1205 (if gnus-novice-user
982 (gnus-Group-describe-briefly)) ;Show brief help message. 1206 (gnus-group-describe-briefly)) ;Show brief help message.
983 (gnus-Group-list-groups nil) 1207 (gnus-group-list-groups nil)
984 ))) 1208 )))
985 1209
986(defun gnus-Group-startup-message () 1210(defun gnus-group-startup-message ()
987 "Insert startup message in current buffer." 1211 "Insert startup message in current buffer."
988 ;; Insert the message. 1212 ;; Insert the message.
989 (insert " 1213 (insert "
990 GNUS Version 3.13 1214 GNUS Version 3.15
991 1215
992 NNTP-based News Reader for GNU Emacs 1216 NNTP-based News Reader for GNU Emacs
993 1217
@@ -998,7 +1222,7 @@ know. I will fix your problems in the next release.
998Comments, suggestions, and bug fixes are welcome. 1222Comments, suggestions, and bug fixes are welcome.
999 1223
1000Masanobu UMEDA 1224Masanobu UMEDA
1001umerin@tc.Nagasaki.GO.JP") 1225umerin@mse.kyutech.ac.jp")
1002 ;; And then hack it. 1226 ;; And then hack it.
1003 ;; 57 is the longest line. 1227 ;; 57 is the longest line.
1004 (indent-rigidly (point-min) (point-max) (/ (max (- (window-width) 57) 0) 2)) 1228 (indent-rigidly (point-min) (point-max) (/ (max (- (window-width) 57) 0) 2))
@@ -1006,42 +1230,41 @@ umerin@tc.Nagasaki.GO.JP")
1006 ;; +4 is fuzzy factor. 1230 ;; +4 is fuzzy factor.
1007 (insert-char ?\n (/ (max (- (window-height) 18) 0) 2))) 1231 (insert-char ?\n (/ (max (- (window-height) 18) 0) 2)))
1008 1232
1009(defun gnus-Group-list-groups (show-all) 1233(defun gnus-group-list-groups (show-all)
1010 "List newsgroups in the Newsgroup buffer. 1234 "List newsgroups in the Newsgroup buffer.
1011If argument SHOW-ALL is non-nil, unsubscribed groups are also listed." 1235If argument SHOW-ALL is non-nil, unsubscribed groups are also listed."
1012 (interactive "P") 1236 (interactive "P")
1013 (let ((last-group ;Current newsgroup. 1237 (let ((case-fold-search nil)
1014 (gnus-Group-group-name)) 1238 (last-group ;Current newsgroup.
1239 (gnus-group-group-name))
1015 (next-group ;Next possible newsgroup. 1240 (next-group ;Next possible newsgroup.
1016 (progn 1241 (progn
1017 (gnus-Group-search-forward nil nil) 1242 (gnus-group-search-forward nil nil)
1018 (gnus-Group-group-name))) 1243 (gnus-group-group-name)))
1019 (prev-group ;Previous possible newsgroup. 1244 (prev-group ;Previous possible newsgroup.
1020 (progn 1245 (progn
1021 (gnus-Group-search-forward t nil) 1246 (gnus-group-search-forward t nil)
1022 (gnus-Group-group-name)))) 1247 (gnus-group-group-name))))
1023 (gnus-Group-prepare show-all) 1248 (set-buffer gnus-group-buffer) ;May call from out of Group buffer
1249 (gnus-group-prepare show-all)
1024 (if (zerop (buffer-size)) 1250 (if (zerop (buffer-size))
1025 (message "No news is good news") 1251 (message "No news is good news")
1026 ;; Go to last newsgroup if possible. If cannot, try next and 1252 ;; Go to last newsgroup if possible. If cannot, try next and
1027 ;; previous. If all fail, go to first unread newsgroup. 1253 ;; previous. If all fail, go to first unread newsgroup.
1028 (goto-char (point-min)) 1254 (goto-char (point-min))
1029 (or (and last-group 1255 (or (and last-group
1030 (re-search-forward 1256 (re-search-forward (gnus-group-make-regexp last-group) nil t))
1031 (concat "^.+: " (regexp-quote last-group) "$") nil t))
1032 (and next-group 1257 (and next-group
1033 (re-search-forward 1258 (re-search-forward (gnus-group-make-regexp next-group) nil t))
1034 (concat "^.+: " (regexp-quote next-group) "$") nil t))
1035 (and prev-group 1259 (and prev-group
1036 (re-search-forward 1260 (re-search-forward (gnus-group-make-regexp prev-group) nil t))
1037 (concat "^.+: " (regexp-quote prev-group) "$") nil t)) 1261 (gnus-group-search-forward nil nil t))
1038 (re-search-forward "^[ \t]+[1-9][0-9]*:" nil t))
1039 ;; Adjust cursor point. 1262 ;; Adjust cursor point.
1040 (beginning-of-line) 1263 (beginning-of-line)
1041 (search-forward ":" nil t) 1264 (search-forward ":" nil t)
1042 ))) 1265 )))
1043 1266
1044(defun gnus-Group-prepare (&optional all) 1267(defun gnus-group-prepare (&optional all)
1045 "Prepare list of newsgroups in current buffer. 1268 "Prepare list of newsgroups in current buffer.
1046If optional argument ALL is non-nil, unsubscribed groups are also listed." 1269If optional argument ALL is non-nil, unsubscribed groups are also listed."
1047 (let ((buffer-read-only nil) 1270 (let ((buffer-read-only nil)
@@ -1060,7 +1283,7 @@ If optional argument ALL is non-nil, unsubscribed groups are also listed."
1060 (if (or all 1283 (if (or all
1061 (and (nth 1 group-info) ;Subscribed. 1284 (and (nth 1 group-info) ;Subscribed.
1062 (> unread-count 0))) ;There are unread articles. 1285 (> unread-count 0))) ;There are unread articles.
1063 ;; Yes, I can use gnus-Group-prepare-line, but this is faster. 1286 ;; Yes, I can use gnus-group-prepare-line, but this is faster.
1064 (insert 1287 (insert
1065 (format cntl 1288 (format cntl
1066 ;; Subscribed or not. 1289 ;; Subscribed or not.
@@ -1070,8 +1293,8 @@ If optional argument ALL is non-nil, unsubscribed groups are also listed."
1070 (>= 0 1293 (>= 0
1071 (- unread-count 1294 (- unread-count
1072 (length 1295 (length
1073 (cdr (assoc group-name 1296 (cdr (gnus-gethash group-name
1074 gnus-marked-assoc)))))) 1297 gnus-marked-hashtb))))))
1075 "*" " ") 1298 "*" " ")
1076 ;; Number of unread articles. 1299 ;; Number of unread articles.
1077 unread-count 1300 unread-count
@@ -1082,10 +1305,10 @@ If optional argument ALL is non-nil, unsubscribed groups are also listed."
1082 ) 1305 )
1083 (setq gnus-have-all-newsgroups all) 1306 (setq gnus-have-all-newsgroups all)
1084 (goto-char (point-min)) 1307 (goto-char (point-min))
1085 (run-hooks 'gnus-Group-prepare-hook) 1308 (run-hooks 'gnus-group-prepare-hook)
1086 )) 1309 ))
1087 1310
1088(defun gnus-Group-prepare-line (info) 1311(defun gnus-group-prepare-line (info)
1089 "Return a string for the Newsgroup buffer from INFO. 1312 "Return a string for the Newsgroup buffer from INFO.
1090INFO is an element of gnus-newsrc-assoc or gnus-killed-assoc." 1313INFO is an element of gnus-newsrc-assoc or gnus-killed-assoc."
1091 (let* ((group-name (car info)) 1314 (let* ((group-name (car info))
@@ -1106,7 +1329,8 @@ INFO is an element of gnus-newsrc-assoc or gnus-killed-assoc."
1106 (>= 0 1329 (>= 0
1107 (- unread-count 1330 (- unread-count
1108 (length 1331 (length
1109 (cdr (assoc group-name gnus-marked-assoc)))))) 1332 (cdr (gnus-gethash group-name
1333 gnus-marked-hashtb))))))
1110 "*" " ") 1334 "*" " ")
1111 ;; Number of unread articles. 1335 ;; Number of unread articles.
1112 unread-count 1336 unread-count
@@ -1114,181 +1338,211 @@ INFO is an element of gnus-newsrc-assoc or gnus-killed-assoc."
1114 group-name 1338 group-name
1115 ))) 1339 )))
1116 1340
1117(defun gnus-Group-update-group (group &optional visible-only) 1341(defun gnus-group-update-group (group &optional visible-only)
1118 "Update newsgroup info of GROUP. 1342 "Update newsgroup info of GROUP.
1119If optional argument VISIBLE-ONLY is non-nil, non displayed group is ignored." 1343If optional argument VISIBLE-ONLY is non-nil, non displayed group is ignored."
1120 (let ((buffer-read-only nil) 1344 (let ((buffer-read-only nil)
1345 (case-fold-search nil) ;appleIIgs vs. appleiigs
1346 (regexp (gnus-group-make-regexp group))
1121 (visible nil)) 1347 (visible nil))
1122 ;; Buffer may be narrowed. 1348 ;; Buffer may be narrowed.
1123 (save-restriction 1349 (save-restriction
1124 (widen) 1350 (widen)
1125 ;; Search point to modify. 1351 ;; Search a line to modify. If the buffer is large, the search
1126 (goto-char (point-min)) 1352 ;; takes long time. In most cases, current point is on the line
1127 (if (re-search-forward (concat "^.+: " (regexp-quote group) "$") nil t) 1353 ;; we are looking for. So, first of all, check current line.
1354 ;; And then if current point is in the first half, search from
1355 ;; the beginning. Otherwise, search from the end.
1356 (if (cond ((progn
1357 (beginning-of-line)
1358 (looking-at regexp)))
1359 ((and (> (/ (buffer-size) 2) (point)) ;In the first half.
1360 (progn
1361 (goto-char (point-min))
1362 (re-search-forward regexp nil t))))
1363 ((progn
1364 (goto-char (point-max))
1365 (re-search-backward regexp nil t))))
1128 ;; GROUP is listed in current buffer. So, delete old line. 1366 ;; GROUP is listed in current buffer. So, delete old line.
1129 (progn 1367 (progn
1130 (setq visible t) 1368 (setq visible t)
1131 (beginning-of-line) 1369 (beginning-of-line)
1132 (delete-region (point) (progn (forward-line 1) (point))) 1370 (delete-region (point) (progn (forward-line 1) (point)))
1133 )) 1371 )
1372 ;; No such line in the buffer, so insert it at the top.
1373 (goto-char (point-min)))
1134 (if (or visible (not visible-only)) 1374 (if (or visible (not visible-only))
1135 (progn 1375 (progn
1136 (insert (gnus-Group-prepare-line (assoc group gnus-newsrc-assoc))) 1376 (insert (gnus-group-prepare-line
1377 (gnus-gethash group gnus-newsrc-hashtb)))
1137 (forward-line -1) ;Move point on that line. 1378 (forward-line -1) ;Move point on that line.
1138 )) 1379 ))
1139 ))) 1380 )))
1140 1381
1141;; GNUS Group mode command 1382(defun gnus-group-group-name ()
1142
1143(defun gnus-Group-group-name ()
1144 "Get newsgroup name around point." 1383 "Get newsgroup name around point."
1145 (save-excursion 1384 (save-excursion
1146 (beginning-of-line) 1385 (beginning-of-line)
1147 (if (looking-at ".[* \t]*[0-9]+:[ \t]+\\([^ \t\n]+\\)$") 1386 (if (looking-at "^.+:[ \t]+\\([^ \t\n]+\\)\\([ \t].*\\|$\\)")
1148 (buffer-substring (match-beginning 1) (match-end 1)) 1387 (buffer-substring (match-beginning 1) (match-end 1))
1149 ))) 1388 )))
1150 1389
1151(defun gnus-Group-read-group (all &optional no-article) 1390(defun gnus-group-make-regexp (newsgroup)
1391 "Return regexp that matches for a line of NEWSGROUP."
1392 (concat "^.+: " (regexp-quote newsgroup) "\\([ \t].*\\|$\\)"))
1393
1394(defun gnus-group-search-forward (backward norest &optional heretoo)
1395 "Search for the next (or previous) newsgroup.
1396If 1st argument BACKWARD is non-nil, search backward instead.
1397If 2nd argument NOREST is non-nil, don't care about newsgroup property.
1398If optional argument HERETOO is non-nil, current line is searched for, too."
1399 (let ((case-fold-search nil)
1400 (func
1401 (if backward
1402 (function re-search-backward) (function re-search-forward)))
1403 (regexp
1404 (format "^%s[ \t]*\\(%s\\):"
1405 (if norest ".." " [ \t]")
1406 (if norest "[0-9]+" "[1-9][0-9]*")))
1407 (found nil))
1408 (if backward
1409 (if heretoo
1410 (end-of-line)
1411 (beginning-of-line))
1412 (if heretoo
1413 (beginning-of-line)
1414 (end-of-line)))
1415 (setq found (funcall func regexp nil t))
1416 ;; Adjust cursor point.
1417 (beginning-of-line)
1418 (search-forward ":" nil t)
1419 ;; Return T if found.
1420 found
1421 ))
1422
1423;; GNUS Group mode command
1424
1425(defun gnus-group-read-group (all &optional no-article)
1152 "Read news in this newsgroup. 1426 "Read news in this newsgroup.
1153If argument ALL is non-nil, already read articles become readable. 1427If argument ALL is non-nil, already read articles become readable.
1154If optional argument NO-ARTICLE is non-nil, no article body is displayed." 1428If optional argument NO-ARTICLE is non-nil, no article body is displayed."
1155 (interactive "P") 1429 (interactive "P")
1156 (let ((group (gnus-Group-group-name))) ;Newsgroup name to read. 1430 (let ((group (gnus-group-group-name))) ;Newsgroup name to read.
1157 (if group 1431 (if group
1158 (gnus-Subject-read-group 1432 (gnus-summary-read-group
1159 group 1433 group
1160 (or all 1434 (or all
1161 ;;(not (nth 1 (assoc group gnus-newsrc-assoc))) ;Unsubscribed 1435 ;;(not (nth 1 (gnus-gethash group gnus-newsrc-hashtb))) ;Unsubscribed
1162 (zerop 1436 (zerop
1163 (nth 1 (gnus-gethash group gnus-unread-hashtb)))) ;No unread 1437 (nth 1 (gnus-gethash group gnus-unread-hashtb)))) ;No unread
1164 no-article 1438 no-article
1165 )) 1439 ))
1166 )) 1440 ))
1167 1441
1168(defun gnus-Group-select-group (all) 1442(defun gnus-group-select-group (all)
1169 "Select this newsgroup. 1443 "Select this newsgroup.
1170No article is selected automatically. 1444No article is selected automatically.
1171If argument ALL is non-nil, already read articles become readable." 1445If argument ALL is non-nil, already read articles become readable."
1172 (interactive "P") 1446 (interactive "P")
1173 (gnus-Group-read-group all t)) 1447 (gnus-group-read-group all t))
1174 1448
1175(defun gnus-Group-jump-to-group (group) 1449(defun gnus-group-jump-to-group (group)
1176 "Jump to newsgroup GROUP." 1450 "Jump to newsgroup GROUP."
1177 (interactive 1451 (interactive
1178 (list (completing-read "Newsgroup: " gnus-newsrc-assoc nil 'require-match))) 1452 (list (completing-read "Newsgroup: " gnus-newsrc-assoc nil 'require-match)))
1179 (goto-char (point-min)) 1453 (let ((case-fold-search nil))
1180 (or (re-search-forward (concat "^.+: " (regexp-quote group) "$") nil t) 1454 (goto-char (point-min))
1181 (if (assoc group gnus-newsrc-assoc) 1455 (or (re-search-forward (gnus-group-make-regexp group) nil t)
1182 ;; Add GROUP entry, then seach again. 1456 (if (gnus-gethash group gnus-newsrc-hashtb)
1183 (gnus-Group-update-group group))) 1457 ;; Add GROUP entry, then seach again.
1184 ;; Adjust cursor point. 1458 (gnus-group-update-group group)))
1185 (beginning-of-line)
1186 (search-forward ":" nil t))
1187
1188(defun gnus-Group-search-forward (backward any-group)
1189 "Search for newsgroup forward.
1190If first argument BACKWARD is non-nil, search backward instead.
1191If second argument ANY-GROUP is non-nil, unsubscribed or empty
1192group may be selected."
1193 (let ((func (if backward 're-search-backward 're-search-forward))
1194 (regexp
1195 (format "^%s[ \t]*\\(%s\\):"
1196 (if any-group ".." " [ \t]")
1197 (if any-group "[0-9]+" "[1-9][0-9]*")))
1198 (found nil))
1199 (if backward
1200 (beginning-of-line)
1201 (end-of-line))
1202 (setq found (funcall func regexp nil t))
1203 ;; Adjust cursor point. 1459 ;; Adjust cursor point.
1204 (beginning-of-line) 1460 (beginning-of-line)
1205 (search-forward ":" nil t) 1461 (search-forward ":" nil t)
1206 ;; Return T if found.
1207 found
1208 )) 1462 ))
1209 1463
1210(defun gnus-Group-next-group (n) 1464(defun gnus-group-next-group (n)
1211 "Go to next N'th newsgroup." 1465 "Go to next N'th newsgroup."
1212 (interactive "p") 1466 (interactive "p")
1213 (while (and (> n 1) 1467 (while (and (> n 1)
1214 (gnus-Group-search-forward nil t)) 1468 (gnus-group-search-forward nil t))
1215 (setq n (1- n))) 1469 (setq n (1- n)))
1216 (or (gnus-Group-search-forward nil t) 1470 (or (gnus-group-search-forward nil t)
1217 (message "No more newsgroups"))) 1471 (message "No more newsgroups")))
1218 1472
1219(defun gnus-Group-next-unread-group (n) 1473(defun gnus-group-next-unread-group (n)
1220 "Go to next N'th unread newsgroup." 1474 "Go to next N'th unread newsgroup."
1221 (interactive "p") 1475 (interactive "p")
1222 (while (and (> n 1) 1476 (while (and (> n 1)
1223 (gnus-Group-search-forward nil nil)) 1477 (gnus-group-search-forward nil nil))
1224 (setq n (1- n))) 1478 (setq n (1- n)))
1225 (or (gnus-Group-search-forward nil nil) 1479 (or (gnus-group-search-forward nil nil)
1226 (message "No more unread newsgroups"))) 1480 (message "No more unread newsgroups")))
1227 1481
1228(defun gnus-Group-prev-group (n) 1482(defun gnus-group-prev-group (n)
1229 "Go to previous N'th newsgroup." 1483 "Go to previous N'th newsgroup."
1230 (interactive "p") 1484 (interactive "p")
1231 (while (and (> n 1) 1485 (while (and (> n 1)
1232 (gnus-Group-search-forward t t)) 1486 (gnus-group-search-forward t t))
1233 (setq n (1- n))) 1487 (setq n (1- n)))
1234 (or (gnus-Group-search-forward t t) 1488 (or (gnus-group-search-forward t t)
1235 (message "No more newsgroups"))) 1489 (message "No more newsgroups")))
1236 1490
1237(defun gnus-Group-prev-unread-group (n) 1491(defun gnus-group-prev-unread-group (n)
1238 "Go to previous N'th unread newsgroup." 1492 "Go to previous N'th unread newsgroup."
1239 (interactive "p") 1493 (interactive "p")
1240 (while (and (> n 1) 1494 (while (and (> n 1)
1241 (gnus-Group-search-forward t nil)) 1495 (gnus-group-search-forward t nil))
1242 (setq n (1- n))) 1496 (setq n (1- n)))
1243 (or (gnus-Group-search-forward t nil) 1497 (or (gnus-group-search-forward t nil)
1244 (message "No more unread newsgroups"))) 1498 (message "No more unread newsgroups")))
1245 1499
1246(defun gnus-Group-catch-up (all &optional quietly) 1500(defun gnus-group-catchup (all)
1247 "Mark all articles not marked as unread in current newsgroup as read. 1501 "Mark all articles not marked as unread in current newsgroup as read.
1248If prefix argument ALL is non-nil, all articles are marked as read. 1502If prefix argument ALL is non-nil, all articles are marked as read.
1249Cross references (Xref: field) of articles are ignored." 1503Cross references (Xref: field) of articles are ignored."
1250 (interactive "P") 1504 (interactive "P")
1251 (let* ((group (gnus-Group-group-name)) 1505 (let* ((group (gnus-group-group-name))
1252 (marked (if (not all) 1506 (marked (if (not all)
1253 (cdr (assoc group gnus-marked-assoc))))) 1507 (cdr (gnus-gethash group gnus-marked-hashtb)))))
1254 (and group 1508 (and group
1255 (or quietly 1509 (or (not gnus-interactive-catchup) ;Without confirmation?
1256 (y-or-n-p 1510 (y-or-n-p
1257 (if all 1511 (if all
1258 "Do you really want to mark everything as read? " 1512 "Do you really want to mark everything as read? "
1259 "Delete all articles not marked as read? "))) 1513 "Delete all articles not marked as read? ")))
1260 (progn 1514 (progn
1261 (message "") ;Erase "Yes or No" question. 1515 (message "") ;Clear "Yes or No" question.
1262 ;; Any marked articles will be preserved. 1516 ;; Any marked articles will be preserved.
1263 (gnus-update-unread-articles group marked marked) 1517 (gnus-update-unread-articles group marked marked)
1264 (gnus-Group-update-group group) 1518 (gnus-group-update-group group)
1265 (gnus-Group-next-group 1))) 1519 (gnus-group-next-group 1)))
1266 )) 1520 ))
1267 1521
1268(defun gnus-Group-catch-up-all (&optional quietly) 1522(defun gnus-group-catchup-all ()
1269 "Mark all articles in current newsgroup as read. 1523 "Mark all articles in current newsgroup as read.
1270Cross references (Xref: field) of articles are ignored." 1524Cross references (Xref: field) of articles are ignored."
1271 (interactive) 1525 (interactive)
1272 (gnus-Group-catch-up t quietly)) 1526 (gnus-group-catchup t))
1273 1527
1274(defun gnus-Group-unsubscribe-current-group () 1528(defun gnus-group-unsubscribe-current-group ()
1275 "Toggle subscribe from/to unsubscribe current group." 1529 "Toggle subscribe from/to unsubscribe current group."
1276 (interactive) 1530 (interactive)
1277 (gnus-Group-unsubscribe-group (gnus-Group-group-name)) 1531 (gnus-group-unsubscribe-group (gnus-group-group-name))
1278 (gnus-Group-next-group 1)) 1532 (gnus-group-next-group 1))
1279 1533
1280(defun gnus-Group-unsubscribe-group (group) 1534(defun gnus-group-unsubscribe-group (group)
1281 "Toggle subscribe from/to unsubscribe GROUP. 1535 "Toggle subscribe from/to unsubscribe GROUP.
1282New newsgroup is added to .newsrc automatically." 1536New newsgroup is added to .newsrc automatically."
1283 (interactive 1537 (interactive
1284 (list (completing-read "Newsgroup: " 1538 (list (completing-read "Newsgroup: "
1285 gnus-active-hashtb nil 'require-match))) 1539 gnus-active-hashtb nil 'require-match)))
1286 (let ((newsrc (assoc group gnus-newsrc-assoc))) 1540 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb)))
1287 (cond ((not (null newsrc)) 1541 (cond ((not (null newsrc))
1288 ;; Toggle subscription flag. 1542 ;; Toggle subscription flag.
1289 (setcar (nthcdr 1 newsrc) (not (nth 1 newsrc))) 1543 (setcar (nthcdr 1 newsrc) (not (nth 1 newsrc)))
1290 (gnus-update-newsrc-buffer group) 1544 (gnus-update-newsrc-buffer group)
1291 (gnus-Group-update-group group) 1545 (gnus-group-update-group group)
1292 ;; Adjust cursor point. 1546 ;; Adjust cursor point.
1293 (beginning-of-line) 1547 (beginning-of-line)
1294 (search-forward ":" nil t)) 1548 (search-forward ":" nil t))
@@ -1296,38 +1550,38 @@ New newsgroup is added to .newsrc automatically."
1296 (gnus-gethash group gnus-active-hashtb)) 1550 (gnus-gethash group gnus-active-hashtb))
1297 ;; Add new newsgroup. 1551 ;; Add new newsgroup.
1298 (gnus-add-newsgroup group) 1552 (gnus-add-newsgroup group)
1299 (gnus-Group-update-group group) 1553 (gnus-group-update-group group)
1300 ;; Adjust cursor point. 1554 ;; Adjust cursor point.
1301 (beginning-of-line) 1555 (beginning-of-line)
1302 (search-forward ":" nil t)) 1556 (search-forward ":" nil t))
1303 (t (error "No such newsgroup: %s" group))) 1557 (t (error "No such newsgroup: %s" group)))
1304 )) 1558 ))
1305 1559
1306(defun gnus-Group-list-all-groups () 1560(defun gnus-group-list-all-groups ()
1307 "List all of newsgroups in the Newsgroup buffer." 1561 "List all of newsgroups in the Newsgroup buffer."
1308 (interactive) 1562 (interactive)
1309 (gnus-Group-list-groups t)) 1563 (gnus-group-list-groups t))
1310 1564
1311(defun gnus-Group-get-new-news () 1565(defun gnus-group-get-new-news ()
1312 "Get newly arrived articles. In fact, read the active file again." 1566 "Get newly arrived articles. In fact, read the active file again."
1313 (interactive) 1567 (interactive)
1314 (gnus-setup-news-info) 1568 (gnus-setup-news)
1315 (gnus-Group-list-groups gnus-have-all-newsgroups)) 1569 (gnus-group-list-groups gnus-have-all-newsgroups))
1316 1570
1317(defun gnus-Group-restart () 1571(defun gnus-group-restart ()
1318 "Force GNUS to read the raw startup file." 1572 "Force GNUS to read the raw startup file."
1319 (interactive) 1573 (interactive)
1320 (gnus-save-newsrc-file) 1574 (gnus-save-newsrc-file)
1321 (gnus-setup-news-info t) ;Force to read the raw startup file. 1575 (gnus-setup-news t) ;Force to read the raw startup file.
1322 (gnus-Group-list-groups gnus-have-all-newsgroups)) 1576 (gnus-group-list-groups gnus-have-all-newsgroups))
1323 1577
1324(defun gnus-Group-check-bogus-groups () 1578(defun gnus-group-check-bogus-groups ()
1325 "Check bogus newsgroups." 1579 "Check bogus newsgroups."
1326 (interactive) 1580 (interactive)
1327 (gnus-check-bogus-newsgroups t) ;Require confirmation. 1581 (gnus-check-bogus-newsgroups t) ;Require confirmation.
1328 (gnus-Group-list-groups gnus-have-all-newsgroups)) 1582 (gnus-group-list-groups gnus-have-all-newsgroups))
1329 1583
1330(defun gnus-Group-restrict-groups (start end) 1584(defun gnus-group-restrict-groups (start end)
1331 "Restrict visible newsgroups to the current region (START and END). 1585 "Restrict visible newsgroups to the current region (START and END).
1332Type \\[widen] to remove restriction." 1586Type \\[widen] to remove restriction."
1333 (interactive "r") 1587 (interactive "r")
@@ -1342,216 +1596,327 @@ Type \\[widen] to remove restriction."
1342 (point)))) 1596 (point))))
1343 (message (substitute-command-keys "Type \\[widen] to remove restriction"))) 1597 (message (substitute-command-keys "Type \\[widen] to remove restriction")))
1344 1598
1345(defun gnus-Group-edit-global-kill () 1599(defun gnus-group-edit-global-kill ()
1346 "Edit a global KILL file." 1600 "Edit a global KILL file."
1347 (interactive) 1601 (interactive)
1348 (setq gnus-current-kill-article nil) ;No articles selected. 1602 (setq gnus-current-kill-article nil) ;No articles selected.
1349 (gnus-Kill-file-edit-file nil) ;Nil stands for global KILL file. 1603 (gnus-kill-file-edit-file nil) ;Nil stands for global KILL file.
1350 (message 1604 (message
1351 (substitute-command-keys 1605 (substitute-command-keys
1352 "Editing a global KILL file (Type \\[gnus-Kill-file-exit] to exit)"))) 1606 "Editing a global KILL file (Type \\[gnus-kill-file-exit] to exit)")))
1353 1607
1354(defun gnus-Group-edit-local-kill () 1608(defun gnus-group-edit-local-kill ()
1355 "Edit a local KILL file." 1609 "Edit a local KILL file."
1356 (interactive) 1610 (interactive)
1357 (setq gnus-current-kill-article nil) ;No articles selected. 1611 (setq gnus-current-kill-article nil) ;No articles selected.
1358 (gnus-Kill-file-edit-file (gnus-Group-group-name)) 1612 (gnus-kill-file-edit-file (gnus-group-group-name))
1359 (message 1613 (message
1360 (substitute-command-keys 1614 (substitute-command-keys
1361 "Editing a local KILL file (Type \\[gnus-Kill-file-exit] to exit)"))) 1615 "Editing a local KILL file (Type \\[gnus-kill-file-exit] to exit)")))
1362 1616
1363(defun gnus-Group-force-update () 1617(defun gnus-group-force-update ()
1364 "Update .newsrc file." 1618 "Update .newsrc file."
1365 (interactive) 1619 (interactive)
1366 (gnus-save-newsrc-file)) 1620 (gnus-save-newsrc-file))
1367 1621
1368(defun gnus-Group-suspend () 1622(defun gnus-group-suspend ()
1369 "Suspend the current GNUS session. 1623 "Suspend the current GNUS session.
1370In fact, cleanup buffers except for Group Mode buffer. 1624In fact, cleanup buffers except for Group Mode buffer.
1371The hook `gnus-Suspend-gnus-hook' is called before actually suspending." 1625The hook gnus-suspend-gnus-hook is called before actually suspending."
1372 (interactive) 1626 (interactive)
1373 (run-hooks 'gnus-Suspend-gnus-hook) 1627 (run-hooks 'gnus-suspend-gnus-hook)
1374 ;; Kill GNUS buffers except for Group Mode buffer. 1628 ;; Kill GNUS buffers except for Group Mode buffer.
1375 (let ((buffers gnus-buffer-list)) 1629 (let ((buffers gnus-buffer-list))
1376 (while buffers 1630 (while buffers
1377 (and (not (eq (car buffers) gnus-Group-buffer)) 1631 (and (not (eq (car buffers) gnus-group-buffer))
1378 (get-buffer (car buffers)) 1632 (get-buffer (car buffers))
1379 (kill-buffer (car buffers))) 1633 (kill-buffer (car buffers)))
1380 (setq buffers (cdr buffers)) 1634 (setq buffers (cdr buffers))
1381 )) 1635 ))
1382 (bury-buffer)) 1636 (bury-buffer))
1383 1637
1384(defun gnus-Group-exit () 1638(defun gnus-group-exit ()
1385 "Quit reading news after updating .newsrc. 1639 "Quit reading news after updating .newsrc.
1386The hook `gnus-Exit-gnus-hook' is called before actually quitting." 1640The hook gnus-exit-gnus-hook is called before actually quitting."
1387 (interactive) 1641 (interactive)
1388 (if (or noninteractive ;For gnus-batch-kill 1642 (if (or noninteractive ;For gnus-batch-kill
1389 (zerop (buffer-size)) ;No news is good news. 1643 (zerop (buffer-size)) ;No news is good news.
1390 (not (gnus-server-opened)) ;NNTP connection closed. 1644 (not (gnus-server-opened)) ;NNTP connection closed.
1645 (not gnus-interactive-exit) ;Without confirmation
1391 (y-or-n-p "Are you sure you want to quit reading news? ")) 1646 (y-or-n-p "Are you sure you want to quit reading news? "))
1392 (progn 1647 (progn
1393 (message "") ;Erase "Yes or No" question. 1648 (message "") ;Erase "Yes or No" question.
1394 (run-hooks 'gnus-Exit-gnus-hook) 1649 (run-hooks 'gnus-exit-gnus-hook)
1395 (gnus-save-newsrc-file) 1650 (gnus-save-newsrc-file)
1396 (gnus-clear-system) 1651 (gnus-clear-system)
1397 (gnus-close-server)) 1652 (gnus-close-server))
1398 )) 1653 ))
1399 1654
1400(defun gnus-Group-quit () 1655(defun gnus-group-quit ()
1401 "Quit reading news without updating .newsrc. 1656 "Quit reading news without updating .newsrc.
1402The hook `gnus-Exit-gnus-hook' is called before actually quitting." 1657The hook gnus-exit-gnus-hook is called before actually quitting."
1403 (interactive) 1658 (interactive)
1404 (if (or (zerop (buffer-size)) 1659 (if (or noninteractive ;For gnus-batch-kill
1660 (zerop (buffer-size))
1405 (not (gnus-server-opened)) 1661 (not (gnus-server-opened))
1406 (yes-or-no-p 1662 (yes-or-no-p
1407 (format "Quit reading news without saving %s? " 1663 (format "Quit reading news without saving %s? "
1408 (file-name-nondirectory gnus-current-startup-file)))) 1664 (file-name-nondirectory gnus-current-startup-file))))
1409 (progn 1665 (progn
1410 (message "") ;Erase "Yes or No" question. 1666 (message "") ;Erase "Yes or No" question.
1411 (run-hooks 'gnus-Exit-gnus-hook) 1667 (run-hooks 'gnus-exit-gnus-hook)
1412 (gnus-clear-system) 1668 (gnus-clear-system)
1413 (gnus-close-server)) 1669 (gnus-close-server))
1414 )) 1670 ))
1415 1671
1416(defun gnus-Group-describe-briefly () 1672(defun gnus-group-describe-briefly ()
1417 "Describe Group mode commands briefly." 1673 "Describe Group mode commands briefly."
1418 (interactive) 1674 (interactive)
1419 (message 1675 (message
1420 (concat 1676 (concat
1421 (substitute-command-keys "\\[gnus-Group-read-group]:Select ") 1677 (substitute-command-keys "\\[gnus-group-read-group]:Select ")
1422 (substitute-command-keys "\\[gnus-Group-next-unread-group]:Forward ") 1678 (substitute-command-keys "\\[gnus-group-next-unread-group]:Forward ")
1423 (substitute-command-keys "\\[gnus-Group-prev-unread-group]:Backward ") 1679 (substitute-command-keys "\\[gnus-group-prev-unread-group]:Backward ")
1424 (substitute-command-keys "\\[gnus-Group-exit]:Exit ") 1680 (substitute-command-keys "\\[gnus-group-exit]:Exit ")
1425 (substitute-command-keys "\\[gnus-Info-find-node]:Run Info ") 1681 (substitute-command-keys "\\[gnus-info-find-node]:Run Info ")
1426 (substitute-command-keys "\\[gnus-Group-describe-briefly]:This help") 1682 (substitute-command-keys "\\[gnus-group-describe-briefly]:This help")
1427 ))) 1683 )))
1428 1684
1429 1685
1430;;; 1686;;;
1431;;; GNUS Subject Mode 1687;;; GNUS Summary Mode
1432;;; 1688;;;
1433 1689
1434(if gnus-Subject-mode-map 1690(if gnus-summary-mode-map
1435 nil 1691 nil
1436 (setq gnus-Subject-mode-map (make-keymap)) 1692 (setq gnus-summary-mode-map (make-keymap))
1437 (suppress-keymap gnus-Subject-mode-map) 1693 (suppress-keymap gnus-summary-mode-map)
1438 (define-key gnus-Subject-mode-map " " 'gnus-Subject-next-page) 1694 (define-key gnus-summary-mode-map " " 'gnus-summary-next-page)
1439 (define-key gnus-Subject-mode-map "\177" 'gnus-Subject-prev-page) 1695 (define-key gnus-summary-mode-map "\177" 'gnus-summary-prev-page)
1440 (define-key gnus-Subject-mode-map "\r" 'gnus-Subject-scroll-up) 1696 (define-key gnus-summary-mode-map "\r" 'gnus-summary-scroll-up)
1441 (define-key gnus-Subject-mode-map "n" 'gnus-Subject-next-unread-article) 1697 (define-key gnus-summary-mode-map "n" 'gnus-summary-next-unread-article)
1442 (define-key gnus-Subject-mode-map "p" 'gnus-Subject-prev-unread-article) 1698 (define-key gnus-summary-mode-map "p" 'gnus-summary-prev-unread-article)
1443 (define-key gnus-Subject-mode-map "N" 'gnus-Subject-next-article) 1699 (define-key gnus-summary-mode-map "N" 'gnus-summary-next-article)
1444 (define-key gnus-Subject-mode-map "P" 'gnus-Subject-prev-article) 1700 (define-key gnus-summary-mode-map "P" 'gnus-summary-prev-article)
1445 (define-key gnus-Subject-mode-map "\e\C-n" 'gnus-Subject-next-same-subject) 1701 (define-key gnus-summary-mode-map "\e\C-n" 'gnus-summary-next-same-subject)
1446 (define-key gnus-Subject-mode-map "\e\C-p" 'gnus-Subject-prev-same-subject) 1702 (define-key gnus-summary-mode-map "\e\C-p" 'gnus-summary-prev-same-subject)
1447 ;;(define-key gnus-Subject-mode-map "\e\C-n" 'gnus-Subject-next-unread-same-subject) 1703 ;;(define-key gnus-summary-mode-map "\e\C-n" 'gnus-summary-next-unread-same-subject)
1448 ;;(define-key gnus-Subject-mode-map "\e\C-p" 'gnus-Subject-prev-unread-same-subject) 1704 ;;(define-key gnus-summary-mode-map "\e\C-p" 'gnus-summary-prev-unread-same-subject)
1449 (define-key gnus-Subject-mode-map "\C-c\C-n" 'gnus-Subject-next-digest) 1705 (define-key gnus-summary-mode-map "\C-c\C-n" 'gnus-summary-next-digest)
1450 (define-key gnus-Subject-mode-map "\C-c\C-p" 'gnus-Subject-prev-digest) 1706 (define-key gnus-summary-mode-map "\C-c\C-p" 'gnus-summary-prev-digest)
1451 (define-key gnus-Subject-mode-map "\C-n" 'gnus-Subject-next-subject) 1707 (define-key gnus-summary-mode-map "\C-n" 'gnus-summary-next-subject)
1452 (define-key gnus-Subject-mode-map "\C-p" 'gnus-Subject-prev-subject) 1708 (define-key gnus-summary-mode-map "\C-p" 'gnus-summary-prev-subject)
1453 (define-key gnus-Subject-mode-map "\en" 'gnus-Subject-next-unread-subject) 1709 (define-key gnus-summary-mode-map "\en" 'gnus-summary-next-unread-subject)
1454 (define-key gnus-Subject-mode-map "\ep" 'gnus-Subject-prev-unread-subject) 1710 (define-key gnus-summary-mode-map "\ep" 'gnus-summary-prev-unread-subject)
1455 ;;(define-key gnus-Subject-mode-map "\C-cn" 'gnus-Subject-next-group) 1711 ;;(define-key gnus-summary-mode-map "\C-cn" 'gnus-summary-next-group)
1456 ;;(define-key gnus-Subject-mode-map "\C-cp" 'gnus-Subject-prev-group) 1712 ;;(define-key gnus-summary-mode-map "\C-cp" 'gnus-summary-prev-group)
1457 (define-key gnus-Subject-mode-map "." 'gnus-Subject-first-unread-article) 1713 (define-key gnus-summary-mode-map "." 'gnus-summary-first-unread-article)
1458 (define-key gnus-Subject-mode-map "/" 'isearch-forward) 1714 ;;(define-key gnus-summary-mode-map "/" 'isearch-forward)
1459 (define-key gnus-Subject-mode-map "s" 'gnus-Subject-isearch-article) 1715 (define-key gnus-summary-mode-map "s" 'gnus-summary-isearch-article)
1460 (define-key gnus-Subject-mode-map "\es" 'gnus-Subject-search-article-forward) 1716 (define-key gnus-summary-mode-map "\es" 'gnus-summary-search-article-forward)
1461 (define-key gnus-Subject-mode-map "\eS" 'gnus-Subject-search-article-backward) 1717 ;;(define-key gnus-summary-mode-map "\eS" 'gnus-summary-search-article-backward)
1462 (define-key gnus-Subject-mode-map "<" 'gnus-Subject-beginning-of-article) 1718 (define-key gnus-summary-mode-map "\er" 'gnus-summary-search-article-backward)
1463 (define-key gnus-Subject-mode-map ">" 'gnus-Subject-end-of-article) 1719 (define-key gnus-summary-mode-map "<" 'gnus-summary-beginning-of-article)
1464 (define-key gnus-Subject-mode-map "j" 'gnus-Subject-goto-subject) 1720 (define-key gnus-summary-mode-map ">" 'gnus-summary-end-of-article)
1465 (define-key gnus-Subject-mode-map "J" 'gnus-Subject-goto-article) 1721 (define-key gnus-summary-mode-map "j" 'gnus-summary-goto-subject)
1466 (define-key gnus-Subject-mode-map "l" 'gnus-Subject-goto-last-article) 1722 ;;(define-key gnus-summary-mode-map "J" 'gnus-summary-goto-article)
1467 (define-key gnus-Subject-mode-map "^" 'gnus-Subject-refer-parent-article) 1723 (define-key gnus-summary-mode-map "l" 'gnus-summary-goto-last-article)
1468 (define-key gnus-Subject-mode-map "\er" 'gnus-Subject-refer-article) 1724 (define-key gnus-summary-mode-map "^" 'gnus-summary-refer-parent-article)
1469 (define-key gnus-Subject-mode-map "u" 'gnus-Subject-mark-as-unread-forward) 1725 ;;(define-key gnus-summary-mode-map "\er" 'gnus-summary-refer-article)
1470 (define-key gnus-Subject-mode-map "U" 'gnus-Subject-mark-as-unread-backward) 1726 (define-key gnus-summary-mode-map "\e^" 'gnus-summary-refer-article)
1471 (define-key gnus-Subject-mode-map "d" 'gnus-Subject-mark-as-read-forward) 1727 (define-key gnus-summary-mode-map "u" 'gnus-summary-mark-as-unread-forward)
1472 (define-key gnus-Subject-mode-map "D" 'gnus-Subject-mark-as-read-backward) 1728 (define-key gnus-summary-mode-map "U" 'gnus-summary-mark-as-unread-backward)
1473 (define-key gnus-Subject-mode-map "\eu" 'gnus-Subject-clear-mark-forward) 1729 (define-key gnus-summary-mode-map "d" 'gnus-summary-mark-as-read-forward)
1474 (define-key gnus-Subject-mode-map "\eU" 'gnus-Subject-clear-mark-backward) 1730 (define-key gnus-summary-mode-map "D" 'gnus-summary-mark-as-read-backward)
1475 (define-key gnus-Subject-mode-map "k" 'gnus-Subject-kill-same-subject-and-select) 1731 (define-key gnus-summary-mode-map "\eu" 'gnus-summary-clear-mark-forward)
1476 (define-key gnus-Subject-mode-map "\C-k" 'gnus-Subject-kill-same-subject) 1732 (define-key gnus-summary-mode-map "\eU" 'gnus-summary-clear-mark-backward)
1477 (define-key gnus-Subject-mode-map "\e\C-t" 'gnus-Subject-toggle-threads) 1733 (define-key gnus-summary-mode-map "k" 'gnus-summary-kill-same-subject-and-select)
1478 (define-key gnus-Subject-mode-map "\e\C-s" 'gnus-Subject-show-thread) 1734 (define-key gnus-summary-mode-map "\C-k" 'gnus-summary-kill-same-subject)
1479 (define-key gnus-Subject-mode-map "\e\C-h" 'gnus-Subject-hide-thread) 1735 (define-key gnus-summary-mode-map "\e\C-t" 'gnus-summary-toggle-threads)
1480 (define-key gnus-Subject-mode-map "\e\C-f" 'gnus-Subject-next-thread) 1736 (define-key gnus-summary-mode-map "\e\C-s" 'gnus-summary-show-thread)
1481 (define-key gnus-Subject-mode-map "\e\C-b" 'gnus-Subject-prev-thread) 1737 (define-key gnus-summary-mode-map "\e\C-h" 'gnus-summary-hide-thread)
1482 (define-key gnus-Subject-mode-map "\e\C-u" 'gnus-Subject-up-thread) 1738 (define-key gnus-summary-mode-map "\e\C-f" 'gnus-summary-next-thread)
1483 (define-key gnus-Subject-mode-map "\e\C-d" 'gnus-Subject-down-thread) 1739 (define-key gnus-summary-mode-map "\e\C-b" 'gnus-summary-prev-thread)
1484 (define-key gnus-Subject-mode-map "\e\C-k" 'gnus-Subject-kill-thread) 1740 (define-key gnus-summary-mode-map "\e\C-u" 'gnus-summary-up-thread)
1485 (define-key gnus-Subject-mode-map "&" 'gnus-Subject-execute-command) 1741 (define-key gnus-summary-mode-map "\e\C-d" 'gnus-summary-down-thread)
1486 ;;(define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up) 1742 (define-key gnus-summary-mode-map "\e\C-k" 'gnus-summary-kill-thread)
1487 ;;(define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up-all) 1743 (define-key gnus-summary-mode-map "&" 'gnus-summary-execute-command)
1488 (define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up-and-exit) 1744 ;;(define-key gnus-summary-mode-map "c" 'gnus-summary-catchup)
1489 ;;(define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up-all-and-exit) 1745 ;;(define-key gnus-summary-mode-map "c" 'gnus-summary-catchup-all)
1490 (define-key gnus-Subject-mode-map "\C-t" 'gnus-Subject-toggle-truncation) 1746 (define-key gnus-summary-mode-map "c" 'gnus-summary-catchup-and-exit)
1491 (define-key gnus-Subject-mode-map "x" 'gnus-Subject-delete-marked-as-read) 1747 ;;(define-key gnus-summary-mode-map "c" 'gnus-summary-catchup-all-and-exit)
1492 (define-key gnus-Subject-mode-map "X" 'gnus-Subject-delete-marked-with) 1748 (define-key gnus-summary-mode-map "\C-t" 'gnus-summary-toggle-truncation)
1493 (define-key gnus-Subject-mode-map "\C-c\C-sn" 'gnus-Subject-sort-by-number) 1749 (define-key gnus-summary-mode-map "x" 'gnus-summary-delete-marked-as-read)
1494 (define-key gnus-Subject-mode-map "\C-c\C-sa" 'gnus-Subject-sort-by-author) 1750 (define-key gnus-summary-mode-map "X" 'gnus-summary-delete-marked-with)
1495 (define-key gnus-Subject-mode-map "\C-c\C-ss" 'gnus-Subject-sort-by-subject) 1751 (define-key gnus-summary-mode-map "\C-c\C-sn" 'gnus-summary-sort-by-number)
1496 (define-key gnus-Subject-mode-map "\C-c\C-sd" 'gnus-Subject-sort-by-date) 1752 (define-key gnus-summary-mode-map "\C-c\C-sa" 'gnus-summary-sort-by-author)
1497 (define-key gnus-Subject-mode-map "\C-c\C-s\C-n" 'gnus-Subject-sort-by-number) 1753 (define-key gnus-summary-mode-map "\C-c\C-ss" 'gnus-summary-sort-by-subject)
1498 (define-key gnus-Subject-mode-map "\C-c\C-s\C-a" 'gnus-Subject-sort-by-author) 1754 (define-key gnus-summary-mode-map "\C-c\C-sd" 'gnus-summary-sort-by-date)
1499 (define-key gnus-Subject-mode-map "\C-c\C-s\C-s" 'gnus-Subject-sort-by-subject) 1755 (define-key gnus-summary-mode-map "\C-c\C-s\C-n" 'gnus-summary-sort-by-number)
1500 (define-key gnus-Subject-mode-map "\C-c\C-s\C-d" 'gnus-Subject-sort-by-date) 1756 (define-key gnus-summary-mode-map "\C-c\C-s\C-a" 'gnus-summary-sort-by-author)
1501 (define-key gnus-Subject-mode-map "=" 'gnus-Subject-expand-window) 1757 (define-key gnus-summary-mode-map "\C-c\C-s\C-s" 'gnus-summary-sort-by-subject)
1502 (define-key gnus-Subject-mode-map "G" 'gnus-Subject-reselect-current-group) 1758 (define-key gnus-summary-mode-map "\C-c\C-s\C-d" 'gnus-summary-sort-by-date)
1503 (define-key gnus-Subject-mode-map "w" 'gnus-Subject-stop-page-breaking) 1759 (define-key gnus-summary-mode-map "=" 'gnus-summary-expand-window)
1504 (define-key gnus-Subject-mode-map "\C-c\C-r" 'gnus-Subject-caesar-message) 1760 ;;(define-key gnus-summary-mode-map "G" 'gnus-summary-reselect-current-group)
1505 (define-key gnus-Subject-mode-map "g" 'gnus-Subject-show-article) 1761 (define-key gnus-summary-mode-map "\C-x\C-s" 'gnus-summary-reselect-current-group)
1506 (define-key gnus-Subject-mode-map "t" 'gnus-Subject-toggle-header) 1762 (define-key gnus-summary-mode-map "w" 'gnus-summary-stop-page-breaking)
1507 (define-key gnus-Subject-mode-map "v" 'gnus-Subject-show-all-headers) 1763 (define-key gnus-summary-mode-map "\C-c\C-r" 'gnus-summary-caesar-message)
1508 (define-key gnus-Subject-mode-map "\C-d" 'gnus-Subject-rmail-digest) 1764 (define-key gnus-summary-mode-map "g" 'gnus-summary-show-article)
1509 (define-key gnus-Subject-mode-map "a" 'gnus-Subject-post-news) 1765 (define-key gnus-summary-mode-map "t" 'gnus-summary-toggle-header)
1510 (define-key gnus-Subject-mode-map "f" 'gnus-Subject-post-reply) 1766 ;;(define-key gnus-summary-mode-map "v" 'gnus-summary-show-all-headers)
1511 (define-key gnus-Subject-mode-map "F" 'gnus-Subject-post-reply-with-original) 1767 (define-key gnus-summary-mode-map "\et" 'gnus-summary-toggle-mime)
1512 (define-key gnus-Subject-mode-map "C" 'gnus-Subject-cancel-article) 1768 (define-key gnus-summary-mode-map "\C-d" 'gnus-summary-rmail-digest)
1513 (define-key gnus-Subject-mode-map "r" 'gnus-Subject-mail-reply) 1769 (define-key gnus-summary-mode-map "a" 'gnus-summary-post-news)
1514 (define-key gnus-Subject-mode-map "R" 'gnus-Subject-mail-reply-with-original) 1770 (define-key gnus-summary-mode-map "f" 'gnus-summary-followup)
1515 (define-key gnus-Subject-mode-map "m" 'gnus-Subject-mail-other-window) 1771 (define-key gnus-summary-mode-map "F" 'gnus-summary-followup-with-original)
1516 (define-key gnus-Subject-mode-map "o" 'gnus-Subject-save-article) 1772 (define-key gnus-summary-mode-map "C" 'gnus-summary-cancel-article)
1517 (define-key gnus-Subject-mode-map "\C-o" 'gnus-Subject-save-in-mail) 1773 (define-key gnus-summary-mode-map "r" 'gnus-summary-reply)
1518 (define-key gnus-Subject-mode-map "|" 'gnus-Subject-pipe-output) 1774 (define-key gnus-summary-mode-map "R" 'gnus-summary-reply-with-original)
1519 (define-key gnus-Subject-mode-map "\ek" 'gnus-Subject-edit-local-kill) 1775 (define-key gnus-summary-mode-map "\C-c\C-f" 'gnus-summary-mail-forward)
1520 (define-key gnus-Subject-mode-map "\eK" 'gnus-Subject-edit-global-kill) 1776 (define-key gnus-summary-mode-map "m" 'gnus-summary-mail-other-window)
1521 (define-key gnus-Subject-mode-map "V" 'gnus-version) 1777 (define-key gnus-summary-mode-map "o" 'gnus-summary-save-article)
1522 (define-key gnus-Subject-mode-map "q" 'gnus-Subject-exit) 1778 (define-key gnus-summary-mode-map "\C-o" 'gnus-summary-save-in-mail)
1523 (define-key gnus-Subject-mode-map "Q" 'gnus-Subject-quit) 1779 (define-key gnus-summary-mode-map "|" 'gnus-summary-pipe-output)
1524 (define-key gnus-Subject-mode-map "?" 'gnus-Subject-describe-briefly) 1780 (define-key gnus-summary-mode-map "\ek" 'gnus-summary-edit-local-kill)
1525 (define-key gnus-Subject-mode-map "\C-c\C-i" 'gnus-Info-find-node)) 1781 (define-key gnus-summary-mode-map "\eK" 'gnus-summary-edit-global-kill)
1526 1782 (define-key gnus-summary-mode-map "V" 'gnus-version)
1527(defun gnus-Subject-mode () 1783 (define-key gnus-summary-mode-map "q" 'gnus-summary-exit)
1784 (define-key gnus-summary-mode-map "Q" 'gnus-summary-quit)
1785 (define-key gnus-summary-mode-map "?" 'gnus-summary-describe-briefly)
1786 (define-key gnus-summary-mode-map "\C-c\C-i" 'gnus-info-find-node))
1787
1788(defun gnus-summary-mode ()
1528 "Major mode for reading articles in this newsgroup. 1789 "Major mode for reading articles in this newsgroup.
1529All normal editing commands are turned off. 1790All normal editing commands are turned off.
1530Instead, these commands are available: 1791Instead, these commands are available:
1531\\{gnus-Subject-mode-map} 1792
1793SPC Scroll to the next page of the current article. The next unread
1794 article is selected automatically at the end of the message.
1795DEL Scroll to the previous page of the current article.
1796RET Scroll up (or down) one line the current article.
1797n Move to the next unread article.
1798p Move to the previous unread article.
1799N Move to the next article.
1800P Move to the previous article.
1801ESC C-n Move to the next article which has the same subject as the
1802 current article.
1803ESC C-p Move to the previous article which has the same subject as the
1804 current article.
1805\\[gnus-summary-next-unread-same-subject]
1806 Move to the next unread article which has the same subject as the
1807 current article.
1808\\[gnus-summary-prev-unread-same-subject]
1809 Move to the previous unread article which has the same subject as
1810 the current article.
1811C-c C-n Scroll to the next digested message of the current article.
1812C-c C-p Scroll to the previous digested message of the current article.
1813C-n Move to the next subject.
1814C-p Move to the previous subject.
1815ESC n Move to the next unread subject.
1816ESC p Move to the previous unread subject.
1817\\[gnus-summary-next-group]
1818 Exit the current newsgroup and select the next unread newsgroup.
1819\\[gnus-summary-prev-group]
1820 Exit the current newsgroup and select the previous unread newsgroup.
1821. Jump to the first unread article in the current newsgroup.
1822s Do an incremental search forward on the current article.
1823ESC s Search for an article containing a regexp forward.
1824ESC r Search for an article containing a regexp backward.
1825< Move point to the beginning of the current article.
1826> Move point to the end of the current article.
1827j Jump to the article specified by the numeric article ID.
1828l Jump to the article you read last.
1829^ Refer to parent of the current article.
1830ESC ^ Refer to the article specified by the Message-ID.
1831u Mark the current article as unread, and go forward.
1832U Mark the current article as unread, and go backward.
1833d Mark the current article as read, and go forward.
1834D Mark the current article as read, and go backward.
1835ESC u Clear the current article's mark, and go forward.
1836ESC U Clear the current article's mark, and go backward.
1837k Mark articles which has the same subject as the current article as
1838 read, and then select the next unread article.
1839C-k Mark articles which has the same subject as the current article as
1840 read.
1841ESC k Edit a local KILL file applied to the current newsgroup.
1842ESC K Edit a global KILL file applied to all newsgroups.
1843ESC C-t Toggle showing conversation threads.
1844ESC C-s Show thread subtrees.
1845ESC C-h Hide thread subtrees.
1846\\[gnus-summary-show-all-threads] Show all thread subtrees.
1847\\[gnus-summary-hide-all-threads] Hide all thread subtrees.
1848ESC C-f Go to the same level next thread.
1849ESC C-b Go to the same level previous thread.
1850ESC C-d Go downward current thread.
1851ESC C-u Go upward current thread.
1852ESC C-k Mark articles under current thread as read.
1853& Execute a command for each article conditionally.
1854\\[gnus-summary-catchup]
1855 Mark all articles as read in the current newsgroup, preserving
1856 articles marked as unread.
1857\\[gnus-summary-catchup-all]
1858 Mark all articles as read in the current newsgroup.
1859\\[gnus-summary-catchup-and-exit]
1860 Catch up all articles not marked as unread, and then exit the
1861 current newsgroup.
1862\\[gnus-summary-catchup-all-and-exit]
1863 Catch up all articles, and then exit the current newsgroup.
1864C-t Toggle truncations of subject lines.
1865x Delete subject lines marked as read.
1866X Delete subject lines with the specific marks.
1867C-c C-s C-n Sort subjects by article number.
1868C-c C-s C-a Sort subjects by article author.
1869C-c C-s C-s Sort subjects alphabetically.
1870C-c C-s C-d Sort subjects by date.
1871= Expand Summary window to show headers full window.
1872C-x C-s Reselect the current newsgroup. Prefix argument means to select all.
1873w Stop page breaking by linefeed.
1874C-c C-r Caesar rotates letters by 13/47 places.
1875g Force to show the current article.
1876t Show original article header if pruned header currently shown, or
1877 vice versa.
1878ESC-t Toggle MIME processing.
1879C-d Run RMAIL on the current digest article.
1880a Post a new article.
1881f Post a reply article.
1882F Post a reply article with original article.
1883C Cancel the current article.
1884r Mail a message to the author.
1885R Mail a message to the author with original author.
1886C-c C-f Forward the current message to another user.
1887m Mail a message in other window.
1888o Save the current article in your favorite format.
1889C-o Append the current article to a file in Unix mail format.
1890| Pipe the contents of the current article to a subprocess.
1891q Quit reading news in the current newsgroup.
1892Q Quit reading news without recording unread articles information.
1893V Show the version number of this GNUS.
1894? Describe Summary mode commands briefly.
1895C-h m Describe Summary mode.
1896C-c C-i Read Info about Summary mode.
1532 1897
1533User customizable variables: 1898User customizable variables:
1534 gnus-large-newsgroup 1899 gnus-large-newsgroup
1535 The number of articles which indicates a large newsgroup. If the 1900 The number of articles which indicates a large newsgroup. If the
1536 number of articles in a newsgroup is greater than the value, the 1901 number of articles in a newsgroup is greater than the value, the
1537 number of articles to be selected is asked for. If the given value 1902 number of articles to be selected is asked for. If the given value
1538 N is positive, the last N articles is selected. If N is negative, 1903 N is positive, the last N articles is selected. If N is negative,
1539 the first N articles are selected. An empty string means to select 1904 the first N articles are selected. An empty string means to select
1540 all articles. 1905 all articles.
1541 1906
1542 gnus-use-long-file-name 1907 gnus-use-long-file-name
1543 Non-nil means that a newsgroup name is used as a default file name 1908 Non-nil means that a newsgroup name is used as a default file name
1544 to save articles to. If it's nil, the directory form of a 1909 to save articles to. If it's nil, the directory form of a
1545 newsgroup is used instead. 1910 newsgroup is used instead.
1546 1911
1547 gnus-default-article-saver 1912 gnus-default-article-saver
1548 Specifies your favorite article saver which is interactively 1913 Specifies your favorite article saver which is interactively
1549 funcallable. Following functions are available: 1914 funcallable. Following functions are available:
1550 1915
1551 gnus-Subject-save-in-rmail (in Rmail format) 1916 gnus-summary-save-in-rmail (in Rmail format)
1552 gnus-Subject-save-in-mail (in Unix mail format) 1917 gnus-summary-save-in-mail (in Unix mail format)
1553 gnus-Subject-save-in-folder (in MH folder) 1918 gnus-summary-save-in-folder (in MH folder)
1554 gnus-Subject-save-in-file (in article format). 1919 gnus-summary-save-in-file (in article format).
1555 1920
1556 gnus-rmail-save-name 1921 gnus-rmail-save-name
1557 gnus-mail-save-name 1922 gnus-mail-save-name
@@ -1560,12 +1925,13 @@ User customizable variables:
1560 Specifies a function generating a file name to save articles in 1925 Specifies a function generating a file name to save articles in
1561 specified format. The function is called with NEWSGROUP, HEADERS, 1926 specified format. The function is called with NEWSGROUP, HEADERS,
1562 and optional LAST-FILE. Access macros to the headers are defined 1927 and optional LAST-FILE. Access macros to the headers are defined
1563 as nntp-header-FIELD, and functions are defined as `gnus-header-FIELD'. 1928 as nntp-header-FIELD, and functions are defined as
1929 gnus-header-FIELD.
1564 1930
1565 gnus-article-save-directory 1931 gnus-article-save-directory
1566 Specifies a directory name to save articles to using the commands 1932 Specifies a directory name to save articles to using the commands
1567 `gnus-Subject-save-in-rmail', `gnus-Subject-save-in-mail' and 1933 gnus-summary-save-in-rmail, gnus-summary-save-in-mail and
1568 `gnus-Subject-save-in-file'. The variable is initialized from the 1934 gnus-summary-save-in-file. The variable is initialized from the
1569 SAVEDIR environment variable. 1935 SAVEDIR environment variable.
1570 1936
1571 gnus-show-all-headers 1937 gnus-show-all-headers
@@ -1574,6 +1940,9 @@ User customizable variables:
1574 gnus-save-all-headers 1940 gnus-save-all-headers
1575 Non-nil means that all headers of an article are saved in a file. 1941 Non-nil means that all headers of an article are saved in a file.
1576 1942
1943 gnus-show-mime
1944 Non-nil means that show a MIME message.
1945
1577 gnus-show-threads 1946 gnus-show-threads
1578 Non-nil means that conversation threads are shown in tree structure. 1947 Non-nil means that conversation threads are shown in tree structure.
1579 1948
@@ -1595,7 +1964,7 @@ User customizable variables:
1595 1964
1596 gnus-optional-headers 1965 gnus-optional-headers
1597 Specifies a function which generates an optional string displayed 1966 Specifies a function which generates an optional string displayed
1598 in the Subject buffer. The function is called with an article 1967 in the Summary buffer. The function is called with an article
1599 HEADERS. The result must be a string excluding `[' and `]'. The 1968 HEADERS. The result must be a string excluding `[' and `]'. The
1600 default function returns a string like NNN:AUTHOR, where NNN is 1969 default function returns a string like NNN:AUTHOR, where NNN is
1601 the number of lines in an article and AUTHOR is the name of the 1970 the number of lines in an article and AUTHOR is the name of the
@@ -1607,17 +1976,17 @@ User customizable variables:
1607 1976
1608 gnus-auto-select-first 1977 gnus-auto-select-first
1609 Non-nil means the first unread article is selected automagically 1978 Non-nil means the first unread article is selected automagically
1610 when a newsgroup is selected normally (by gnus-Group-read-group). 1979 when a newsgroup is selected normally (by gnus-group-read-group).
1611 If you'd like to prevent automatic selection of the first unread 1980 If you'd like to prevent automatic selection of the first unread
1612 article in some newsgroups, set the variable to nil in 1981 article in some newsgroups, set the variable to nil in
1613 gnus-Select-group-hook or gnus-Apply-kill-hook. 1982 gnus-select-group-hook or gnus-apply-kill-hook.
1614 1983
1615 gnus-auto-select-next 1984 gnus-auto-select-next
1616 Non-nil means the next newsgroup is selected automagically at the 1985 Non-nil means the next newsgroup is selected automagically at the
1617 end of the newsgroup. If the value is t and the next newsgroup is 1986 end of the newsgroup. If the value is t and the next newsgroup is
1618 empty (no unread articles), GNUS will exit Subject mode and go 1987 empty (no unread articles), GNUS will exit Summary mode and go
1619 back to Group mode. If the value is neither nil nor t, GNUS won't 1988 back to Group mode. If the value is neither nil nor t, GNUS won't
1620 exit Subject mode but select the following unread newsgroup. 1989 exit Summary mode but select the following unread newsgroup.
1621 Especially, if the value is the symbol `quietly', the next unread 1990 Especially, if the value is the symbol `quietly', the next unread
1622 newsgroup will be selected without any confirmations. 1991 newsgroup will be selected without any confirmations.
1623 1992
@@ -1625,8 +1994,8 @@ User customizable variables:
1625 Non-nil means an article with the same subject as the current 1994 Non-nil means an article with the same subject as the current
1626 article is selected automagically like `rn -S'. 1995 article is selected automagically like `rn -S'.
1627 1996
1628 gnus-auto-center-subject 1997 gnus-auto-center-summary
1629 Non-nil means the point of Subject Mode window is always kept 1998 Non-nil means the point of Summary Mode window is always kept
1630 centered. 1999 centered.
1631 2000
1632 gnus-break-pages 2001 gnus-break-pages
@@ -1643,7 +2012,8 @@ User customizable variables:
1643 2012
1644 gnus-digest-show-summary 2013 gnus-digest-show-summary
1645 Non-nil means that a summary of digest messages is shown when 2014 Non-nil means that a summary of digest messages is shown when
1646 reading a digest article using `gnus-Subject-rmail-digest' command. 2015 reading a digest article using `gnus-summary-rmail-digest'
2016 command.
1647 2017
1648 gnus-digest-separator 2018 gnus-digest-separator
1649 Specifies a regexp separating messages in a digest article. 2019 Specifies a regexp separating messages in a digest article.
@@ -1651,65 +2021,70 @@ User customizable variables:
1651 gnus-mail-reply-method 2021 gnus-mail-reply-method
1652 gnus-mail-other-window-method 2022 gnus-mail-other-window-method
1653 Specifies a function to begin composing mail message using 2023 Specifies a function to begin composing mail message using
1654 commands gnus-Subject-mail-reply and 2024 commands gnus-summary-reply and gnus-summary-mail-other-window.
1655 gnus-Subject-mail-other-window. Functions 2025 Functions gnus-mail-reply-using-mail and gnus-mail-reply-using-mhe
1656 gnus-mail-reply-using-mail and gnus-mail-reply-using-mhe are 2026 are available for the value of gnus-mail-reply-method. And
1657 available for the value of gnus-mail-reply-method. And functions 2027 functions gnus-mail-other-window-using-mail and
1658 gnus-mail-other-window-using-mail and
1659 gnus-mail-other-window-using-mhe are available for the value of 2028 gnus-mail-other-window-using-mhe are available for the value of
1660 gnus-mail-other-window-method. 2029 gnus-mail-other-window-method.
1661 2030
2031 gnus-mail-send-method
2032 Specifies a function to mail a message too which is being posted
2033 as an article. The message must have To: or Cc: field. The value
2034 of the variable send-mail-function is the default function which
2035 uses sendmail mail program.
2036
1662Various hooks for customization: 2037Various hooks for customization:
1663 gnus-Subject-mode-hook 2038 gnus-summary-mode-hook
1664 Entry to this mode calls the value with no arguments, if that 2039 Entry to this mode calls the value with no arguments, if that
1665 value is non-nil. 2040 value is non-nil.
1666 2041
1667 gnus-Select-group-hook 2042 gnus-select-group-hook
1668 Called with no arguments when newsgroup is selected, if that value 2043 Called with no arguments when newsgroup is selected, if that value
1669 is non-nil. It is possible to sort subjects in this hook. See the 2044 is non-nil. It is possible to sort subjects in this hook. See the
1670 documentation of this variable for more information. 2045 documentation of this variable for more information.
1671 2046
1672 gnus-Subject-prepare-hook 2047 gnus-summary-prepare-hook
1673 Called with no arguments after a subject list is created in the 2048 Called with no arguments after a summary list is created in the
1674 Subject buffer, if that value is non-nil. If you'd like to modify 2049 Summary buffer, if that value is non-nil. If you'd like to modify
1675 the buffer, you can use this hook. 2050 the buffer, you can use this hook.
1676 2051
1677 gnus-Select-article-hook 2052 gnus-select-article-hook
1678 Called with no arguments when an article is selected, if that 2053 Called with no arguments when an article is selected, if that
1679 value is non-nil. See the documentation of this variable for 2054 value is non-nil. See the documentation of this variable for more
1680 more information. 2055 information.
1681 2056
1682 gnus-Select-digest-hook 2057 gnus-select-digest-hook
1683 Called with no arguments when reading digest messages using Rmail, 2058 Called with no arguments when reading digest messages using Rmail,
1684 if that value is non-nil. This hook can be used to modify an 2059 if that value is non-nil. This hook can be used to modify an
1685 article so that Rmail can work with it. See the documentation of 2060 article so that Rmail can work with it. See the documentation of
1686 the variable for more information. 2061 the variable for more information.
1687 2062
1688 gnus-Rmail-digest-hook 2063 gnus-rmail-digest-hook
1689 Called with no arguments when reading digest messages using Rmail, 2064 Called with no arguments when reading digest messages using Rmail,
1690 if that value is non-nil. This hook is intended to customize Rmail 2065 if that value is non-nil. This hook is intended to customize Rmail
1691 mode. 2066 mode.
1692 2067
1693 gnus-Apply-kill-hook 2068 gnus-apply-kill-hook
1694 Called with no arguments when a newsgroup is selected and the 2069 Called with no arguments when a newsgroup is selected and the
1695 Subject buffer is prepared. This hook is intended to apply a KILL 2070 Summary buffer is prepared. This hook is intended to apply a KILL
1696 file to the selected newsgroup. The format of KILL file is 2071 file to the selected newsgroup. The format of KILL file is
1697 completely different from that of version 3.8. You have to rewrite 2072 completely different from that of version 3.8. You have to rewrite
1698 them in the new format. See the documentation of Kill file mode 2073 them in the new format. See the documentation of Kill file mode
1699 for more information. 2074 for more information.
1700 2075
1701 gnus-Mark-article-hook 2076 gnus-mark-article-hook
1702 Called with no arguments when an article is selected at the first 2077 Called with no arguments when an article is selected at the first
1703 time. The hook is intended to mark an article as read (or unread) 2078 time. The hook is intended to mark an article as read (or unread)
1704 automatically when it is selected. See the documentation of the 2079 automatically when it is selected. See the documentation of the
1705 variable for more information. 2080 variable for more information.
1706 2081
1707 gnus-Exit-group-hook 2082 gnus-exit-group-hook
1708 Called with no arguments when exiting the current newsgroup, if 2083 Called with no arguments when exiting the current newsgroup, if
1709 that value is non-nil. If your machine is so slow that exiting 2084 that value is non-nil. If your machine is so slow that exiting
1710 from Subject mode takes very long time, inhibit marking articles 2085 from Summary mode takes very long time, inhibit marking articles
1711 as read using cross-references by setting the variable 2086 as read using cross-references by setting the variable
1712 `gnus-newsgroup-headers' to nil in this hook." 2087 gnus-use-cross-reference to nil in this hook."
1713 (interactive) 2088 (interactive)
1714 (kill-all-local-variables) 2089 (kill-all-local-variables)
1715 ;; Gee. Why don't you upgrade? 2090 ;; Gee. Why don't you upgrade?
@@ -1718,38 +2093,39 @@ Various hooks for customization:
1718 ((listp (default-value 'mode-line-format)) 2093 ((listp (default-value 'mode-line-format))
1719 (setq mode-line-format 2094 (setq mode-line-format
1720 (cons "--- " (cdr (default-value 'mode-line-format)))))) 2095 (cons "--- " (cdr (default-value 'mode-line-format))))))
1721 (make-local-variable 'global-mode-string) 2096 ;; To disable display-time facility.
1722 (setq global-mode-string nil) 2097 ;;(make-local-variable 'global-mode-string)
1723 (setq major-mode 'gnus-Subject-mode) 2098 ;;(setq global-mode-string nil)
1724 (setq mode-name "Subject") 2099 (setq major-mode 'gnus-summary-mode)
2100 (setq mode-name "Summary")
1725 ;;(setq mode-line-process '(" " gnus-newsgroup-name)) 2101 ;;(setq mode-line-process '(" " gnus-newsgroup-name))
1726 (make-local-variable 'minor-mode-alist) 2102 (make-local-variable 'minor-mode-alist)
1727 (or (assq 'gnus-show-threads minor-mode-alist) 2103 (or (assq 'gnus-show-threads minor-mode-alist)
1728 (setq minor-mode-alist 2104 (setq minor-mode-alist
1729 (cons (list 'gnus-show-threads " Thread") minor-mode-alist))) 2105 (cons (list 'gnus-show-threads " Thread") minor-mode-alist)))
1730 (gnus-Subject-set-mode-line) 2106 (gnus-summary-set-mode-line)
1731 (use-local-map gnus-Subject-mode-map) 2107 (use-local-map gnus-summary-mode-map)
1732 (buffer-disable-undo (current-buffer)) 2108 (buffer-flush-undo (current-buffer))
1733 (setq buffer-read-only t) ;Disable modification 2109 (setq buffer-read-only t) ;Disable modification
1734 (setq truncate-lines t) ;Stop line folding 2110 (setq truncate-lines t) ;Stop line folding
1735 (setq selective-display t) 2111 (setq selective-display t)
1736 (setq selective-display-ellipses t) ;Display `...' 2112 (setq selective-display-ellipses t) ;Display `...'
1737 ;;(setq case-fold-search t) 2113 ;;(setq case-fold-search t)
1738 (run-hooks 'gnus-Subject-mode-hook)) 2114 (run-hooks 'gnus-summary-mode-hook))
1739 2115
1740(defun gnus-Subject-setup-buffer () 2116(defun gnus-summary-setup-buffer ()
1741 "Initialize subject display buffer." 2117 "Initialize Summary buffer."
1742 (if (get-buffer gnus-Subject-buffer) 2118 (if (get-buffer gnus-summary-buffer)
1743 (set-buffer gnus-Subject-buffer) 2119 (set-buffer gnus-summary-buffer)
1744 (set-buffer (get-buffer-create gnus-Subject-buffer)) 2120 (set-buffer (get-buffer-create gnus-summary-buffer))
1745 (gnus-Subject-mode) 2121 (gnus-summary-mode)
1746 )) 2122 ))
1747 2123
1748(defun gnus-Subject-read-group (group &optional show-all no-article) 2124(defun gnus-summary-read-group (group &optional show-all no-article)
1749 "Start reading news in newsgroup GROUP. 2125 "Start reading news in newsgroup GROUP.
1750If optional first argument SHOW-ALL is non-nil, already read articles are 2126If optional 1st argument SHOW-ALL is non-nil, already read articles are
1751also listed. 2127also listed.
1752If optional second argument NO-ARTICLE is non-nil, no article is selected 2128If optional 2nd argument NO-ARTICLE is non-nil, no article is selected
1753initially." 2129initially."
1754 (message "Retrieving newsgroup: %s..." group) 2130 (message "Retrieving newsgroup: %s..." group)
1755 (if (gnus-select-newsgroup group show-all) 2131 (if (gnus-select-newsgroup group show-all)
@@ -1757,48 +2133,48 @@ initially."
1757 ;; Don't switch-to-buffer to prevent displaying old contents 2133 ;; Don't switch-to-buffer to prevent displaying old contents
1758 ;; of the buffer until new subjects list is created. 2134 ;; of the buffer until new subjects list is created.
1759 ;; Suggested by Juha Heinanen <jh@tut.fi> 2135 ;; Suggested by Juha Heinanen <jh@tut.fi>
1760 (gnus-Subject-setup-buffer) 2136 (gnus-summary-setup-buffer)
1761 ;; You can change the order of subjects in this hook. 2137 ;; You can change the order of subjects in this hook.
1762 (run-hooks 'gnus-Select-group-hook) 2138 (run-hooks 'gnus-select-group-hook)
1763 (gnus-Subject-prepare) 2139 (gnus-summary-prepare)
1764 ;; Function `gnus-apply-kill-file' must be called in this hook. 2140 ;; Function `gnus-apply-kill-file' must be called in this hook.
1765 (run-hooks 'gnus-Apply-kill-hook) 2141 (run-hooks 'gnus-apply-kill-hook)
1766 (if (zerop (buffer-size)) 2142 (if (zerop (buffer-size))
1767 ;; This newsgroup is empty. 2143 ;; This newsgroup is empty.
1768 (progn 2144 (progn
1769 (gnus-Subject-catch-up-and-exit nil t) ;Without confirmations. 2145 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
1770 (message "No unread news")) 2146 (message "No unread news"))
1771 ;; Hide conversation thread subtrees. We cannot do this in 2147 ;; Hide conversation thread subtrees. We cannot do this in
1772 ;; gnus-Subject-prepare-hook since kill processing may not 2148 ;; gnus-summary-prepare-hook since kill processing may not
1773 ;; work with hidden articles. 2149 ;; work with hidden articles.
1774 (and gnus-show-threads 2150 (and gnus-show-threads
1775 gnus-thread-hide-subtree 2151 gnus-thread-hide-subtree
1776 (gnus-Subject-hide-all-threads)) 2152 (gnus-summary-hide-all-threads))
1777 ;; Show first unread article if requested. 2153 ;; Show first unread article if requested.
1778 (goto-char (point-min)) 2154 (goto-char (point-min))
1779 (if (and (not no-article) 2155 (if (and (not no-article)
1780 gnus-auto-select-first 2156 gnus-auto-select-first
1781 (gnus-Subject-first-unread-article)) 2157 (gnus-summary-first-unread-article))
1782 ;; Window is configured automatically. 2158 ;; Window is configured automatically.
1783 ;; Current buffer may be changed as a result of hook 2159 ;; Current buffer may be changed as a result of hook
1784 ;; evaluation, especially by gnus-Subject-rmail-digest 2160 ;; evaluation, especially by gnus-summary-rmail-digest
1785 ;; command, so we should adjust cursor point carefully. 2161 ;; command, so we should adjust cursor point carefully.
1786 (if (eq (current-buffer) (get-buffer gnus-Subject-buffer)) 2162 (if (eq (current-buffer) (get-buffer gnus-summary-buffer))
1787 (progn 2163 (progn
1788 ;; Adjust cursor point. 2164 ;; Adjust cursor point.
1789 (beginning-of-line) 2165 (beginning-of-line)
1790 (search-forward ":" nil t))) 2166 (search-forward ":" nil t)))
1791 (gnus-configure-windows 'SelectNewsgroup) 2167 (gnus-configure-windows 'summary)
1792 (pop-to-buffer gnus-Subject-buffer) 2168 (pop-to-buffer gnus-summary-buffer)
1793 (gnus-Subject-set-mode-line) 2169 (gnus-summary-set-mode-line)
1794 ;; I sometime get confused with the old Article buffer. 2170 ;; I sometime get confused with the old Article buffer.
1795 (if (get-buffer gnus-Article-buffer) 2171 (if (get-buffer gnus-article-buffer)
1796 (if (get-buffer-window gnus-Article-buffer) 2172 (if (get-buffer-window gnus-article-buffer)
1797 (save-excursion 2173 (save-excursion
1798 (set-buffer gnus-Article-buffer) 2174 (set-buffer gnus-article-buffer)
1799 (let ((buffer-read-only nil)) 2175 (let ((buffer-read-only nil))
1800 (erase-buffer))) 2176 (erase-buffer)))
1801 (kill-buffer gnus-Article-buffer))) 2177 (kill-buffer gnus-article-buffer)))
1802 ;; Adjust cursor point. 2178 ;; Adjust cursor point.
1803 (beginning-of-line) 2179 (beginning-of-line)
1804 (search-forward ":" nil t)) 2180 (search-forward ":" nil t))
@@ -1809,43 +2185,50 @@ initially."
1809 ;; If NNTP is used, nntp_access file may not be installed 2185 ;; If NNTP is used, nntp_access file may not be installed
1810 ;; properly. Otherwise, may be active file problem. 2186 ;; properly. Otherwise, may be active file problem.
1811 (ding) 2187 (ding)
1812 (message "Cannot select %s. May be security or active file problem." group) 2188 (message
2189 (gnus-nntp-message
2190 (format "Cannot select %s. May be security or active file problem." group)))
1813 (sit-for 0)) 2191 (sit-for 0))
1814 ;; Check bogus newsgroups. 2192 ;; Check bogus newsgroups.
1815 ;; We must be in Group Mode buffer. 2193 ;; We must be in Group Mode buffer.
1816 (gnus-Group-check-bogus-groups)) 2194 (gnus-group-check-bogus-groups))
1817 )) 2195 ))
1818 2196
1819(defun gnus-Subject-prepare () 2197(defun gnus-summary-prepare ()
1820 "Prepare subject list of current newsgroup in Subject mode buffer." 2198 "Prepare summary list of current newsgroup in Summary buffer."
1821 (let ((buffer-read-only nil)) 2199 (let ((buffer-read-only nil))
1822 ;; Note: The next codes are not actually used because the user who 2200 ;; Note: The next codes are not actually used because the user who
1823 ;; want it can define them in gnus-Select-group-hook. 2201 ;; want it can define them in gnus-select-group-hook.
1824 ;; Print verbose messages if too many articles are selected. 2202 ;; Print verbose messages if too many articles are selected.
1825 ;; (and (numberp gnus-large-newsgroup) 2203 ;; (and (numberp gnus-large-newsgroup)
1826 ;; (> (length gnus-newsgroup-headers) gnus-large-newsgroup) 2204 ;; (> (length gnus-newsgroup-headers) gnus-large-newsgroup)
1827 ;; (message "Preparing headers...")) 2205 ;; (message "Preparing headers..."))
1828 (erase-buffer) 2206 (erase-buffer)
1829 (gnus-Subject-prepare-threads 2207 (gnus-summary-prepare-threads
1830 (if gnus-show-threads 2208 (if gnus-show-threads
1831 (gnus-make-threads gnus-newsgroup-headers) 2209 (gnus-make-threads gnus-newsgroup-headers)
1832 gnus-newsgroup-headers) 0) 2210 gnus-newsgroup-headers) 0)
1833 ;; Erase header retrieval message. 2211 ;; Erase header retrieval message.
1834 (message "") 2212 (message "")
1835 ;; Call hooks for modifying Subject mode buffer. 2213 ;; Call hooks for modifying Summary buffer.
1836 ;; Suggested by sven@tde.LTH.Se (Sven Mattisson). 2214 ;; Suggested by sven@tde.LTH.Se (Sven Mattisson).
1837 (goto-char (point-min)) 2215 (goto-char (point-min))
1838 (run-hooks 'gnus-Subject-prepare-hook) 2216 (run-hooks 'gnus-summary-prepare-hook)
1839 )) 2217 ))
1840 2218
1841;; Basic ideas by Paul Dworkin <paul@media-lab.media.mit.edu> 2219;; Basic ideas by Paul Dworkin <paul@media-lab.media.mit.edu>
2220;; Subject bug fix by jbw@bigbird.bu.edu (Joe Wells)
1842 2221
1843(defun gnus-Subject-prepare-threads (threads level) 2222(defun gnus-summary-prepare-threads (threads level &optional parent-subject)
1844 "Prepare Subject buffer from THREADS and indentation LEVEL. 2223 "Prepare Summary buffer from THREADS and indentation LEVEL.
1845THREADS is a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...]).'" 2224THREADS is a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...]).'
2225Optional PARENT-SUBJECT specifies the subject of the parent."
1846 (let ((thread nil) 2226 (let ((thread nil)
1847 (header nil) 2227 (header nil)
1848 (number nil) 2228 (number nil)
2229 (subject nil)
2230 (child-subject nil)
2231 (parent-subject (or parent-subject ""))
1849 ;; `M Indent NUM: [OPT] SUBJECT' 2232 ;; `M Indent NUM: [OPT] SUBJECT'
1850 (cntl (format "%%s %%s%%%dd: [%%s] %%s\n" 2233 (cntl (format "%%s %%s%%%dd: [%%s] %%s\n"
1851 (length (prin1-to-string gnus-newsgroup-end))))) 2234 (length (prin1-to-string gnus-newsgroup-end)))))
@@ -1861,6 +2244,8 @@ THREADS is a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...]).'"
1861 (if (vectorp header) ;Depends on nntp.el. 2244 (if (vectorp header) ;Depends on nntp.el.
1862 (progn 2245 (progn
1863 (setq number (nntp-header-number header)) 2246 (setq number (nntp-header-number header))
2247 (setq subject (nntp-header-subject header))
2248 (setq child-subject (gnus-simplify-subject subject 're-only))
1864 (insert 2249 (insert
1865 (format cntl 2250 (format cntl
1866 ;; Read or not. 2251 ;; Read or not.
@@ -1876,51 +2261,87 @@ THREADS is a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...]).'"
1876 (funcall gnus-optional-headers header)) "") 2261 (funcall gnus-optional-headers header)) "")
1877 ;; Its subject string. 2262 ;; Its subject string.
1878 (concat (if (or (zerop level) 2263 (concat (if (or (zerop level)
1879 (not gnus-thread-hide-subject)) 2264 (not gnus-thread-hide-subject)
2265 ;; Subject is different from the parent.
2266 (not (string-equal
2267 parent-subject child-subject)))
1880 nil 2268 nil
1881 (make-string (window-width) ? )) 2269 (make-string (window-width) ? ))
1882 (nntp-header-subject header)) 2270 subject)
1883 )) 2271 ))
1884 )) 2272 ))
1885 ;; Print subthreads. 2273 ;; Print subthreads.
1886 (and (consp thread) 2274 (and (consp thread)
1887 (cdr thread) 2275 (cdr thread)
1888 (gnus-Subject-prepare-threads (cdr thread) (1+ level))) 2276 (gnus-summary-prepare-threads
2277 (cdr thread) (1+ level) child-subject))
1889 ))) 2278 )))
1890 2279
1891(defun gnus-Subject-set-mode-line () 2280;;(defun gnus-summary-set-mode-line ()
1892 "Set Subject mode line string." 2281;; "Set Summary mode line string."
1893 ;; The value must be a string to escape %-constructs. 2282;; ;; The value must be a string to escape %-constructs.
1894 (let ((subject 2283;; (let ((subject
1895 (if gnus-current-headers 2284;; (if gnus-current-headers
1896 (nntp-header-subject gnus-current-headers) gnus-newsgroup-name))) 2285;; (nntp-header-subject gnus-current-headers) gnus-newsgroup-name)))
2286;; (setq mode-line-buffer-identification
2287;; (concat "GNUS: "
2288;; subject
2289;; ;; Enough spaces to pad subject to 17 positions.
2290;; (make-string (max 0 (- 17 (length subject))) ? ))))
2291;; (set-buffer-modified-p t))
2292
2293;; New implementation in gnus 3.14.3
2294
2295(defun gnus-summary-set-mode-line ()
2296 "Set Summary mode line string.
2297If you don't like it, define your own gnus-summary-set-mode-line."
2298 (let ((unmarked
2299 (- (length gnus-newsgroup-unreads)
2300 (length (gnus-intersection
2301 gnus-newsgroup-unreads gnus-newsgroup-marked))))
2302 (unselected
2303 (- (length gnus-newsgroup-unselected)
2304 (length (gnus-intersection
2305 gnus-newsgroup-unselected gnus-newsgroup-marked)))))
1897 (setq mode-line-buffer-identification 2306 (setq mode-line-buffer-identification
1898 (concat "GNUS: " 2307 (list 17
1899 subject 2308 (format "GNUS: %s%s %s"
1900 ;; Enough spaces to pad subject to 17 positions. 2309 gnus-newsgroup-name
1901 (make-string (max 0 (- 17 (length subject))) ? )))) 2310 (if gnus-current-article
2311 (format "/%d" gnus-current-article) "")
2312 ;; Basic ideas by tale@pawl.rpi.edu.
2313 (cond ((and (zerop unmarked)
2314 (zerop unselected))
2315 "")
2316 ((zerop unselected)
2317 (format "{%d more}" unmarked))
2318 (t
2319 (format "{%d(+%d) more}" unmarked unselected)))
2320 ))))
1902 (set-buffer-modified-p t)) 2321 (set-buffer-modified-p t))
1903 2322
1904;; GNUS Subject mode command. 2323;; GNUS Summary mode command.
1905 2324
1906(defun gnus-Subject-search-group (&optional backward) 2325(defun gnus-summary-search-group (&optional backward)
1907 "Search for next unread newsgroup. 2326 "Search for next unread newsgroup.
1908If optional argument BACKWARD is non-nil, search backward instead." 2327If optional argument BACKWARD is non-nil, search backward instead."
1909 (save-excursion 2328 (save-excursion
1910 (set-buffer gnus-Group-buffer) 2329 (set-buffer gnus-group-buffer)
1911 (save-excursion 2330 (save-excursion
1912 ;; We don't want to alter current point of Group mode buffer. 2331 ;; We don't want to alter current point of Group mode buffer.
1913 (if (gnus-Group-search-forward backward nil) 2332 (if (gnus-group-search-forward backward nil)
1914 (gnus-Group-group-name)) 2333 (gnus-group-group-name))
1915 ))) 2334 )))
1916 2335
1917(defun gnus-Subject-search-subject (backward unread subject) 2336(defun gnus-summary-search-subject (backward unread subject)
1918 "Search for article forward. 2337 "Search for article forward.
1919If first argument BACKWARD is non-nil, search backward. 2338If 1st argument BACKWARD is non-nil, search backward.
1920If second argument UNREAD is non-nil, only unread article is selected. 2339If 2nd argument UNREAD is non-nil, only unread article is selected.
1921If third argument SUBJECT is non-nil, the article which has 2340If 3rd argument SUBJECT is non-nil, the article which has
1922the same subject will be searched for." 2341the same subject will be searched for."
1923 (let ((func (if backward 're-search-backward 're-search-forward)) 2342 (let ((func
2343 (if backward
2344 (function re-search-backward) (function re-search-forward)))
1924 (article nil) 2345 (article nil)
1925 ;; We have to take care of hidden lines. 2346 ;; We have to take care of hidden lines.
1926 (regexp 2347 (regexp
@@ -1948,21 +2369,21 @@ the same subject will be searched for."
1948 article 2369 article
1949 )) 2370 ))
1950 2371
1951(defun gnus-Subject-search-forward (&optional unread subject) 2372(defun gnus-summary-search-forward (&optional unread subject)
1952 "Search for article forward. 2373 "Search for article forward.
1953If first optional argument UNREAD is non-nil, only unread article is selected. 2374If 1st optional argument UNREAD is non-nil, only unread article is selected.
1954If second optional argument SUBJECT is non-nil, the article which has 2375If 2nd optional argument SUBJECT is non-nil, the article which has
1955the same subject will be searched for." 2376the same subject will be searched for."
1956 (gnus-Subject-search-subject nil unread subject)) 2377 (gnus-summary-search-subject nil unread subject))
1957 2378
1958(defun gnus-Subject-search-backward (&optional unread subject) 2379(defun gnus-summary-search-backward (&optional unread subject)
1959 "Search for article backward. 2380 "Search for article backward.
1960If first optional argument UNREAD is non-nil, only unread article is selected. 2381If 1st optional argument UNREAD is non-nil, only unread article is selected.
1961If second optional argument SUBJECT is non-nil, the article which has 2382If 2nd optional argument SUBJECT is non-nil, the article which has
1962the same subject will be searched for." 2383the same subject will be searched for."
1963 (gnus-Subject-search-subject t unread subject)) 2384 (gnus-summary-search-subject t unread subject))
1964 2385
1965(defun gnus-Subject-article-number () 2386(defun gnus-summary-article-number ()
1966 "Article number around point. If nothing, return current number." 2387 "Article number around point. If nothing, return current number."
1967 (save-excursion 2388 (save-excursion
1968 (beginning-of-line) 2389 (beginning-of-line)
@@ -1973,18 +2394,18 @@ the same subject will be searched for."
1973 gnus-current-article 2394 gnus-current-article
1974 ))) 2395 )))
1975 2396
1976(defun gnus-Subject-subject-string () 2397(defun gnus-summary-subject-string ()
1977 "Return current subject string or nil if nothing." 2398 "Return current subject string or nil if nothing."
1978 (save-excursion 2399 (save-excursion
1979 ;; It is possible to implement this function using 2400 ;; It is possible to implement this function using
1980 ;; `gnus-Subject-article-number' and `gnus-newsgroup-headers'. 2401 ;; `gnus-summary-article-number' and `gnus-newsgroup-headers'.
1981 (beginning-of-line) 2402 (beginning-of-line)
1982 ;; We have to take care of hidden lines. 2403 ;; We have to take care of hidden lines.
1983 (if (looking-at ".[ \t]+[0-9]+:.\\[[^]\r\n]*\\][ \t]+\\([^\r\n]*\\)[\r\n]") 2404 (if (looking-at ".[ \t]+[0-9]+:.\\[[^]\r\n]*\\][ \t]+\\([^\r\n]*\\)[\r\n]")
1984 (buffer-substring (match-beginning 1) (match-end 1))) 2405 (buffer-substring (match-beginning 1) (match-end 1)))
1985 )) 2406 ))
1986 2407
1987(defun gnus-Subject-goto-subject (article) 2408(defun gnus-summary-goto-subject (article)
1988 "Move point to ARTICLE's subject." 2409 "Move point to ARTICLE's subject."
1989 (interactive 2410 (interactive
1990 (list 2411 (list
@@ -2003,185 +2424,188 @@ the same subject will be searched for."
2003 (progn (goto-char current) nil)) 2424 (progn (goto-char current) nil))
2004 )) 2425 ))
2005 2426
2006(defun gnus-Subject-recenter () 2427(defun gnus-summary-recenter ()
2007 "Center point in Subject mode window." 2428 "Center point in Summary window."
2008 ;; Scroll window so as to cursor comes center of Subject mode window 2429 ;; Scroll window so as to cursor comes center of Summary window
2009 ;; only when article is displayed. 2430 ;; only when article is displayed.
2010 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle). 2431 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
2011 ;; Recenter only when requested. 2432 ;; Recenter only when requested.
2012 ;; Suggested by popovich@park.cs.columbia.edu 2433 ;; Subbested by popovich@park.cs.columbia.edu
2013 (and gnus-auto-center-subject 2434 (and gnus-auto-center-summary
2014 (get-buffer-window gnus-Article-buffer) 2435 (get-buffer-window gnus-article-buffer)
2015 (< (/ (- (window-height) 1) 2) 2436 (< (/ (- (window-height) 1) 2)
2016 (count-lines (point) (point-max))) 2437 (count-lines (point) (point-max)))
2017 (recenter (/ (- (window-height) 2) 2)))) 2438 (recenter (/ (- (window-height) 2) 2))))
2018 2439
2019;; Walking around Group mode buffer. 2440;; Walking around Group mode buffer.
2020 2441
2021(defun gnus-Subject-jump-to-group (newsgroup) 2442(defun gnus-summary-jump-to-group (newsgroup)
2022 "Move point to NEWSGROUP in Group mode buffer." 2443 "Move point to NEWSGROUP in Group mode buffer."
2023 ;; Keep update point of Group mode buffer if visible. 2444 ;; Keep update point of Group mode buffer if visible.
2024 (if (eq (current-buffer) 2445 (if (eq (current-buffer)
2025 (get-buffer gnus-Group-buffer)) 2446 (get-buffer gnus-group-buffer))
2026 (save-window-excursion 2447 (save-window-excursion
2027 ;; Take care of tree window mode. 2448 ;; Take care of tree window mode.
2028 (if (get-buffer-window gnus-Group-buffer) 2449 (if (get-buffer-window gnus-group-buffer)
2029 (pop-to-buffer gnus-Group-buffer)) 2450 (pop-to-buffer gnus-group-buffer))
2030 (gnus-Group-jump-to-group newsgroup)) 2451 (gnus-group-jump-to-group newsgroup))
2031 (save-excursion 2452 (save-excursion
2032 ;; Take care of tree window mode. 2453 ;; Take care of tree window mode.
2033 (if (get-buffer-window gnus-Group-buffer) 2454 (if (get-buffer-window gnus-group-buffer)
2034 (pop-to-buffer gnus-Group-buffer) 2455 (pop-to-buffer gnus-group-buffer)
2035 (set-buffer gnus-Group-buffer)) 2456 (set-buffer gnus-group-buffer))
2036 (gnus-Group-jump-to-group newsgroup)))) 2457 (gnus-group-jump-to-group newsgroup))))
2037 2458
2038(defun gnus-Subject-next-group (no-article) 2459(defun gnus-summary-next-group (no-article)
2039 "Exit current newsgroup and then select next unread newsgroup. 2460 "Exit current newsgroup and then select next unread newsgroup.
2040If prefix argument NO-ARTICLE is non-nil, no article is selected initially." 2461If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
2041 (interactive "P") 2462 (interactive "P")
2042 ;; Make sure Group mode buffer point is on current newsgroup. 2463 ;; Make sure Group mode buffer point is on current newsgroup.
2043 (gnus-Subject-jump-to-group gnus-newsgroup-name) 2464 (gnus-summary-jump-to-group gnus-newsgroup-name)
2044 (let ((group (gnus-Subject-search-group))) 2465 (let ((group (gnus-summary-search-group)))
2045 (if (null group) 2466 (if (null group)
2046 (progn 2467 (progn
2047 (message "Exiting %s..." gnus-newsgroup-name) 2468 (message "Exiting %s..." gnus-newsgroup-name)
2048 (gnus-Subject-exit) 2469 (gnus-summary-exit)
2049 (message "")) 2470 (message ""))
2050 (message "Selecting %s..." group) 2471 (message "Selecting %s..." group)
2051 (gnus-Subject-exit t) ;Exit Subject mode temporary. 2472 (gnus-summary-exit t) ;Exit Summary mode temporary.
2052 ;; We are now in Group mode buffer. 2473 ;; We are now in Group mode buffer.
2053 ;; Make sure Group mode buffer point is on GROUP. 2474 ;; Make sure Group mode buffer point is on GROUP.
2054 (gnus-Subject-jump-to-group group) 2475 (gnus-summary-jump-to-group group)
2055 (gnus-Subject-read-group group nil no-article) 2476 (gnus-summary-read-group group nil no-article)
2056 (or (eq (current-buffer) 2477 (or (eq (current-buffer)
2057 (get-buffer gnus-Subject-buffer)) 2478 (get-buffer gnus-summary-buffer))
2058 (eq gnus-auto-select-next t) 2479 (eq gnus-auto-select-next t)
2059 ;; Expected newsgroup has nothing to read since the articles 2480 ;; Expected newsgroup has nothing to read since the articles
2060 ;; are marked as read by cross-referencing. So, try next 2481 ;; are marked as read by cross-referencing. So, try next
2061 ;; newsgroup. (Make sure we are in Group mode buffer now.) 2482 ;; newsgroup. (Make sure we are in Group mode buffer now.)
2062 (and (eq (current-buffer) 2483 (and (eq (current-buffer)
2063 (get-buffer gnus-Group-buffer)) 2484 (get-buffer gnus-group-buffer))
2064 (gnus-Group-group-name) 2485 (gnus-group-group-name)
2065 (gnus-Subject-read-group 2486 (gnus-summary-read-group
2066 (gnus-Group-group-name) nil no-article)) 2487 (gnus-group-group-name) nil no-article))
2067 ) 2488 )
2068 ))) 2489 )))
2069 2490
2070(defun gnus-Subject-prev-group (no-article) 2491(defun gnus-summary-prev-group (no-article)
2071 "Exit current newsgroup and then select previous unread newsgroup. 2492 "Exit current newsgroup and then select previous unread newsgroup.
2072If prefix argument NO-ARTICLE is non-nil, no article is selected initially." 2493If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
2073 (interactive "P") 2494 (interactive "P")
2074 ;; Make sure Group mode buffer point is on current newsgroup. 2495 ;; Make sure Group mode buffer point is on current newsgroup.
2075 (gnus-Subject-jump-to-group gnus-newsgroup-name) 2496 (gnus-summary-jump-to-group gnus-newsgroup-name)
2076 (let ((group (gnus-Subject-search-group t))) 2497 (let ((group (gnus-summary-search-group t)))
2077 (if (null group) 2498 (if (null group)
2078 (progn 2499 (progn
2079 (message "Exiting %s..." gnus-newsgroup-name) 2500 (message "Exiting %s..." gnus-newsgroup-name)
2080 (gnus-Subject-exit) 2501 (gnus-summary-exit)
2081 (message "")) 2502 (message ""))
2082 (message "Selecting %s..." group) 2503 (message "Selecting %s..." group)
2083 (gnus-Subject-exit t) ;Exit Subject mode temporary. 2504 (gnus-summary-exit t) ;Exit Summary mode temporary.
2084 ;; We are now in Group mode buffer. 2505 ;; We are now in Group mode buffer.
2085 ;; We have to adjust point of Group mode buffer because current 2506 ;; We have to adjust point of Group mode buffer because current
2086 ;; point is moved to next unread newsgroup by exiting. 2507 ;; point is moved to next unread newsgroup by exiting.
2087 (gnus-Subject-jump-to-group group) 2508 (gnus-summary-jump-to-group group)
2088 (gnus-Subject-read-group group nil no-article) 2509 (gnus-summary-read-group group nil no-article)
2089 (or (eq (current-buffer) 2510 (or (eq (current-buffer)
2090 (get-buffer gnus-Subject-buffer)) 2511 (get-buffer gnus-summary-buffer))
2091 (eq gnus-auto-select-next t) 2512 (eq gnus-auto-select-next t)
2092 ;; Expected newsgroup has nothing to read since the articles 2513 ;; Expected newsgroup has nothing to read since the articles
2093 ;; are marked as read by cross-referencing. So, try next 2514 ;; are marked as read by cross-referencing. So, try next
2094 ;; newsgroup. (Make sure we are in Group mode buffer now.) 2515 ;; newsgroup. (Make sure we are in Group mode buffer now.)
2095 (and (eq (current-buffer) 2516 (and (eq (current-buffer)
2096 (get-buffer gnus-Group-buffer)) 2517 (get-buffer gnus-group-buffer))
2097 (gnus-Subject-search-group t) 2518 (gnus-summary-search-group t)
2098 (gnus-Subject-read-group 2519 (gnus-summary-read-group
2099 (gnus-Subject-search-group t) nil no-article)) 2520 (gnus-summary-search-group t) nil no-article))
2100 ) 2521 )
2101 ))) 2522 )))
2102 2523
2103;; Walking around subject lines. 2524;; Walking around summary lines.
2104 2525
2105(defun gnus-Subject-next-subject (n &optional unread) 2526(defun gnus-summary-next-subject (n &optional unread)
2106 "Go to next N'th subject line. 2527 "Go to next N'th summary line.
2107If optional argument UNREAD is non-nil, only unread article is selected." 2528If optional argument UNREAD is non-nil, only unread article is selected."
2108 (interactive "p") 2529 (interactive "p")
2109 (while (and (> n 1) 2530 (while (and (> n 1)
2110 (gnus-Subject-search-forward unread)) 2531 (gnus-summary-search-forward unread))
2111 (setq n (1- n))) 2532 (setq n (1- n)))
2112 (cond ((gnus-Subject-search-forward unread) 2533 (cond ((gnus-summary-search-forward unread)
2113 (gnus-Subject-recenter)) 2534 (gnus-summary-recenter))
2114 (unread 2535 (unread
2115 (message "No more unread articles")) 2536 (message "No more unread articles"))
2116 (t 2537 (t
2117 (message "No more articles")) 2538 (message "No more articles"))
2118 )) 2539 ))
2119 2540
2120(defun gnus-Subject-next-unread-subject (n) 2541(defun gnus-summary-next-unread-subject (n)
2121 "Go to next N'th unread subject line." 2542 "Go to next N'th unread summary line."
2122 (interactive "p") 2543 (interactive "p")
2123 (gnus-Subject-next-subject n t)) 2544 (gnus-summary-next-subject n t))
2124 2545
2125(defun gnus-Subject-prev-subject (n &optional unread) 2546(defun gnus-summary-prev-subject (n &optional unread)
2126 "Go to previous N'th subject line. 2547 "Go to previous N'th summary line.
2127If optional argument UNREAD is non-nil, only unread article is selected." 2548If optional argument UNREAD is non-nil, only unread article is selected."
2128 (interactive "p") 2549 (interactive "p")
2129 (while (and (> n 1) 2550 (while (and (> n 1)
2130 (gnus-Subject-search-backward unread)) 2551 (gnus-summary-search-backward unread))
2131 (setq n (1- n))) 2552 (setq n (1- n)))
2132 (cond ((gnus-Subject-search-backward unread) 2553 (cond ((gnus-summary-search-backward unread)
2133 (gnus-Subject-recenter)) 2554 (gnus-summary-recenter))
2134 (unread 2555 (unread
2135 (message "No more unread articles")) 2556 (message "No more unread articles"))
2136 (t 2557 (t
2137 (message "No more articles")) 2558 (message "No more articles"))
2138 )) 2559 ))
2139 2560
2140(defun gnus-Subject-prev-unread-subject (n) 2561(defun gnus-summary-prev-unread-subject (n)
2141 "Go to previous N'th unread subject line." 2562 "Go to previous N'th unread summary line."
2142 (interactive "p") 2563 (interactive "p")
2143 (gnus-Subject-prev-subject n t)) 2564 (gnus-summary-prev-subject n t))
2144 2565
2145;; Walking around subject lines with displaying articles. 2566;; Walking around summary lines with displaying articles.
2146 2567
2147(defun gnus-Subject-expand-window () 2568(defun gnus-summary-expand-window ()
2148 "Expand Subject window to show headers full window." 2569 "Expand Summary window to show headers full window."
2149 (interactive) 2570 (interactive)
2150 (gnus-configure-windows 'ExpandSubject) 2571 (gnus-configure-windows 'summary)
2151 (pop-to-buffer gnus-Subject-buffer)) 2572 (pop-to-buffer gnus-summary-buffer))
2152 2573
2153(defun gnus-Subject-display-article (article &optional all-header) 2574(defun gnus-summary-display-article (article &optional all-header)
2154 "Display ARTICLE in Article buffer." 2575 "Display ARTICLE in Article buffer."
2155 (if (null article) 2576 (if (null article)
2156 nil 2577 nil
2157 (gnus-configure-windows 'SelectArticle) 2578 (gnus-configure-windows 'article)
2158 (pop-to-buffer gnus-Subject-buffer) 2579 (pop-to-buffer gnus-summary-buffer)
2159 (gnus-Article-prepare article all-header) 2580 (gnus-article-prepare article all-header)
2160 (gnus-Subject-recenter) 2581 (gnus-summary-recenter)
2161 (gnus-Subject-set-mode-line) 2582 (gnus-summary-set-mode-line)
2162 (run-hooks 'gnus-Select-article-hook) 2583 (run-hooks 'gnus-select-article-hook)
2163 ;; Successfully display article. 2584 ;; Successfully display article.
2164 t 2585 t
2165 )) 2586 ))
2166 2587
2167(defun gnus-Subject-select-article (&optional all-headers force) 2588(defun gnus-summary-select-article (&optional all-headers force)
2168 "Select the current article. 2589 "Select the current article.
2169Optional argument ALL-HEADERS is non-nil, show all headers." 2590Optional first argument ALL-HEADERS is non-nil, show all header fields.
2170 (let ((article (gnus-Subject-article-number))) 2591Optional second argument FORCE is nil, the article is only selected
2592again when current header does not match with ALL-HEADERS option."
2593 (let ((article (gnus-summary-article-number))
2594 (all-headers (not (not all-headers)))) ;Must be T or NIL.
2171 (if (or (null gnus-current-article) 2595 (if (or (null gnus-current-article)
2172 (/= article gnus-current-article) 2596 (/= article gnus-current-article)
2173 (and force (not (eq all-headers gnus-have-all-headers)))) 2597 (and force (not (eq all-headers gnus-have-all-headers))))
2174 ;; The selected subject is different from that of the current article. 2598 ;; The selected one is different from that of the current article.
2175 (gnus-Subject-display-article article all-headers) 2599 (gnus-summary-display-article article all-headers)
2176 (gnus-configure-windows 'SelectArticle) 2600 (gnus-configure-windows 'article)
2177 (pop-to-buffer gnus-Subject-buffer)) 2601 (pop-to-buffer gnus-summary-buffer))
2178 )) 2602 ))
2179 2603
2180(defun gnus-Subject-set-current-mark (&optional current-mark) 2604(defun gnus-summary-set-current-mark (&optional current-mark)
2181 "Put `+' at the current article. 2605 "Put `+' at the current article.
2182Optional argument specifies CURRENT-MARK instead of `+'." 2606Optional argument specifies CURRENT-MARK instead of `+'."
2183 (save-excursion 2607 (save-excursion
2184 (set-buffer gnus-Subject-buffer) 2608 (set-buffer gnus-summary-buffer)
2185 (let ((buffer-read-only nil)) 2609 (let ((buffer-read-only nil))
2186 (goto-char (point-min)) 2610 (goto-char (point-min))
2187 ;; First of all clear mark at last article. 2611 ;; First of all clear mark at last article.
@@ -2196,43 +2620,56 @@ Optional argument specifies CURRENT-MARK instead of `+'."
2196 (insert (or current-mark "+")))) 2620 (insert (or current-mark "+"))))
2197 ))) 2621 )))
2198 2622
2199(defun gnus-Subject-next-article (unread &optional subject) 2623;;(defun gnus-summary-next-article (unread &optional subject)
2624;; "Select article after current one.
2625;;If argument UNREAD is non-nil, only unread article is selected."
2626;; (interactive "P")
2627;; (cond ((gnus-summary-display-article
2628;; (gnus-summary-search-forward unread subject)))
2629;; (unread
2630;; (message "No more unread articles"))
2631;; (t
2632;; (message "No more articles"))
2633;; ))
2634
2635(defun gnus-summary-next-article (unread &optional subject)
2200 "Select article after current one. 2636 "Select article after current one.
2201If argument UNREAD is non-nil, only unread article is selected." 2637If argument UNREAD is non-nil, only unread article is selected."
2202 (interactive "P") 2638 (interactive "P")
2203 (let ((header nil)) 2639 (let ((header nil))
2204 (cond ((gnus-Subject-display-article 2640 (cond ((gnus-summary-display-article
2205 (gnus-Subject-search-forward unread subject))) 2641 (gnus-summary-search-forward unread subject)))
2206 ((and subject 2642 ((and subject
2207 gnus-auto-select-same 2643 gnus-auto-select-same
2208 (gnus-set-difference gnus-newsgroup-unreads 2644 (gnus-set-difference gnus-newsgroup-unreads
2209 gnus-newsgroup-marked) 2645 gnus-newsgroup-marked)
2210 (memq this-command 2646 (memq this-command
2211 '(gnus-Subject-next-unread-article 2647 '(gnus-summary-next-unread-article
2212 gnus-Subject-next-page 2648 gnus-summary-next-page
2213 gnus-Subject-kill-same-subject-and-select 2649 gnus-summary-kill-same-subject-and-select
2214 ;;gnus-Subject-next-article 2650 ;;gnus-summary-next-article
2215 ;;gnus-Subject-next-same-subject 2651 ;;gnus-summary-next-same-subject
2216 ;;gnus-Subject-next-unread-same-subject 2652 ;;gnus-summary-next-unread-same-subject
2217 ))) 2653 )))
2218 ;; Wrap article pointer if there are unread articles. 2654 ;; Wrap article pointer if there are unread articles.
2219 ;; Hook function, such as gnus-Subject-rmail-digest, may 2655 ;; Hook function, such as gnus-summary-rmail-digest, may
2220 ;; change current buffer, so need check. 2656 ;; change current buffer, so need check.
2221 (let ((buffer (current-buffer)) 2657 (let ((buffer (current-buffer))
2222 (last-point (point))) 2658 (last-point (point)))
2223 ;; No more articles with same subject, so jump to the first 2659 ;; No more articles with same subject, so jump to the first
2224 ;; unread article. 2660 ;; unread article.
2225 (gnus-Subject-first-unread-article) 2661 (gnus-summary-first-unread-article)
2226 ;;(and (eq buffer (current-buffer)) 2662 ;;(and (eq buffer (current-buffer))
2227 ;; (= (point) last-point) 2663 ;; (= (point) last-point)
2228 ;; ;; Ignore given SUBJECT, and try again. 2664 ;; ;; Ignore given SUBJECT, and try again.
2229 ;; (gnus-Subject-next-article unread nil)) 2665 ;; (gnus-summary-next-article unread nil))
2230 (and (eq buffer (current-buffer)) 2666 (and (eq buffer (current-buffer))
2231 (< (point) last-point) 2667 (< (point) last-point)
2232 (message "Wrapped")) 2668 (message "Wrapped"))
2233 )) 2669 ))
2234 ((and (not unread) 2670 ((and gnus-auto-extend-newsgroup
2235 gnus-auto-extend-newsgroup 2671 (not unread) ;Not unread only
2672 (not subject) ;Only if subject is not specified.
2236 (setq header (gnus-more-header-forward))) 2673 (setq header (gnus-more-header-forward)))
2237 ;; Extend to next article if possible. 2674 ;; Extend to next article if possible.
2238 ;; Basic ideas by himacdonald@watdragon.waterloo.edu 2675 ;; Basic ideas by himacdonald@watdragon.waterloo.edu
@@ -2240,24 +2677,24 @@ If argument UNREAD is non-nil, only unread article is selected."
2240 ;; Threads feature must be turned off. 2677 ;; Threads feature must be turned off.
2241 (let ((buffer-read-only nil)) 2678 (let ((buffer-read-only nil))
2242 (goto-char (point-max)) 2679 (goto-char (point-max))
2243 (gnus-Subject-prepare-threads (list header) 0)) 2680 (gnus-summary-prepare-threads (list header) 0))
2244 (gnus-Subject-goto-article gnus-newsgroup-end)) 2681 (gnus-summary-goto-article gnus-newsgroup-end))
2245 (t 2682 (t
2246 ;; Select next newsgroup automatically if requested. 2683 ;; Select next newsgroup automatically if requested.
2247 (let ((cmd (string-to-char (this-command-keys))) 2684 (let ((cmd (string-to-char (this-command-keys)))
2248 (group (gnus-Subject-search-group)) 2685 (group (gnus-summary-search-group))
2249 (auto-select 2686 (auto-select
2250 (and gnus-auto-select-next 2687 (and gnus-auto-select-next
2251 ;;(null (gnus-set-difference gnus-newsgroup-unreads 2688 ;;(null (gnus-set-difference gnus-newsgroup-unreads
2252 ;; gnus-newsgroup-marked)) 2689 ;; gnus-newsgroup-marked))
2253 (memq this-command 2690 (memq this-command
2254 '(gnus-Subject-next-unread-article 2691 '(gnus-summary-next-unread-article
2255 gnus-Subject-next-article 2692 gnus-summary-next-article
2256 gnus-Subject-next-page 2693 gnus-summary-next-page
2257 gnus-Subject-next-same-subject 2694 gnus-summary-next-same-subject
2258 gnus-Subject-next-unread-same-subject 2695 gnus-summary-next-unread-same-subject
2259 gnus-Subject-kill-same-subject 2696 gnus-summary-kill-same-subject
2260 gnus-Subject-kill-same-subject-and-select 2697 gnus-summary-kill-same-subject-and-select
2261 )) 2698 ))
2262 ;; Ignore characters typed ahead. 2699 ;; Ignore characters typed ahead.
2263 (not (input-pending-p)) 2700 (not (input-pending-p))
@@ -2267,7 +2704,7 @@ If argument UNREAD is non-nil, only unread article is selected."
2267 (if (and auto-select 2704 (if (and auto-select
2268 (not (eq gnus-auto-select-next 'quietly))) 2705 (not (eq gnus-auto-select-next 'quietly)))
2269 (if group 2706 (if group
2270 (format " (Type %s to %s [%d])" 2707 (format " (Type %s for %s [%d])"
2271 (key-description (char-to-string cmd)) 2708 (key-description (char-to-string cmd))
2272 group 2709 group
2273 (nth 1 (gnus-gethash group 2710 (nth 1 (gnus-gethash group
@@ -2281,145 +2718,146 @@ If argument UNREAD is non-nil, only unread article is selected."
2281 (cond ((and auto-select 2718 (cond ((and auto-select
2282 (eq gnus-auto-select-next 'quietly)) 2719 (eq gnus-auto-select-next 'quietly))
2283 ;; Select quietly. 2720 ;; Select quietly.
2284 (gnus-Subject-next-group nil)) 2721 (gnus-summary-next-group nil))
2285 (auto-select 2722 (auto-select
2286 ;; Confirm auto selection. 2723 ;; Confirm auto selection.
2287 (let ((char (read-char))) 2724 (let ((char (read-char)))
2288 (if (= char cmd) 2725 (if (= char cmd)
2289 (gnus-Subject-next-group nil) 2726 (gnus-summary-next-group nil)
2290 (setq unread-command-events (list char))))) 2727 (setq unread-command-char char))))
2291 ) 2728 )
2292 )) 2729 ))
2293 ))) 2730 )))
2294 2731
2295(defun gnus-Subject-next-unread-article () 2732(defun gnus-summary-next-unread-article ()
2296 "Select unread article after current one." 2733 "Select unread article after current one."
2297 (interactive) 2734 (interactive)
2298 (gnus-Subject-next-article t (and gnus-auto-select-same 2735 (gnus-summary-next-article t (and gnus-auto-select-same
2299 (gnus-Subject-subject-string)))) 2736 (gnus-summary-subject-string))))
2300 2737
2301(defun gnus-Subject-prev-article (unread &optional subject) 2738(defun gnus-summary-prev-article (unread &optional subject)
2302 "Select article before current one. 2739 "Select article before current one.
2303If argument UNREAD is non-nil, only unread article is selected." 2740If argument UNREAD is non-nil, only unread article is selected."
2304 (interactive "P") 2741 (interactive "P")
2305 (let ((header nil)) 2742 (let ((header nil))
2306 (cond ((gnus-Subject-display-article 2743 (cond ((gnus-summary-display-article
2307 (gnus-Subject-search-backward unread subject))) 2744 (gnus-summary-search-backward unread subject)))
2308 ((and subject 2745 ((and subject
2309 gnus-auto-select-same 2746 gnus-auto-select-same
2310 (gnus-set-difference gnus-newsgroup-unreads 2747 (gnus-set-difference gnus-newsgroup-unreads
2311 gnus-newsgroup-marked) 2748 gnus-newsgroup-marked)
2312 (memq this-command 2749 (memq this-command
2313 '(gnus-Subject-prev-unread-article 2750 '(gnus-summary-prev-unread-article
2314 ;;gnus-Subject-prev-page 2751 ;;gnus-summary-prev-page
2315 ;;gnus-Subject-prev-article 2752 ;;gnus-summary-prev-article
2316 ;;gnus-Subject-prev-same-subject 2753 ;;gnus-summary-prev-same-subject
2317 ;;gnus-Subject-prev-unread-same-subject 2754 ;;gnus-summary-prev-unread-same-subject
2318 ))) 2755 )))
2319 ;; Ignore given SUBJECT, and try again. 2756 ;; Ignore given SUBJECT, and try again.
2320 (gnus-Subject-prev-article unread nil)) 2757 (gnus-summary-prev-article unread nil))
2321 (unread 2758 (unread
2322 (message "No more unread articles")) 2759 (message "No more unread articles"))
2323 ((and gnus-auto-extend-newsgroup 2760 ((and gnus-auto-extend-newsgroup
2761 (not subject) ;Only if subject is not specified.
2324 (setq header (gnus-more-header-backward))) 2762 (setq header (gnus-more-header-backward)))
2325 ;; Extend to previous article if possible. 2763 ;; Extend to previous article if possible.
2326 ;; Basic ideas by himacdonald@watdragon.waterloo.edu 2764 ;; Basic ideas by himacdonald@watdragon.waterloo.edu
2327 (gnus-extend-newsgroup header t) 2765 (gnus-extend-newsgroup header t)
2328 (let ((buffer-read-only nil)) 2766 (let ((buffer-read-only nil))
2329 (goto-char (point-min)) 2767 (goto-char (point-min))
2330 (gnus-Subject-prepare-threads (list header) 0)) 2768 (gnus-summary-prepare-threads (list header) 0))
2331 (gnus-Subject-goto-article gnus-newsgroup-begin)) 2769 (gnus-summary-goto-article gnus-newsgroup-begin))
2332 (t 2770 (t
2333 (message "No more articles")) 2771 (message "No more articles"))
2334 ))) 2772 )))
2335 2773
2336(defun gnus-Subject-prev-unread-article () 2774(defun gnus-summary-prev-unread-article ()
2337 "Select unred article before current one." 2775 "Select unred article before current one."
2338 (interactive) 2776 (interactive)
2339 (gnus-Subject-prev-article t (and gnus-auto-select-same 2777 (gnus-summary-prev-article t (and gnus-auto-select-same
2340 (gnus-Subject-subject-string)))) 2778 (gnus-summary-subject-string))))
2341 2779
2342(defun gnus-Subject-next-page (lines) 2780(defun gnus-summary-next-page (lines)
2343 "Show next page of selected article. 2781 "Show next page of selected article.
2344If end of artile, select next article. 2782If end of artile, select next article.
2345Argument LINES specifies lines to be scrolled up." 2783Argument LINES specifies lines to be scrolled up."
2346 (interactive "P") 2784 (interactive "P")
2347 (let ((article (gnus-Subject-article-number)) 2785 (let ((article (gnus-summary-article-number))
2348 (endp nil)) 2786 (endp nil))
2349 (if (or (null gnus-current-article) 2787 (if (or (null gnus-current-article)
2350 (/= article gnus-current-article)) 2788 (/= article gnus-current-article))
2351 ;; Selected subject is different from current article's. 2789 ;; Selected subject is different from current article's.
2352 (gnus-Subject-display-article article) 2790 (gnus-summary-display-article article)
2353 (gnus-configure-windows 'SelectArticle) 2791 (gnus-configure-windows 'article)
2354 (pop-to-buffer gnus-Subject-buffer) 2792 (pop-to-buffer gnus-summary-buffer)
2355 (gnus-eval-in-buffer-window gnus-Article-buffer 2793 (gnus-eval-in-buffer-window gnus-article-buffer
2356 (setq endp (gnus-Article-next-page lines))) 2794 (setq endp (gnus-article-next-page lines)))
2357 (cond ((and endp lines) 2795 (cond ((and endp lines)
2358 (message "End of message")) 2796 (message "End of message"))
2359 ((and endp (null lines)) 2797 ((and endp (null lines))
2360 (gnus-Subject-next-unread-article))) 2798 (gnus-summary-next-unread-article)))
2361 ))) 2799 )))
2362 2800
2363(defun gnus-Subject-prev-page (lines) 2801(defun gnus-summary-prev-page (lines)
2364 "Show previous page of selected article. 2802 "Show previous page of selected article.
2365Argument LINES specifies lines to be scrolled down." 2803Argument LINES specifies lines to be scrolled down."
2366 (interactive "P") 2804 (interactive "P")
2367 (let ((article (gnus-Subject-article-number))) 2805 (let ((article (gnus-summary-article-number)))
2368 (if (or (null gnus-current-article) 2806 (if (or (null gnus-current-article)
2369 (/= article gnus-current-article)) 2807 (/= article gnus-current-article))
2370 ;; Selected subject is different from current article's. 2808 ;; Selected subject is different from current article's.
2371 (gnus-Subject-display-article article) 2809 (gnus-summary-display-article article)
2372 (gnus-configure-windows 'SelectArticle) 2810 (gnus-configure-windows 'article)
2373 (pop-to-buffer gnus-Subject-buffer) 2811 (pop-to-buffer gnus-summary-buffer)
2374 (gnus-eval-in-buffer-window gnus-Article-buffer 2812 (gnus-eval-in-buffer-window gnus-article-buffer
2375 (gnus-Article-prev-page lines)) 2813 (gnus-article-prev-page lines))
2376 ))) 2814 )))
2377 2815
2378(defun gnus-Subject-scroll-up (lines) 2816(defun gnus-summary-scroll-up (lines)
2379 "Scroll up (or down) one line current article. 2817 "Scroll up (or down) one line current article.
2380Argument LINES specifies lines to be scrolled up (or down if negative)." 2818Argument LINES specifies lines to be scrolled up (or down if negative)."
2381 (interactive "p") 2819 (interactive "p")
2382 (gnus-Subject-select-article) 2820 (gnus-summary-select-article)
2383 (gnus-eval-in-buffer-window gnus-Article-buffer 2821 (gnus-eval-in-buffer-window gnus-article-buffer
2384 (cond ((> lines 0) 2822 (cond ((> lines 0)
2385 (if (gnus-Article-next-page lines) 2823 (if (gnus-article-next-page lines)
2386 (message "End of message"))) 2824 (message "End of message")))
2387 ((< lines 0) 2825 ((< lines 0)
2388 (gnus-Article-prev-page (- 0 lines)))) 2826 (gnus-article-prev-page (- 0 lines))))
2389 )) 2827 ))
2390 2828
2391(defun gnus-Subject-next-same-subject () 2829(defun gnus-summary-next-same-subject ()
2392 "Select next article which has the same subject as current one." 2830 "Select next article which has the same subject as current one."
2393 (interactive) 2831 (interactive)
2394 (gnus-Subject-next-article nil (gnus-Subject-subject-string))) 2832 (gnus-summary-next-article nil (gnus-summary-subject-string)))
2395 2833
2396(defun gnus-Subject-prev-same-subject () 2834(defun gnus-summary-prev-same-subject ()
2397 "Select previous article which has the same subject as current one." 2835 "Select previous article which has the same subject as current one."
2398 (interactive) 2836 (interactive)
2399 (gnus-Subject-prev-article nil (gnus-Subject-subject-string))) 2837 (gnus-summary-prev-article nil (gnus-summary-subject-string)))
2400 2838
2401(defun gnus-Subject-next-unread-same-subject () 2839(defun gnus-summary-next-unread-same-subject ()
2402 "Select next unread article which has the same subject as current one." 2840 "Select next unread article which has the same subject as current one."
2403 (interactive) 2841 (interactive)
2404 (gnus-Subject-next-article t (gnus-Subject-subject-string))) 2842 (gnus-summary-next-article t (gnus-summary-subject-string)))
2405 2843
2406(defun gnus-Subject-prev-unread-same-subject () 2844(defun gnus-summary-prev-unread-same-subject ()
2407 "Select previous unread article which has the same subject as current one." 2845 "Select previous unread article which has the same subject as current one."
2408 (interactive) 2846 (interactive)
2409 (gnus-Subject-prev-article t (gnus-Subject-subject-string))) 2847 (gnus-summary-prev-article t (gnus-summary-subject-string)))
2410 2848
2411(defun gnus-Subject-refer-parent-article (child) 2849(defun gnus-summary-refer-parent-article (child)
2412 "Refer parent article of current article. 2850 "Refer parent article of current article.
2413If a prefix argument CHILD is non-nil, go back to the child article 2851If a prefix argument CHILD is non-nil, go back to the child article
2414using internally maintained articles history. 2852using internally maintained articles history.
2415NOTE: This command may not work with nnspool.el." 2853NOTE: This command may not work with nnspool.el."
2416 (interactive "P") 2854 (interactive "P")
2417 (gnus-Subject-select-article t t) ;Request all headers. 2855 (gnus-summary-select-article t t) ;Request all headers.
2418 (let ((referenced-id nil)) ;Message-id of parent or child article. 2856 (let ((referenced-id nil)) ;Message-id of parent or child article.
2419 (if child 2857 (if child
2420 ;; Go back to child article using history. 2858 ;; Go back to child article using history.
2421 (gnus-Subject-refer-article nil) 2859 (gnus-summary-refer-article nil)
2422 (gnus-eval-in-buffer-window gnus-Article-buffer 2860 (gnus-eval-in-buffer-window gnus-article-buffer
2423 ;; Look for parent Message-ID. 2861 ;; Look for parent Message-ID.
2424 ;; We cannot use gnus-current-headers to get references 2862 ;; We cannot use gnus-current-headers to get references
2425 ;; because we may be looking at parent or refered article. 2863 ;; because we may be looking at parent or refered article.
@@ -2432,23 +2870,23 @@ NOTE: This command may not work with nnspool.el."
2432 (match-beginning 1) (match-end 1)))) 2870 (match-beginning 1) (match-end 1))))
2433 )) 2871 ))
2434 (if (stringp referenced-id) 2872 (if (stringp referenced-id)
2435 (gnus-Subject-refer-article referenced-id) 2873 (gnus-summary-refer-article referenced-id)
2436 (error "No more parents")) 2874 (error "No more parents"))
2437 ))) 2875 )))
2438 2876
2439(defun gnus-Subject-refer-article (message-id) 2877(defun gnus-summary-refer-article (message-id)
2440 "Refer article specified by MESSAGE-ID. 2878 "Refer article specified by MESSAGE-ID.
2441If MESSAGE-ID is nil or an empty string, it is popped from an 2879If the MESSAGE-ID is nil or an empty string, Message-ID is poped from
2442internally maintained articles history. 2880internally maintained articles history.
2443NOTE: This command may not work with nnspool.el." 2881NOTE: This command may not work with nnspool.el nor mhspool.el."
2444 (interactive "sMessage-ID: ") 2882 (interactive "sMessage-ID: ")
2445 ;; Make sure that this command depends on the fact that article 2883 ;; Make sure that this command depends on the fact that article
2446 ;; related information is not updated when an article is retrieved 2884 ;; related information is not updated when an article is retrieved
2447 ;; by Message-ID. 2885 ;; by Message-ID.
2448 (gnus-Subject-select-article t t) ;Request all headers. 2886 (gnus-summary-select-article t t) ;Request all headers.
2449 (if (and (stringp message-id) 2887 (if (and (stringp message-id)
2450 (> (length message-id) 0)) 2888 (> (length message-id) 0))
2451 (gnus-eval-in-buffer-window gnus-Article-buffer 2889 (gnus-eval-in-buffer-window gnus-article-buffer
2452 ;; Construct the correct Message-ID if necessary. 2890 ;; Construct the correct Message-ID if necessary.
2453 ;; Suggested by tale@pawl.rpi.edu. 2891 ;; Suggested by tale@pawl.rpi.edu.
2454 (or (string-match "^<" message-id) 2892 (or (string-match "^<" message-id)
@@ -2469,53 +2907,54 @@ NOTE: This command may not work with nnspool.el."
2469 (setq message-id (car gnus-current-history)) 2907 (setq message-id (car gnus-current-history))
2470 (setq gnus-current-history (cdr gnus-current-history))) 2908 (setq gnus-current-history (cdr gnus-current-history)))
2471 (if (stringp message-id) 2909 (if (stringp message-id)
2472 ;; Retrieve article by message-id. This may not work with nnspool. 2910 ;; Retrieve article by message-id. This may not work with
2473 (gnus-Article-prepare message-id t) 2911 ;; nnspool nor mhspool.
2912 (gnus-article-prepare message-id t)
2474 (error "No such references")) 2913 (error "No such references"))
2475 ) 2914 )
2476 2915
2477(defun gnus-Subject-next-digest (nth) 2916(defun gnus-summary-next-digest (nth)
2478 "Move to head of NTH next digested message." 2917 "Move to head of NTH next digested message."
2479 (interactive "p") 2918 (interactive "p")
2480 (gnus-Subject-select-article) 2919 (gnus-summary-select-article)
2481 (gnus-eval-in-buffer-window gnus-Article-buffer 2920 (gnus-eval-in-buffer-window gnus-article-buffer
2482 (gnus-Article-next-digest (or nth 1)) 2921 (gnus-article-next-digest (or nth 1))
2483 )) 2922 ))
2484 2923
2485(defun gnus-Subject-prev-digest (nth) 2924(defun gnus-summary-prev-digest (nth)
2486 "Move to head of NTH previous digested message." 2925 "Move to head of NTH previous digested message."
2487 (interactive "p") 2926 (interactive "p")
2488 (gnus-Subject-select-article) 2927 (gnus-summary-select-article)
2489 (gnus-eval-in-buffer-window gnus-Article-buffer 2928 (gnus-eval-in-buffer-window gnus-article-buffer
2490 (gnus-Article-prev-digest (or nth 1)) 2929 (gnus-article-prev-digest (or nth 1))
2491 )) 2930 ))
2492 2931
2493(defun gnus-Subject-first-unread-article () 2932(defun gnus-summary-first-unread-article ()
2494 "Select first unread article. Return non-nil if successfully selected." 2933 "Select first unread article. Return non-nil if successfully selected."
2495 (interactive) 2934 (interactive)
2496 (let ((begin (point))) 2935 (let ((begin (point)))
2497 (goto-char (point-min)) 2936 (goto-char (point-min))
2498 (if (re-search-forward "^ [ \t]+[0-9]+:" nil t) 2937 (if (re-search-forward "^ [ \t]+[0-9]+:" nil t)
2499 (gnus-Subject-display-article (gnus-Subject-article-number)) 2938 (gnus-summary-display-article (gnus-summary-article-number))
2500 ;; If there is no unread articles, stay there. 2939 ;; If there is no unread articles, stay there.
2501 (goto-char begin) 2940 (goto-char begin)
2502 ;;(gnus-Subject-display-article (gnus-Subject-article-number)) 2941 ;;(gnus-summary-display-article (gnus-summary-article-number))
2503 (message "No more unread articles") 2942 (message "No more unread articles")
2504 nil 2943 nil
2505 ) 2944 )
2506 )) 2945 ))
2507 2946
2508(defun gnus-Subject-isearch-article () 2947(defun gnus-summary-isearch-article ()
2509 "Do incremental search forward on current article." 2948 "Do incremental search forward on current article."
2510 (interactive) 2949 (interactive)
2511 (gnus-Subject-select-article) 2950 (gnus-summary-select-article)
2512 (gnus-eval-in-buffer-window gnus-Article-buffer 2951 (gnus-eval-in-buffer-window gnus-article-buffer
2513 (call-interactively 'isearch-forward) 2952 (call-interactively 'isearch-forward)
2514 )) 2953 ))
2515 2954
2516(defun gnus-Subject-search-article-forward (regexp) 2955(defun gnus-summary-search-article-forward (regexp)
2517 "Search for an article containing REGEXP forward. 2956 "Search for an article containing REGEXP forward.
2518`gnus-Select-article-hook' is not called during the search." 2957gnus-select-article-hook is not called during the search."
2519 (interactive 2958 (interactive
2520 (list (read-string 2959 (list (read-string
2521 (concat "Search forward (regexp): " 2960 (concat "Search forward (regexp): "
@@ -2524,17 +2963,17 @@ NOTE: This command may not work with nnspool.el."
2524 (if (string-equal regexp "") 2963 (if (string-equal regexp "")
2525 (setq regexp (or gnus-last-search-regexp "")) 2964 (setq regexp (or gnus-last-search-regexp ""))
2526 (setq gnus-last-search-regexp regexp)) 2965 (setq gnus-last-search-regexp regexp))
2527 (if (gnus-Subject-search-article regexp nil) 2966 (if (gnus-summary-search-article regexp nil)
2528 (gnus-eval-in-buffer-window gnus-Article-buffer 2967 (gnus-eval-in-buffer-window gnus-article-buffer
2529 (recenter 0) 2968 (recenter 0)
2530 ;;(sit-for 1) 2969 ;;(sit-for 1)
2531 ) 2970 )
2532 (error "Search failed: \"%s\"" regexp) 2971 (error "Search failed: \"%s\"" regexp)
2533 )) 2972 ))
2534 2973
2535(defun gnus-Subject-search-article-backward (regexp) 2974(defun gnus-summary-search-article-backward (regexp)
2536 "Search for an article containing REGEXP backward. 2975 "Search for an article containing REGEXP backward.
2537`gnus-Select-article-hook' is not called during the search." 2976gnus-select-article-hook is not called during the search."
2538 (interactive 2977 (interactive
2539 (list (read-string 2978 (list (read-string
2540 (concat "Search backward (regexp): " 2979 (concat "Search backward (regexp): "
@@ -2543,44 +2982,44 @@ NOTE: This command may not work with nnspool.el."
2543 (if (string-equal regexp "") 2982 (if (string-equal regexp "")
2544 (setq regexp (or gnus-last-search-regexp "")) 2983 (setq regexp (or gnus-last-search-regexp ""))
2545 (setq gnus-last-search-regexp regexp)) 2984 (setq gnus-last-search-regexp regexp))
2546 (if (gnus-Subject-search-article regexp t) 2985 (if (gnus-summary-search-article regexp t)
2547 (gnus-eval-in-buffer-window gnus-Article-buffer 2986 (gnus-eval-in-buffer-window gnus-article-buffer
2548 (recenter 0) 2987 (recenter 0)
2549 ;;(sit-for 1) 2988 ;;(sit-for 1)
2550 ) 2989 )
2551 (error "Search failed: \"%s\"" regexp) 2990 (error "Search failed: \"%s\"" regexp)
2552 )) 2991 ))
2553 2992
2554(defun gnus-Subject-search-article (regexp &optional backward) 2993(defun gnus-summary-search-article (regexp &optional backward)
2555 "Search for an article containing REGEXP. 2994 "Search for an article containing REGEXP.
2556Optional argument BACKWARD means do search for backward. 2995Optional argument BACKWARD means do search for backward.
2557`gnus-Select-article-hook' is not called during the search." 2996gnus-select-article-hook is not called during the search."
2558 (let ((gnus-Select-article-hook nil) ;Disable hook. 2997 (let ((gnus-select-article-hook nil) ;Disable hook.
2559 (gnus-Mark-article-hook nil) ;Inhibit marking as read. 2998 (gnus-mark-article-hook nil) ;Inhibit marking as read.
2560 (re-search 2999 (re-search
2561 (if backward 3000 (if backward
2562 (function re-search-backward) (function re-search-forward))) 3001 (function re-search-backward) (function re-search-forward)))
2563 (found nil) 3002 (found nil)
2564 (last nil)) 3003 (last nil))
2565 ;; Hidden thread subtrees must be searched for ,too. 3004 ;; Hidden thread subtrees must be searched for ,too.
2566 (gnus-Subject-show-all-threads) 3005 (gnus-summary-show-all-threads)
2567 ;; First of all, search current article. 3006 ;; First of all, search current article.
2568 ;; We don't want to read article again from NNTP server nor reset 3007 ;; We don't want to read article again from NNTP server nor reset
2569 ;; current point. 3008 ;; current point.
2570 (gnus-Subject-select-article) 3009 (gnus-summary-select-article)
2571 (message "Searching article: %d..." gnus-current-article) 3010 (message "Searching article: %d..." gnus-current-article)
2572 (setq last gnus-current-article) 3011 (setq last gnus-current-article)
2573 (gnus-eval-in-buffer-window gnus-Article-buffer 3012 (gnus-eval-in-buffer-window gnus-article-buffer
2574 (save-restriction 3013 (save-restriction
2575 (widen) 3014 (widen)
2576 ;; Begin search from current point. 3015 ;; Begin search from current point.
2577 (setq found (funcall re-search regexp nil t)))) 3016 (setq found (funcall re-search regexp nil t))))
2578 ;; Then search next articles. 3017 ;; Then search next articles.
2579 (while (and (not found) 3018 (while (and (not found)
2580 (gnus-Subject-display-article 3019 (gnus-summary-display-article
2581 (gnus-Subject-search-subject backward nil nil))) 3020 (gnus-summary-search-subject backward nil nil)))
2582 (message "Searching article: %d..." gnus-current-article) 3021 (message "Searching article: %d..." gnus-current-article)
2583 (gnus-eval-in-buffer-window gnus-Article-buffer 3022 (gnus-eval-in-buffer-window gnus-article-buffer
2584 (save-restriction 3023 (save-restriction
2585 (widen) 3024 (widen)
2586 (goto-char (if backward (point-max) (point-min))) 3025 (goto-char (if backward (point-max) (point-min)))
@@ -2594,8 +3033,8 @@ Optional argument BACKWARD means do search for backward.
2594 found 3033 found
2595 )) 3034 ))
2596 3035
2597(defun gnus-Subject-execute-command (field regexp command &optional backward) 3036(defun gnus-summary-execute-command (field regexp command &optional backward)
2598 "If FIELD of article header matches REGEXP, execute COMMAND string. 3037 "If FIELD of article header matches REGEXP, execute a COMMAND string.
2599If FIELD is an empty string (or nil), entire article body is searched for. 3038If FIELD is an empty string (or nil), entire article body is searched for.
2600If optional (prefix) argument BACKWARD is non-nil, do backward instead." 3039If optional (prefix) argument BACKWARD is non-nil, do backward instead."
2601 (interactive 3040 (interactive
@@ -2609,7 +3048,7 @@ If optional (prefix) argument BACKWARD is non-nil, do backward instead."
2609 (read-key-sequence "Command: ") 3048 (read-key-sequence "Command: ")
2610 current-prefix-arg)) 3049 current-prefix-arg))
2611 ;; Hidden thread subtrees must be searched for ,too. 3050 ;; Hidden thread subtrees must be searched for ,too.
2612 (gnus-Subject-show-all-threads) 3051 (gnus-summary-show-all-threads)
2613 ;; We don't want to change current point nor window configuration. 3052 ;; We don't want to change current point nor window configuration.
2614 (save-excursion 3053 (save-excursion
2615 (save-window-excursion 3054 (save-window-excursion
@@ -2621,29 +3060,29 @@ If optional (prefix) argument BACKWARD is non-nil, do backward instead."
2621 backward) 3060 backward)
2622 (message "Executing %s... done" (key-description command))))) 3061 (message "Executing %s... done" (key-description command)))))
2623 3062
2624(defun gnus-Subject-beginning-of-article () 3063(defun gnus-summary-beginning-of-article ()
2625 "Go to beginning of article body" 3064 "Go to beginning of article body"
2626 (interactive) 3065 (interactive)
2627 (gnus-Subject-select-article) 3066 (gnus-summary-select-article)
2628 (gnus-eval-in-buffer-window gnus-Article-buffer 3067 (gnus-eval-in-buffer-window gnus-article-buffer
2629 (widen) 3068 (widen)
2630 (beginning-of-buffer) 3069 (beginning-of-buffer)
2631 (if gnus-break-pages 3070 (if gnus-break-pages
2632 (gnus-narrow-to-page)) 3071 (gnus-narrow-to-page))
2633 )) 3072 ))
2634 3073
2635(defun gnus-Subject-end-of-article () 3074(defun gnus-summary-end-of-article ()
2636 "Go to end of article body" 3075 "Go to end of article body"
2637 (interactive) 3076 (interactive)
2638 (gnus-Subject-select-article) 3077 (gnus-summary-select-article)
2639 (gnus-eval-in-buffer-window gnus-Article-buffer 3078 (gnus-eval-in-buffer-window gnus-article-buffer
2640 (widen) 3079 (widen)
2641 (end-of-buffer) 3080 (end-of-buffer)
2642 (if gnus-break-pages 3081 (if gnus-break-pages
2643 (gnus-narrow-to-page)) 3082 (gnus-narrow-to-page))
2644 )) 3083 ))
2645 3084
2646(defun gnus-Subject-goto-article (article &optional all-headers) 3085(defun gnus-summary-goto-article (article &optional all-headers)
2647 "Read ARTICLE if exists. 3086 "Read ARTICLE if exists.
2648Optional argument ALL-HEADERS means all headers are shown." 3087Optional argument ALL-HEADERS means all headers are shown."
2649 (interactive 3088 (interactive
@@ -2657,23 +3096,23 @@ Optional argument ALL-HEADERS means all headers are shown."
2657 (int-to-string (nntp-header-number headers))))) 3096 (int-to-string (nntp-header-number headers)))))
2658 gnus-newsgroup-headers) 3097 gnus-newsgroup-headers)
2659 nil 'require-match)))) 3098 nil 'require-match))))
2660 (if (gnus-Subject-goto-subject article) 3099 (if (gnus-summary-goto-subject article)
2661 (gnus-Subject-display-article article all-headers))) 3100 (gnus-summary-display-article article all-headers)))
2662 3101
2663(defun gnus-Subject-goto-last-article () 3102(defun gnus-summary-goto-last-article ()
2664 "Go to last subject line." 3103 "Go to last subject line."
2665 (interactive) 3104 (interactive)
2666 (if gnus-last-article 3105 (if gnus-last-article
2667 (gnus-Subject-goto-article gnus-last-article))) 3106 (gnus-summary-goto-article gnus-last-article)))
2668 3107
2669(defun gnus-Subject-show-article () 3108(defun gnus-summary-show-article ()
2670 "Force to show current article." 3109 "Force to show current article."
2671 (interactive) 3110 (interactive)
2672 ;; The following is a trick to force to read the current article again. 3111 ;; The following is a trick to force to read the current article again.
2673 (setq gnus-have-all-headers (not gnus-have-all-headers)) 3112 (setq gnus-have-all-headers (not gnus-have-all-headers))
2674 (gnus-Subject-select-article (not gnus-have-all-headers) t)) 3113 (gnus-summary-select-article (not gnus-have-all-headers) t))
2675 3114
2676(defun gnus-Subject-toggle-header (arg) 3115(defun gnus-summary-toggle-header (arg)
2677 "Show original header if pruned header currently shown, or vice versa. 3116 "Show original header if pruned header currently shown, or vice versa.
2678With arg, show original header iff arg is positive." 3117With arg, show original header iff arg is positive."
2679 (interactive "P") 3118 (interactive "P")
@@ -2682,21 +3121,33 @@ With arg, show original header iff arg is positive."
2682 (all-headers 3121 (all-headers
2683 (if (null arg) (not gnus-have-all-headers) 3122 (if (null arg) (not gnus-have-all-headers)
2684 (> (prefix-numeric-value arg) 0)))) 3123 (> (prefix-numeric-value arg) 0))))
2685 (gnus-Subject-select-article all-headers t))) 3124 (gnus-summary-select-article all-headers t)))
2686 3125
2687(defun gnus-Subject-show-all-headers () 3126(defun gnus-summary-show-all-headers ()
2688 "Show original article header." 3127 "Show original article header."
2689 (interactive) 3128 (interactive)
2690 (gnus-Subject-select-article t t)) 3129 (gnus-summary-select-article t t))
3130
3131(defun gnus-summary-toggle-mime (arg)
3132 "Toggle MIME processing.
3133With arg, turn MIME processing on iff arg is positive."
3134 (interactive "P")
3135 (setq gnus-show-mime
3136 (if (null arg) (not gnus-show-mime)
3137 (> (prefix-numeric-value arg) 0)))
3138 ;; The following is a trick to force to read the current article again.
3139 (setq gnus-have-all-headers (not gnus-have-all-headers))
3140 (gnus-summary-select-article (not gnus-have-all-headers) t))
2691 3141
2692(defun gnus-Subject-stop-page-breaking () 3142(defun gnus-summary-stop-page-breaking ()
2693 "Stop page breaking by linefeed temporary (Widen article buffer)." 3143 "Stop page breaking by linefeed temporary (Widen article buffer)."
2694 (interactive) 3144 (interactive)
2695 (gnus-Subject-select-article) 3145 (gnus-summary-select-article)
2696 (gnus-eval-in-buffer-window gnus-Article-buffer 3146 (gnus-eval-in-buffer-window gnus-article-buffer
2697 (widen))) 3147 (widen)
3148 ))
2698 3149
2699(defun gnus-Subject-kill-same-subject-and-select (unmark) 3150(defun gnus-summary-kill-same-subject-and-select (unmark)
2700 "Mark articles which has the same subject as read, and then select next. 3151 "Mark articles which has the same subject as read, and then select next.
2701If argument UNMARK is positive, remove any kinds of marks. 3152If argument UNMARK is positive, remove any kinds of marks.
2702If argument UNMARK is negative, mark articles as unread instead." 3153If argument UNMARK is negative, mark articles as unread instead."
@@ -2704,17 +3155,17 @@ If argument UNMARK is negative, mark articles as unread instead."
2704 (if unmark 3155 (if unmark
2705 (setq unmark (prefix-numeric-value unmark))) 3156 (setq unmark (prefix-numeric-value unmark)))
2706 (let ((count 3157 (let ((count
2707 (gnus-Subject-mark-same-subject 3158 (gnus-summary-mark-same-subject
2708 (gnus-Subject-subject-string) unmark))) 3159 (gnus-summary-subject-string) unmark)))
2709 ;; Select next unread article. If auto-select-same mode, should 3160 ;; Select next unread article. If auto-select-same mode, should
2710 ;; select the first unread article. 3161 ;; select the first unread article.
2711 (gnus-Subject-next-article t (and gnus-auto-select-same 3162 (gnus-summary-next-article t (and gnus-auto-select-same
2712 (gnus-Subject-subject-string))) 3163 (gnus-summary-subject-string)))
2713 (message "%d articles are marked as %s" 3164 (message "%d articles are marked as %s"
2714 count (if unmark "unread" "read")) 3165 count (if unmark "unread" "read"))
2715 )) 3166 ))
2716 3167
2717(defun gnus-Subject-kill-same-subject (unmark) 3168(defun gnus-summary-kill-same-subject (unmark)
2718 "Mark articles which has the same subject as read. 3169 "Mark articles which has the same subject as read.
2719If argument UNMARK is positive, remove any kinds of marks. 3170If argument UNMARK is positive, remove any kinds of marks.
2720If argument UNMARK is negative, mark articles as unread instead." 3171If argument UNMARK is negative, mark articles as unread instead."
@@ -2722,145 +3173,144 @@ If argument UNMARK is negative, mark articles as unread instead."
2722 (if unmark 3173 (if unmark
2723 (setq unmark (prefix-numeric-value unmark))) 3174 (setq unmark (prefix-numeric-value unmark)))
2724 (let ((count 3175 (let ((count
2725 (gnus-Subject-mark-same-subject 3176 (gnus-summary-mark-same-subject
2726 (gnus-Subject-subject-string) unmark))) 3177 (gnus-summary-subject-string) unmark)))
2727 ;; If marked as read, go to next unread subject. 3178 ;; If marked as read, go to next unread subject.
2728 (if (null unmark) 3179 (if (null unmark)
2729 ;; Go to next unread subject. 3180 ;; Go to next unread subject.
2730 (gnus-Subject-next-subject 1 t)) 3181 (gnus-summary-next-subject 1 t))
2731 (message "%d articles are marked as %s" 3182 (message "%d articles are marked as %s"
2732 count (if unmark "unread" "read")) 3183 count (if unmark "unread" "read"))
2733 )) 3184 ))
2734 3185
2735(defun gnus-Subject-mark-same-subject (subject &optional unmark) 3186(defun gnus-summary-mark-same-subject (subject &optional unmark)
2736 "Mark articles with same SUBJECT as read, and return marked number. 3187 "Mark articles with same SUBJECT as read, and return marked number.
2737If optional argument UNMARK is positive, remove any kinds of marks. 3188If optional argument UNMARK is positive, remove any kinds of marks.
2738If optional argument UNMARK is negative, mark articles as unread instead." 3189If optional argument UNMARK is negative, mark articles as unread instead."
2739 (let ((count 1)) 3190 (let ((count 1))
2740 (save-excursion 3191 (save-excursion
2741 (cond ((null unmark) 3192 (cond ((null unmark)
2742 (gnus-Subject-mark-as-read nil "K")) 3193 (gnus-summary-mark-as-read nil "K"))
2743 ((> unmark 0) 3194 ((> unmark 0)
2744 (gnus-Subject-mark-as-unread nil t)) 3195 (gnus-summary-mark-as-unread nil t))
2745 (t 3196 (t
2746 (gnus-Subject-mark-as-unread))) 3197 (gnus-summary-mark-as-unread)))
2747 (while (and subject 3198 (while (and subject
2748 (gnus-Subject-search-forward nil subject)) 3199 (gnus-summary-search-forward nil subject))
2749 (cond ((null unmark) 3200 (cond ((null unmark)
2750 (gnus-Subject-mark-as-read nil "K")) 3201 (gnus-summary-mark-as-read nil "K"))
2751 ((> unmark 0) 3202 ((> unmark 0)
2752 (gnus-Subject-mark-as-unread nil t)) 3203 (gnus-summary-mark-as-unread nil t))
2753 (t 3204 (t
2754 (gnus-Subject-mark-as-unread))) 3205 (gnus-summary-mark-as-unread)))
2755 (setq count (1+ count)) 3206 (setq count (1+ count))
2756 )) 3207 ))
2757 ;; Hide killed thread subtrees. Does not work properly always. 3208 ;; Hide killed thread subtrees. Does not work properly always.
2758 ;;(and (null unmark) 3209 ;;(and (null unmark)
2759 ;; gnus-thread-hide-killed 3210 ;; gnus-thread-hide-killed
2760 ;; (gnus-Subject-hide-thread)) 3211 ;; (gnus-summary-hide-thread))
2761 ;; Return number of articles marked as read. 3212 ;; Return number of articles marked as read.
2762 count 3213 count
2763 )) 3214 ))
2764 3215
2765(defun gnus-Subject-mark-as-unread-forward (count) 3216(defun gnus-summary-mark-as-unread-forward (count)
2766 "Mark current article as unread, and then go forward. 3217 "Mark current article as unread, and then go forward.
2767Argument COUNT specifies number of articles marked as unread." 3218Argument COUNT specifies number of articles marked as unread."
2768 (interactive "p") 3219 (interactive "p")
2769 (while (> count 0) 3220 (while (> count 0)
2770 (gnus-Subject-mark-as-unread nil nil) 3221 (gnus-summary-mark-as-unread nil nil)
2771 (gnus-Subject-next-subject 1 nil) 3222 (gnus-summary-next-subject 1 nil)
2772 (setq count (1- count)))) 3223 (setq count (1- count))))
2773 3224
2774(defun gnus-Subject-mark-as-unread-backward (count) 3225(defun gnus-summary-mark-as-unread-backward (count)
2775 "Mark current article as unread, and then go backward. 3226 "Mark current article as unread, and then go backward.
2776Argument COUNT specifies number of articles marked as unread." 3227Argument COUNT specifies number of articles marked as unread."
2777 (interactive "p") 3228 (interactive "p")
2778 (while (> count 0) 3229 (while (> count 0)
2779 (gnus-Subject-mark-as-unread nil nil) 3230 (gnus-summary-mark-as-unread nil nil)
2780 (gnus-Subject-prev-subject 1 nil) 3231 (gnus-summary-prev-subject 1 nil)
2781 (setq count (1- count)))) 3232 (setq count (1- count))))
2782 3233
2783(defun gnus-Subject-mark-as-unread (&optional article clear-mark) 3234(defun gnus-summary-mark-as-unread (&optional article clear-mark)
2784 "Mark current article as unread. 3235 "Mark current article as unread.
2785Optional first argument ARTICLE specifies article number to be 3236Optional 1st argument ARTICLE specifies article number to be marked as unread.
2786marked as unread. Optional second argument CLEAR-MARK removes 3237Optional 2nd argument CLEAR-MARK remove any kinds of mark."
2787any kind of mark."
2788 (save-excursion 3238 (save-excursion
2789 (set-buffer gnus-Subject-buffer) 3239 (set-buffer gnus-summary-buffer)
2790 ;; First of all, show hidden thread subtrees. 3240 ;; First of all, show hidden thread subtrees.
2791 (gnus-Subject-show-thread) 3241 (gnus-summary-show-thread)
2792 (let* ((buffer-read-only nil) 3242 (let* ((buffer-read-only nil)
2793 (current (gnus-Subject-article-number)) 3243 (current (gnus-summary-article-number))
2794 (article (or article current))) 3244 (article (or article current)))
2795 (gnus-mark-article-as-unread article clear-mark) 3245 (gnus-mark-article-as-unread article clear-mark)
2796 (if (or (eq article current) 3246 (if (or (eq article current)
2797 (gnus-Subject-goto-subject article)) 3247 (gnus-summary-goto-subject article))
2798 (progn 3248 (progn
2799 (beginning-of-line) 3249 (beginning-of-line)
2800 (delete-char 1) 3250 (delete-char 1)
2801 (insert (if clear-mark " " "-")))) 3251 (insert (if clear-mark " " "-"))))
2802 ))) 3252 )))
2803 3253
2804(defun gnus-Subject-mark-as-read-forward (count) 3254(defun gnus-summary-mark-as-read-forward (count)
2805 "Mark current article as read, and then go forward. 3255 "Mark current article as read, and then go forward.
2806Argument COUNT specifies number of articles marked as read" 3256Argument COUNT specifies number of articles marked as read"
2807 (interactive "p") 3257 (interactive "p")
2808 (while (> count 0) 3258 (while (> count 0)
2809 (gnus-Subject-mark-as-read) 3259 (gnus-summary-mark-as-read)
2810 (gnus-Subject-next-subject 1 'unread-only) 3260 (gnus-summary-next-subject 1 'unread-only)
2811 (setq count (1- count)))) 3261 (setq count (1- count))))
2812 3262
2813(defun gnus-Subject-mark-as-read-backward (count) 3263(defun gnus-summary-mark-as-read-backward (count)
2814 "Mark current article as read, and then go backward. 3264 "Mark current article as read, and then go backward.
2815Argument COUNT specifies number of articles marked as read" 3265Argument COUNT specifies number of articles marked as read"
2816 (interactive "p") 3266 (interactive "p")
2817 (while (> count 0) 3267 (while (> count 0)
2818 (gnus-Subject-mark-as-read) 3268 (gnus-summary-mark-as-read)
2819 (gnus-Subject-prev-subject 1 'unread-only) 3269 (gnus-summary-prev-subject 1 'unread-only)
2820 (setq count (1- count)))) 3270 (setq count (1- count))))
2821 3271
2822(defun gnus-Subject-mark-as-read (&optional article mark) 3272(defun gnus-summary-mark-as-read (&optional article mark)
2823 "Mark current article as read. 3273 "Mark current article as read.
2824Optional first argument ARTICLE specifies article number to be marked as read. 3274Optional 1st argument ARTICLE specifies article number to be marked as read.
2825Optional second argument MARK specifies a string inserted at beginning of line. 3275Optional 2nd argument MARK specifies a string inserted at beginning of line.
2826Any kind of string (length 1) except for a space and `-' is ok." 3276Any kind of string (length 1) except for a space and `-' is ok."
2827 (save-excursion 3277 (save-excursion
2828 (set-buffer gnus-Subject-buffer) 3278 (set-buffer gnus-summary-buffer)
2829 ;; First of all, show hidden thread subtrees. 3279 ;; First of all, show hidden thread subtrees.
2830 (gnus-Subject-show-thread) 3280 (gnus-summary-show-thread)
2831 (let* ((buffer-read-only nil) 3281 (let* ((buffer-read-only nil)
2832 (mark (or mark "D")) ;Default mark is `D'. 3282 (mark (or mark "D")) ;Default mark is `D'.
2833 (current (gnus-Subject-article-number)) 3283 (current (gnus-summary-article-number))
2834 (article (or article current))) 3284 (article (or article current)))
2835 (gnus-mark-article-as-read article) 3285 (gnus-mark-article-as-read article)
2836 (if (or (eq article current) 3286 (if (or (eq article current)
2837 (gnus-Subject-goto-subject article)) 3287 (gnus-summary-goto-subject article))
2838 (progn 3288 (progn
2839 (beginning-of-line) 3289 (beginning-of-line)
2840 (delete-char 1) 3290 (delete-char 1)
2841 (insert mark))) 3291 (insert mark)))
2842 ))) 3292 )))
2843 3293
2844(defun gnus-Subject-clear-mark-forward (count) 3294(defun gnus-summary-clear-mark-forward (count)
2845 "Remove current article's mark, and go forward. 3295 "Remove current article's mark, and go forward.
2846Argument COUNT specifies number of articles unmarked" 3296Argument COUNT specifies number of articles unmarked"
2847 (interactive "p") 3297 (interactive "p")
2848 (while (> count 0) 3298 (while (> count 0)
2849 (gnus-Subject-mark-as-unread nil t) 3299 (gnus-summary-mark-as-unread nil t)
2850 (gnus-Subject-next-subject 1 nil) 3300 (gnus-summary-next-subject 1 nil)
2851 (setq count (1- count)))) 3301 (setq count (1- count))))
2852 3302
2853(defun gnus-Subject-clear-mark-backward (count) 3303(defun gnus-summary-clear-mark-backward (count)
2854 "Remove current article's mark, and go backward. 3304 "Remove current article's mark, and go backward.
2855Argument COUNT specifies number of articles unmarked" 3305Argument COUNT specifies number of articles unmarked"
2856 (interactive "p") 3306 (interactive "p")
2857 (while (> count 0) 3307 (while (> count 0)
2858 (gnus-Subject-mark-as-unread nil t) 3308 (gnus-summary-mark-as-unread nil t)
2859 (gnus-Subject-prev-subject 1 nil) 3309 (gnus-summary-prev-subject 1 nil)
2860 (setq count (1- count)))) 3310 (setq count (1- count))))
2861 3311
2862(defun gnus-Subject-delete-marked-as-read () 3312(defun gnus-summary-delete-marked-as-read ()
2863 "Delete lines which are marked as read." 3313 "Delete lines which is marked as read."
2864 (interactive) 3314 (interactive)
2865 (if gnus-newsgroup-unreads 3315 (if gnus-newsgroup-unreads
2866 (let ((buffer-read-only nil)) 3316 (let ((buffer-read-only nil))
@@ -2869,14 +3319,14 @@ Argument COUNT specifies number of articles unmarked"
2869 (delete-non-matching-lines "^[ ---]")) 3319 (delete-non-matching-lines "^[ ---]"))
2870 ;; Adjust point. 3320 ;; Adjust point.
2871 (if (eobp) 3321 (if (eobp)
2872 (gnus-Subject-prev-subject 1) 3322 (gnus-summary-prev-subject 1)
2873 (beginning-of-line) 3323 (beginning-of-line)
2874 (search-forward ":" nil t))) 3324 (search-forward ":" nil t)))
2875 ;; It is not so good idea to make the buffer empty. 3325 ;; It is not so good idea to make the buffer empty.
2876 (message "All articles are marked as read") 3326 (message "All articles are marked as read")
2877 )) 3327 ))
2878 3328
2879(defun gnus-Subject-delete-marked-with (marks) 3329(defun gnus-summary-delete-marked-with (marks)
2880 "Delete lines which are marked with MARKS (e.g. \"DK\")." 3330 "Delete lines which are marked with MARKS (e.g. \"DK\")."
2881 (interactive "sMarks: ") 3331 (interactive "sMarks: ")
2882 (let ((buffer-read-only nil)) 3332 (let ((buffer-read-only nil))
@@ -2886,26 +3336,26 @@ Argument COUNT specifies number of articles unmarked"
2886 ;; Adjust point. 3336 ;; Adjust point.
2887 (or (zerop (buffer-size)) 3337 (or (zerop (buffer-size))
2888 (if (eobp) 3338 (if (eobp)
2889 (gnus-Subject-prev-subject 1) 3339 (gnus-summary-prev-subject 1)
2890 (beginning-of-line) 3340 (beginning-of-line)
2891 (search-forward ":" nil t))) 3341 (search-forward ":" nil t)))
2892 )) 3342 ))
2893 3343
2894;; Thread-based commands. 3344;; Thread-based commands.
2895 3345
2896(defun gnus-Subject-toggle-threads (arg) 3346(defun gnus-summary-toggle-threads (arg)
2897 "Toggle showing conversation threads. 3347 "Toggle showing conversation threads.
2898With arg, turn showing conversation threads on iff arg is positive." 3348With arg, turn showing conversation threads on iff arg is positive."
2899 (interactive "P") 3349 (interactive "P")
2900 (let ((current (gnus-Subject-article-number))) 3350 (let ((current (gnus-summary-article-number)))
2901 (setq gnus-show-threads 3351 (setq gnus-show-threads
2902 (if (null arg) (not gnus-show-threads) 3352 (if (null arg) (not gnus-show-threads)
2903 (> (prefix-numeric-value arg) 0))) 3353 (> (prefix-numeric-value arg) 0)))
2904 (gnus-Subject-prepare) 3354 (gnus-summary-prepare)
2905 (gnus-Subject-goto-subject current) 3355 (gnus-summary-goto-subject current)
2906 )) 3356 ))
2907 3357
2908(defun gnus-Subject-show-all-threads () 3358(defun gnus-summary-show-all-threads ()
2909 "Show all thread subtrees." 3359 "Show all thread subtrees."
2910 (interactive) 3360 (interactive)
2911 (if gnus-show-threads 3361 (if gnus-show-threads
@@ -2914,7 +3364,7 @@ With arg, turn showing conversation threads on iff arg is positive."
2914 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t) 3364 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)
2915 )))) 3365 ))))
2916 3366
2917(defun gnus-Subject-show-thread () 3367(defun gnus-summary-show-thread ()
2918 "Show thread subtrees." 3368 "Show thread subtrees."
2919 (interactive) 3369 (interactive)
2920 (if gnus-show-threads 3370 (if gnus-show-threads
@@ -2927,7 +3377,7 @@ With arg, turn showing conversation threads on iff arg is positive."
2927 ?\^M ?\n t) 3377 ?\^M ?\n t)
2928 )))) 3378 ))))
2929 3379
2930(defun gnus-Subject-hide-all-threads () 3380(defun gnus-summary-hide-all-threads ()
2931 "Hide all thread subtrees." 3381 "Hide all thread subtrees."
2932 (interactive) 3382 (interactive)
2933 (if gnus-show-threads 3383 (if gnus-show-threads
@@ -2936,13 +3386,13 @@ With arg, turn showing conversation threads on iff arg is positive."
2936 (goto-char (point-min)) 3386 (goto-char (point-min))
2937 (search-forward ":" nil t) 3387 (search-forward ":" nil t)
2938 (let ((level (current-column))) 3388 (let ((level (current-column)))
2939 (gnus-Subject-hide-thread) 3389 (gnus-summary-hide-thread)
2940 (while (gnus-Subject-search-forward) 3390 (while (gnus-summary-search-forward)
2941 (and (>= level (current-column)) 3391 (and (>= level (current-column))
2942 (gnus-Subject-hide-thread))) 3392 (gnus-summary-hide-thread)))
2943 )))) 3393 ))))
2944 3394
2945(defun gnus-Subject-hide-thread () 3395(defun gnus-summary-hide-thread ()
2946 "Hide thread subtrees." 3396 "Hide thread subtrees."
2947 (interactive) 3397 (interactive)
2948 (if gnus-show-threads 3398 (if gnus-show-threads
@@ -2954,7 +3404,7 @@ With arg, turn showing conversation threads on iff arg is positive."
2954 (init (point)) 3404 (init (point))
2955 (last (point)) 3405 (last (point))
2956 (level (current-column))) 3406 (level (current-column)))
2957 (while (and (gnus-Subject-search-forward) 3407 (while (and (gnus-summary-search-forward)
2958 (< level (current-column))) 3408 (< level (current-column)))
2959 ;; Interested in lower levels. 3409 ;; Interested in lower levels.
2960 (if (< level (current-column)) 3410 (if (< level (current-column))
@@ -2965,7 +3415,7 @@ With arg, turn showing conversation threads on iff arg is positive."
2965 (subst-char-in-region init last ?\n ?\^M t) 3415 (subst-char-in-region init last ?\n ?\^M t)
2966 )))) 3416 ))))
2967 3417
2968(defun gnus-Subject-next-thread (n) 3418(defun gnus-summary-next-thread (n)
2969 "Go to the same level next thread. 3419 "Go to the same level next thread.
2970Argument N specifies the number of threads." 3420Argument N specifies the number of threads."
2971 (interactive "p") 3421 (interactive "p")
@@ -2976,7 +3426,7 @@ Argument N specifies the number of threads."
2976 (last (point)) 3426 (last (point))
2977 (level (current-column))) 3427 (level (current-column)))
2978 (while (and (> n 0) 3428 (while (and (> n 0)
2979 (gnus-Subject-search-forward) 3429 (gnus-summary-search-forward)
2980 (<= level (current-column))) 3430 (<= level (current-column)))
2981 ;; We have to skip lower levels. 3431 ;; We have to skip lower levels.
2982 (if (= level (current-column)) 3432 (if (= level (current-column))
@@ -2990,7 +3440,7 @@ Argument N specifies the number of threads."
2990 (goto-char last)) 3440 (goto-char last))
2991 )) 3441 ))
2992 3442
2993(defun gnus-Subject-prev-thread (n) 3443(defun gnus-summary-prev-thread (n)
2994 "Go to the same level previous thread. 3444 "Go to the same level previous thread.
2995Argument N specifies the number of threads." 3445Argument N specifies the number of threads."
2996 (interactive "p") 3446 (interactive "p")
@@ -3001,7 +3451,7 @@ Argument N specifies the number of threads."
3001 (last (point)) 3451 (last (point))
3002 (level (current-column))) 3452 (level (current-column)))
3003 (while (and (> n 0) 3453 (while (and (> n 0)
3004 (gnus-Subject-search-backward) 3454 (gnus-summary-search-backward)
3005 (<= level (current-column))) 3455 (<= level (current-column)))
3006 ;; We have to skip lower levels. 3456 ;; We have to skip lower levels.
3007 (if (= level (current-column)) 3457 (if (= level (current-column))
@@ -3015,7 +3465,7 @@ Argument N specifies the number of threads."
3015 (goto-char last)) 3465 (goto-char last))
3016 )) 3466 ))
3017 3467
3018(defun gnus-Subject-down-thread (d) 3468(defun gnus-summary-down-thread (d)
3019 "Go downward current thread. 3469 "Go downward current thread.
3020Argument D specifies the depth goes down." 3470Argument D specifies the depth goes down."
3021 (interactive "p") 3471 (interactive "p")
@@ -3025,7 +3475,7 @@ Argument D specifies the depth goes down."
3025 (let ((last (point)) 3475 (let ((last (point))
3026 (level (current-column))) 3476 (level (current-column)))
3027 (while (and (> d 0) 3477 (while (and (> d 0)
3028 (gnus-Subject-search-forward) 3478 (gnus-summary-search-forward)
3029 (<= level (current-column))) ;<= can be <. Which do you like? 3479 (<= level (current-column))) ;<= can be <. Which do you like?
3030 ;; We have to skip the same levels. 3480 ;; We have to skip the same levels.
3031 (if (< level (current-column)) 3481 (if (< level (current-column))
@@ -3038,7 +3488,7 @@ Argument D specifies the depth goes down."
3038 (goto-char last) 3488 (goto-char last)
3039 )) 3489 ))
3040 3490
3041(defun gnus-Subject-up-thread (d) 3491(defun gnus-summary-up-thread (d)
3042 "Go upward current thread. 3492 "Go upward current thread.
3043Argument D specifies the depth goes up." 3493Argument D specifies the depth goes up."
3044 (interactive "p") 3494 (interactive "p")
@@ -3048,7 +3498,7 @@ Argument D specifies the depth goes up."
3048 (let ((last (point)) 3498 (let ((last (point))
3049 (level (current-column))) 3499 (level (current-column)))
3050 (while (and (> d 0) 3500 (while (and (> d 0)
3051 (gnus-Subject-search-backward)) 3501 (gnus-summary-search-backward))
3052 ;; We have to skip the same levels. 3502 ;; We have to skip the same levels.
3053 (if (> level (current-column)) 3503 (if (> level (current-column))
3054 (progn 3504 (progn
@@ -3060,7 +3510,7 @@ Argument D specifies the depth goes up."
3060 (goto-char last) 3510 (goto-char last)
3061 )) 3511 ))
3062 3512
3063(defun gnus-Subject-kill-thread (unmark) 3513(defun gnus-summary-kill-thread (unmark)
3064 "Mark articles under current thread as read. 3514 "Mark articles under current thread as read.
3065If argument UNMARK is positive, remove any kinds of marks. 3515If argument UNMARK is positive, remove any kinds of marks.
3066If argument UNMARK is negative, mark articles as unread instead." 3516If argument UNMARK is negative, mark articles as unread instead."
@@ -3074,121 +3524,136 @@ If argument UNMARK is negative, mark articles as unread instead."
3074 (let ((level (current-column))) 3524 (let ((level (current-column)))
3075 ;; Mark current article. 3525 ;; Mark current article.
3076 (cond ((null unmark) 3526 (cond ((null unmark)
3077 (gnus-Subject-mark-as-read nil "K")) 3527 (gnus-summary-mark-as-read nil "K"))
3078 ((> unmark 0) 3528 ((> unmark 0)
3079 (gnus-Subject-mark-as-unread nil t)) 3529 (gnus-summary-mark-as-unread nil t))
3080 (t 3530 (t
3081 (gnus-Subject-mark-as-unread)) 3531 (gnus-summary-mark-as-unread))
3082 ) 3532 )
3083 ;; Mark following articles. 3533 ;; Mark following articles.
3084 (while (and (gnus-Subject-search-forward) 3534 (while (and (gnus-summary-search-forward)
3085 (< level (current-column))) 3535 (< level (current-column)))
3086 (cond ((null unmark) 3536 (cond ((null unmark)
3087 (gnus-Subject-mark-as-read nil "K")) 3537 (gnus-summary-mark-as-read nil "K"))
3088 ((> unmark 0) 3538 ((> unmark 0)
3089 (gnus-Subject-mark-as-unread nil t)) 3539 (gnus-summary-mark-as-unread nil t))
3090 (t 3540 (t
3091 (gnus-Subject-mark-as-unread)) 3541 (gnus-summary-mark-as-unread))
3092 )) 3542 ))
3093 )) 3543 ))
3094 ;; Hide killed subtrees. 3544 ;; Hide killed subtrees.
3095 (and (null unmark) 3545 (and (null unmark)
3096 gnus-thread-hide-killed 3546 gnus-thread-hide-killed
3097 (gnus-Subject-hide-thread)) 3547 (gnus-summary-hide-thread))
3098 ;; If marked as read, go to next unread subject. 3548 ;; If marked as read, go to next unread subject.
3099 (if (null unmark) 3549 (if (null unmark)
3100 ;; Go to next unread subject. 3550 ;; Go to next unread subject.
3101 (gnus-Subject-next-subject 1 t)) 3551 (gnus-summary-next-subject 1 t))
3102 ) 3552 )
3103 3553
3104(defun gnus-Subject-toggle-truncation (arg) 3554(defun gnus-summary-toggle-truncation (arg)
3105 "Toggle truncation of subject lines. 3555 "Toggle truncation of summary lines.
3106With ARG, turn line truncation on iff ARG is positive." 3556With arg, turn line truncation on iff arg is positive."
3107 (interactive "P") 3557 (interactive "P")
3108 (setq truncate-lines 3558 (setq truncate-lines
3109 (if (null arg) (not truncate-lines) 3559 (if (null arg) (not truncate-lines)
3110 (> (prefix-numeric-value arg) 0))) 3560 (> (prefix-numeric-value arg) 0)))
3111 (redraw-display)) 3561 (redraw-display))
3112 3562
3113(defun gnus-Subject-sort-by-number (reverse) 3563(defun gnus-summary-sort-by-number (reverse)
3114 "Sort subject display buffer by article number. 3564 "Sort Summary buffer by article number.
3115Argument REVERSE means reverse order." 3565Argument REVERSE means reverse order."
3116 (interactive "P") 3566 (interactive "P")
3117 (gnus-Subject-sort-subjects 3567 (gnus-summary-keysort-summary
3568 (function <)
3118 (function 3569 (function
3119 (lambda (a b) 3570 (lambda (a)
3120 (< (nntp-header-number a) (nntp-header-number b)))) 3571 (nntp-header-number a)))
3121 reverse 3572 reverse
3122 )) 3573 ))
3123 3574
3124(defun gnus-Subject-sort-by-author (reverse) 3575(defun gnus-summary-sort-by-author (reverse)
3125 "Sort subject display buffer by author name alphabetically. 3576 "Sort Summary buffer by author name alphabetically.
3126If case-fold-search is non-nil, case of letters is ignored. 3577If case-fold-search is non-nil, case of letters is ignored.
3127Argument REVERSE means reverse order." 3578Argument REVERSE means reverse order."
3128 (interactive "P") 3579 (interactive "P")
3129 (gnus-Subject-sort-subjects 3580 (gnus-summary-keysort-summary
3581 (function string-lessp)
3130 (function 3582 (function
3131 (lambda (a b) 3583 (lambda (a)
3132 (gnus-string-lessp (nntp-header-from a) (nntp-header-from b)))) 3584 (if case-fold-search
3585 (downcase (nntp-header-from a))
3586 (nntp-header-from a))))
3133 reverse 3587 reverse
3134 )) 3588 ))
3135 3589
3136(defun gnus-Subject-sort-by-subject (reverse) 3590(defun gnus-summary-sort-by-subject (reverse)
3137 "Sort subject display buffer by subject alphabetically. `Re:'s are ignored. 3591 "Sort Summary buffer by subject alphabetically. `Re:'s are ignored.
3138If case-fold-search is non-nil, case of letters is ignored. 3592If case-fold-search is non-nil, case of letters is ignored.
3139Argument REVERSE means reverse order." 3593Argument REVERSE means reverse order."
3140 (interactive "P") 3594 (interactive "P")
3141 (gnus-Subject-sort-subjects 3595 (gnus-summary-keysort-summary
3596 (function string-lessp)
3142 (function 3597 (function
3143 (lambda (a b) 3598 (lambda (a)
3144 (gnus-string-lessp 3599 (if case-fold-search
3145 (gnus-simplify-subject (nntp-header-subject a) 're-only) 3600 (downcase (gnus-simplify-subject (nntp-header-subject a) 're-only))
3146 (gnus-simplify-subject (nntp-header-subject b) 're-only)))) 3601 (gnus-simplify-subject (nntp-header-subject a) 're-only))))
3147 reverse 3602 reverse
3148 )) 3603 ))
3149 3604
3150(defun gnus-Subject-sort-by-date (reverse) 3605(defun gnus-summary-sort-by-date (reverse)
3151 "Sort subject display buffer by posted date. 3606 "Sort Summary buffer by date.
3152Argument REVERSE means reverse order." 3607Argument REVERSE means reverse order."
3153 (interactive "P") 3608 (interactive "P")
3154 (gnus-Subject-sort-subjects 3609 (gnus-summary-keysort-summary
3610 (function string-lessp)
3155 (function 3611 (function
3156 (lambda (a b) 3612 (lambda (a)
3157 (gnus-date-lessp (nntp-header-date a) (nntp-header-date b)))) 3613 (gnus-sortable-date (nntp-header-date a))))
3158 reverse 3614 reverse
3159 )) 3615 ))
3160 3616
3161(defun gnus-Subject-sort-subjects (predicate &optional reverse) 3617(defun gnus-summary-keysort-summary (predicate key &optional reverse)
3162 "Sort subject display buffer by PREDICATE. 3618 "Sort Summary buffer by PREDICATE using a value passed by KEY.
3619Optional argument REVERSE means reverse order."
3620 (let ((current (gnus-summary-article-number)))
3621 (gnus-keysort-headers predicate key reverse)
3622 (gnus-summary-prepare)
3623 (gnus-summary-goto-subject current)
3624 ))
3625
3626(defun gnus-summary-sort-summary (predicate &optional reverse)
3627 "Sort Summary buffer by PREDICATE.
3163Optional argument REVERSE means reverse order." 3628Optional argument REVERSE means reverse order."
3164 (let ((current (gnus-Subject-article-number))) 3629 (let ((current (gnus-summary-article-number)))
3165 (gnus-sort-headers predicate reverse) 3630 (gnus-sort-headers predicate reverse)
3166 (gnus-Subject-prepare) 3631 (gnus-summary-prepare)
3167 (gnus-Subject-goto-subject current) 3632 (gnus-summary-goto-subject current)
3168 )) 3633 ))
3169 3634
3170(defun gnus-Subject-reselect-current-group (show-all) 3635(defun gnus-summary-reselect-current-group (show-all)
3171 "Once exit and then reselect the current newsgroup. 3636 "Once exit and then reselect the current newsgroup.
3172Prefix argument SHOW-ALL means to select all articles." 3637Prefix argument SHOW-ALL means to select all articles."
3173 (interactive "P") 3638 (interactive "P")
3174 (let ((current-subject (gnus-Subject-article-number))) 3639 (let ((current-subject (gnus-summary-article-number)))
3175 (gnus-Subject-exit t) 3640 (gnus-summary-exit t)
3176 ;; We have to adjust the point of Group mode buffer because the 3641 ;; We have to adjust the point of Group mode buffer because the
3177 ;; current point was moved to the next unread newsgroup by 3642 ;; current point was moved to the next unread newsgroup by
3178 ;; exiting. 3643 ;; exiting.
3179 (gnus-Subject-jump-to-group gnus-newsgroup-name) 3644 (gnus-summary-jump-to-group gnus-newsgroup-name)
3180 (gnus-Group-read-group show-all t) 3645 (gnus-group-read-group show-all t)
3181 (gnus-Subject-goto-subject current-subject) 3646 (gnus-summary-goto-subject current-subject)
3182 )) 3647 ))
3183 3648
3184(defun gnus-Subject-caesar-message (rotnum) 3649(defun gnus-summary-caesar-message (rotnum)
3185 "Caesar rotates all letters of current message by 13/47 places. 3650 "Caesar rotates all letters of current message by 13/47 places.
3186With prefix arg, specifies the number of places to rotate each letter forward. 3651With prefix arg, specifies the number of places to rotate each letter forward.
3187Caesar rotates Japanese letters by 47 places in any case." 3652Caesar rotates Japanese letters by 47 places in any case."
3188 (interactive "P") 3653 (interactive "P")
3189 (gnus-Subject-select-article) 3654 (gnus-summary-select-article)
3190 (gnus-overload-functions) 3655 (gnus-overload-functions)
3191 (gnus-eval-in-buffer-window gnus-Article-buffer 3656 (gnus-eval-in-buffer-window gnus-article-buffer
3192 (save-restriction 3657 (save-restriction
3193 (widen) 3658 (widen)
3194 ;; We don't want to jump to the beginning of the message. 3659 ;; We don't want to jump to the beginning of the message.
@@ -3201,26 +3666,25 @@ Caesar rotates Japanese letters by 47 places in any case."
3201 )) 3666 ))
3202 )) 3667 ))
3203 3668
3204(defun gnus-Subject-rmail-digest () 3669(defun gnus-summary-rmail-digest ()
3205 "Run RMAIL on current digest article. 3670 "Run RMAIL on current digest article.
3206`gnus-Select-digest-hook' will be called with no arguments, if that 3671gnus-select-digest-hook will be called with no arguments, if that
3207value is non-nil. It is possible to modify the article so that Rmail 3672value is non-nil. It is possible to modify the article so that Rmail
3208can work with it. 3673can work with it.
3209 3674gnus-rmail-digest-hook will be called with no arguments, if that value
3210`gnus-Rmail-digest-hook' will be called with no arguments, if that value 3675is non-nil. The hook is intended to customize Rmail mode."
3211is non-nil. The hook is intended to customize Rmail mode."
3212 (interactive) 3676 (interactive)
3213 (gnus-Subject-select-article) 3677 (gnus-summary-select-article)
3214 (require 'rmail) 3678 (require 'rmail)
3215 (let ((artbuf gnus-Article-buffer) 3679 (let ((artbuf gnus-article-buffer)
3216 (digbuf (get-buffer-create gnus-Digest-buffer)) 3680 (digbuf (get-buffer-create gnus-digest-buffer))
3217 (mail-header-separator "")) 3681 (mail-header-separator ""))
3218 (set-buffer digbuf) 3682 (set-buffer digbuf)
3219 (buffer-disable-undo (current-buffer)) 3683 (buffer-flush-undo (current-buffer))
3220 (setq buffer-read-only nil) 3684 (setq buffer-read-only nil)
3221 (erase-buffer) 3685 (erase-buffer)
3222 (insert-buffer-substring artbuf) 3686 (insert-buffer-substring artbuf)
3223 (run-hooks 'gnus-Select-digest-hook) 3687 (run-hooks 'gnus-select-digest-hook)
3224 (gnus-convert-article-to-rmail) 3688 (gnus-convert-article-to-rmail)
3225 (goto-char (point-min)) 3689 (goto-char (point-min))
3226 ;; Rmail initializations. 3690 ;; Rmail initializations.
@@ -3260,33 +3724,33 @@ is non-nil. The hook is intended to customize Rmail mode."
3260 )) 3724 ))
3261 ;; Prevent generating new buffer named ***<N> each time. 3725 ;; Prevent generating new buffer named ***<N> each time.
3262 (setq rmail-summary-buffer 3726 (setq rmail-summary-buffer
3263 (get-buffer-create gnus-Digest-summary-buffer)) 3727 (get-buffer-create gnus-digest-summary-buffer))
3264 (run-hooks 'gnus-Rmail-digest-hook) 3728 (run-hooks 'gnus-rmail-digest-hook)
3265 ;; Take all windows safely. 3729 ;; Take all windows safely.
3266 (gnus-configure-windows '(1 0 0)) 3730 (gnus-configure-windows '(1 0 0))
3267 (pop-to-buffer gnus-Group-buffer) 3731 (pop-to-buffer gnus-group-buffer)
3268 ;; Use Subject and Article windows for Digest summary and 3732 ;; Use Summary Article windows for Digest summary and
3269 ;; Digest buffers. 3733 ;; Digest buffers.
3270 (if gnus-digest-show-summary 3734 (if gnus-digest-show-summary
3271 (let ((gnus-Subject-buffer gnus-Digest-summary-buffer) 3735 (let ((gnus-summary-buffer gnus-digest-summary-buffer)
3272 (gnus-Article-buffer gnus-Digest-buffer)) 3736 (gnus-article-buffer gnus-digest-buffer))
3273 (gnus-configure-windows 'SelectArticle) 3737 (gnus-configure-windows 'article)
3274 (pop-to-buffer gnus-Digest-buffer) 3738 (pop-to-buffer gnus-digest-buffer)
3275 (rmail-summary) 3739 (rmail-summary)
3276 (pop-to-buffer gnus-Digest-summary-buffer) 3740 (pop-to-buffer gnus-digest-summary-buffer)
3277 (message (substitute-command-keys 3741 (message (substitute-command-keys
3278 "Type \\[rmail-summary-quit] to return to GNUS"))) 3742 "Type \\[rmail-summary-quit] to return to GNUS")))
3279 (let ((gnus-Subject-buffer gnus-Digest-buffer)) 3743 (let ((gnus-summary-buffer gnus-digest-buffer))
3280 (gnus-configure-windows 'ExpandSubject) 3744 (gnus-configure-windows 'summary)
3281 (pop-to-buffer gnus-Digest-buffer) 3745 (pop-to-buffer gnus-digest-buffer)
3282 (message (substitute-command-keys 3746 (message (substitute-command-keys
3283 "Type \\[rmail-quit] to return to GNUS"))) 3747 "Type \\[rmail-quit] to return to GNUS")))
3284 ) 3748 )
3285 ;; Move the buffers to the end of buffer list. 3749 ;; Move the buffers to the end of buffer list.
3286 (bury-buffer gnus-Article-buffer) 3750 (bury-buffer gnus-article-buffer)
3287 (bury-buffer gnus-Group-buffer) 3751 (bury-buffer gnus-group-buffer)
3288 (bury-buffer gnus-Digest-summary-buffer) 3752 (bury-buffer gnus-digest-summary-buffer)
3289 (bury-buffer gnus-Digest-buffer)) 3753 (bury-buffer gnus-digest-buffer))
3290 (error (set-buffer-modified-p nil) 3754 (error (set-buffer-modified-p nil)
3291 (kill-buffer digbuf) 3755 (kill-buffer digbuf)
3292 ;; This command should not signal an error because the 3756 ;; This command should not signal an error because the
@@ -3294,25 +3758,23 @@ is non-nil. The hook is intended to customize Rmail mode."
3294 (ding) (message "Article is not a digest"))) 3758 (ding) (message "Article is not a digest")))
3295 )) 3759 ))
3296 3760
3297(defun gnus-Subject-save-article () 3761(defun gnus-summary-save-article ()
3298 "Save this article using default saver function. 3762 "Save this article using default saver function.
3299Variable `gnus-default-article-saver' specifies the saver function." 3763The variable `gnus-default-article-saver' specifies the saver function."
3300 (interactive) 3764 (interactive)
3301 (gnus-Subject-select-article 3765 (gnus-summary-select-article gnus-save-all-headers gnus-save-all-headers)
3302 (not (null gnus-save-all-headers)) gnus-save-all-headers)
3303 (if gnus-default-article-saver 3766 (if gnus-default-article-saver
3304 (call-interactively gnus-default-article-saver) 3767 (call-interactively gnus-default-article-saver)
3305 (error "No default saver is defined."))) 3768 (error "No default saver is defined.")))
3306 3769
3307(defun gnus-Subject-save-in-rmail (&optional filename) 3770(defun gnus-summary-save-in-rmail (&optional filename)
3308 "Append this article to Rmail file. 3771 "Append this article to Rmail file.
3309Optional argument FILENAME specifies file name. 3772Optional argument FILENAME specifies file name.
3310Directory to save to is default to `gnus-article-save-directory' which 3773Directory to save to is default to `gnus-article-save-directory' which
3311is initialized from the SAVEDIR environment variable." 3774is initialized from the SAVEDIR environment variable."
3312 (interactive) 3775 (interactive)
3313 (gnus-Subject-select-article 3776 (gnus-summary-select-article gnus-save-all-headers gnus-save-all-headers)
3314 (not (null gnus-save-all-headers)) gnus-save-all-headers) 3777 (gnus-eval-in-buffer-window gnus-article-buffer
3315 (gnus-eval-in-buffer-window gnus-Article-buffer
3316 (save-excursion 3778 (save-excursion
3317 (save-restriction 3779 (save-restriction
3318 (widen) 3780 (widen)
@@ -3337,15 +3799,14 @@ is initialized from the SAVEDIR environment variable."
3337 ))) 3799 )))
3338 )) 3800 ))
3339 3801
3340(defun gnus-Subject-save-in-mail (&optional filename) 3802(defun gnus-summary-save-in-mail (&optional filename)
3341 "Append this article to Unix mail file. 3803 "Append this article to Unix mail file.
3342Optional argument FILENAME specifies file name. 3804Optional argument FILENAME specifies file name.
3343Directory to save to is default to `gnus-article-save-directory' which 3805Directory to save to is default to `gnus-article-save-directory' which
3344is initialized from the SAVEDIR environment variable." 3806is initialized from the SAVEDIR environment variable."
3345 (interactive) 3807 (interactive)
3346 (gnus-Subject-select-article 3808 (gnus-summary-select-article gnus-save-all-headers gnus-save-all-headers)
3347 (not (null gnus-save-all-headers)) gnus-save-all-headers) 3809 (gnus-eval-in-buffer-window gnus-article-buffer
3348 (gnus-eval-in-buffer-window gnus-Article-buffer
3349 (save-excursion 3810 (save-excursion
3350 (save-restriction 3811 (save-restriction
3351 (widen) 3812 (widen)
@@ -3370,15 +3831,14 @@ is initialized from the SAVEDIR environment variable."
3370 ))) 3831 )))
3371 )) 3832 ))
3372 3833
3373(defun gnus-Subject-save-in-file (&optional filename) 3834(defun gnus-summary-save-in-file (&optional filename)
3374 "Append this article to file. 3835 "Append this article to file.
3375Optional argument FILENAME specifies file name. 3836Optional argument FILENAME specifies file name.
3376Directory to save to is default to `gnus-article-save-directory' which 3837Directory to save to is default to `gnus-article-save-directory' which
3377is initialized from the SAVEDIR environment variable." 3838is initialized from the SAVEDIR environment variable."
3378 (interactive) 3839 (interactive)
3379 (gnus-Subject-select-article 3840 (gnus-summary-select-article gnus-save-all-headers gnus-save-all-headers)
3380 (not (null gnus-save-all-headers)) gnus-save-all-headers) 3841 (gnus-eval-in-buffer-window gnus-article-buffer
3381 (gnus-eval-in-buffer-window gnus-Article-buffer
3382 (save-excursion 3842 (save-excursion
3383 (save-restriction 3843 (save-restriction
3384 (widen) 3844 (widen)
@@ -3403,13 +3863,12 @@ is initialized from the SAVEDIR environment variable."
3403 ))) 3863 )))
3404 )) 3864 ))
3405 3865
3406(defun gnus-Subject-save-in-folder (&optional folder) 3866(defun gnus-summary-save-in-folder (&optional folder)
3407 "Save this article to MH folder (using `rcvstore' in MH library). 3867 "Save this article to MH folder (using `rcvstore' in MH library).
3408Optional argument FOLDER specifies folder name." 3868Optional argument FOLDER specifies folder name."
3409 (interactive) 3869 (interactive)
3410 (gnus-Subject-select-article 3870 (gnus-summary-select-article gnus-save-all-headers gnus-save-all-headers)
3411 (not (null gnus-save-all-headers)) gnus-save-all-headers) 3871 (gnus-eval-in-buffer-window gnus-article-buffer
3412 (gnus-eval-in-buffer-window gnus-Article-buffer
3413 (save-restriction 3872 (save-restriction
3414 (widen) 3873 (widen)
3415 ;; Thanks to yuki@flab.Fujitsu.JUNET and ohm@kaba.junet. 3874 ;; Thanks to yuki@flab.Fujitsu.JUNET and ohm@kaba.junet.
@@ -3438,12 +3897,14 @@ Optional argument FOLDER specifies folder name."
3438 )) 3897 ))
3439 )) 3898 ))
3440 3899
3441(defun gnus-Subject-pipe-output () 3900(defun gnus-summary-pipe-output ()
3442 "Pipe this article to subprocess." 3901 "Pipe this article to subprocess."
3443 (interactive) 3902 (interactive)
3444 ;; Ignore `gnus-save-all-headers' since this is not save command. 3903 ;; Ignore `gnus-save-all-headers' since this is not save command.
3445 (gnus-Subject-select-article) 3904 ;;(gnus-summary-select-article)
3446 (gnus-eval-in-buffer-window gnus-Article-buffer 3905 ;; Huuum. Is this right?
3906 (gnus-summary-select-article gnus-save-all-headers gnus-save-all-headers)
3907 (gnus-eval-in-buffer-window gnus-article-buffer
3447 (save-restriction 3908 (save-restriction
3448 (widen) 3909 (widen)
3449 (let ((command (read-string "Shell command on article: " 3910 (let ((command (read-string "Shell command on article: "
@@ -3455,7 +3916,7 @@ Optional argument FOLDER specifies folder name."
3455 )) 3916 ))
3456 )) 3917 ))
3457 3918
3458(defun gnus-Subject-catch-up (all &optional quietly) 3919(defun gnus-summary-catchup (all &optional quietly)
3459 "Mark all articles not marked as unread in this newsgroup as read. 3920 "Mark all articles not marked as unread in this newsgroup as read.
3460If prefix argument ALL is non-nil, all articles are marked as read." 3921If prefix argument ALL is non-nil, all articles are marked as read."
3461 (interactive "P") 3922 (interactive "P")
@@ -3468,18 +3929,20 @@ If prefix argument ALL is non-nil, all articles are marked as read."
3468 (gnus-set-difference gnus-newsgroup-unreads 3929 (gnus-set-difference gnus-newsgroup-unreads
3469 (if (not all) gnus-newsgroup-marked)))) 3930 (if (not all) gnus-newsgroup-marked))))
3470 (message "") ;Erase "Yes or No" question. 3931 (message "") ;Erase "Yes or No" question.
3932 ;; Hidden thread subtrees must be searched for ,too.
3933 (gnus-summary-show-all-threads)
3471 (while unmarked 3934 (while unmarked
3472 (gnus-Subject-mark-as-read (car unmarked) "C") 3935 (gnus-summary-mark-as-read (car unmarked) "C")
3473 (setq unmarked (cdr unmarked)) 3936 (setq unmarked (cdr unmarked))
3474 )) 3937 ))
3475 )) 3938 ))
3476 3939
3477(defun gnus-Subject-catch-up-all (&optional quietly) 3940(defun gnus-summary-catchup-all (&optional quietly)
3478 "Mark all articles in this newsgroup as read." 3941 "Mark all articles in this newsgroup as read."
3479 (interactive) 3942 (interactive)
3480 (gnus-Subject-catch-up t quietly)) 3943 (gnus-summary-catchup t quietly))
3481 3944
3482(defun gnus-Subject-catch-up-and-exit (all &optional quietly) 3945(defun gnus-summary-catchup-and-exit (all &optional quietly)
3483 "Mark all articles not marked as unread in this newsgroup as read, then exit. 3946 "Mark all articles not marked as unread in this newsgroup as read, then exit.
3484If prefix argument ALL is non-nil, all articles are marked as read." 3947If prefix argument ALL is non-nil, all articles are marked as read."
3485 (interactive "P") 3948 (interactive "P")
@@ -3498,46 +3961,46 @@ If prefix argument ALL is non-nil, all articles are marked as read."
3498 ;; Select next newsgroup or exit. 3961 ;; Select next newsgroup or exit.
3499 (cond ((eq gnus-auto-select-next 'quietly) 3962 (cond ((eq gnus-auto-select-next 'quietly)
3500 ;; Select next newsgroup quietly. 3963 ;; Select next newsgroup quietly.
3501 (gnus-Subject-next-group nil)) 3964 (gnus-summary-next-group nil))
3502 (t 3965 (t
3503 (gnus-Subject-exit))) 3966 (gnus-summary-exit)))
3504 ))) 3967 )))
3505 3968
3506(defun gnus-Subject-catch-up-all-and-exit (&optional quietly) 3969(defun gnus-summary-catchup-all-and-exit (&optional quietly)
3507 "Mark all articles in this newsgroup as read, and then exit." 3970 "Mark all articles in this newsgroup as read, and then exit."
3508 (interactive) 3971 (interactive)
3509 (gnus-Subject-catch-up-and-exit t quietly)) 3972 (gnus-summary-catchup-and-exit t quietly))
3510 3973
3511(defun gnus-Subject-edit-global-kill () 3974(defun gnus-summary-edit-global-kill ()
3512 "Edit a global KILL file." 3975 "Edit a global KILL file."
3513 (interactive) 3976 (interactive)
3514 (setq gnus-current-kill-article (gnus-Subject-article-number)) 3977 (setq gnus-current-kill-article (gnus-summary-article-number))
3515 (gnus-Kill-file-edit-file nil) ;Nil stands for global KILL file. 3978 (gnus-kill-file-edit-file nil) ;Nil stands for global KILL file.
3516 (message 3979 (message
3517 (substitute-command-keys 3980 (substitute-command-keys
3518 "Editing a global KILL file (Type \\[gnus-Kill-file-exit] to exit)"))) 3981 "Editing a global KILL file (Type \\[gnus-kill-file-exit] to exit)")))
3519 3982
3520(defun gnus-Subject-edit-local-kill () 3983(defun gnus-summary-edit-local-kill ()
3521 "Edit a local KILL file applied to the current newsgroup." 3984 "Edit a local KILL file applied to the current newsgroup."
3522 (interactive) 3985 (interactive)
3523 (setq gnus-current-kill-article (gnus-Subject-article-number)) 3986 (setq gnus-current-kill-article (gnus-summary-article-number))
3524 (gnus-Kill-file-edit-file gnus-newsgroup-name) 3987 (gnus-kill-file-edit-file gnus-newsgroup-name)
3525 (message 3988 (message
3526 (substitute-command-keys 3989 (substitute-command-keys
3527 "Editing a local KILL file (Type \\[gnus-Kill-file-exit] to exit)"))) 3990 "Editing a local KILL file (Type \\[gnus-kill-file-exit] to exit)")))
3528 3991
3529(defun gnus-Subject-exit (&optional temporary) 3992(defun gnus-summary-exit (&optional temporary)
3530 "Exit reading current newsgroup, and then return to group selection mode. 3993 "Exit reading current newsgroup, and then return to group selection mode.
3531gnus-Exit-group-hook is called with no arguments if that value is non-nil." 3994gnus-exit-group-hook is called with no arguments if that value is non-nil."
3532 (interactive) 3995 (interactive)
3533 (let ((updated nil) 3996 (let ((updated nil)
3534 (gnus-newsgroup-headers gnus-newsgroup-headers) 3997 (gnus-newsgroup-headers gnus-newsgroup-headers)
3535 (gnus-newsgroup-unreads gnus-newsgroup-unreads) 3998 (gnus-newsgroup-unreads gnus-newsgroup-unreads)
3536 (gnus-newsgroup-unselected gnus-newsgroup-unselected) 3999 (gnus-newsgroup-unselected gnus-newsgroup-unselected)
3537 (gnus-newsgroup-marked gnus-newsgroup-marked)) 4000 (gnus-newsgroup-marked gnus-newsgroup-marked))
3538 ;; Important internal variables are save, so we can reenter 4001 ;; Important internal variables are saved, so we can reenter
3539 ;; Subject Mode buffer even if hook changes them. 4002 ;; Summary buffer even if hook changes them.
3540 (run-hooks 'gnus-Exit-group-hook) 4003 (run-hooks 'gnus-exit-group-hook)
3541 (gnus-update-unread-articles gnus-newsgroup-name 4004 (gnus-update-unread-articles gnus-newsgroup-name
3542 (append gnus-newsgroup-unselected 4005 (append gnus-newsgroup-unselected
3543 gnus-newsgroup-unreads) 4006 gnus-newsgroup-unreads)
@@ -3551,55 +4014,55 @@ gnus-Exit-group-hook is called with no arguments if that value is non-nil."
3551 (eq gnus-use-cross-reference t) 4014 (eq gnus-use-cross-reference t)
3552 ))) 4015 )))
3553 ;; Do not switch windows but change the buffer to work. 4016 ;; Do not switch windows but change the buffer to work.
3554 (set-buffer gnus-Group-buffer) 4017 (set-buffer gnus-group-buffer)
3555 ;; Update cross referenced group info. 4018 ;; Update cross referenced group info.
3556 (while updated 4019 (while updated
3557 (gnus-Group-update-group (car updated) t) ;Ignore invisible group. 4020 (gnus-group-update-group (car updated) t) ;Ignore invisible group.
3558 (setq updated (cdr updated))) 4021 (setq updated (cdr updated)))
3559 (gnus-Group-update-group gnus-newsgroup-name)) 4022 (gnus-group-update-group gnus-newsgroup-name))
3560 ;; Make sure where I was, and go to next newsgroup. 4023 ;; Make sure where I was, and go to next newsgroup.
3561 (gnus-Group-jump-to-group gnus-newsgroup-name) 4024 (gnus-group-jump-to-group gnus-newsgroup-name)
3562 (gnus-Group-next-unread-group 1) 4025 (gnus-group-next-unread-group 1)
3563 (if temporary 4026 (if temporary
3564 ;; If exiting temporary, caller should adjust Group mode 4027 ;; If exiting temporary, caller should adjust Group mode
3565 ;; buffer point by itself. 4028 ;; buffer point by itself.
3566 nil ;Nothing to do. 4029 nil ;Nothing to do.
3567 ;; Return to Group mode buffer. 4030 ;; Return to Group mode buffer.
3568 (if (get-buffer gnus-Subject-buffer) 4031 (if (get-buffer gnus-summary-buffer)
3569 (bury-buffer gnus-Subject-buffer)) 4032 (bury-buffer gnus-summary-buffer))
3570 (if (get-buffer gnus-Article-buffer) 4033 (if (get-buffer gnus-article-buffer)
3571 (bury-buffer gnus-Article-buffer)) 4034 (bury-buffer gnus-article-buffer))
3572 (gnus-configure-windows 'ExitNewsgroup) 4035 (gnus-configure-windows 'newsgroups)
3573 (pop-to-buffer gnus-Group-buffer))) 4036 (pop-to-buffer gnus-group-buffer)))
3574 4037
3575(defun gnus-Subject-quit () 4038(defun gnus-summary-quit ()
3576 "Quit reading current newsgroup without updating read article info." 4039 "Quit reading current newsgroup without updating read article info."
3577 (interactive) 4040 (interactive)
3578 (if (y-or-n-p "Do you really wanna quit reading this group? ") 4041 (if (y-or-n-p "Do you really wanna quit reading this group? ")
3579 (progn 4042 (progn
3580 (message "") ;Erase "Yes or No" question. 4043 (message "") ;Erase "Yes or No" question.
3581 ;; Return to Group selection mode. 4044 ;; Return to Group selection mode.
3582 (if (get-buffer gnus-Subject-buffer) 4045 (if (get-buffer gnus-summary-buffer)
3583 (bury-buffer gnus-Subject-buffer)) 4046 (bury-buffer gnus-summary-buffer))
3584 (if (get-buffer gnus-Article-buffer) 4047 (if (get-buffer gnus-article-buffer)
3585 (bury-buffer gnus-Article-buffer)) 4048 (bury-buffer gnus-article-buffer))
3586 (gnus-configure-windows 'ExitNewsgroup) 4049 (gnus-configure-windows 'newsgroups)
3587 (pop-to-buffer gnus-Group-buffer) 4050 (pop-to-buffer gnus-group-buffer)
3588 (gnus-Group-jump-to-group gnus-newsgroup-name) ;Make sure where I was. 4051 (gnus-group-jump-to-group gnus-newsgroup-name) ;Make sure where I was.
3589 (gnus-Group-next-group 1) ;(gnus-Group-next-unread-group 1) 4052 (gnus-group-next-group 1) ;(gnus-group-next-unread-group 1)
3590 ))) 4053 )))
3591 4054
3592(defun gnus-Subject-describe-briefly () 4055(defun gnus-summary-describe-briefly ()
3593 "Describe Subject mode commands briefly." 4056 "Describe Summary mode commands briefly."
3594 (interactive) 4057 (interactive)
3595 (message 4058 (message
3596 (concat 4059 (concat
3597 (substitute-command-keys "\\[gnus-Subject-next-page]:Select ") 4060 (substitute-command-keys "\\[gnus-summary-next-page]:Select ")
3598 (substitute-command-keys "\\[gnus-Subject-next-unread-article]:Forward ") 4061 (substitute-command-keys "\\[gnus-summary-next-unread-article]:Forward ")
3599 (substitute-command-keys "\\[gnus-Subject-prev-unread-article]:Backward ") 4062 (substitute-command-keys "\\[gnus-summary-prev-unread-article]:Backward ")
3600 (substitute-command-keys "\\[gnus-Subject-exit]:Exit ") 4063 (substitute-command-keys "\\[gnus-summary-exit]:Exit ")
3601 (substitute-command-keys "\\[gnus-Info-find-node]:Run Info ") 4064 (substitute-command-keys "\\[gnus-info-find-node]:Run Info ")
3602 (substitute-command-keys "\\[gnus-Subject-describe-briefly]:This help") 4065 (substitute-command-keys "\\[gnus-summary-describe-briefly]:This help")
3603 ))) 4066 )))
3604 4067
3605 4068
@@ -3607,31 +4070,31 @@ gnus-Exit-group-hook is called with no arguments if that value is non-nil."
3607;;; GNUS Article Mode 4070;;; GNUS Article Mode
3608;;; 4071;;;
3609 4072
3610(if gnus-Article-mode-map 4073(if gnus-article-mode-map
3611 nil 4074 nil
3612 (setq gnus-Article-mode-map (make-keymap)) 4075 (setq gnus-article-mode-map (make-keymap))
3613 (suppress-keymap gnus-Article-mode-map) 4076 (suppress-keymap gnus-article-mode-map)
3614 (define-key gnus-Article-mode-map " " 'gnus-Article-next-page) 4077 (define-key gnus-article-mode-map " " 'gnus-article-next-page)
3615 (define-key gnus-Article-mode-map "\177" 'gnus-Article-prev-page) 4078 (define-key gnus-article-mode-map "\177" 'gnus-article-prev-page)
3616 (define-key gnus-Article-mode-map "r" 'gnus-Article-refer-article) 4079 (define-key gnus-article-mode-map "r" 'gnus-article-refer-article)
3617 (define-key gnus-Article-mode-map "o" 'gnus-Article-pop-article) 4080 (define-key gnus-article-mode-map "o" 'gnus-article-pop-article)
3618 (define-key gnus-Article-mode-map "h" 'gnus-Article-show-subjects) 4081 (define-key gnus-article-mode-map "h" 'gnus-article-show-summary)
3619 (define-key gnus-Article-mode-map "s" 'gnus-Article-show-subjects) 4082 (define-key gnus-article-mode-map "s" 'gnus-article-show-summary)
3620 (define-key gnus-Article-mode-map "?" 'gnus-Article-describe-briefly) 4083 (define-key gnus-article-mode-map "?" 'gnus-article-describe-briefly)
3621 (define-key gnus-Article-mode-map "\C-c\C-i" 'gnus-Info-find-node)) 4084 (define-key gnus-article-mode-map "\C-c\C-i" 'gnus-info-find-node))
3622 4085
3623(defun gnus-Article-mode () 4086(defun gnus-article-mode ()
3624 "Major mode for browsing through an article. 4087 "Major mode for browsing through an article.
3625All normal editing commands are turned off. 4088All normal editing commands are turned off.
3626Instead, these commands are available: 4089Instead, these commands are available:
3627\\{gnus-Article-mode-map} 4090\\{gnus-article-mode-map}
3628 4091
3629Various hooks for customization: 4092Various hooks for customization:
3630 gnus-Article-mode-hook 4093 gnus-article-mode-hook
3631 Entry to this mode calls the value with no arguments, if that 4094 Entry to this mode calls the value with no arguments, if that
3632 value is non-nil. 4095 value is non-nil.
3633 4096
3634 gnus-Article-prepare-hook 4097 gnus-article-prepare-hook
3635 Called with no arguments after an article is prepared for reading, 4098 Called with no arguments after an article is prepared for reading,
3636 if that value is non-nil." 4099 if that value is non-nil."
3637 (interactive) 4100 (interactive)
@@ -3642,80 +4105,113 @@ Various hooks for customization:
3642 ((listp (default-value 'mode-line-format)) 4105 ((listp (default-value 'mode-line-format))
3643 (setq mode-line-format 4106 (setq mode-line-format
3644 (cons "--- " (cdr (default-value 'mode-line-format)))))) 4107 (cons "--- " (cdr (default-value 'mode-line-format))))))
3645 (make-local-variable 'global-mode-string) 4108 ;; To disable display-time facility.
3646 (setq global-mode-string nil) 4109 ;;(make-local-variable 'global-mode-string)
3647 (setq major-mode 'gnus-Article-mode) 4110 ;;(setq global-mode-string nil)
4111 (setq major-mode 'gnus-article-mode)
3648 (setq mode-name "Article") 4112 (setq mode-name "Article")
3649 (gnus-Article-set-mode-line) 4113 (make-local-variable 'minor-mode-alist)
3650 (use-local-map gnus-Article-mode-map) 4114 (or (assq 'gnus-show-mime minor-mode-alist)
4115 (setq minor-mode-alist
4116 (cons (list 'gnus-show-mime " MIME") minor-mode-alist)))
4117 (gnus-article-set-mode-line)
4118 (use-local-map gnus-article-mode-map)
3651 (make-local-variable 'page-delimiter) 4119 (make-local-variable 'page-delimiter)
3652 (setq page-delimiter gnus-page-delimiter) 4120 (setq page-delimiter gnus-page-delimiter)
3653 (make-local-variable 'mail-header-separator) 4121 (make-local-variable 'mail-header-separator)
3654 (setq mail-header-separator "") ;For caesar function. 4122 (setq mail-header-separator "") ;For caesar function.
3655 (buffer-disable-undo (current-buffer)) 4123 (buffer-flush-undo (current-buffer))
3656 (setq buffer-read-only t) ;Disable modification 4124 (setq buffer-read-only t) ;Disable modification
3657 (run-hooks 'gnus-Article-mode-hook)) 4125 (run-hooks 'gnus-article-mode-hook))
3658 4126
3659(defun gnus-Article-setup-buffer () 4127(defun gnus-article-setup-buffer ()
3660 "Initialize Article mode buffer." 4128 "Initialize Article mode buffer."
3661 (or (get-buffer gnus-Article-buffer) 4129 (or (get-buffer gnus-article-buffer)
3662 (save-excursion 4130 (save-excursion
3663 (set-buffer (get-buffer-create gnus-Article-buffer)) 4131 (set-buffer (get-buffer-create gnus-article-buffer))
3664 (gnus-Article-mode)) 4132 (gnus-article-mode))
3665 )) 4133 ))
3666 4134
3667(defun gnus-Article-prepare (article &optional all-headers) 4135(defun gnus-article-prepare (article &optional all-headers)
3668 "Prepare ARTICLE in Article mode buffer. 4136 "Prepare ARTICLE in Article mode buffer.
4137ARTICLE can be either a article number or Message-ID.
3669If optional argument ALL-HEADERS is non-nil, all headers are inserted." 4138If optional argument ALL-HEADERS is non-nil, all headers are inserted."
4139 ;; Make sure a connection to NNTP server is alive.
4140 (if (not (gnus-server-opened))
4141 (progn
4142 (gnus-start-news-server)
4143 (gnus-request-group gnus-newsgroup-name)))
3670 (save-excursion 4144 (save-excursion
3671 (set-buffer gnus-Article-buffer) 4145 (set-buffer gnus-article-buffer)
3672 (let ((buffer-read-only nil)) 4146 (let ((buffer-read-only nil))
3673 (erase-buffer) 4147 (erase-buffer)
3674 (if (gnus-request-article article) 4148 ;; mhspool does not work with Message-ID. So, let's translate
4149 ;; it into an article number as possible as can. This may help
4150 ;; nnspool too.
4151 ;; Note: this conversion must be done here since if the article
4152 ;; is specified by number or message-id has a different meaning
4153 ;; in the following.
4154 (if (let* ((header
4155 (and (stringp article)
4156 (gnus-get-header-by-id article)))
4157 (article
4158 (if header
4159 (nntp-header-number header) article)))
4160 (gnus-request-article article))
3675 (progn 4161 (progn
3676 ;; Prepare article buffer 4162 ;; Prepare article buffer
3677 (insert-buffer-substring nntp-server-buffer) 4163 (insert-buffer-substring nntp-server-buffer)
3678 (setq gnus-have-all-headers (or all-headers gnus-show-all-headers)) 4164 ;; gnus-have-all-headers must be either T or NIL.
4165 (setq gnus-have-all-headers
4166 (not (not (or all-headers gnus-show-all-headers))))
3679 (if (and (numberp article) 4167 (if (and (numberp article)
3680 (not (eq article gnus-current-article))) 4168 (not (eq article gnus-current-article)))
3681 ;; Seems me that a new article is selected. 4169 ;; Seems me that a new article has been selected.
3682 (progn 4170 (progn
3683 ;; gnus-current-article must be an article number. 4171 ;; gnus-current-article must be an article number.
3684 (setq gnus-last-article gnus-current-article) 4172 (setq gnus-last-article gnus-current-article)
3685 (setq gnus-current-article article) 4173 (setq gnus-current-article article)
4174;; (setq gnus-current-headers
4175;; (gnus-find-header-by-number gnus-newsgroup-headers
4176;; gnus-current-article))
3686 (setq gnus-current-headers 4177 (setq gnus-current-headers
3687 (gnus-find-header-by-number gnus-newsgroup-headers 4178 (gnus-get-header-by-number gnus-current-article))
3688 gnus-current-article)) 4179 (run-hooks 'gnus-mark-article-hook)
3689 ;; Clear articles history only when articles are
3690 ;; retrieved by article numbers.
3691 (setq gnus-current-history nil)
3692 (run-hooks 'gnus-Mark-article-hook)
3693 )) 4180 ))
3694 ;; Hooks for modifying contents of the article. This hook 4181 ;; Clear article history only when the article is
4182 ;; retrieved by the article number.
4183 (if (numberp article)
4184 (setq gnus-current-history nil))
4185 ;; Hooks for modifying contents of the article. This hook
3695 ;; must be called before being narrowed. 4186 ;; must be called before being narrowed.
3696 (run-hooks 'gnus-Article-prepare-hook) 4187 (run-hooks 'gnus-article-prepare-hook)
4188 ;; Decode MIME message.
4189 (if (and gnus-show-mime
4190 (gnus-fetch-field "Mime-Version"))
4191 (funcall gnus-show-mime-method))
3697 ;; Delete unnecessary headers. 4192 ;; Delete unnecessary headers.
3698 (or gnus-have-all-headers 4193 (or gnus-have-all-headers
3699 (gnus-Article-delete-headers)) 4194 (gnus-article-delete-headers))
3700 ;; Do page break. 4195 ;; Do page break.
3701 (goto-char (point-min)) 4196 (goto-char (point-min))
3702 (if gnus-break-pages 4197 (if gnus-break-pages
3703 (gnus-narrow-to-page)) 4198 (gnus-narrow-to-page))
3704 ;; Next function must be called after setting 4199 ;; Next function must be called after setting
3705 ;; `gnus-current-article' variable and narrowed to page. 4200 ;; `gnus-current-article' variable and narrowed to page.
3706 (gnus-Article-set-mode-line) 4201 (gnus-article-set-mode-line)
3707 ) 4202 )
4203 ;; There is no such article.
3708 (if (numberp article) 4204 (if (numberp article)
3709 (gnus-Subject-mark-as-read article)) 4205 (gnus-summary-mark-as-read article))
3710 (ding) (message "No such article (may be canceled)")) 4206 (ding) (message "No such article (may be canceled)"))
3711 ))) 4207 )))
3712 4208
3713(defun gnus-Article-show-all-headers () 4209(defun gnus-article-show-all-headers ()
3714 "Show all article headers in Article mode buffer." 4210 "Show all article headers in Article mode buffer."
3715 (or gnus-have-all-headers 4211 (or gnus-have-all-headers
3716 (gnus-Article-prepare gnus-current-article t))) 4212 (gnus-article-prepare gnus-current-article t)))
3717 4213
3718;;(defun gnus-Article-set-mode-line () 4214;;(defun gnus-article-set-mode-line ()
3719;; "Set Article mode line string." 4215;; "Set Article mode line string."
3720;; (setq mode-line-buffer-identification 4216;; (setq mode-line-buffer-identification
3721;; (list 17 4217;; (list 17
@@ -3727,33 +4223,54 @@ If optional argument ALL-HEADERS is non-nil, all headers are inserted."
3727;; ))) 4223;; )))
3728;; (set-buffer-modified-p t)) 4224;; (set-buffer-modified-p t))
3729 4225
3730(defun gnus-Article-set-mode-line () 4226;;(defun gnus-article-set-mode-line ()
3731 "Set Article mode line string." 4227;; "Set Article mode line string."
3732 (let ((unmarked 4228;; (let ((unmarked
3733 (- (length gnus-newsgroup-unreads) 4229;; (- (length gnus-newsgroup-unreads)
3734 (length (gnus-intersection 4230;; (length (gnus-intersection
3735 gnus-newsgroup-unreads gnus-newsgroup-marked)))) 4231;; gnus-newsgroup-unreads gnus-newsgroup-marked))))
3736 (unselected 4232;; (unselected
3737 (- (length gnus-newsgroup-unselected) 4233;; (- (length gnus-newsgroup-unselected)
3738 (length (gnus-intersection 4234;; (length (gnus-intersection
3739 gnus-newsgroup-unselected gnus-newsgroup-marked))))) 4235;; gnus-newsgroup-unselected gnus-newsgroup-marked)))))
4236;; (setq mode-line-buffer-identification
4237;; (list 17
4238;; (format "GNUS: %s{%d} %s"
4239;; gnus-newsgroup-name
4240;; gnus-current-article
4241;; ;; This is proposed by tale@pawl.rpi.edu.
4242;; (cond ((and (zerop unmarked)
4243;; (zerop unselected))
4244;; " ")
4245;; ((zerop unselected)
4246;; (format "%d more" unmarked))
4247;; (t
4248;; (format "%d(+%d) more" unmarked unselected)))
4249;; ))))
4250;; (set-buffer-modified-p t))
4251
4252;; New implementation in gnus 3.14.3
4253
4254(defun gnus-article-set-mode-line ()
4255 "Set Article mode line string.
4256If you don't like it, define your own gnus-article-set-mode-line."
4257 (let ((maxlen 15) ;Maximum subject length
4258 (subject
4259 (if gnus-current-headers
4260 (nntp-header-subject gnus-current-headers) "")))
4261 ;; The value must be a string to escape %-constructs because of subject.
3740 (setq mode-line-buffer-identification 4262 (setq mode-line-buffer-identification
3741 (list 17 4263 (format "GNUS: %s%s %s%s%s"
3742 (format "GNUS: %s{%d} %s" 4264 gnus-newsgroup-name
3743 gnus-newsgroup-name 4265 (if gnus-current-article
3744 gnus-current-article 4266 (format "/%d" gnus-current-article) "")
3745 ;; This is proposed by tale@pawl.rpi.edu. 4267 (substring subject 0 (min (length subject) maxlen))
3746 (cond ((and (zerop unmarked) 4268 (if (> (length subject) maxlen) "..." "")
3747 (zerop unselected)) 4269 (make-string (max 0 (- 17 (length subject))) ? )
3748 " ") 4270 )))
3749 ((zerop unselected)
3750 (format "%d more" unmarked))
3751 (t
3752 (format "%d(+%d) more" unmarked unselected)))
3753 ))))
3754 (set-buffer-modified-p t)) 4271 (set-buffer-modified-p t))
3755 4272
3756(defun gnus-Article-delete-headers () 4273(defun gnus-article-delete-headers ()
3757 "Delete unnecessary headers." 4274 "Delete unnecessary headers."
3758 (save-excursion 4275 (save-excursion
3759 (save-restriction 4276 (save-restriction
@@ -3772,7 +4289,7 @@ If optional argument ALL-HEADERS is non-nil, all headers are inserted."
3772 4289
3773;; Working on article's buffer 4290;; Working on article's buffer
3774 4291
3775(defun gnus-Article-next-page (lines) 4292(defun gnus-article-next-page (lines)
3776 "Show next page of current article. 4293 "Show next page of current article.
3777If end of article, return non-nil. Otherwise return nil. 4294If end of article, return non-nil. Otherwise return nil.
3778Argument LINES specifies lines to be scrolled up." 4295Argument LINES specifies lines to be scrolled up."
@@ -3801,7 +4318,7 @@ Argument LINES specifies lines to be scrolled up."
3801 nil 4318 nil
3802 )) 4319 ))
3803 4320
3804(defun gnus-Article-prev-page (lines) 4321(defun gnus-article-prev-page (lines)
3805 "Show previous page of current article. 4322 "Show previous page of current article.
3806Argument LINES specifies lines to be scrolled down." 4323Argument LINES specifies lines to be scrolled down."
3807 (interactive "P") 4324 (interactive "P")
@@ -3815,7 +4332,7 @@ Argument LINES specifies lines to be scrolled down."
3815 (recenter -1)) 4332 (recenter -1))
3816 (scroll-down lines))) 4333 (scroll-down lines)))
3817 4334
3818(defun gnus-Article-next-digest (nth) 4335(defun gnus-article-next-digest (nth)
3819 "Move to head of NTH next digested message. 4336 "Move to head of NTH next digested message.
3820Set mark at end of digested message." 4337Set mark at end of digested message."
3821 ;; Stop page breaking in digest mode. 4338 ;; Stop page breaking in digest mode.
@@ -3845,7 +4362,7 @@ Set mark at end of digested message."
3845 (message "End of message") 4362 (message "End of message")
3846 )) 4363 ))
3847 4364
3848(defun gnus-Article-prev-digest (nth) 4365(defun gnus-article-prev-digest (nth)
3849 "Move to head of NTH previous digested message." 4366 "Move to head of NTH previous digested message."
3850 ;; Stop page breaking in digest mode. 4367 ;; Stop page breaking in digest mode.
3851 (widen) 4368 (widen)
@@ -3874,7 +4391,7 @@ Set mark at end of digested message."
3874 (message "Top of message") 4391 (message "Top of message")
3875 )) 4392 ))
3876 4393
3877(defun gnus-Article-refer-article () 4394(defun gnus-article-refer-article ()
3878 "Read article specified by message-id around point." 4395 "Read article specified by message-id around point."
3879 (interactive) 4396 (interactive)
3880 (save-window-excursion 4397 (save-window-excursion
@@ -3883,35 +4400,35 @@ Set mark at end of digested message."
3883 (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t) 4400 (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t)
3884 (let ((message-id 4401 (let ((message-id
3885 (buffer-substring (match-beginning 1) (match-end 1)))) 4402 (buffer-substring (match-beginning 1) (match-end 1))))
3886 (set-buffer gnus-Subject-buffer) 4403 (set-buffer gnus-summary-buffer)
3887 (gnus-Subject-refer-article message-id)) 4404 (gnus-summary-refer-article message-id))
3888 (error "No references around point")) 4405 (error "No references around point"))
3889 ))) 4406 )))
3890 4407
3891(defun gnus-Article-pop-article () 4408(defun gnus-article-pop-article ()
3892 "Pop up article history." 4409 "Pop up article history."
3893 (interactive) 4410 (interactive)
3894 (save-window-excursion 4411 (save-window-excursion
3895 (set-buffer gnus-Subject-buffer) 4412 (set-buffer gnus-summary-buffer)
3896 (gnus-Subject-refer-article nil))) 4413 (gnus-summary-refer-article nil)))
3897 4414
3898(defun gnus-Article-show-subjects () 4415(defun gnus-article-show-summary ()
3899 "Reconfigure windows to show headers." 4416 "Reconfigure windows to show Summary buffer."
3900 (interactive) 4417 (interactive)
3901 (gnus-configure-windows 'SelectArticle) 4418 (gnus-configure-windows 'article)
3902 (pop-to-buffer gnus-Subject-buffer) 4419 (pop-to-buffer gnus-summary-buffer)
3903 (gnus-Subject-goto-subject gnus-current-article)) 4420 (gnus-summary-goto-subject gnus-current-article))
3904 4421
3905(defun gnus-Article-describe-briefly () 4422(defun gnus-article-describe-briefly ()
3906 "Describe Article mode commands briefly." 4423 "Describe Article mode commands briefly."
3907 (interactive) 4424 (interactive)
3908 (message 4425 (message
3909 (concat 4426 (concat
3910 (substitute-command-keys "\\[gnus-Article-next-page]:Next page ") 4427 (substitute-command-keys "\\[gnus-article-next-page]:Next page ")
3911 (substitute-command-keys "\\[gnus-Article-prev-page]:Prev page ") 4428 (substitute-command-keys "\\[gnus-article-prev-page]:Prev page ")
3912 (substitute-command-keys "\\[gnus-Article-show-subjects]:Show headers ") 4429 (substitute-command-keys "\\[gnus-article-show-summary]:Show Summary ")
3913 (substitute-command-keys "\\[gnus-Info-find-node]:Run Info ") 4430 (substitute-command-keys "\\[gnus-info-find-node]:Run Info ")
3914 (substitute-command-keys "\\[gnus-Article-describe-briefly]:This help") 4431 (substitute-command-keys "\\[gnus-article-describe-briefly]:This help")
3915 ))) 4432 )))
3916 4433
3917 4434
@@ -3919,27 +4436,27 @@ Set mark at end of digested message."
3919;;; GNUS KILL-File Mode 4436;;; GNUS KILL-File Mode
3920;;; 4437;;;
3921 4438
3922(if gnus-Kill-file-mode-map 4439(if gnus-kill-file-mode-map
3923 nil 4440 nil
3924 (setq gnus-Kill-file-mode-map (copy-keymap emacs-lisp-mode-map)) 4441 (setq gnus-kill-file-mode-map (copy-keymap emacs-lisp-mode-map))
3925 (define-key gnus-Kill-file-mode-map "\C-c\C-k\C-s" 'gnus-Kill-file-kill-by-subject) 4442 (define-key gnus-kill-file-mode-map "\C-c\C-k\C-s" 'gnus-kill-file-kill-by-subject)
3926 (define-key gnus-Kill-file-mode-map "\C-c\C-k\C-a" 'gnus-Kill-file-kill-by-author) 4443 (define-key gnus-kill-file-mode-map "\C-c\C-k\C-a" 'gnus-kill-file-kill-by-author)
3927 (define-key gnus-Kill-file-mode-map "\C-c\C-a" 'gnus-Kill-file-apply-buffer) 4444 (define-key gnus-kill-file-mode-map "\C-c\C-a" 'gnus-kill-file-apply-buffer)
3928 (define-key gnus-Kill-file-mode-map "\C-c\C-e" 'gnus-Kill-file-apply-last-sexp) 4445 (define-key gnus-kill-file-mode-map "\C-c\C-e" 'gnus-kill-file-apply-last-sexp)
3929 (define-key gnus-Kill-file-mode-map "\C-c\C-c" 'gnus-Kill-file-exit) 4446 (define-key gnus-kill-file-mode-map "\C-c\C-c" 'gnus-kill-file-exit)
3930 (define-key gnus-Kill-file-mode-map "\C-c\C-i" 'gnus-Info-find-node)) 4447 (define-key gnus-kill-file-mode-map "\C-c\C-i" 'gnus-info-find-node))
3931 4448
3932(defun gnus-Kill-file-mode () 4449(defun gnus-kill-file-mode ()
3933 "Major mode for editing KILL file. 4450 "Major mode for editing KILL file.
3934 4451
3935In addition to Emacs-Lisp Mode, the following commands are available: 4452In addition to Emacs-Lisp Mode, the following commands are available:
3936 4453
3937\\[gnus-Kill-file-kill-by-subject] Insert KILL command for current subject. 4454\\[gnus-kill-file-kill-by-subject] Insert KILL command for current subject.
3938\\[gnus-Kill-file-kill-by-author] Insert KILL command for current author. 4455\\[gnus-kill-file-kill-by-author] Insert KILL command for current author.
3939\\[gnus-Kill-file-apply-buffer] Apply current buffer to selected newsgroup. 4456\\[gnus-kill-file-apply-buffer] Apply current buffer to selected newsgroup.
3940\\[gnus-Kill-file-apply-last-sexp] Apply sexp before point to selected newsgroup. 4457\\[gnus-kill-file-apply-last-sexp] Apply sexp before point to selected newsgroup.
3941\\[gnus-Kill-file-exit] Save file and exit editing KILL file. 4458\\[gnus-kill-file-exit] Save file and exit editing KILL file.
3942\\[gnus-Info-find-node] Read Info about KILL file. 4459\\[gnus-info-find-node] Read Info about KILL file.
3943 4460
3944 A KILL file contains lisp expressions to be applied to a selected 4461 A KILL file contains lisp expressions to be applied to a selected
3945newsgroup. The purpose is to mark articles as read on the basis of 4462newsgroup. The purpose is to mark articles as read on the basis of
@@ -3949,20 +4466,20 @@ global KILL file is applied to every newsgroup, for better performance
3949use a local one. 4466use a local one.
3950 4467
3951 A KILL file can contain any kind of Emacs lisp expressions expected 4468 A KILL file can contain any kind of Emacs lisp expressions expected
3952to be evaluated in the Subject buffer. Writing lisp programs for this 4469to be evaluated in the Summary buffer. Writing lisp programs for this
3953purpose is not so easy because the internal working of GNUS must be 4470purpose is not so easy because the internal working of GNUS must be
3954well-known. For this reason, GNUS provides a general function which 4471well-known. For this reason, GNUS provides a general function which
3955does this easily for non-Lisp programmers. 4472does this easily for non-Lisp programmers.
3956 4473
3957 The `gnus-kill' function executes commands available in Subject Mode 4474 The `gnus-kill' function executes commands available in Summary Mode
3958by their key sequences. `gnus-kill' should be called with FIELD, 4475by their key sequences. `gnus-kill' should be called with FIELD,
3959REGEXP and optional COMMAND and ALL. FIELD is a string representing 4476REGEXP and optional COMMAND and ALL. FIELD is a string representing
3960the header field or an empty string. If FIELD is an empty string, the 4477the header field or an empty string. If FIELD is an empty string, the
3961entire article body is searched for. REGEXP is a string which is 4478entire article body is searched for. REGEXP is a string which is
3962compared with FIELD value. COMMAND is a string representing a valid 4479compared with FIELD value. COMMAND is a string representing a valid
3963key sequence in Subject Mode or Lisp expression. COMMAND is default to 4480key sequence in Summary Mode or Lisp expression. COMMAND is default to
3964'(gnus-Subject-mark-as-read nil \"X\"). Make sure that COMMAND is 4481'(gnus-summary-mark-as-read nil \"X\"). Make sure that COMMAND is
3965executed in the Subject buffer. If the second optional argument ALL 4482executed in the Summary buffer. If the second optional argument ALL
3966is non-nil, the COMMAND is applied to articles which are already 4483is non-nil, the COMMAND is applied to articles which are already
3967marked as read or unread. Articles which are marked are skipped over 4484marked as read or unread. Articles which are marked are skipped over
3968by default. 4485by default.
@@ -3978,31 +4495,31 @@ the following expression:
3978 (gnus-kill \"Subject\" \"AI\" \"d\") 4495 (gnus-kill \"Subject\" \"AI\" \"d\")
3979 4496
3980In this example it is assumed that the command 4497In this example it is assumed that the command
3981`gnus-Subject-mark-as-read-forward' is assigned to `d' in Subject Mode. 4498`gnus-summary-mark-as-read-forward' is assigned to `d' in Summary Mode.
3982 4499
3983 It is possible to delete unnecessary headers which are marked with 4500 It is possible to delete unnecessary headers which are marked with
3984`X' in a KILL file as follows: 4501`X' in a KILL file as follows:
3985 4502
3986 (gnus-expunge \"X\") 4503 (gnus-expunge \"X\")
3987 4504
3988 If the Subject buffer is empty after applying KILL files, GNUS will 4505 If the Summary buffer is empty after applying KILL files, GNUS will
3989exit the selected newsgroup normally. If headers which are marked 4506exit the selected newsgroup normally. If headers which are marked
3990with `D' are deleted in a KILL file, it is impossible to read articles 4507with `D' are deleted in a KILL file, it is impossible to read articles
3991which are marked as read in the previous GNUS sessions. Marks other 4508which are marked as read in the previous GNUS sessions. Marks other
3992than `D' should be used for articles which should really be deleted. 4509than `D' should be used for articles which should really be deleted.
3993 4510
3994Entry to this mode calls emacs-lisp-mode-hook and 4511Entry to this mode calls emacs-lisp-mode-hook and
3995gnus-Kill-file-mode-hook with no arguments, if that value is non-nil." 4512gnus-kill-file-mode-hook with no arguments, if that value is non-nil."
3996 (interactive) 4513 (interactive)
3997 (kill-all-local-variables) 4514 (kill-all-local-variables)
3998 (use-local-map gnus-Kill-file-mode-map) 4515 (use-local-map gnus-kill-file-mode-map)
3999 (set-syntax-table emacs-lisp-mode-syntax-table) 4516 (set-syntax-table emacs-lisp-mode-syntax-table)
4000 (setq major-mode 'gnus-Kill-file-mode) 4517 (setq major-mode 'gnus-kill-file-mode)
4001 (setq mode-name "KILL-File") 4518 (setq mode-name "KILL-File")
4002 (lisp-mode-variables nil) 4519 (lisp-mode-variables nil)
4003 (run-hooks 'emacs-lisp-mode-hook 'gnus-Kill-file-mode-hook)) 4520 (run-hooks 'emacs-lisp-mode-hook 'gnus-kill-file-mode-hook))
4004 4521
4005(defun gnus-Kill-file-edit-file (newsgroup) 4522(defun gnus-kill-file-edit-file (newsgroup)
4006 "Begin editing a KILL file of NEWSGROUP. 4523 "Begin editing a KILL file of NEWSGROUP.
4007If NEWSGROUP is nil, the global KILL file is selected." 4524If NEWSGROUP is nil, the global KILL file is selected."
4008 (interactive "sNewsgroup: ") 4525 (interactive "sNewsgroup: ")
@@ -4016,24 +4533,24 @@ If NEWSGROUP is nil, the global KILL file is selected."
4016 (let ((buffer (find-file-noselect file))) 4533 (let ((buffer (find-file-noselect file)))
4017 (cond ((get-buffer-window buffer) 4534 (cond ((get-buffer-window buffer)
4018 (pop-to-buffer buffer)) 4535 (pop-to-buffer buffer))
4019 ((eq major-mode 'gnus-Group-mode) 4536 ((eq major-mode 'gnus-group-mode)
4020 (gnus-configure-windows '(1 0 0)) ;Take all windows. 4537 (gnus-configure-windows '(1 0 0)) ;Take all windows.
4021 (pop-to-buffer gnus-Group-buffer) 4538 (pop-to-buffer gnus-group-buffer)
4022 (let ((gnus-Subject-buffer buffer)) 4539 (let ((gnus-summary-buffer buffer))
4023 (gnus-configure-windows '(1 1 0)) ;Split into two. 4540 (gnus-configure-windows '(1 1 0)) ;Split into two.
4024 (pop-to-buffer buffer))) 4541 (pop-to-buffer buffer)))
4025 ((eq major-mode 'gnus-Subject-mode) 4542 ((eq major-mode 'gnus-summary-mode)
4026 (gnus-configure-windows 'SelectArticle) 4543 (gnus-configure-windows 'article)
4027 (pop-to-buffer gnus-Article-buffer) 4544 (pop-to-buffer gnus-article-buffer)
4028 (bury-buffer gnus-Article-buffer) 4545 (bury-buffer gnus-article-buffer)
4029 (switch-to-buffer buffer)) 4546 (switch-to-buffer buffer))
4030 (t ;No good rules. 4547 (t ;No good rules.
4031 (find-file-other-window file)) 4548 (find-file-other-window file))
4032 )) 4549 ))
4033 (gnus-Kill-file-mode) 4550 (gnus-kill-file-mode)
4034 )) 4551 ))
4035 4552
4036(defun gnus-Kill-file-kill-by-subject () 4553(defun gnus-kill-file-kill-by-subject ()
4037 "Insert KILL command for current subject." 4554 "Insert KILL command for current subject."
4038 (interactive) 4555 (interactive)
4039 (insert 4556 (insert
@@ -4042,11 +4559,13 @@ If NEWSGROUP is nil, the global KILL file is selected."
4042 (if gnus-current-kill-article 4559 (if gnus-current-kill-article
4043 (regexp-quote 4560 (regexp-quote
4044 (nntp-header-subject 4561 (nntp-header-subject
4562 ;; No need to speed up this command.
4563 ;;(gnus-get-header-by-number gnus-current-kill-article)
4045 (gnus-find-header-by-number gnus-newsgroup-headers 4564 (gnus-find-header-by-number gnus-newsgroup-headers
4046 gnus-current-kill-article))) 4565 gnus-current-kill-article)))
4047 ""))))) 4566 "")))))
4048 4567
4049(defun gnus-Kill-file-kill-by-author () 4568(defun gnus-kill-file-kill-by-author ()
4050 "Insert KILL command for current author." 4569 "Insert KILL command for current author."
4051 (interactive) 4570 (interactive)
4052 (insert 4571 (insert
@@ -4055,46 +4574,48 @@ If NEWSGROUP is nil, the global KILL file is selected."
4055 (if gnus-current-kill-article 4574 (if gnus-current-kill-article
4056 (regexp-quote 4575 (regexp-quote
4057 (nntp-header-from 4576 (nntp-header-from
4577 ;; No need to speed up this command.
4578 ;;(gnus-get-header-by-number gnus-current-kill-article)
4058 (gnus-find-header-by-number gnus-newsgroup-headers 4579 (gnus-find-header-by-number gnus-newsgroup-headers
4059 gnus-current-kill-article))) 4580 gnus-current-kill-article)))
4060 ""))))) 4581 "")))))
4061 4582
4062(defun gnus-Kill-file-apply-buffer () 4583(defun gnus-kill-file-apply-buffer ()
4063 "Apply current buffer to current newsgroup." 4584 "Apply current buffer to current newsgroup."
4064 (interactive) 4585 (interactive)
4065 (if (and gnus-current-kill-article 4586 (if (and gnus-current-kill-article
4066 (get-buffer gnus-Subject-buffer)) 4587 (get-buffer gnus-summary-buffer))
4067 ;; Assume newsgroup is selected. 4588 ;; Assume newsgroup is selected.
4068 (let ((string (concat "(progn \n" (buffer-string) "\n)" ))) 4589 (let ((string (concat "(progn \n" (buffer-string) "\n)" )))
4069 (save-excursion 4590 (save-excursion
4070 (save-window-excursion 4591 (save-window-excursion
4071 (pop-to-buffer gnus-Subject-buffer) 4592 (pop-to-buffer gnus-summary-buffer)
4072 (eval (car (read-from-string string)))))) 4593 (eval (car (read-from-string string))))))
4073 (ding) (message "No newsgroup is selected."))) 4594 (ding) (message "No newsgroup is selected.")))
4074 4595
4075(defun gnus-Kill-file-apply-last-sexp () 4596(defun gnus-kill-file-apply-last-sexp ()
4076 "Apply sexp before point in current buffer to current newsgroup." 4597 "Apply sexp before point in current buffer to current newsgroup."
4077 (interactive) 4598 (interactive)
4078 (if (and gnus-current-kill-article 4599 (if (and gnus-current-kill-article
4079 (get-buffer gnus-Subject-buffer)) 4600 (get-buffer gnus-summary-buffer))
4080 ;; Assume newsgroup is selected. 4601 ;; Assume newsgroup is selected.
4081 (let ((string 4602 (let ((string
4082 (buffer-substring 4603 (buffer-substring
4083 (save-excursion (forward-sexp -1) (point)) (point)))) 4604 (save-excursion (forward-sexp -1) (point)) (point))))
4084 (save-excursion 4605 (save-excursion
4085 (save-window-excursion 4606 (save-window-excursion
4086 (pop-to-buffer gnus-Subject-buffer) 4607 (pop-to-buffer gnus-summary-buffer)
4087 (eval (car (read-from-string string)))))) 4608 (eval (car (read-from-string string))))))
4088 (ding) (message "No newsgroup is selected."))) 4609 (ding) (message "No newsgroup is selected.")))
4089 4610
4090(defun gnus-Kill-file-exit () 4611(defun gnus-kill-file-exit ()
4091 "Save a KILL file, then return to the previous buffer." 4612 "Save a KILL file, then return to the previous buffer."
4092 (interactive) 4613 (interactive)
4093 (save-buffer) 4614 (save-buffer)
4094 (let ((killbuf (current-buffer))) 4615 (let ((killbuf (current-buffer)))
4095 ;; We don't want to return to Article buffer. 4616 ;; We don't want to return to Article buffer.
4096 (and (get-buffer gnus-Article-buffer) 4617 (and (get-buffer gnus-article-buffer)
4097 (bury-buffer (get-buffer gnus-Article-buffer))) 4618 (bury-buffer (get-buffer gnus-article-buffer)))
4098 ;; Delete the KILL file windows. 4619 ;; Delete the KILL file windows.
4099 (delete-windows-on killbuf) 4620 (delete-windows-on killbuf)
4100 ;; Restore last window configuration if available. 4621 ;; Restore last window configuration if available.
@@ -4147,16 +4668,18 @@ Usage: emacs -batch -l gnus -f gnus-batch-kill NEWSGROUP ..."
4147 (or (null no) 4668 (or (null no)
4148 (not (string-match no group)))) 4669 (not (string-match no group))))
4149 (progn 4670 (progn
4150 (gnus-Subject-read-group group nil t) 4671 (gnus-summary-read-group group nil t)
4151 (if (eq (current-buffer) (get-buffer gnus-Subject-buffer)) 4672 (if (eq (current-buffer) (get-buffer gnus-summary-buffer))
4152 (gnus-Subject-exit t)) 4673 (gnus-summary-exit t))
4153 )) 4674 ))
4154 ) 4675 )
4155 ;; Finally, exit Emacs. 4676 ;; Finally, exit Emacs.
4156 (set-buffer gnus-Group-buffer) 4677 (set-buffer gnus-group-buffer)
4157 (gnus-Group-exit) 4678 (gnus-group-exit)
4158 )) 4679 ))
4159 4680
4681;; For saving articles
4682
4160(defun gnus-Numeric-save-name (newsgroup headers &optional last-file) 4683(defun gnus-Numeric-save-name (newsgroup headers &optional last-file)
4161 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE. 4684 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
4162If variable `gnus-use-long-file-name' is nil, it is ~/News/News.group/num. 4685If variable `gnus-use-long-file-name' is nil, it is ~/News/News.group/num.
@@ -4164,7 +4687,7 @@ Otherwise, it is like ~/News/news/group/num."
4164 (let ((default 4687 (let ((default
4165 (expand-file-name 4688 (expand-file-name
4166 (concat (if gnus-use-long-file-name 4689 (concat (if gnus-use-long-file-name
4167 (capitalize newsgroup) 4690 (gnus-capitalize-newsgroup newsgroup)
4168 (gnus-newsgroup-directory-form newsgroup)) 4691 (gnus-newsgroup-directory-form newsgroup))
4169 "/" (int-to-string (nntp-header-number headers))) 4692 "/" (int-to-string (nntp-header-number headers)))
4170 (or gnus-article-save-directory "~/News")))) 4693 (or gnus-article-save-directory "~/News"))))
@@ -4200,7 +4723,7 @@ Otherwise, it is like ~/News/news/group/news."
4200 (or last-file 4723 (or last-file
4201 (expand-file-name 4724 (expand-file-name
4202 (if gnus-use-long-file-name 4725 (if gnus-use-long-file-name
4203 (capitalize newsgroup) 4726 (gnus-capitalize-newsgroup newsgroup)
4204 (concat (gnus-newsgroup-directory-form newsgroup) "/news")) 4727 (concat (gnus-newsgroup-directory-form newsgroup) "/news"))
4205 (or gnus-article-save-directory "~/News")))) 4728 (or gnus-article-save-directory "~/News"))))
4206 4729
@@ -4222,7 +4745,7 @@ Otherwise, it is like +news/group."
4222 (or last-folder 4745 (or last-folder
4223 (concat "+" 4746 (concat "+"
4224 (if gnus-use-long-file-name 4747 (if gnus-use-long-file-name
4225 (capitalize newsgroup) 4748 (gnus-capitalize-newsgroup newsgroup)
4226 (gnus-newsgroup-directory-form newsgroup))))) 4749 (gnus-newsgroup-directory-form newsgroup)))))
4227 4750
4228(defun gnus-folder-save-name (newsgroup headers &optional last-folder) 4751(defun gnus-folder-save-name (newsgroup headers &optional last-folder)
@@ -4235,6 +4758,8 @@ Otherwise, it is like +news/group."
4235 newsgroup 4758 newsgroup
4236 (gnus-newsgroup-directory-form newsgroup))))) 4759 (gnus-newsgroup-directory-form newsgroup)))))
4237 4760
4761;; For KILL files
4762
4238(defun gnus-apply-kill-file () 4763(defun gnus-apply-kill-file ()
4239 "Apply KILL file to the current newsgroup." 4764 "Apply KILL file to the current newsgroup."
4240 ;; Apply the global KILL file. 4765 ;; Apply the global KILL file.
@@ -4252,7 +4777,7 @@ If NEWSGROUP is nil, return the global KILL file instead."
4252 (or gnus-article-save-directory "~/News"))) 4777 (or gnus-article-save-directory "~/News")))
4253 (gnus-use-long-file-name 4778 (gnus-use-long-file-name
4254 ;; Append ".KILL" to capitalized newsgroup name. 4779 ;; Append ".KILL" to capitalized newsgroup name.
4255 (expand-file-name (concat (capitalize newsgroup) 4780 (expand-file-name (concat (gnus-capitalize-newsgroup newsgroup)
4256 "." gnus-kill-file-name) 4781 "." gnus-kill-file-name)
4257 (or gnus-article-save-directory "~/News"))) 4782 (or gnus-article-save-directory "~/News")))
4258 (t 4783 (t
@@ -4281,6 +4806,67 @@ If NEWSGROUP is nil, return the global KILL file instead."
4281 (or gnus-article-save-directory "~/News"))) 4806 (or gnus-article-save-directory "~/News")))
4282 )) 4807 ))
4283 4808
4809;; For subscribing new newsgroup
4810
4811(defun gnus-subscribe-randomly (newsgroup)
4812 "Subscribe new NEWSGROUP and insert it at the beginning of newsgroups."
4813 (gnus-subscribe-newsgroup newsgroup
4814 (car (car gnus-newsrc-assoc))))
4815
4816(defun gnus-subscribe-alphabetically (newgroup)
4817 "Subscribe new NEWSGROUP and insert it in strict alphabetic order."
4818 ;; Basic ideas by mike-w@cs.aukuni.ac.nz (Mike Williams)
4819 (let ((groups gnus-newsrc-assoc)
4820 (before nil))
4821 (while (and (not before) groups)
4822 (if (string< newgroup (car (car groups)))
4823 (setq before (car (car groups)))
4824 (setq groups (cdr groups))))
4825 (gnus-subscribe-newsgroup newgroup before)
4826 ))
4827
4828(defun gnus-subscribe-hierarchically (newgroup)
4829 "Subscribe new NEWSGROUP and insert it in hierarchical newsgroup order."
4830 ;; Basic ideas by mike-w@cs.aukuni.ac.nz (Mike Williams)
4831 (save-excursion
4832 (set-buffer (find-file-noselect gnus-current-startup-file))
4833 (let ((groupkey newgroup)
4834 (before nil))
4835 (while (and (not before) groupkey)
4836 (goto-char (point-min))
4837 (let ((groupkey-re
4838 (concat "^\\(" (regexp-quote groupkey) ".*\\)[!:]")))
4839 (while (and (re-search-forward groupkey-re nil t)
4840 (progn
4841 (setq before (buffer-substring
4842 (match-beginning 1) (match-end 1)))
4843 (string< before newgroup)))
4844 ))
4845 ;; Remove tail of newsgroup name (eg. a.b.c -> a.b)
4846 (setq groupkey
4847 (if (string-match "^\\(.*\\)\\.[^.]+$" groupkey)
4848 (substring groupkey (match-beginning 1) (match-end 1)))))
4849 (gnus-subscribe-newsgroup newgroup before)
4850 )))
4851
4852(defun gnus-subscribe-interactively (newsgroup)
4853 "Subscribe new NEWSGROUP interactively.
4854It is inserted in hierarchical newsgroup order if subscribed.
4855Unless, it is killed."
4856 (if (y-or-n-p (format "Subscribe new newsgroup: %s " newsgroup))
4857 (gnus-subscribe-hierarchically newsgroup)
4858 ;; Save in kill-ring
4859 (gnus-subscribe-newsgroup newsgroup)
4860 (gnus-kill-newsgroup newsgroup)))
4861
4862(defun gnus-subscribe-newsgroup (newsgroup &optional next)
4863 "Subscribe new NEWSGROUP.
4864If optional argument NEXT is non-nil, it is inserted before NEXT."
4865 (gnus-insert-newsgroup (list newsgroup t) next)
4866 (message "Subscribe newsgroup: %s" newsgroup))
4867
4868;; For directories
4869
4284(defun gnus-newsgroup-directory-form (newsgroup) 4870(defun gnus-newsgroup-directory-form (newsgroup)
4285 "Make hierarchical directory name from NEWSGROUP name." 4871 "Make hierarchical directory name from NEWSGROUP name."
4286 (let ((newsgroup (substring newsgroup 0)) ;Copy string. 4872 (let ((newsgroup (substring newsgroup 0)) ;Copy string.
@@ -4303,15 +4889,29 @@ If NEWSGROUP is nil, return the global KILL file instead."
4303 4889
4304(defun gnus-make-directory-1 (head tail) 4890(defun gnus-make-directory-1 (head tail)
4305 (cond ((string-match "^/\\([^/]+\\)" tail) 4891 (cond ((string-match "^/\\([^/]+\\)" tail)
4306 (setq head 4892 ;; ange-ftp interferes with calling match-* after
4307 (concat (file-name-as-directory head) 4893 ;; calling file-name-as-directory.
4308 (substring tail (match-beginning 1) (match-end 1)))) 4894 (let ((beg (match-beginning 1))
4309 (or (file-exists-p head) 4895 (end (match-end 1)))
4310 (call-process "mkdir" nil nil nil head)) 4896 (setq head (concat (file-name-as-directory head)
4311 (gnus-make-directory-1 head (substring tail (match-end 1)))) 4897 (substring tail beg end)))
4898 (or (file-exists-p head)
4899 (call-process "mkdir" nil nil nil head))
4900 (gnus-make-directory-1 head (substring tail end))))
4312 ((string-equal tail "") t) 4901 ((string-equal tail "") t)
4313 )) 4902 ))
4314 4903
4904(defun gnus-capitalize-newsgroup (newsgroup)
4905 "Capitalize NEWSGROUP name with treating '.' and '-' as part of words."
4906 ;; Suggested by "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>.
4907 (let ((current-syntax-table (copy-syntax-table (syntax-table))))
4908 (unwind-protect
4909 (progn
4910 (modify-syntax-entry ?- "w")
4911 (modify-syntax-entry ?. "w")
4912 (capitalize newsgroup))
4913 (set-syntax-table current-syntax-table))))
4914
4315(defun gnus-simplify-subject (subject &optional re-only) 4915(defun gnus-simplify-subject (subject &optional re-only)
4316 "Remove `Re:' and words in parentheses. 4916 "Remove `Re:' and words in parentheses.
4317If optional argument RE-ONLY is non-nil, strip `Re:' only." 4917If optional argument RE-ONLY is non-nil, strip `Re:' only."
@@ -4345,58 +4945,101 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
4345 "Return a string like `NNN' from HEADER." 4945 "Return a string like `NNN' from HEADER."
4346 (format "%4d" (nntp-header-lines header))) 4946 (format "%4d" (nntp-header-lines header)))
4347 4947
4948;; Basic ideas by flee@cs.psu.edu (Felix Lee)
4949
4950(defun gnus-keysort-headers (predicate key &optional reverse)
4951 "Sort current headers by PREDICATE using a value passed by KEY safely.
4952*Safely* means C-g quitting is disabled during sort.
4953Optional argument REVERSE means reverse order."
4954 (let ((inhibit-quit t))
4955 (setq gnus-newsgroup-headers
4956 (if reverse
4957 (nreverse
4958 (gnus-keysort (nreverse gnus-newsgroup-headers) predicate key))
4959 (gnus-keysort gnus-newsgroup-headers predicate key)))
4960 ;; Make sure we don't have to call
4961 ;; gnus-clear-hashtables-for-newsgroup-headers to clear hash
4962 ;; tables for the variable gnus-newsgroup-headers since no new
4963 ;; entry is added to nor deleted from the variable.
4964 ))
4965
4966(defun gnus-keysort (list predicate key)
4967 "Sort LIST by PREDICATE using a value passed by KEY."
4968 (mapcar (function cdr)
4969 (sort (mapcar (function (lambda (a) (cons (funcall key a) a))) list)
4970 (function (lambda (a b)
4971 (funcall predicate (car a) (car b)))))))
4972
4348(defun gnus-sort-headers (predicate &optional reverse) 4973(defun gnus-sort-headers (predicate &optional reverse)
4349 "Sort current group headers by PREDICATE safely. 4974 "Sort current headers by PREDICATE safely.
4350*Safely* means C-g quitting is disabled during sorting. 4975*Safely* means C-g quitting is disabled during sort.
4351Optional argument REVERSE means reverse order." 4976Optional argument REVERSE means reverse order."
4352 (let ((inhibit-quit t)) 4977 (let ((inhibit-quit t))
4353 (setq gnus-newsgroup-headers 4978 (setq gnus-newsgroup-headers
4354 (if reverse 4979 (if reverse
4355 (nreverse (sort (nreverse gnus-newsgroup-headers) predicate)) 4980 (nreverse (sort (nreverse gnus-newsgroup-headers) predicate))
4356 (sort gnus-newsgroup-headers predicate))) 4981 (sort gnus-newsgroup-headers predicate)))
4982 ;; Make sure we don't have to call
4983 ;; gnus-clear-hashtables-for-newsgroup-headers to clear hash
4984 ;; tables for the variable gnus-newsgroup-headers since no new
4985 ;; entry is added to nor deleted from the variable.
4357 )) 4986 ))
4358 4987
4359(defun gnus-string-lessp (a b) 4988(defun gnus-string-lessp (a b)
4360 "Return T if first arg string is less than second in lexicographic order. 4989 "Return T if first arg string is less than second in lexicographic order.
4361If case-fold-search is non-nil, case of letters is ignored." 4990If case-fold-search is non-nil, case of letters is ignored."
4362 (if case-fold-search 4991 (if case-fold-search
4363 (string-lessp (downcase a) (downcase b)) (string-lessp a b))) 4992 (string-lessp (downcase a) (downcase b))
4993 (string-lessp a b)))
4364 4994
4365(defun gnus-date-lessp (date1 date2) 4995(defun gnus-date-lessp (date1 date2)
4366 "Return T if DATE1 is earlyer than DATE2." 4996 "Return T if DATE1 is earlyer than DATE2."
4367 (string-lessp (gnus-comparable-date date1) 4997 (string-lessp (gnus-sortable-date date1)
4368 (gnus-comparable-date date2))) 4998 (gnus-sortable-date date2)))
4369 4999
4370(defun gnus-comparable-date (date) 5000(defun gnus-sortable-date (date)
4371 "Make comparable string by string-lessp from DATE." 5001 "Make sortable string by string-lessp from DATE.
4372 (let ((month '(("JAN" . " 1")("FEB" . " 2")("MAR" . " 3") 5002Timezone package is used."
4373 ("APR" . " 4")("MAY" . " 5")("JUN" . " 6") 5003 (let* ((date (timezone-parse-date date)) ;[Y M D T]
4374 ("JUL" . " 7")("AUG" . " 8")("SEP" . " 9") 5004 (year (string-to-int (aref date 0)))
4375 ("OCT" . "10")("NOV" . "11")("DEC" . "12"))) 5005 (month (string-to-int (aref date 1)))
4376 (date (or date ""))) 5006 (day (string-to-int (aref date 2)))
4377 ;; Can understand the following styles: 5007 (time (aref date 3))) ;HH:MM:SS
4378 ;; (1) 14 Apr 89 03:20:12 GMT 5008 ;; Timezone package is used. But, we don't have to care about
4379 ;; (2) Fri, 17 Mar 89 4:01:33 GMT 5009 ;; the timezone since article's timezones are always GMT.
4380 (if (string-match 5010 (timezone-make-sortable-date year month day time)
4381 "\\([0-9]+\\) \\([^ ,]+\\) \\([0-9]+\\) \\([0-9:]+\\)" date)
4382 (concat
4383 ;; Year
4384 (substring date (match-beginning 3) (match-end 3))
4385 ;; Month
4386 (cdr
4387 (assoc
4388 (upcase (substring date (match-beginning 2) (match-end 2))) month))
4389 ;; Day
4390 (format "%2d" (string-to-int
4391 (substring date
4392 (match-beginning 1) (match-end 1))))
4393 ;; Time
4394 (substring date (match-beginning 4) (match-end 4)))
4395 ;; Cannot understand DATE string.
4396 date
4397 )
4398 )) 5011 ))
4399 5012
5013;;(defun gnus-sortable-date (date)
5014;; "Make sortable string by string-lessp from DATE."
5015;; (let ((month '(("JAN" . " 1")("FEB" . " 2")("MAR" . " 3")
5016;; ("APR" . " 4")("MAY" . " 5")("JUN" . " 6")
5017;; ("JUL" . " 7")("AUG" . " 8")("SEP" . " 9")
5018;; ("OCT" . "10")("NOV" . "11")("DEC" . "12")))
5019;; (date (or date "")))
5020;; ;; Can understand the following styles:
5021;; ;; (1) 14 Apr 89 03:20:12 GMT
5022;; ;; (2) Fri, 17 Mar 89 4:01:33 GMT
5023;; (if (string-match
5024;; "\\([0-9]+\\) \\([^ ,]+\\) \\([0-9]+\\) \\([0-9:]+\\)" date)
5025;; (concat
5026;; ;; Year
5027;; (substring date (match-beginning 3) (match-end 3))
5028;; ;; Month
5029;; (cdr
5030;; (assoc
5031;; (upcase (substring date (match-beginning 2) (match-end 2))) month))
5032;; ;; Day
5033;; (format "%2d" (string-to-int
5034;; (substring date
5035;; (match-beginning 1) (match-end 1))))
5036;; ;; Time
5037;; (substring date (match-beginning 4) (match-end 4)))
5038;; ;; Cannot understand DATE string.
5039;; date
5040;; )
5041;; ))
5042
4400(defun gnus-fetch-field (field) 5043(defun gnus-fetch-field (field)
4401 "Return the value of the header FIELD of current article." 5044 "Return the value of the header FIELD of current article."
4402 (save-excursion 5045 (save-excursion
@@ -4407,32 +5050,32 @@ If case-fold-search is non-nil, case of letters is ignored."
4407 (progn (search-forward "\n\n" nil 'move) (point))) 5050 (progn (search-forward "\n\n" nil 'move) (point)))
4408 (mail-fetch-field field)))) 5051 (mail-fetch-field field))))
4409 5052
4410(fset 'gnus-expunge 'gnus-Subject-delete-marked-with) 5053(fset 'gnus-expunge 'gnus-summary-delete-marked-with)
4411 5054
4412(defun gnus-kill (field regexp &optional command all) 5055(defun gnus-kill (field regexp &optional command all)
4413 "If FIELD of an article matches REGEXP, execute COMMAND. 5056 "If FIELD of an article matches REGEXP, execute COMMAND.
4414Optional third argument COMMAND is default to 5057Optional 1st argument COMMAND is default to
4415 (gnus-Subject-mark-as-read nil \"X\"). 5058 (gnus-summary-mark-as-read nil \"X\").
4416If optional fourth argument ALL is non-nil, articles marked are also applied 5059If optional 2nd argument ALL is non-nil, articles marked are also applied to.
4417to. If FIELD is an empty string (or nil), entire article body is searched for. 5060If FIELD is an empty string (or nil), entire article body is searched for.
4418COMMAND must be a lisp expression or a string representing a key sequence." 5061COMMAND must be a lisp expression or a string representing a key sequence."
4419 ;; We don't want to change current point nor window configuration. 5062 ;; We don't want to change current point nor window configuration.
4420 (save-excursion 5063 (save-excursion
4421 (save-window-excursion 5064 (save-window-excursion
4422 ;; Selected window must be Subject mode buffer to execute 5065 ;; Selected window must be Summary buffer to execute keyboard
4423 ;; keyboard macros correctly. See command_loop_1. 5066 ;; macros correctly. See command_loop_1.
4424 (switch-to-buffer gnus-Subject-buffer 'norecord) 5067 (switch-to-buffer gnus-summary-buffer 'norecord)
4425 (goto-char (point-min)) ;From the beginning. 5068 (goto-char (point-min)) ;From the beginning.
4426 (if (null command) 5069 (if (null command)
4427 (setq command '(gnus-Subject-mark-as-read nil "X"))) 5070 (setq command '(gnus-summary-mark-as-read nil "X")))
4428 (gnus-execute field regexp command nil (not all)) 5071 (gnus-execute field regexp command nil (not all))
4429 ))) 5072 )))
4430 5073
4431(defun gnus-execute (field regexp form &optional backward ignore-marked) 5074(defun gnus-execute (field regexp form &optional backward ignore-marked)
4432 "If FIELD of article header matches REGEXP, execute lisp FORM (or a string). 5075 "If FIELD of article header matches REGEXP, execute lisp FORM (or a string).
4433If FIELD is an empty string (or nil), entire article body is searched for. 5076If FIELD is an empty string (or nil), entire article body is searched for.
4434If optional fifth argument BACKWARD is non-nil, do backward instead. 5077If optional 1st argument BACKWARD is non-nil, do backward instead.
4435If optional sixth argument IGNORE-MARKED is non-nil, articles which are 5078If optional 2nd argument IGNORE-MARKED is non-nil, articles which are
4436marked as read or unread are ignored." 5079marked as read or unread are ignored."
4437 (let ((function nil) 5080 (let ((function nil)
4438 (header nil) 5081 (header nil)
@@ -4454,25 +5097,26 @@ marked as read or unread are ignored."
4454 ;; Starting from the current article. 5097 ;; Starting from the current article.
4455 (or (and ignore-marked 5098 (or (and ignore-marked
4456 ;; Articles marked as read and unread should be ignored. 5099 ;; Articles marked as read and unread should be ignored.
4457 (setq article (gnus-Subject-article-number)) 5100 (setq article (gnus-summary-article-number))
4458 (or (not (memq article gnus-newsgroup-unreads)) ;Marked as read. 5101 (or (not (memq article gnus-newsgroup-unreads)) ;Marked as read.
4459 (memq article gnus-newsgroup-marked) ;Marked as unread. 5102 (memq article gnus-newsgroup-marked) ;Marked as unread.
4460 )) 5103 ))
4461 (gnus-execute-1 function regexp form)) 5104 (gnus-execute-1 function regexp form))
4462 (while (gnus-Subject-search-subject backward ignore-marked nil) 5105 (while (gnus-summary-search-subject backward ignore-marked nil)
4463 (gnus-execute-1 function regexp form)) 5106 (gnus-execute-1 function regexp form))
4464 )) 5107 ))
4465 5108
4466(defun gnus-execute-1 (function regexp form) 5109(defun gnus-execute-1 (function regexp form)
4467 (save-excursion 5110 (save-excursion
4468 ;; The point of Subject mode buffer must be saved during execution. 5111 ;; The point of Summary buffer must be saved during execution.
4469 (let ((article (gnus-Subject-article-number))) 5112 (let ((article (gnus-summary-article-number)))
4470 (if (null article) 5113 (if (null article)
4471 nil ;Nothing to do. 5114 nil ;Nothing to do.
4472 (if function 5115 (if function
4473 ;; Compare with header field. 5116 ;; Compare with header field.
4474 (let ((header (gnus-find-header-by-number 5117 (let (;;(header (gnus-find-header-by-number
4475 gnus-newsgroup-headers article)) 5118 ;; gnus-newsgroup-headers article))
5119 (header (gnus-get-header-by-number article))
4476 (value nil)) 5120 (value nil))
4477 (and header 5121 (and header
4478 (progn 5122 (progn
@@ -4488,12 +5132,12 @@ marked as read or unread are ignored."
4488 (let ((gnus-current-article nil) ;Save article pointer. 5132 (let ((gnus-current-article nil) ;Save article pointer.
4489 (gnus-last-article nil) 5133 (gnus-last-article nil)
4490 (gnus-break-pages nil) ;No need to break pages. 5134 (gnus-break-pages nil) ;No need to break pages.
4491 (gnus-Mark-article-hook nil)) ;Inhibit marking as read. 5135 (gnus-mark-article-hook nil)) ;Inhibit marking as read.
4492 (message "Searching for article: %d..." article) 5136 (message "Searching for article: %d..." article)
4493 (gnus-Article-setup-buffer) 5137 (gnus-article-setup-buffer)
4494 (gnus-Article-prepare article t) 5138 (gnus-article-prepare article t)
4495 (if (save-excursion 5139 (if (save-excursion
4496 (set-buffer gnus-Article-buffer) 5140 (set-buffer gnus-article-buffer)
4497 (goto-char (point-min)) 5141 (goto-char (point-min))
4498 (re-search-forward regexp nil t)) 5142 (re-search-forward regexp nil t))
4499 (if (stringp form) ;Keyboard macro. 5143 (if (stringp form) ;Keyboard macro.
@@ -4617,7 +5261,7 @@ ROT47 will be performed for Japanese text in any case."
4617 (kill-buffer file-buffer)) 5261 (kill-buffer file-buffer))
4618 (error "Output file does not exist"))) 5262 (error "Output file does not exist")))
4619 (set-buffer tmpbuf) 5263 (set-buffer tmpbuf)
4620 (buffer-disable-undo (current-buffer)) 5264 (buffer-flush-undo (current-buffer))
4621 (erase-buffer) 5265 (erase-buffer)
4622 (insert-buffer-substring artbuf) 5266 (insert-buffer-substring artbuf)
4623 (gnus-convert-article-to-rmail) 5267 (gnus-convert-article-to-rmail)
@@ -4655,7 +5299,7 @@ ROT47 will be performed for Japanese text in any case."
4655 (tmpbuf (get-buffer-create " *GNUS-output*"))) 5299 (tmpbuf (get-buffer-create " *GNUS-output*")))
4656 (save-excursion 5300 (save-excursion
4657 (set-buffer tmpbuf) 5301 (set-buffer tmpbuf)
4658 (buffer-disable-undo (current-buffer)) 5302 (buffer-flush-undo (current-buffer))
4659 (erase-buffer) 5303 (erase-buffer)
4660 (insert-buffer-substring artbuf) 5304 (insert-buffer-substring artbuf)
4661 ;; Append newline at end of the buffer as separator, and then 5305 ;; Append newline at end of the buffer as separator, and then
@@ -4705,7 +5349,7 @@ ROT47 will be performed for Japanese text in any case."
4705 "Open network stream to remote NNTP server. 5349 "Open network stream to remote NNTP server.
4706If optional argument CONFIRM is non-nil, ask you host that NNTP server 5350If optional argument CONFIRM is non-nil, ask you host that NNTP server
4707is running even if it is defined. 5351is running even if it is defined.
4708Run gnus-Open-server-hook just before opening news server." 5352Run gnus-open-server-hook just before opening news server."
4709 (if (gnus-server-opened) 5353 (if (gnus-server-opened)
4710 ;; Stream is already opened. 5354 ;; Stream is already opened.
4711 nil 5355 nil
@@ -4722,9 +5366,14 @@ Run gnus-Open-server-hook just before opening news server."
4722 (setq gnus-nntp-server 5366 (setq gnus-nntp-server
4723 (read-string "NNTP server: " gnus-nntp-server)))) 5367 (read-string "NNTP server: " gnus-nntp-server))))
4724 ;; If no server name is given, local host is assumed. 5368 ;; If no server name is given, local host is assumed.
4725 (if (string-equal gnus-nntp-server "") 5369 (if (or (string-equal gnus-nntp-server "")
5370 (string-equal gnus-nntp-server "::")) ;RMS preference.
4726 (setq gnus-nntp-server (system-name))) 5371 (setq gnus-nntp-server (system-name)))
4727 (cond ((string= gnus-nntp-server "::") 5372 ;; gnus-nntp-server must be either (system-name), ':DIRECTORY', or
5373 ;; nntp server name. I mean '::' cannot be a value of
5374 ;; gnus-nntp-server.
5375 (cond ((and (null gnus-nntp-service)
5376 (string-equal gnus-nntp-server (system-name)))
4728 (require 'nnspool) 5377 (require 'nnspool)
4729 (gnus-define-access-method 'nnspool) 5378 (gnus-define-access-method 'nnspool)
4730 (message "Looking up local news spool...")) 5379 (message "Looking up local news spool..."))
@@ -4736,19 +5385,30 @@ Run gnus-Open-server-hook just before opening news server."
4736 (t 5385 (t
4737 (gnus-define-access-method 'nntp) 5386 (gnus-define-access-method 'nntp)
4738 (message "Connecting to NNTP server on %s..." gnus-nntp-server))) 5387 (message "Connecting to NNTP server on %s..." gnus-nntp-server)))
4739 (run-hooks 'gnus-Open-server-hook) 5388 (run-hooks 'gnus-open-server-hook)
4740 (cond ((gnus-open-server gnus-nntp-server gnus-nntp-service)) 5389 (cond ((gnus-server-opened) ;Maybe opened in gnus-open-server-hook.
4741 ((and (stringp (gnus-status-message)) 5390 (message ""))
4742 (> (length (gnus-status-message)) 0)) 5391 ((gnus-open-server gnus-nntp-server gnus-nntp-service)
4743 ;; Show valuable message if available. 5392 (message ""))
4744 (error (gnus-status-message))) 5393 (t
4745 (t (error "Cannot open NNTP server on %s" gnus-nntp-server))) 5394 (error
5395 (gnus-nntp-message
5396 (format "Cannot open NNTP server on %s" gnus-nntp-server)))))
4746 )) 5397 ))
4747 5398
4748;; Dummy functions used only once. Should return nil. 5399;; Dummy functions used only once. Should return nil.
4749(defun gnus-server-opened () nil) 5400(defun gnus-server-opened () nil)
4750(defun gnus-close-server () nil) 5401(defun gnus-close-server () nil)
4751 5402
5403(defun gnus-nntp-message (&optional message)
5404 "Return a message returned from NNTP server.
5405If no message is available and optional MESSAGE is given, return it."
5406 (let ((status (gnus-status-message))
5407 (message (or message "")))
5408 (if (and (stringp status)
5409 (> (length status) 0))
5410 status message)))
5411
4752(defun gnus-define-access-method (method &optional access-methods) 5412(defun gnus-define-access-method (method &optional access-methods)
4753 "Define access functions for the access METHOD. 5413 "Define access functions for the access METHOD.
4754Methods defintion is taken from optional argument ACCESS-METHODS or 5414Methods defintion is taken from optional argument ACCESS-METHODS or
@@ -4759,7 +5419,8 @@ the variable gnus-access-methods."
4759 (error "Unknown access method: %s" method) 5419 (error "Unknown access method: %s" method)
4760 ;; Should not use symbol-function here since overload does not work. 5420 ;; Should not use symbol-function here since overload does not work.
4761 (while bindings 5421 (while bindings
4762 (fset (car (car bindings)) (cdr (car bindings))) 5422 ;; Alist syntax is different from that of 3.14.3.
5423 (fset (car (car bindings)) (car (cdr (car bindings))))
4763 (setq bindings (cdr bindings))) 5424 (setq bindings (cdr bindings)))
4764 ))) 5425 )))
4765 5426
@@ -4767,6 +5428,8 @@ the variable gnus-access-methods."
4767 "Select newsgroup GROUP. 5428 "Select newsgroup GROUP.
4768If optional argument SHOW-ALL is non-nil, all of articles in the group 5429If optional argument SHOW-ALL is non-nil, all of articles in the group
4769are selected." 5430are selected."
5431 ;; Make sure a connection to NNTP server is alive.
5432 (gnus-start-news-server)
4770 (if (gnus-request-group group) 5433 (if (gnus-request-group group)
4771 (let ((articles nil)) 5434 (let ((articles nil))
4772 (setq gnus-newsgroup-name group) 5435 (setq gnus-newsgroup-name group)
@@ -4834,7 +5497,8 @@ are selected."
4834 (setq gnus-newsgroup-marked 5497 (setq gnus-newsgroup-marked
4835 (gnus-intersection (append gnus-newsgroup-unselected 5498 (gnus-intersection (append gnus-newsgroup-unselected
4836 gnus-newsgroup-unreads) 5499 gnus-newsgroup-unreads)
4837 (cdr (assoc group gnus-marked-assoc)))) 5500 (cdr
5501 (gnus-gethash group gnus-marked-hashtb))))
4838 ;; First and last article in this newsgroup. 5502 ;; First and last article in this newsgroup.
4839 (setq gnus-newsgroup-begin 5503 (setq gnus-newsgroup-begin
4840 (if gnus-newsgroup-headers 5504 (if gnus-newsgroup-headers
@@ -4858,11 +5522,66 @@ are selected."
4858 (setq gnus-current-history nil) 5522 (setq gnus-current-history nil)
4859 (setq gnus-have-all-headers nil) 5523 (setq gnus-have-all-headers nil)
4860 (setq gnus-last-article nil) 5524 (setq gnus-last-article nil)
5525 ;; Clear old hash tables for the variable gnus-newsgroup-headers.
5526 (gnus-clear-hashtables-for-newsgroup-headers)
4861 ;; GROUP is successfully selected. 5527 ;; GROUP is successfully selected.
4862 t 5528 t
4863 ) 5529 )
4864 )) 5530 ))
4865 5531
5532;; Hacking for making header search much faster.
5533
5534(defun gnus-get-header-by-number (number)
5535 "Return a header specified by a NUMBER.
5536If the variable gnus-newsgroup-headers is updated, the hashed table
5537gnus-newsgroup-headers-hashtb-by-number must be set to nil to indicate
5538rehash is necessary."
5539 (or gnus-newsgroup-headers-hashtb-by-number
5540 (gnus-make-headers-hashtable-by-number))
5541 (gnus-gethash (int-to-string number)
5542 gnus-newsgroup-headers-hashtb-by-number))
5543
5544(defun gnus-get-header-by-id (id)
5545 "Return a header specified by an ID.
5546If the variable gnus-newsgroup-headers is updated, the hashed table
5547gnus-newsgroup-headers-hashtb-by-id must be set to nil to indicate
5548rehash is necessary."
5549 (or gnus-newsgroup-headers-hashtb-by-id
5550 (gnus-make-headers-hashtable-by-id))
5551 (and (stringp id)
5552 (gnus-gethash id gnus-newsgroup-headers-hashtb-by-id)))
5553
5554(defun gnus-make-headers-hashtable-by-number ()
5555 "Make hashtable for the variable gnus-newsgroup-headers by number."
5556 (let ((header nil)
5557 (headers gnus-newsgroup-headers))
5558 (setq gnus-newsgroup-headers-hashtb-by-number
5559 (gnus-make-hashtable (length headers)))
5560 (while headers
5561 (setq header (car headers))
5562 (gnus-sethash (int-to-string (nntp-header-number header))
5563 header gnus-newsgroup-headers-hashtb-by-number)
5564 (setq headers (cdr headers))
5565 )))
5566
5567(defun gnus-make-headers-hashtable-by-id ()
5568 "Make hashtable for the variable gnus-newsgroup-headers by id."
5569 (let ((header nil)
5570 (headers gnus-newsgroup-headers))
5571 (setq gnus-newsgroup-headers-hashtb-by-id
5572 (gnus-make-hashtable (length headers)))
5573 (while headers
5574 (setq header (car headers))
5575 (gnus-sethash (nntp-header-id header)
5576 header gnus-newsgroup-headers-hashtb-by-id)
5577 (setq headers (cdr headers))
5578 )))
5579
5580(defun gnus-clear-hashtables-for-newsgroup-headers ()
5581 "Clear hash tables created for the variable gnus-newsgroup-headers."
5582 (setq gnus-newsgroup-headers-hashtb-by-id nil)
5583 (setq gnus-newsgroup-headers-hashtb-by-number nil))
5584
4866(defun gnus-more-header-backward () 5585(defun gnus-more-header-backward ()
4867 "Find new header backward." 5586 "Find new header backward."
4868 (let ((first 5587 (let ((first
@@ -4898,6 +5617,8 @@ Optional argument BACKWARD means extend toward backward."
4898 (if backward 5617 (if backward
4899 (cons header gnus-newsgroup-headers) 5618 (cons header gnus-newsgroup-headers)
4900 (append gnus-newsgroup-headers (list header)))) 5619 (append gnus-newsgroup-headers (list header))))
5620 ;; Clear current hash tables for the variable gnus-newsgroup-headers.
5621 (gnus-clear-hashtables-for-newsgroup-headers)
4901 ;; We have to update unreads and unselected, but don't have to 5622 ;; We have to update unreads and unselected, but don't have to
4902 ;; care about gnus-newsgroup-marked. 5623 ;; care about gnus-newsgroup-marked.
4903 (if (memq artnum gnus-newsgroup-unselected) 5624 (if (memq artnum gnus-newsgroup-unselected)
@@ -4942,8 +5663,15 @@ that it was marked as read once."
4942 (set (car variables) nil) 5663 (set (car variables) nil)
4943 (setq variables (cdr variables)))) 5664 (setq variables (cdr variables))))
4944 ;; Clear other internal variables. 5665 ;; Clear other internal variables.
5666 (setq gnus-newsrc-hashtb nil)
5667 (setq gnus-marked-hashtb nil)
5668 (setq gnus-killed-hashtb nil)
4945 (setq gnus-active-hashtb nil) 5669 (setq gnus-active-hashtb nil)
5670 (setq gnus-octive-hashtb nil)
4946 (setq gnus-unread-hashtb nil) 5671 (setq gnus-unread-hashtb nil)
5672 (setq gnus-newsgroup-headers nil)
5673 (setq gnus-newsgroup-headers-hashtb-by-id nil)
5674 (setq gnus-newsgroup-headers-hashtb-by-number nil)
4947 ;; Kill the startup file. 5675 ;; Kill the startup file.
4948 (and gnus-current-startup-file 5676 (and gnus-current-startup-file
4949 (get-file-buffer gnus-current-startup-file) 5677 (get-file-buffer gnus-current-startup-file)
@@ -4959,15 +5687,15 @@ that it was marked as read once."
4959 5687
4960(defun gnus-configure-windows (action) 5688(defun gnus-configure-windows (action)
4961 "Configure GNUS windows according to the next ACTION. 5689 "Configure GNUS windows according to the next ACTION.
4962The ACTION is either a symbol, such as `SelectNewsgroup', or a 5690The ACTION is either a symbol, such as `summary', or a
4963configuration list such as `(1 1 2)'. If ACTION is not a list, 5691configuration list such as `(1 1 2)'. If ACTION is not a list,
4964configuration list is got from the variable `gnus-window-configuration'." 5692configuration list is got from the variable gnus-window-configuration."
4965 (let* ((windows 5693 (let* ((windows
4966 (if (listp action) 5694 (if (listp action)
4967 action (car (cdr (assq action gnus-window-configuration))))) 5695 action (car (cdr (assq action gnus-window-configuration)))))
4968 (grpwin (get-buffer-window gnus-Group-buffer)) 5696 (grpwin (get-buffer-window gnus-group-buffer))
4969 (subwin (get-buffer-window gnus-Subject-buffer)) 5697 (subwin (get-buffer-window gnus-summary-buffer))
4970 (artwin (get-buffer-window gnus-Article-buffer)) 5698 (artwin (get-buffer-window gnus-article-buffer))
4971 (winsum nil) 5699 (winsum nil)
4972 (height nil) 5700 (height nil)
4973 (grpheight 0) 5701 (grpheight 0)
@@ -4994,11 +5722,11 @@ configuration list is got from the variable `gnus-window-configuration'."
4994 (if artwin (window-height artwin) 0))))) 5722 (if artwin (window-height artwin) 0)))))
4995 ;; The Newsgroup buffer exits always. So, use it to extend the 5723 ;; The Newsgroup buffer exits always. So, use it to extend the
4996 ;; Group window so as to get enough window space. 5724 ;; Group window so as to get enough window space.
4997 (switch-to-buffer gnus-Group-buffer 'norecord) 5725 (switch-to-buffer gnus-group-buffer 'norecord)
4998 (and (get-buffer gnus-Subject-buffer) 5726 (and (get-buffer gnus-summary-buffer)
4999 (delete-windows-on gnus-Subject-buffer)) 5727 (delete-windows-on gnus-summary-buffer))
5000 (and (get-buffer gnus-Article-buffer) 5728 (and (get-buffer gnus-article-buffer)
5001 (delete-windows-on gnus-Article-buffer)) 5729 (delete-windows-on gnus-article-buffer))
5002 ;; Compute expected window height. 5730 ;; Compute expected window height.
5003 (setq winsum (apply (function +) windows)) 5731 (setq winsum (apply (function +) windows))
5004 (if (not (zerop (nth 0 windows))) 5732 (if (not (zerop (nth 0 windows)))
@@ -5023,18 +5751,18 @@ configuration list is got from the variable `gnus-window-configuration'."
5023 ;; Then select buffers in each window. 5751 ;; Then select buffers in each window.
5024 (and (not (zerop grpheight)) 5752 (and (not (zerop grpheight))
5025 (progn 5753 (progn
5026 (switch-to-buffer gnus-Group-buffer 'norecord) 5754 (switch-to-buffer gnus-group-buffer 'norecord)
5027 (other-window 1))) 5755 (other-window 1)))
5028 (and (not (zerop subheight)) 5756 (and (not (zerop subheight))
5029 (progn 5757 (progn
5030 (switch-to-buffer gnus-Subject-buffer 'norecord) 5758 (switch-to-buffer gnus-summary-buffer 'norecord)
5031 (other-window 1))) 5759 (other-window 1)))
5032 (and (not (zerop artheight)) 5760 (and (not (zerop artheight))
5033 (progn 5761 (progn
5034 ;; If Article buffer does not exist, it will be created 5762 ;; If Article buffer does not exist, it will be created
5035 ;; and initialized. 5763 ;; and initialized.
5036 (gnus-Article-setup-buffer) 5764 (gnus-article-setup-buffer)
5037 (switch-to-buffer gnus-Article-buffer 'norecord))) 5765 (switch-to-buffer gnus-article-buffer 'norecord)))
5038 ) 5766 )
5039 )) 5767 ))
5040 5768
@@ -5074,18 +5802,19 @@ configuration list is got from the variable `gnus-window-configuration'."
5074 (t 5802 (t
5075 (message "%s; %s" gnus-version nntp-version)))) 5803 (message "%s; %s" gnus-version nntp-version))))
5076 5804
5077(defun gnus-Info-find-node () 5805(defun gnus-info-find-node ()
5078 "Find Info documentation of GNUS." 5806 "Find Info documentation of GNUS."
5079 (interactive) 5807 (interactive)
5080 (require 'info) 5808 (require 'info)
5081 ;; Enlarge info window if needed. 5809 ;; Enlarge info window if needed.
5082 (cond ((eq major-mode 'gnus-Group-mode) 5810 (cond ((eq major-mode 'gnus-group-mode)
5083 (gnus-configure-windows '(1 0 0)) ;Take all windows. 5811 (gnus-configure-windows '(1 0 0)) ;Take all windows.
5084 (pop-to-buffer gnus-Group-buffer)) 5812 (pop-to-buffer gnus-group-buffer))
5085 ((eq major-mode 'gnus-Subject-mode) 5813 ((eq major-mode 'gnus-summary-mode)
5086 (gnus-configure-windows '(0 1 0)) ;Take all windows. 5814 (gnus-configure-windows '(0 1 0)) ;Take all windows.
5087 (pop-to-buffer gnus-Subject-buffer))) 5815 (pop-to-buffer gnus-summary-buffer)))
5088 (Info-goto-node (cdr (assq major-mode gnus-Info-nodes)))) 5816 (let ((Info-directory (expand-file-name gnus-info-directory nil)))
5817 (Info-goto-node (car (cdr (assq major-mode gnus-info-nodes))))))
5089 5818
5090(defun gnus-overload-functions (&optional overloads) 5819(defun gnus-overload-functions (&optional overloads)
5091 "Overload functions specified by optional argument OVERLOADS. 5820 "Overload functions specified by optional argument OVERLOADS.
@@ -5106,6 +5835,7 @@ If nothing is specified, use the variable gnus-overload-functions."
5106(defun gnus-make-threads (newsgroup-headers) 5835(defun gnus-make-threads (newsgroup-headers)
5107 "Make conversation threads tree from NEWSGROUP-HEADERS." 5836 "Make conversation threads tree from NEWSGROUP-HEADERS."
5108 (let ((headers newsgroup-headers) 5837 (let ((headers newsgroup-headers)
5838 (refer nil)
5109 (h nil) 5839 (h nil)
5110 (d nil) 5840 (d nil)
5111 (roots nil) 5841 (roots nil)
@@ -5118,13 +5848,19 @@ If nothing is specified, use the variable gnus-overload-functions."
5118 (if (vectorp h) ;Depends on nntp.el. 5848 (if (vectorp h) ;Depends on nntp.el.
5119 (progn 5849 (progn
5120 ;; Ignore broken references, e.g "<123@a.b.c". 5850 ;; Ignore broken references, e.g "<123@a.b.c".
5121 (setq d (and (nntp-header-references h) 5851 (setq refer (nntp-header-references h))
5122 (string-match "\\(<[^<>]+>\\)[^>]*$" 5852 (setq d (and refer
5123 (nntp-header-references h)) 5853 (string-match "\\(<[^<>]+>\\)[^>]*$" refer)
5124 (gnus-find-header-by-id 5854;; (gnus-find-header-by-id
5125 newsgroup-headers 5855;; newsgroup-headers
5126 (substring (nntp-header-references h) 5856;; (substring refer (match-beginning 1) (match-end 1)))
5127 (match-beginning 1) (match-end 1))))) 5857 ;; In fact if the variable newsgroup-headers
5858 ;; is not 'equal' to the variable
5859 ;; gnus-newsgroup-headers, the following
5860 ;; function call may return bogus value.
5861 (gnus-get-header-by-id
5862 (substring refer (match-beginning 1) (match-end 1)))
5863 ))
5128 ;; Check subject equality. 5864 ;; Check subject equality.
5129 (or gnus-thread-ignore-subject 5865 (or gnus-thread-ignore-subject
5130 (null d) 5866 (null d)
@@ -5206,6 +5942,22 @@ thus showing a page other than the one point was originally in."
5206 (point))) 5942 (point)))
5207 )) 5943 ))
5208 5944
5945;; Create hash table for alist, such as gnus-newsrc-assoc,
5946;; gnus-killed-assoc, and gnus-marked-assoc.
5947
5948(defun gnus-make-hashtable-from-alist (alist &optional hashsize)
5949 "Return hash table for ALIST.
5950Optional argument HASHSIZE specifies the hashtable size.
5951Hash key is a car of alist element, which must be a string."
5952 (let ((hashtb (gnus-make-hashtable (or hashsize (length alist)))))
5953 (while alist
5954 (gnus-sethash (car (car alist)) ;Newsgroup name
5955 (car alist) ;Alist element
5956 hashtb)
5957 (setq alist (cdr alist)))
5958 hashtb
5959 ))
5960
5209(defun gnus-last-element (list) 5961(defun gnus-last-element (list)
5210 "Return last element of LIST." 5962 "Return last element of LIST."
5211 (let ((last nil)) 5963 (let ((last nil))
@@ -5257,7 +6009,7 @@ thus showing a page other than the one point was originally in."
5257;; ("misc" 14 (1 . 10) (12 . 15)) 6009;; ("misc" 14 (1 . 10) (12 . 15))
5258;; ("test" 99 (1 . 99)) ...) 6010;; ("test" 99 (1 . 99)) ...)
5259 6011
5260(defun gnus-setup-news-info (&optional rawfile) 6012(defun gnus-setup-news (&optional rawfile)
5261 "Setup news information. 6013 "Setup news information.
5262If optional argument RAWFILE is non-nil, force to read raw startup file." 6014If optional argument RAWFILE is non-nil, force to read raw startup file."
5263 (let ((init (not (and gnus-newsrc-assoc 6015 (let ((init (not (and gnus-newsrc-assoc
@@ -5270,9 +6022,16 @@ If optional argument RAWFILE is non-nil, force to read raw startup file."
5270 (setq gnus-newsrc-assoc nil 6022 (setq gnus-newsrc-assoc nil
5271 gnus-active-hashtb nil 6023 gnus-active-hashtb nil
5272 gnus-unread-hashtb nil)) 6024 gnus-unread-hashtb nil))
5273 (if init
5274 (gnus-read-newsrc-file rawfile))
5275 (gnus-read-active-file) 6025 (gnus-read-active-file)
6026 ;; Initialize only once.
6027 (if init
6028 (progn
6029 ;; Get distributions only once.
6030 (gnus-read-distributions-file)
6031 ;; newsrc file must be read after reading active file since
6032 ;; its size is used to guess the size of gnus-newsrc-hashtb.
6033 (gnus-read-newsrc-file rawfile)
6034 ))
5276 (gnus-expire-marked-articles) 6035 (gnus-expire-marked-articles)
5277 (gnus-get-unread-articles) 6036 (gnus-get-unread-articles)
5278 ;; Check new newsgroups and subscribe them. 6037 ;; Check new newsgroups and subscribe them.
@@ -5284,17 +6043,11 @@ If optional argument RAWFILE is non-nil, force to read raw startup file."
5284 ))) 6043 )))
5285 )) 6044 ))
5286 6045
5287(defun gnus-subscribe-newsgroup (newsgroup &optional next)
5288 "Subscribe new NEWSGROUP.
5289If optional argument NEXT is non-nil, it is inserted before NEXT."
5290 (gnus-insert-newsgroup (list newsgroup t) next)
5291 (message "Newsgroup %s is subscribed" newsgroup))
5292
5293(defun gnus-add-newsgroup (newsgroup) 6046(defun gnus-add-newsgroup (newsgroup)
5294 "Subscribe new NEWSGROUP safely and put it at top." 6047 "Subscribe new NEWSGROUP safely and put it at top."
5295 (and (null (assoc newsgroup gnus-newsrc-assoc)) ;Really new? 6048 (and (null (gnus-gethash newsgroup gnus-newsrc-hashtb)) ;Really new?
5296 (gnus-gethash newsgroup gnus-active-hashtb) ;Really exist? 6049 (gnus-gethash newsgroup gnus-active-hashtb) ;Really exist?
5297 (gnus-insert-newsgroup (or (assoc newsgroup gnus-killed-assoc) 6050 (gnus-insert-newsgroup (or (gnus-gethash newsgroup gnus-killed-hashtb)
5298 (list newsgroup t)) 6051 (list newsgroup t))
5299 (car (car gnus-newsrc-assoc))))) 6052 (car (car gnus-newsrc-assoc)))))
5300 6053
@@ -5312,8 +6065,8 @@ If optional argument NEXT is non-nil, it is inserted before NEXT."
5312 (not (string-match gnus-newsrc-options-n-no group)) 6065 (not (string-match gnus-newsrc-options-n-no group))
5313 (and gnus-newsrc-options-n-yes 6066 (and gnus-newsrc-options-n-yes
5314 (string-match gnus-newsrc-options-n-yes group))) 6067 (string-match gnus-newsrc-options-n-yes group)))
5315 (null (assoc group gnus-killed-assoc)) ;Ignore killed. 6068 (null (gnus-gethash group gnus-killed-hashtb)) ;Ignore killed.
5316 (null (assoc group gnus-newsrc-assoc)) ;Really new. 6069 (null (gnus-gethash group gnus-newsrc-hashtb)) ;Really new.
5317 ;; Find new newsgroup. 6070 ;; Find new newsgroup.
5318 (setq new-newsgroups 6071 (setq new-newsgroups
5319 (cons group new-newsgroups))) 6072 (cons group new-newsgroups)))
@@ -5325,15 +6078,18 @@ If optional argument NEXT is non-nil, it is inserted before NEXT."
5325 6078
5326(defun gnus-kill-newsgroup (group) 6079(defun gnus-kill-newsgroup (group)
5327 "Kill GROUP from gnus-newsrc-assoc, .newsrc and gnus-unread-hashtb." 6080 "Kill GROUP from gnus-newsrc-assoc, .newsrc and gnus-unread-hashtb."
5328 (let ((info (assoc group gnus-newsrc-assoc))) 6081 (let ((info (gnus-gethash group gnus-newsrc-hashtb)))
5329 (if (null info) 6082 (if (null info)
5330 nil 6083 nil
5331 ;; Delete from gnus-newsrc-assoc 6084 ;; Delete from gnus-newsrc-assoc and gnus-newsrc-hashtb.
5332 (setq gnus-newsrc-assoc (delq info gnus-newsrc-assoc)) 6085 (setq gnus-newsrc-assoc (delq info gnus-newsrc-assoc))
5333 ;; Add to gnus-killed-assoc. 6086 (gnus-sethash group nil gnus-newsrc-hashtb)
6087 ;; Add to gnus-killed-assoc and gnus-killed-hashtb.
5334 (setq gnus-killed-assoc 6088 (setq gnus-killed-assoc
5335 (cons info 6089 (cons info
5336 (delq (assoc group gnus-killed-assoc) gnus-killed-assoc))) 6090 (delq (gnus-gethash group gnus-killed-hashtb)
6091 gnus-killed-assoc)))
6092 (gnus-sethash group info gnus-killed-hashtb)
5337 ;; Clear unread hashtable. 6093 ;; Clear unread hashtable.
5338 ;; Thanks cwitty@csli.Stanford.EDU (Carl Witty). 6094 ;; Thanks cwitty@csli.Stanford.EDU (Carl Witty).
5339 (gnus-sethash group nil gnus-unread-hashtb) 6095 (gnus-sethash group nil gnus-unread-hashtb)
@@ -5353,15 +6109,15 @@ If optional argument NEXT is nil, appended to the last."
5353 (gnus-difference-of-range 6109 (gnus-difference-of-range
5354 (nth 2 (gnus-gethash group gnus-active-hashtb)) (nthcdr 2 info)))) 6110 (nth 2 (gnus-gethash group gnus-active-hashtb)) (nthcdr 2 info))))
5355 ;; Check duplication. 6111 ;; Check duplication.
5356 (if (assoc group gnus-newsrc-assoc) 6112 (if (gnus-gethash group gnus-newsrc-hashtb)
5357 (error "Duplicated: %s" group)) 6113 (error "Duplicated: %s" group))
5358 ;; Insert to gnus-newsrc-assoc. 6114 ;; Insert to gnus-newsrc-assoc and gnus-newsrc-hashtb.
5359 (if (string-equal next (car (car gnus-newsrc-assoc))) 6115 (if (string-equal next (car (car gnus-newsrc-assoc)))
5360 (setq gnus-newsrc-assoc 6116 (setq gnus-newsrc-assoc
5361 (cons info gnus-newsrc-assoc)) 6117 (cons info gnus-newsrc-assoc))
5362 (let ((found nil) 6118 (let ((found nil)
5363 (rest gnus-newsrc-assoc) 6119 (rest (cdr gnus-newsrc-assoc))
5364 (tail (cons nil gnus-newsrc-assoc))) 6120 (tail gnus-newsrc-assoc))
5365 ;; Seach insertion point. 6121 ;; Seach insertion point.
5366 (while (and (not found) rest) 6122 (while (and (not found) rest)
5367 (if (string-equal next (car (car rest))) 6123 (if (string-equal next (car (car rest)))
@@ -5370,13 +6126,17 @@ If optional argument NEXT is nil, appended to the last."
5370 (setq tail (cdr tail)) 6126 (setq tail (cdr tail))
5371 )) 6127 ))
5372 ;; Find it. 6128 ;; Find it.
5373 (setcdr tail nil) 6129 (if (consp tail)
5374 (setq gnus-newsrc-assoc 6130 (setcdr tail (cons info rest))
5375 (append gnus-newsrc-assoc (cons info rest))) 6131 ;; gnus-newsrc-assoc must be nil.
6132 (setq gnus-newsrc-assoc
6133 (append gnus-newsrc-assoc (cons info rest))))
5376 )) 6134 ))
5377 ;; Delete from gnus-killed-assoc. 6135 (gnus-sethash group info gnus-newsrc-hashtb)
6136 ;; Delete from gnus-killed-assoc and gnus-killed-hashtb.
5378 (setq gnus-killed-assoc 6137 (setq gnus-killed-assoc
5379 (delq (assoc group gnus-killed-assoc) gnus-killed-assoc)) 6138 (delq (gnus-gethash group gnus-killed-hashtb) gnus-killed-assoc))
6139 (gnus-sethash group nil gnus-killed-hashtb)
5380 ;; Then insert to .newsrc. 6140 ;; Then insert to .newsrc.
5381 (gnus-update-newsrc-buffer group nil next) 6141 (gnus-update-newsrc-buffer group nil next)
5382 ;; Add to gnus-unread-hashtb. 6142 ;; Add to gnus-unread-hashtb.
@@ -5387,7 +6147,8 @@ If optional argument NEXT is nil, appended to the last."
5387 )) 6147 ))
5388 6148
5389(defun gnus-check-killed-newsgroups () 6149(defun gnus-check-killed-newsgroups ()
5390 "Check consistency between gnus-newsrc-assoc and gnus-killed-assoc." 6150 "Check consistency between gnus-newsrc-assoc and gnus-killed-assoc.
6151gnus-killed-hashtb is also updated."
5391 (let ((group nil) 6152 (let ((group nil)
5392 (new-killed nil) 6153 (new-killed nil)
5393 (old-killed gnus-killed-assoc)) 6154 (old-killed gnus-killed-assoc))
@@ -5397,13 +6158,15 @@ If optional argument NEXT is nil, appended to the last."
5397 (not (string-match gnus-newsrc-options-n-no group)) 6158 (not (string-match gnus-newsrc-options-n-no group))
5398 (and gnus-newsrc-options-n-yes 6159 (and gnus-newsrc-options-n-yes
5399 (string-match gnus-newsrc-options-n-yes group))) 6160 (string-match gnus-newsrc-options-n-yes group)))
5400 (null (assoc group gnus-newsrc-assoc)) ;No duplication. 6161 (null (gnus-gethash group gnus-newsrc-hashtb)) ;No duplication.
5401 ;; Subscribed in options line and not in gnus-newsrc-assoc. 6162 ;; Subscribed in options line and not in gnus-newsrc-assoc.
5402 (setq new-killed 6163 (setq new-killed
5403 (cons (car old-killed) new-killed))) 6164 (cons (car old-killed) new-killed)))
5404 (setq old-killed (cdr old-killed)) 6165 (setq old-killed (cdr old-killed))
5405 ) 6166 )
5406 (setq gnus-killed-assoc (nreverse new-killed)) 6167 (setq gnus-killed-assoc (nreverse new-killed))
6168 (setq gnus-killed-hashtb
6169 (gnus-make-hashtable-from-alist gnus-killed-assoc))
5407 )) 6170 ))
5408 6171
5409(defun gnus-check-bogus-newsgroups (&optional confirm) 6172(defun gnus-check-bogus-newsgroups (&optional confirm)
@@ -5418,7 +6181,7 @@ If optional argument CONFIRM is non-nil, confirm deletion of newsgroups."
5418 (old-marked gnus-marked-assoc) 6181 (old-marked gnus-marked-assoc)
5419 (new-marked nil)) 6182 (new-marked nil))
5420 (message "Checking bogus newsgroups...") 6183 (message "Checking bogus newsgroups...")
5421 ;; Update gnus-newsrc-assoc. 6184 ;; Update gnus-newsrc-assoc and gnus-newsrc-hashtb.
5422 (while old-newsrc 6185 (while old-newsrc
5423 (setq group (car (car old-newsrc))) 6186 (setq group (car (car old-newsrc)))
5424 (if (or (gnus-gethash group gnus-active-hashtb) 6187 (if (or (gnus-gethash group gnus-active-hashtb)
@@ -5432,29 +6195,35 @@ If optional argument CONFIRM is non-nil, confirm deletion of newsgroups."
5432 (setq old-newsrc (cdr old-newsrc)) 6195 (setq old-newsrc (cdr old-newsrc))
5433 ) 6196 )
5434 (setq gnus-newsrc-assoc (nreverse new-newsrc)) 6197 (setq gnus-newsrc-assoc (nreverse new-newsrc))
5435 ;; Update gnus-killed-assoc. 6198 (setq gnus-newsrc-hashtb
6199 (gnus-make-hashtable-from-alist gnus-newsrc-assoc))
6200 ;; Update gnus-killed-assoc and gnus-killed-hashtb.
5436 ;; The killed newsgroups are deleted without any confirmations. 6201 ;; The killed newsgroups are deleted without any confirmations.
5437 (while old-killed 6202 (while old-killed
5438 (setq group (car (car old-killed))) 6203 (setq group (car (car old-killed)))
5439 (and (gnus-gethash group gnus-active-hashtb) 6204 (and (gnus-gethash group gnus-active-hashtb)
5440 (null (assoc group gnus-newsrc-assoc)) 6205 (null (gnus-gethash group gnus-newsrc-hashtb))
5441 ;; Active and really killed newsgroup. 6206 ;; Active and really killed newsgroup.
5442 (setq new-killed (cons (car old-killed) new-killed))) 6207 (setq new-killed (cons (car old-killed) new-killed)))
5443 (setq old-killed (cdr old-killed)) 6208 (setq old-killed (cdr old-killed))
5444 ) 6209 )
5445 (setq gnus-killed-assoc (nreverse new-killed)) 6210 (setq gnus-killed-assoc (nreverse new-killed))
6211 (setq gnus-killed-hashtb
6212 (gnus-make-hashtable-from-alist gnus-killed-assoc))
5446 ;; Remove BOGUS from .newsrc file. 6213 ;; Remove BOGUS from .newsrc file.
5447 (while bogus 6214 (while bogus
5448 (gnus-update-newsrc-buffer (car bogus) 'delete) 6215 (gnus-update-newsrc-buffer (car bogus) 'delete)
5449 (setq bogus (cdr bogus))) 6216 (setq bogus (cdr bogus)))
5450 ;; Update gnus-marked-assoc. 6217 ;; Update gnus-marked-assoc and gnus-marked-hashtb.
5451 (while old-marked 6218 (while old-marked
5452 (setq group (car (car old-marked))) 6219 (setq group (car (car old-marked)))
5453 (if (and (cdr (car old-marked)) ;Non-empty? 6220 (if (and (cdr (car old-marked)) ;Non-empty?
5454 (assoc group gnus-newsrc-assoc)) ;Not bogus? 6221 (gnus-gethash group gnus-newsrc-hashtb)) ;Not bogus?
5455 (setq new-marked (cons (car old-marked) new-marked))) 6222 (setq new-marked (cons (car old-marked) new-marked)))
5456 (setq old-marked (cdr old-marked))) 6223 (setq old-marked (cdr old-marked)))
5457 (setq gnus-marked-assoc new-marked) 6224 (setq gnus-marked-assoc new-marked)
6225 (setq gnus-marked-hashtb
6226 (gnus-make-hashtable-from-alist gnus-marked-assoc))
5458 (message "Checking bogus newsgroups... done") 6227 (message "Checking bogus newsgroups... done")
5459 )) 6228 ))
5460 6229
@@ -5467,7 +6236,8 @@ If optional argument CONFIRM is non-nil, confirm deletion of newsgroups."
5467 (range nil)) 6236 (range nil))
5468 (message "Checking new news...") 6237 (message "Checking new news...")
5469 (or gnus-unread-hashtb 6238 (or gnus-unread-hashtb
5470 (setq gnus-unread-hashtb (gnus-make-hashtable))) 6239 (setq gnus-unread-hashtb
6240 (gnus-make-hashtable (length gnus-active-hashtb))))
5471 (while read 6241 (while read
5472 (setq group-info (car read)) ;About one newsgroup 6242 (setq group-info (car read)) ;About one newsgroup
5473 (setq group-name (car group-info)) 6243 (setq group-name (car group-info))
@@ -5516,6 +6286,8 @@ If optional argument CONFIRM is non-nil, confirm deletion of newsgroups."
5516 (cons (cons (car marked) updated) updated-assoc))) 6286 (cons (cons (car marked) updated) updated-assoc)))
5517 (setq marked-assoc (cdr marked-assoc))) 6287 (setq marked-assoc (cdr marked-assoc)))
5518 (setq gnus-marked-assoc updated-assoc) 6288 (setq gnus-marked-assoc updated-assoc)
6289 (setq gnus-marked-hashtb
6290 (gnus-make-hashtable-from-alist gnus-marked-assoc))
5519 )) 6291 ))
5520 6292
5521(defun gnus-mark-as-read-by-xref 6293(defun gnus-mark-as-read-by-xref
@@ -5542,9 +6314,9 @@ Arguments are GROUP, HEADERS, UNREADS, and optional SUBSCRIBED-ONLY."
5542 (or (string-equal group gname) ;Ignore current newsgroup. 6314 (or (string-equal group gname) ;Ignore current newsgroup.
5543 ;; Ignore unsubscribed newsgroup if requested. 6315 ;; Ignore unsubscribed newsgroup if requested.
5544 (and subscribed-only 6316 (and subscribed-only
5545 (not (nth 1 (assoc gname gnus-newsrc-assoc)))) 6317 (not (nth 1 (gnus-gethash gname gnus-newsrc-hashtb))))
5546 ;; Ignore article marked as unread. 6318 ;; Ignore article marked as unread.
5547 (memq article (cdr (assoc gname gnus-marked-assoc))) 6319 (memq article (cdr (gnus-gethash gname gnus-marked-hashtb)))
5548 (let ((group-xref (assoc gname xref-list))) 6320 (let ((group-xref (assoc gname xref-list)))
5549 (if group-xref 6321 (if group-xref
5550 (if (memq article (cdr group-xref)) 6322 (if (memq article (cdr group-xref))
@@ -5628,40 +6400,49 @@ Arguments are GROUP, HEADERS, UNREADS, and optional SUBSCRIBED-ONLY."
5628 (if (> (car active) 0) 6400 (if (> (car active) 0)
5629 ;; Articles from 1 to N are not active. 6401 ;; Articles from 1 to N are not active.
5630 (setq active (cons 1 (cdr active)))) 6402 (setq active (cons 1 (cdr active))))
5631 (setcdr (cdr (assoc group gnus-newsrc-assoc)) 6403 (setcdr (cdr (gnus-gethash group gnus-newsrc-hashtb))
5632 (gnus-difference-of-range active (nthcdr 2 unread))) 6404 (gnus-difference-of-range active (nthcdr 2 unread)))
5633 ;; Update .newsrc buffer. 6405 ;; Update .newsrc buffer.
5634 (gnus-update-newsrc-buffer group) 6406 (gnus-update-newsrc-buffer group)
5635 ;; Update gnus-marked-assoc. 6407 ;; Update gnus-marked-assoc.
5636 (if (listp marked-list) ;Includes NIL. 6408 (if (listp marked-list) ;Includes NIL.
5637 (let ((marked (assoc group gnus-marked-assoc))) 6409 (let ((marked (gnus-gethash group gnus-marked-hashtb)))
5638 (cond (marked 6410 (cond (marked ;There is an entry.
5639 (setcdr marked marked-list)) 6411 (setcdr marked marked-list))
5640 (marked-list ;Non-NIL. 6412 (marked-list ;Non-NIL.
5641 (setq gnus-marked-assoc 6413 (let ((info (cons group marked-list)))
5642 (cons (cons group marked-list) 6414 ;; hashtb must share the same cons cell.
5643 gnus-marked-assoc))) 6415 (setq gnus-marked-assoc
6416 (cons info gnus-marked-assoc))
6417 (gnus-sethash group info gnus-marked-hashtb)
6418 ))
5644 ))) 6419 )))
5645 ))) 6420 )))
5646 6421
5647(defun gnus-read-active-file () 6422(defun gnus-read-active-file ()
5648 "Get active file from NNTP server." 6423 "Get active file from NNTP server."
6424 ;; Make sure a connection to NNTP server is alive.
6425 (gnus-start-news-server)
5649 (message "Reading active file...") 6426 (message "Reading active file...")
5650 (if (gnus-request-list) ;Get active file from server 6427 (if (gnus-request-list) ;Get active file from server
5651 (save-excursion 6428 (save-excursion
5652 (set-buffer nntp-server-buffer) 6429 (set-buffer nntp-server-buffer)
5653 ;; Save OLD active info.
5654 (setq gnus-octive-hashtb gnus-active-hashtb)
5655 (setq gnus-active-hashtb (gnus-make-hashtable))
5656 (gnus-active-to-gnus-format) 6430 (gnus-active-to-gnus-format)
5657 (message "Reading active file... done")) 6431 (message "Reading active file... done"))
5658 (error "Cannot read active file from NNTP server."))) 6432 (error "Cannot read active file from NNTP server.")))
5659 6433
5660(defun gnus-active-to-gnus-format () 6434(defun gnus-active-to-gnus-format ()
5661 "Convert active file format to internal format." 6435 "Convert active file format to internal format.
6436Lines matching gnus-ignored-newsgroups are ignored."
5662 ;; Delete unnecessary lines. 6437 ;; Delete unnecessary lines.
5663 (goto-char (point-min)) 6438 (goto-char (point-min))
5664 (delete-matching-lines "^to\\..*$") 6439 ;;(delete-matching-lines "^to\\..*$")
6440 (delete-matching-lines gnus-ignored-newsgroups)
6441 ;; Save OLD active info.
6442 (setq gnus-octive-hashtb gnus-active-hashtb)
6443 ;; Make large enough hash table.
6444 (setq gnus-active-hashtb
6445 (gnus-make-hashtable (count-lines (point-min) (point-max))))
5665 ;; Store active file in hashtable. 6446 ;; Store active file in hashtable.
5666 (goto-char (point-min)) 6447 (goto-char (point-min))
5667 (while 6448 (while
@@ -5677,16 +6458,13 @@ Arguments are GROUP, HEADERS, UNREADS, and optional SUBSCRIBED-ONLY."
5677 (buffer-substring (match-beginning 3) (match-end 3))) 6458 (buffer-substring (match-beginning 3) (match-end 3)))
5678 (string-to-int 6459 (string-to-int
5679 (buffer-substring (match-beginning 2) (match-end 2))))) 6460 (buffer-substring (match-beginning 2) (match-end 2)))))
5680 gnus-active-hashtb))) 6461 gnus-active-hashtb)
6462 ))
5681 6463
5682(defun gnus-read-newsrc-file (&optional rawfile) 6464(defun gnus-read-newsrc-file (&optional rawfile)
5683 "Read startup FILE. 6465 "Read startup FILE.
5684If optional argument RAWFILE is non-nil, the raw startup file is read." 6466If optional argument RAWFILE is non-nil, the raw startup file is read."
5685 (setq gnus-current-startup-file 6467 (setq gnus-current-startup-file (gnus-make-newsrc-file gnus-startup-file))
5686 (let* ((file (expand-file-name gnus-startup-file nil))
5687 (real-file (concat file "-" gnus-nntp-server)))
5688 (if (file-exists-p real-file)
5689 real-file file)))
5690 ;; Reset variables which may be included in the quick startup file. 6468 ;; Reset variables which may be included in the quick startup file.
5691 (let ((variables gnus-variable-list)) 6469 (let ((variables gnus-variable-list))
5692 (while variables 6470 (while variables
@@ -5694,35 +6472,35 @@ If optional argument RAWFILE is non-nil, the raw startup file is read."
5694 (setq variables (cdr variables)))) 6472 (setq variables (cdr variables))))
5695 (let* ((newsrc-file gnus-current-startup-file) 6473 (let* ((newsrc-file gnus-current-startup-file)
5696 (quick-file (concat newsrc-file ".el")) 6474 (quick-file (concat newsrc-file ".el"))
5697 (quick-loaded nil) 6475 (quick-loaded nil))
5698 (newsrc-mod (nth 5 (file-attributes newsrc-file)))
5699 (quick-mod (nth 5 (file-attributes quick-file))))
5700 (save-excursion 6476 (save-excursion
5701 ;; Prepare .newsrc buffer. 6477 ;; Prepare .newsrc buffer.
5702 (set-buffer (find-file-noselect newsrc-file)) 6478 (set-buffer (find-file-noselect newsrc-file))
5703 ;; It is not so good idea turning off undo. 6479 ;; It is not so good idea turning off undo.
5704 ;;(buffer-disable-undo (current-buffer)) 6480 ;;(buffer-flush-undo (current-buffer))
5705 ;; Load quick .newsrc to restore gnus-marked-assoc and 6481 ;; Load quick .newsrc to restore gnus-marked-assoc and
5706 ;; gnus-killed-assoc even if gnus-newsrc-assoc is out of date. 6482 ;; gnus-killed-assoc even if gnus-newsrc-assoc is out of date.
5707 (condition-case nil 6483 (condition-case nil
5708 (setq quick-loaded (load quick-file t t t)) 6484 (progn
6485 (setq quick-loaded (load quick-file t t t))
6486 ;; Recreate hashtables.
6487 (setq gnus-killed-hashtb
6488 (gnus-make-hashtable-from-alist gnus-killed-assoc))
6489 (setq gnus-marked-hashtb
6490 (gnus-make-hashtable-from-alist gnus-marked-assoc))
6491 )
5709 (error nil)) 6492 (error nil))
5710 (cond ((and (not rawfile) ;Not forced to read the raw file. 6493 (cond ((and (not rawfile) ;Not forced to read the raw file.
5711 (or (and (fboundp 'file-newer-than-file-p) 6494 ;; .newsrc.el is newer than .newsrc.
5712 (file-newer-than-file-p quick-file newsrc-file)) 6495 (file-newer-than-file-p quick-file newsrc-file)
5713 (and newsrc-mod quick-mod
5714 ;; .newsrc.el is newer than .newsrc.
5715 ;; Some older version does not support function
5716 ;; `file-newer-than-file-p'.
5717 (or (< (car newsrc-mod) (car quick-mod))
5718 (and (= (car newsrc-mod) (car quick-mod))
5719 (<= (nth 1 newsrc-mod) (nth 1 quick-mod))))
5720 ))
5721 quick-loaded 6496 quick-loaded
5722 gnus-newsrc-assoc ;Really loaded? 6497 gnus-newsrc-assoc ;Really loaded?
5723 ) 6498 )
5724 ;; We don't have to read the raw startup file. 6499 ;; We don't have to read the raw startup file.
5725 ) 6500 ;; gnus-newsrc-assoc may be defined in the quick startup file.
6501 ;; So, we have to define the hashtable here.
6502 (setq gnus-newsrc-hashtb
6503 (gnus-make-hashtable-from-alist gnus-newsrc-assoc)))
5726 (t 6504 (t
5727 ;; Since .newsrc file is newer than quick file, read it. 6505 ;; Since .newsrc file is newer than quick file, read it.
5728 (message "Reading %s..." newsrc-file) 6506 (message "Reading %s..." newsrc-file)
@@ -5753,6 +6531,11 @@ If optional argument RAWFILE is non-nil, the raw startup file is read."
5753 (setq gnus-newsrc-options-n-yes nil) 6531 (setq gnus-newsrc-options-n-yes nil)
5754 (setq gnus-newsrc-options-n-no nil) 6532 (setq gnus-newsrc-options-n-no nil)
5755 (setq gnus-newsrc-assoc nil) 6533 (setq gnus-newsrc-assoc nil)
6534 ;; Make large enough hash table.
6535 (setq gnus-newsrc-hashtb
6536 (gnus-make-hashtable
6537 (max (length gnus-active-hashtb)
6538 (count-lines (point-min) (point-max)))))
5756 ;; Save options line to variable. 6539 ;; Save options line to variable.
5757 ;; Lines beginning with white spaces are treated as continuation 6540 ;; Lines beginning with white spaces are treated as continuation
5758 ;; line. Refer man page of newsrc(5). 6541 ;; line. Refer man page of newsrc(5).
@@ -5785,7 +6568,7 @@ If optional argument RAWFILE is non-nil, the raw startup file is read."
5785 (setq newsgroup (buffer-substring (match-beginning 1) (match-end 1))) 6568 (setq newsgroup (buffer-substring (match-beginning 1) (match-end 1)))
5786 ;; Check duplications of newsgroups. 6569 ;; Check duplications of newsgroups.
5787 ;; Note: Checking the duplications takes very long time. 6570 ;; Note: Checking the duplications takes very long time.
5788 (if (assoc newsgroup gnus-newsrc-assoc) 6571 (if (gnus-gethash newsgroup gnus-newsrc-hashtb)
5789 (message "Ignore duplicated newsgroup: %s" newsgroup) 6572 (message "Ignore duplicated newsgroup: %s" newsgroup)
5790 (setq subscribe 6573 (setq subscribe
5791 (string-equal 6574 (string-equal
@@ -5817,9 +6600,10 @@ If optional argument RAWFILE is non-nil, the raw startup file is read."
5817 (setq gnus-newsrc-assoc 6600 (setq gnus-newsrc-assoc
5818 (cons (cons newsgroup (cons subscribe (nreverse read-list))) 6601 (cons (cons newsgroup (cons subscribe (nreverse read-list)))
5819 gnus-newsrc-assoc)) 6602 gnus-newsrc-assoc))
6603 ;; Update gnus-newsrc-hashtb one by one.
6604 (gnus-sethash newsgroup (car gnus-newsrc-assoc) gnus-newsrc-hashtb)
5820 )) 6605 ))
5821 (setq gnus-newsrc-assoc 6606 (setq gnus-newsrc-assoc (nreverse gnus-newsrc-assoc))
5822 (nreverse gnus-newsrc-assoc))
5823 )) 6607 ))
5824 6608
5825(defun gnus-parse-n-options (options) 6609(defun gnus-parse-n-options (options)
@@ -5846,13 +6630,18 @@ If optional argument RAWFILE is non-nil, the raw startup file is read."
5846 (concat (substring newsgroup 0 (match-end 1)) 6630 (concat (substring newsgroup 0 (match-end 1))
5847 ".+" 6631 ".+"
5848 (substring newsgroup (match-beginning 2))))) 6632 (substring newsgroup (match-beginning 2)))))
6633 ;; It is yes or no.
5849 (cond ((string-equal yes-or-no "!") 6634 (cond ((string-equal yes-or-no "!")
5850 (setq no (cons newsgroup no))) 6635 (setq no (cons newsgroup no)))
5851 ((string-equal newsgroup ".+")) ;Ignore `all'. 6636 ((string-equal newsgroup ".+")) ;Ignore `all'.
5852 (t 6637 (t
5853 (setq yes (cons newsgroup yes))) 6638 (setq yes (cons newsgroup yes))))
5854 )) 6639 )
5855 ;; Make a cons of regexps from parsing result. 6640 ;; Make a cons of regexps from parsing result.
6641 ;; We have to append \(\.\|$\) to prevent matching substring of
6642 ;; newsgroup. For example, "jp.net" should not match with
6643 ;; "jp.network".
6644 ;; Fixes for large regexp problems are from yonezu@nak.math.keio.ac.jp.
5856 (cons (if yes 6645 (cons (if yes
5857 (concat "^\\(" 6646 (concat "^\\("
5858 (apply (function concat) 6647 (apply (function concat)
@@ -5861,7 +6650,7 @@ If optional argument RAWFILE is non-nil, the raw startup file is read."
5861 (lambda (newsgroup) 6650 (lambda (newsgroup)
5862 (concat newsgroup "\\|"))) 6651 (concat newsgroup "\\|")))
5863 (cdr yes))) 6652 (cdr yes)))
5864 (car yes) "\\)")) 6653 (car yes) "\\)\\(\\.\\|$\\)"))
5865 (if no 6654 (if no
5866 (concat "^\\(" 6655 (concat "^\\("
5867 (apply (function concat) 6656 (apply (function concat)
@@ -5870,7 +6659,7 @@ If optional argument RAWFILE is non-nil, the raw startup file is read."
5870 (lambda (newsgroup) 6659 (lambda (newsgroup)
5871 (concat newsgroup "\\|"))) 6660 (concat newsgroup "\\|")))
5872 (cdr no))) 6661 (cdr no)))
5873 (car no) "\\)"))) 6662 (car no) "\\)\\(\\.\\|$\\)")))
5874 )) 6663 ))
5875 6664
5876(defun gnus-save-newsrc-file () 6665(defun gnus-save-newsrc-file ()
@@ -5891,11 +6680,11 @@ If optional argument RAWFILE is non-nil, the raw startup file is read."
5891 ;; Make backup file of master newsrc. 6680 ;; Make backup file of master newsrc.
5892 ;; You can stop or change version control of backup file. 6681 ;; You can stop or change version control of backup file.
5893 ;; Suggested by jason@violet.berkeley.edu. 6682 ;; Suggested by jason@violet.berkeley.edu.
5894 (run-hooks 'gnus-Save-newsrc-hook) 6683 (run-hooks 'gnus-save-newsrc-hook)
5895 (save-buffer)) 6684 (save-buffer))
5896 ;; Quickly loadable .newsrc. 6685 ;; Quickly loadable .newsrc.
5897 (set-buffer (get-buffer-create " *GNUS-newsrc*")) 6686 (set-buffer (get-buffer-create " *GNUS-newsrc*"))
5898 (buffer-disable-undo (current-buffer)) 6687 (buffer-flush-undo (current-buffer))
5899 (erase-buffer) 6688 (erase-buffer)
5900 (gnus-gnus-to-quick-newsrc-format) 6689 (gnus-gnus-to-quick-newsrc-format)
5901 (let ((make-backup-files nil) 6690 (let ((make-backup-files nil)
@@ -5909,8 +6698,8 @@ If optional argument RAWFILE is non-nil, the raw startup file is read."
5909 6698
5910(defun gnus-update-newsrc-buffer (group &optional delete next) 6699(defun gnus-update-newsrc-buffer (group &optional delete next)
5911 "Incrementally update .newsrc buffer about GROUP. 6700 "Incrementally update .newsrc buffer about GROUP.
5912If optional second argument DELETE is non-nil, delete the group. 6701If optional 1st argument DELETE is non-nil, delete the group.
5913If optional third argument NEXT is non-nil, inserted before it." 6702If optional 2nd argument NEXT is non-nil, inserted before it."
5914 (save-excursion 6703 (save-excursion
5915 ;; Taking account of the killed startup file. 6704 ;; Taking account of the killed startup file.
5916 ;; Suggested by tale@pawl.rpi.edu. 6705 ;; Suggested by tale@pawl.rpi.edu.
@@ -5920,6 +6709,7 @@ If optional third argument NEXT is non-nil, inserted before it."
5920 ;; Before supporting continuation lines, " newsgroup ! 1-5" was 6709 ;; Before supporting continuation lines, " newsgroup ! 1-5" was
5921 ;; okay, but now it is invalid. It should be "newsgroup! 1-5". 6710 ;; okay, but now it is invalid. It should be "newsgroup! 1-5".
5922 (let ((deleted nil) 6711 (let ((deleted nil)
6712 (case-fold-search nil) ;Should NOT ignore case.
5923 (buffer-read-only nil)) ;May be not modifiable. 6713 (buffer-read-only nil)) ;May be not modifiable.
5924 ;; Delete ALL entries which match for GROUP. 6714 ;; Delete ALL entries which match for GROUP.
5925 (goto-char (point-min)) 6715 (goto-char (point-min))
@@ -5932,7 +6722,7 @@ If optional third argument NEXT is non-nil, inserted before it."
5932 (if delete 6722 (if delete
5933 nil 6723 nil
5934 ;; Insert group entry. 6724 ;; Insert group entry.
5935 (let ((newsrc (assoc group gnus-newsrc-assoc))) 6725 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb)))
5936 (if (null newsrc) 6726 (if (null newsrc)
5937 nil 6727 nil
5938 ;; Find insertion point. 6728 ;; Find insertion point.
@@ -5963,14 +6753,17 @@ If optional third argument NEXT is non-nil, inserted before it."
5963 ))) 6753 )))
5964 6754
5965(defun gnus-gnus-to-quick-newsrc-format () 6755(defun gnus-gnus-to-quick-newsrc-format ()
5966 "Insert GNUS variables such as `gnus-newsrc-assoc' in Lisp format." 6756 "Insert GNUS variables such as gnus-newsrc-assoc in lisp format."
5967 (insert ";; GNUS internal format of .newsrc.\n") 6757 (insert ";; GNUS internal format of .newsrc.\n")
5968 (insert ";; Touch .newsrc instead if you think to remove this file.\n") 6758 (insert ";; Touch .newsrc instead if you think to remove this file.\n")
5969 (let ((variable nil) 6759 (let ((variable nil)
5970 (variables gnus-variable-list) 6760 (variables gnus-variable-list)
5971 ;; Temporary rebind to make changes invisible. 6761 ;; Temporary rebind to make changes
5972 (gnus-killed-assoc gnus-killed-assoc)) 6762 ;; gnus-check-killed-newsgroups in invisible.
5973 ;; Remove duplicated or unsubscribed newsgroups in gnus-killed-assoc. 6763 (gnus-killed-assoc gnus-killed-assoc)
6764 (gnus-killed-hashtb gnus-killed-hashtb))
6765 ;; Remove duplicated or unsubscribed newsgroups in
6766 ;; gnus-killed-assoc (and gnus-killed-hashtb).
5974 (gnus-check-killed-newsgroups) 6767 (gnus-check-killed-newsgroups)
5975 ;; Then, insert lisp expressions. 6768 ;; Then, insert lisp expressions.
5976 (while variables 6769 (while variables
@@ -6083,11 +6876,63 @@ Range of OBJ is expressed as `((beg1 . end1) (beg2 . end2) ...)."
6083 (list (cons 0 0))) 6876 (list (cons 0 0)))
6084 )) 6877 ))
6085 6878
6879(defun gnus-read-distributions-file ()
6880 "Get distributions file from NNTP server (NNTP2 functionality)."
6881 ;; Make sure a connection to NNTP server is alive.
6882 (gnus-start-news-server)
6883 (message "Reading distributions file...")
6884 (setq gnus-distribution-list nil)
6885 (if (gnus-request-list-distributions)
6886 (save-excursion
6887 (set-buffer nntp-server-buffer)
6888 (gnus-distributions-to-gnus-format)
6889 (message "Reading distributions file... done"))
6890 ;; It's not a fatal error.
6891 ;;(error "Cannot read distributions file from NNTP server.")
6892 )
6893 ;; Merge with user supplied default distributions.
6894 (let ((defaults (reverse gnus-local-distributions))
6895 (dist nil))
6896 (while defaults
6897 (setq dist (assoc (car defaults) gnus-distribution-list))
6898 (if dist
6899 (setq gnus-distribution-list
6900 (delq dist gnus-distribution-list)))
6901 (setq gnus-distribution-list
6902 (cons (list (car defaults)) gnus-distribution-list))
6903 (setq defaults (cdr defaults))
6904 )))
6905
6906(defun gnus-distributions-to-gnus-format ()
6907 "Convert distributions file format to internal format."
6908 (setq gnus-distribution-list nil)
6909 (goto-char (point-min))
6910 (while (re-search-forward "^\\([^ \t\n]+\\).*$" nil t)
6911 (setq gnus-distribution-list
6912 (cons (list (buffer-substring (match-beginning 1) (match-end 1)))
6913 gnus-distribution-list)))
6914 (setq gnus-distribution-list
6915 (nreverse gnus-distribution-list)))
6916
6917;; Some older version of GNU Emacs does not support function
6918;; `file-newer-than-file-p'.
6919
6920(or (fboundp 'file-newer-than-file-p)
6921 (defun file-newer-than-file-p (file1 file2)
6922 "Return t if file FILE1 is newer than file FILE2.
6923If FILE1 does not exist, the answer is nil;
6924otherwise, if FILE2 does not exist, the answer is t."
6925 (let ((mod1 (nth 5 (file-attributes file1)))
6926 (mod2 (nth 5 (file-attributes file2))))
6927 (cond ((not (file-exists-p file1)) nil)
6928 ((not (file-exists-p file2)) t)
6929 ((and mod2 mod1)
6930 (or (< (car mod2) (car mod1))
6931 (and (= (car mod2) (car mod1))
6932 (<= (nth 1 mod2) (nth 1 mod1)))))
6933 ))))
6934
6086 6935
6087;;Local variables: 6936;;Local variables:
6088;;eval: (put 'gnus-eval-in-buffer-window 'lisp-indent-function 1) 6937;;eval: (put 'gnus-eval-in-buffer-window 'lisp-indent-hook 1)
6089;;end: 6938;;end:
6090
6091(provide 'gnus)
6092
6093;;; gnus.el ends here
diff --git a/lisp/gnusmail.el b/lisp/gnusmail.el
index b9fe3c0620d..5277acf64e1 100644
--- a/lisp/gnusmail.el
+++ b/lisp/gnusmail.el
@@ -1,6 +1,6 @@
1;;; gnusmail.el --- mail reply commands for GNUS newsreader 1;;; gnusmail.el --- mail reply commands for GNUS newsreader
2 2
3;; Copyright (C) 1990 Free Software Foundation, Inc. 3;; Copyright (C) 1990, 1993 Free Software Foundation, Inc.
4 4
5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6;; Keywords: news 6;; Keywords: news
@@ -46,34 +46,48 @@
46(autoload 'mh-find-path "mh-e") 46(autoload 'mh-find-path "mh-e")
47(autoload 'mh-yank-cur-msg "mh-e") 47(autoload 'mh-yank-cur-msg "mh-e")
48 48
49;;; Mail reply commands of GNUS Subject Mode 49;;; Mail reply commands of GNUS Summary Mode
50 50
51(defun gnus-Subject-mail-reply (yank) 51(defun gnus-summary-reply (yank)
52 "Reply mail to news author. 52 "Reply mail to news author.
53If prefix arg YANK is non-nil, original article is yanked automatically. 53If prefix argument YANK is non-nil, original article is yanked automatically.
54Customize the variable `gnus-mail-reply-method' to use another mailer." 54Customize the variable gnus-mail-reply-method to use another mailer."
55 (interactive "P") 55 (interactive "P")
56 (gnus-Subject-select-article) 56 ;; Bug fix by jbw@bigbird.bu.edu (Joe Wells)
57 (switch-to-buffer gnus-Article-buffer) 57 ;; Stripping headers should be specified with mail-yank-ignored-headers.
58 (gnus-summary-select-article t t)
59 (switch-to-buffer gnus-article-buffer)
58 (widen) 60 (widen)
59 (delete-other-windows) 61 (delete-other-windows)
60 (bury-buffer gnus-Article-buffer) 62 (bury-buffer gnus-article-buffer)
61 (funcall gnus-mail-reply-method yank)) 63 (funcall gnus-mail-reply-method yank))
62 64
63(defun gnus-Subject-mail-reply-with-original () 65(defun gnus-summary-reply-with-original ()
64 "Reply mail to news author with original article." 66 "Reply mail to news author with original article.
67Customize the variable gnus-mail-reply-method to use another mailer."
65 (interactive) 68 (interactive)
66 (gnus-Subject-mail-reply t)) 69 (gnus-summary-reply t))
67 70
68(defun gnus-Subject-mail-other-window () 71(defun gnus-summary-mail-forward ()
72 "Forward the current message to another user.
73Customize the variable gnus-mail-forward-method to use another mailer."
74 (interactive)
75 (gnus-summary-select-article)
76 (switch-to-buffer gnus-article-buffer)
77 (widen)
78 (delete-other-windows)
79 (bury-buffer gnus-article-buffer)
80 (funcall gnus-mail-forward-method))
81
82(defun gnus-summary-mail-other-window ()
69 "Compose mail in other window. 83 "Compose mail in other window.
70Customize the variable `gnus-mail-other-window-method' to use another mailer." 84Customize the variable gnus-mail-other-window-method to use another mailer."
71 (interactive) 85 (interactive)
72 (gnus-Subject-select-article) 86 (gnus-summary-select-article)
73 (switch-to-buffer gnus-Article-buffer) 87 (switch-to-buffer gnus-article-buffer)
74 (widen) 88 (widen)
75 (delete-other-windows) 89 (delete-other-windows)
76 (bury-buffer gnus-Article-buffer) 90 (bury-buffer gnus-article-buffer)
77 (funcall gnus-mail-other-window-method)) 91 (funcall gnus-mail-other-window-method))
78 92
79 93
@@ -91,6 +105,31 @@ Optional argument YANK means yank original article."
91 (goto-char last) 105 (goto-char last)
92 ))) 106 )))
93 107
108(defun gnus-mail-forward-using-mail ()
109 "Forward the current message to another user using mail."
110 ;; This is almost a carbon copy of rmail-forward in rmail.el.
111 (let ((forward-buffer (current-buffer))
112 (subject
113 (concat "[" gnus-newsgroup-name "] "
114 ;;(mail-strip-quoted-names (gnus-fetch-field "From")) ": "
115 (or (gnus-fetch-field "Subject") ""))))
116 ;; If only one window, use it for the mail buffer.
117 ;; Otherwise, use another window for the mail buffer
118 ;; so that the Rmail buffer remains visible
119 ;; and sending the mail will get back to it.
120 (if (if (one-window-p t)
121 (mail nil nil subject)
122 (mail-other-window nil nil subject))
123 (save-excursion
124 (goto-char (point-max))
125 (insert "------- Start of forwarded message -------\n")
126 (insert-buffer forward-buffer)
127 (goto-char (point-max))
128 (insert "------- End of forwarded message -------\n")
129 ;; You have a chance to arrange the message.
130 (run-hooks 'gnus-mail-forward-hook)
131 ))))
132
94(defun gnus-mail-other-window-using-mail () 133(defun gnus-mail-other-window-using-mail ()
95 "Compose mail other window using mail." 134 "Compose mail other window using mail."
96 (news-mail-other-window) 135 (news-mail-other-window)
@@ -107,11 +146,11 @@ Optional argument YANK means yank original article."
107(defun gnus-mail-reply-using-mhe (&optional yank) 146(defun gnus-mail-reply-using-mhe (&optional yank)
108 "Compose reply mail using mh-e. 147 "Compose reply mail using mh-e.
109Optional argument YANK means yank original article. 148Optional argument YANK means yank original article.
110The command \\[mh-yank-cur-msg] yanks the original message into current buffer." 149The command \\[mh-yank-cur-msg] yank the original message into current buffer."
111 ;; First of all, prepare mhe mail buffer. 150 ;; First of all, prepare mhe mail buffer.
112 (let (from cc subject date to reply-to (buffer (current-buffer))) 151 (let (from cc subject date to reply-to (buffer (current-buffer)))
113 (save-restriction 152 (save-restriction
114 (gnus-Article-show-all-headers) ;I don't think this is really needed. 153 (gnus-article-show-all-headers) ;I don't think this is really needed.
115 (setq from (gnus-fetch-field "from") 154 (setq from (gnus-fetch-field "from")
116 subject (let ((subject (gnus-fetch-field "subject"))) 155 subject (let ((subject (gnus-fetch-field "subject")))
117 (if (and subject 156 (if (and subject
@@ -140,12 +179,39 @@ The command \\[mh-yank-cur-msg] yanks the original message into current buffer."
140 (goto-char last) 179 (goto-char last)
141 ))) 180 )))
142 181
182;; gnus-mail-forward-using-mhe is contributed by Jun-ichiro Itoh
183;; <itojun@ingram.mt.cs.keio.ac.jp>
184
185(defun gnus-mail-forward-using-mhe ()
186 "Forward the current message to another user using mh-e."
187 ;; First of all, prepare mhe mail buffer.
188 (let ((to (read-string "To: "))
189 (cc (read-string "Cc: "))
190 (buffer (current-buffer))
191 subject)
192 ;;(gnus-article-show-all-headers)
193 (setq subject
194 (concat "[" gnus-newsgroup-name "] "
195 ;;(mail-strip-quoted-names (gnus-fetch-field "From")) ": "
196 (or (gnus-fetch-field "subject") "")))
197 (setq mh-show-buffer buffer)
198 (mh-find-path)
199 (mh-send to (or cc "") subject)
200 (save-excursion
201 (goto-char (point-max))
202 (insert "\n------- Forwarded Message\n\n")
203 (insert-buffer buffer)
204 (goto-char (point-max))
205 (insert "\n------- End of Forwarded Message\n")
206 (setq mh-sent-from-folder buffer)
207 (setq mh-sent-from-msg 1))))
208
143(defun gnus-mail-other-window-using-mhe () 209(defun gnus-mail-other-window-using-mhe ()
144 "Compose mail other window using MH-E Mail." 210 "Compose mail other window using mh-e."
145 (let ((to (read-string "To: ")) 211 (let ((to (read-string "To: "))
146 (cc (read-string "Cc: ")) 212 (cc (read-string "Cc: "))
147 (subject (read-string "Subject: " (gnus-fetch-field "subject")))) 213 (subject (read-string "Subject: " (gnus-fetch-field "subject"))))
148 (gnus-Article-show-all-headers) ;I don't think this is really needed. 214 (gnus-article-show-all-headers) ;I don't think this is really needed.
149 (setq mh-show-buffer (current-buffer)) 215 (setq mh-show-buffer (current-buffer))
150 (mh-find-path) 216 (mh-find-path)
151 (mh-send-other-window to cc subject) 217 (mh-send-other-window to cc subject)
diff --git a/lisp/gnusmisc.el b/lisp/gnusmisc.el
index e939036ee5b..49768dd617e 100644
--- a/lisp/gnusmisc.el
+++ b/lisp/gnusmisc.el
@@ -1,6 +1,6 @@
1;;; gnusmisc.el --- miscellaneous commands for GNUS newsreader 1;;; gnusmisc.el --- miscellaneous commands for GNUS newsreader
2 2
3;; Copyright (C) 1989, 1990 Free Software Foundation, Inc. 3;; Copyright (C) 1989, 1990, 1993 Free Software Foundation, Inc.
4 4
5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6;; Keywords: news 6;; Keywords: news
@@ -32,48 +32,58 @@
32;; Some ideas are due to roland@wheaties.ai.mit.edu (Roland McGrath). 32;; Some ideas are due to roland@wheaties.ai.mit.edu (Roland McGrath).
33;; I'd like to thank him very much. 33;; I'd like to thank him very much.
34 34
35(defvar gnus-Browse-killed-mode-hook nil 35(defvar gnus-browse-killed-mode-hook nil
36 "*A hook for GNUS Browse-Killed Mode.") 36 "*A hook for GNUS Browse-Killed Mode.")
37 37
38(defvar gnus-Browse-killed-buffer "*Killed Newsgroup*") 38(defvar gnus-browse-killed-buffer "*Killed Newsgroup*")
39(defvar gnus-Browse-killed-mode-map nil) 39(defvar gnus-browse-killed-mode-map nil)
40(defvar gnus-winconf-browse-killed nil) 40(defvar gnus-winconf-browse-killed nil)
41 41
42(put 'gnus-Browse-killed-mode 'mode-class 'special) 42(autoload 'timezone-make-date-arpa-standard "timezone")
43
44(put 'gnus-browse-killed-mode 'mode-class 'special)
45
46
47;;;
48;;; GNUS Browse-Killed Mode
49;;;
50
51;; Some ideas are due to roland@wheaties.ai.mit.edu (Roland McGrath).
52;; I'd like to thank him very much.
43 53
44;; Make the buffer to be managed by GNUS. 54;; Make the buffer to be managed by GNUS.
45 55
46(or (memq gnus-Browse-killed-buffer gnus-buffer-list) 56(or (memq gnus-browse-killed-buffer gnus-buffer-list)
47 (setq gnus-buffer-list 57 (setq gnus-buffer-list
48 (cons gnus-Browse-killed-buffer gnus-buffer-list))) 58 (cons gnus-browse-killed-buffer gnus-buffer-list)))
49 59
50(if gnus-Browse-killed-mode-map 60(if gnus-browse-killed-mode-map
51 nil 61 nil
52 (setq gnus-Browse-killed-mode-map (make-keymap)) 62 (setq gnus-browse-killed-mode-map (make-keymap))
53 (suppress-keymap gnus-Browse-killed-mode-map t) 63 (suppress-keymap gnus-browse-killed-mode-map t)
54 (define-key gnus-Browse-killed-mode-map " " 'gnus-Group-next-group) 64 (define-key gnus-browse-killed-mode-map " " 'gnus-group-next-group)
55 (define-key gnus-Browse-killed-mode-map "\177" 'gnus-Group-prev-group) 65 (define-key gnus-browse-killed-mode-map "\177" 'gnus-group-prev-group)
56 (define-key gnus-Browse-killed-mode-map "\C-n" 'gnus-Group-next-group) 66 (define-key gnus-browse-killed-mode-map "\C-n" 'gnus-group-next-group)
57 (define-key gnus-Browse-killed-mode-map "\C-p" 'gnus-Group-prev-group) 67 (define-key gnus-browse-killed-mode-map "\C-p" 'gnus-group-prev-group)
58 (define-key gnus-Browse-killed-mode-map "n" 'gnus-Group-next-group) 68 (define-key gnus-browse-killed-mode-map "n" 'gnus-group-next-group)
59 (define-key gnus-Browse-killed-mode-map "p" 'gnus-Group-prev-group) 69 (define-key gnus-browse-killed-mode-map "p" 'gnus-group-prev-group)
60 (define-key gnus-Browse-killed-mode-map "y" 'gnus-Browse-killed-yank) 70 (define-key gnus-browse-killed-mode-map "y" 'gnus-browse-killed-yank)
61 (define-key gnus-Browse-killed-mode-map "\C-y" 'gnus-Browse-killed-yank) 71 (define-key gnus-browse-killed-mode-map "\C-y" 'gnus-browse-killed-yank)
62 (define-key gnus-Browse-killed-mode-map "l" 'gnus-Browse-killed-groups) 72 (define-key gnus-browse-killed-mode-map "l" 'gnus-list-killed-groups)
63 (define-key gnus-Browse-killed-mode-map "q" 'gnus-Browse-killed-exit) 73 (define-key gnus-browse-killed-mode-map "q" 'gnus-browse-killed-exit)
64 (define-key gnus-Browse-killed-mode-map "\C-c\C-c" 'gnus-Browse-killed-exit) 74 (define-key gnus-browse-killed-mode-map "\C-c\C-c" 'gnus-browse-killed-exit)
65 (define-key gnus-Browse-killed-mode-map "\C-c\C-i" 'gnus-Info-find-node)) 75 (define-key gnus-browse-killed-mode-map "\C-c\C-i" 'gnus-info-find-node))
66 76
67(defun gnus-Browse-killed-mode () 77(defun gnus-browse-killed-mode ()
68 "Major mode for browsing the killed newsgroups. 78 "Major mode for browsing the killed newsgroups.
69All normal editing commands are turned off. 79All normal editing commands are turned off.
70Instead, these commands are available: 80Instead, these commands are available:
71\\{gnus-Browse-killed-mode-map} 81\\{gnus-browse-killed-mode-map}
72 82
73The killed newsgroups are saved in the quick startup file \".newsrc.el\" 83The killed newsgroups are saved in the quick startup file (.newsrc.el)
74unless disabled inthe options line of the startup file \".newsrc\". 84unless it against the options line in the startup file (.newsrc).
75 85
76Entry to this mode calls `gnus-Browse-killed-mode-hook' with no arguments 86Entry to this mode calls gnus-browse-killed-mode-hook with no arguments,
77if that value is non-nil." 87if that value is non-nil."
78 (interactive) 88 (interactive)
79 (kill-all-local-variables) 89 (kill-all-local-variables)
@@ -86,65 +96,66 @@ if that value is non-nil."
86 (t 96 (t
87 (setq mode-line-format 97 (setq mode-line-format
88 "--- GNUS: Killed Newsgroups %[(%m)%]----%3p-%-"))) 98 "--- GNUS: Killed Newsgroups %[(%m)%]----%3p-%-")))
89 (setq major-mode 'gnus-Browse-killed-mode) 99 (setq major-mode 'gnus-browse-killed-mode)
90 (setq mode-name "Browse-Killed") 100 (setq mode-name "Browse-Killed")
91 (setq mode-line-buffer-identification "GNUS: Killed Newsgroups") 101 (setq mode-line-buffer-identification "GNUS: Killed Newsgroups")
92 (use-local-map gnus-Browse-killed-mode-map) 102 (use-local-map gnus-browse-killed-mode-map)
93 (buffer-flush-undo (current-buffer)) 103 (buffer-flush-undo (current-buffer))
94 (setq buffer-read-only t) ;Disable modification 104 (setq buffer-read-only t) ;Disable modification
95 (run-hooks 'gnus-Browse-killed-mode-hook)) 105 (run-hooks 'gnus-browse-killed-mode-hook))
96 106
97(defun gnus-Browse-killed-groups () 107(defun gnus-list-killed-groups ()
98 "Browse the killed newsgroups. 108 "List the killed newsgroups.
99\\<gnus-Browse-killed-mode-map>\\[gnus-Browse-killed-yank] yanks the newsgroup on the current line into the Newsgroups buffer." 109The keys y and C-y yank the newsgroup on the current line into the
110Newsgroups buffer."
100 (interactive) 111 (interactive)
101 (or gnus-killed-assoc 112 (or gnus-killed-assoc
102 (error "No killed newsgroups")) 113 (error "No killed newsgroups"))
103 ;; Save current window configuration if this is first invocation.. 114 ;; Save current window configuration if this is first invocation..
104 (or (get-buffer-window gnus-Browse-killed-buffer) 115 (or (get-buffer-window gnus-browse-killed-buffer)
105 (setq gnus-winconf-browse-killed 116 (setq gnus-winconf-browse-killed
106 (current-window-configuration))) 117 (current-window-configuration)))
107 ;; Prepare browsing buffer. 118 ;; Prepare browsing buffer.
108 (pop-to-buffer (get-buffer-create gnus-Browse-killed-buffer)) 119 (pop-to-buffer (get-buffer-create gnus-browse-killed-buffer))
109 (gnus-Browse-killed-mode) 120 (gnus-browse-killed-mode)
110 (let ((buffer-read-only nil) 121 (let ((buffer-read-only nil)
111 (killed-assoc gnus-killed-assoc)) 122 (killed-assoc gnus-killed-assoc))
112 (erase-buffer) 123 (erase-buffer)
113 (while killed-assoc 124 (while killed-assoc
114 (insert (gnus-Group-prepare-line (car killed-assoc))) 125 (insert (gnus-group-prepare-line (car killed-assoc)))
115 (setq killed-assoc (cdr killed-assoc))) 126 (setq killed-assoc (cdr killed-assoc)))
116 (goto-char (point-min)) 127 (goto-char (point-min))
117 )) 128 ))
118 129
119(defun gnus-Browse-killed-yank () 130(defun gnus-browse-killed-yank ()
120 "Yank current newsgroup to Newsgroup buffer." 131 "Yank current newsgroup to Newsgroup buffer."
121 (interactive) 132 (interactive)
122 (let ((group (gnus-Group-group-name))) 133 (let ((group (gnus-group-group-name)))
123 (if group 134 (if group
124 (let* ((buffer-read-only nil) 135 (let* ((buffer-read-only nil)
125 (killed (assoc group gnus-killed-assoc))) 136 (killed (gnus-gethash group gnus-killed-hashtb)))
126 (pop-to-buffer gnus-Group-buffer) ;Needed to adjust point. 137 (pop-to-buffer gnus-group-buffer) ;Needed to adjust point.
127 (if killed 138 (if killed
128 (gnus-Group-insert-group killed)) 139 (gnus-group-insert-group killed))
129 (pop-to-buffer gnus-Browse-killed-buffer) 140 (pop-to-buffer gnus-browse-killed-buffer)
130 (beginning-of-line) 141 (beginning-of-line)
131 (delete-region (point) 142 (delete-region (point)
132 (progn (forward-line 1) (point))) 143 (progn (forward-line 1) (point)))
133 ))) 144 )))
134 (gnus-Browse-killed-check-buffer)) 145 (gnus-browse-killed-check-buffer))
135 146
136(defun gnus-Browse-killed-check-buffer () 147(defun gnus-browse-killed-check-buffer ()
137 "Exit if the buffer is empty by deleting the window and killing the buffer." 148 "Exit if the buffer is empty by deleting the window and killing the buffer."
138 (and (null gnus-killed-assoc) 149 (and (null gnus-killed-assoc)
139 (get-buffer gnus-Browse-killed-buffer) 150 (get-buffer gnus-browse-killed-buffer)
140 (gnus-Browse-killed-exit))) 151 (gnus-browse-killed-exit)))
141 152
142(defun gnus-Browse-killed-exit () 153(defun gnus-browse-killed-exit ()
143 "Exit this mode by deleting the window and killing the buffer." 154 "Exit this mode by deleting the window and killing the buffer."
144 (interactive) 155 (interactive)
145 (and (get-buffer-window gnus-Browse-killed-buffer) 156 (and (get-buffer-window gnus-browse-killed-buffer)
146 (delete-window (get-buffer-window gnus-Browse-killed-buffer))) 157 (delete-window (get-buffer-window gnus-browse-killed-buffer)))
147 (kill-buffer gnus-Browse-killed-buffer) 158 (kill-buffer gnus-browse-killed-buffer)
148 ;; Restore previous window configuration if available. 159 ;; Restore previous window configuration if available.
149 (and gnus-winconf-browse-killed 160 (and gnus-winconf-browse-killed
150 (set-window-configuration gnus-winconf-browse-killed)) 161 (set-window-configuration gnus-winconf-browse-killed))
@@ -155,14 +166,53 @@ if that value is non-nil."
155;;; kill/yank newsgroup commands of GNUS Group Mode 166;;; kill/yank newsgroup commands of GNUS Group Mode
156;;; 167;;;
157 168
158(defun gnus-Group-kill-group (n) 169(defun gnus-group-transpose-groups (arg)
170 "Exchange current newsgroup and previous newsgroup.
171With argument ARG, takes previous newsgroup and moves it past ARG newsgroup."
172 (interactive "p")
173 ;; BUG: last newsgroup and the last but one cannot be transposed
174 ;; since gnus-group-search-forward does not move forward beyond the
175 ;; last. If we instead use forward-line, no problem, but I don't
176 ;; want to use it for later extension.
177 (while (> arg 0)
178 (gnus-group-search-forward t t)
179 (gnus-group-kill-group 1)
180 (gnus-group-search-forward nil t)
181 (gnus-group-yank-group)
182 (gnus-group-search-forward nil t)
183 (setq arg (1- arg))
184 ))
185
186(defun gnus-group-kill-region (begin end)
187 "Kill newsgroups in current region (excluding current point).
188The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
189 (interactive "r")
190 (let ((lines
191 ;; Exclude a line where current point is on.
192 (1-
193 ;; Count lines.
194 (save-excursion
195 (count-lines
196 (progn
197 (goto-char begin)
198 (beginning-of-line)
199 (point))
200 (progn
201 (goto-char end)
202 (end-of-line)
203 (point)))))))
204 (goto-char begin)
205 (beginning-of-line) ;Important when LINES < 1
206 (gnus-group-kill-group lines)))
207
208(defun gnus-group-kill-group (n)
159 "Kill newsgroup on current line, repeated prefix argument N times. 209 "Kill newsgroup on current line, repeated prefix argument N times.
160The killed newsgroups can be yanked by using \\[gnus-Group-yank-group]." 210The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
161 (interactive "p") 211 (interactive "p")
162 (let ((buffer-read-only nil) 212 (let ((buffer-read-only nil)
163 (group nil)) 213 (group nil))
164 (while (> n 0) 214 (while (> n 0)
165 (setq group (gnus-Group-group-name)) 215 (setq group (gnus-group-group-name))
166 (or group 216 (or group
167 (signal 'end-of-buffer nil)) 217 (signal 'end-of-buffer nil))
168 (beginning-of-line) 218 (beginning-of-line)
@@ -171,50 +221,74 @@ The killed newsgroups can be yanked by using \\[gnus-Group-yank-group]."
171 (gnus-kill-newsgroup group) 221 (gnus-kill-newsgroup group)
172 (setq n (1- n)) 222 (setq n (1- n))
173 ;; Add to killed newsgroups in the buffer if exists. 223 ;; Add to killed newsgroups in the buffer if exists.
174 (if (get-buffer gnus-Browse-killed-buffer) 224 (if (get-buffer gnus-browse-killed-buffer)
175 (save-excursion 225 (save-excursion
176 (set-buffer gnus-Browse-killed-buffer) 226 (set-buffer gnus-browse-killed-buffer)
177 (let ((buffer-read-only nil)) 227 (let ((buffer-read-only nil))
178 (goto-char (point-min)) 228 (goto-char (point-min))
179 (insert (gnus-Group-prepare-line (car gnus-killed-assoc))) 229 (insert (gnus-group-prepare-line (car gnus-killed-assoc)))
180 ))) 230 )))
181 ) 231 )
182 (search-forward ":" nil t) 232 (search-forward ":" nil t)
183 )) 233 ))
184 234
185(defun gnus-Group-yank-group () 235(defun gnus-group-yank-group ()
186 "Yank the last newsgroup killed with \\[gnus-Group-kill-group], 236 "Yank the last newsgroup killed with \\[gnus-group-kill-group],
187inserting it before the newsgroup on the line containging point." 237inserting it before the newsgroup on the line containging point."
188 (interactive) 238 (interactive)
189 (gnus-Group-insert-group (car gnus-killed-assoc)) 239 (gnus-group-insert-group (car gnus-killed-assoc))
190 ;; Remove killed newsgroups from the buffer if exists. 240 ;; Remove killed newsgroups from the buffer if exists.
191 (if (get-buffer gnus-Browse-killed-buffer) 241 (if (get-buffer gnus-browse-killed-buffer)
192 (save-excursion 242 (save-excursion
193 (set-buffer gnus-Browse-killed-buffer) 243 (set-buffer gnus-browse-killed-buffer)
194 (let ((buffer-read-only nil)) 244 (let ((buffer-read-only nil))
195 (goto-char (point-min)) 245 (goto-char (point-min))
196 (delete-region (point-min) 246 (delete-region (point-min)
197 (progn (forward-line 1) (point))) 247 (progn (forward-line 1) (point)))
198 ))) 248 )))
199 (gnus-Browse-killed-check-buffer)) 249 (gnus-browse-killed-check-buffer))
200 250
201(defun gnus-Group-insert-group (info) 251(defun gnus-group-insert-group (info)
202 "Insert newsgroup at current line using `gnus-newsrc-assoc' INFO." 252 "Insert newsgroup at current line using gnus-newsrc-assoc INFO."
203 (if (null gnus-killed-assoc) 253 (if (null gnus-killed-assoc)
204 (error "No killed newsgroups")) 254 (error "No killed newsgroups"))
205 (if (not gnus-have-all-newsgroups) 255 ;; Huuum. It this right?
206 (error 256 ;;(if (not gnus-have-all-newsgroups)
207 (substitute-command-keys 257 ;; (error
208 "Not all newsgroups are displayed. Type \\[gnus-Group-list-all-groups] to display all newsgroups."))) 258 ;; (substitute-command-keys
259 ;; "Not all newsgroups are displayed. Type \\[gnus-group-list-all-groups] to display all newsgroups.")))
209 (let ((buffer-read-only nil) 260 (let ((buffer-read-only nil)
210 (group (gnus-Group-group-name))) 261 (group (gnus-group-group-name)))
211 (gnus-insert-newsgroup info group) 262 (gnus-insert-newsgroup info group)
212 (beginning-of-line) 263 (beginning-of-line)
213 (insert (gnus-Group-prepare-line info)) 264 (insert (gnus-group-prepare-line info))
214 (forward-line -1) 265 (forward-line -1)
215 (search-forward ":" nil t) 266 (search-forward ":" nil t)
216 )) 267 ))
217 268
269
270;;; Rewrite Date: field in GMT to local
271
272(defun gnus-gmt-to-local ()
273 "Rewrite Date: field described in GMT to local in current buffer.
274The variable gnus-local-timezone is used for local time zone.
275Intended to be used with gnus-article-prepare-hook."
276 (save-excursion
277 (save-restriction
278 (widen)
279 (goto-char (point-min))
280 (narrow-to-region (point-min)
281 (progn (search-forward "\n\n" nil 'move) (point)))
282 (goto-char (point-min))
283 (if (re-search-forward "^Date:[ \t]\\(.*\\)$" nil t)
284 (let ((buffer-read-only nil)
285 (date (buffer-substring (match-beginning 1) (match-end 1))))
286 (delete-region (match-beginning 1) (match-end 1))
287 (insert
288 (timezone-make-date-arpa-standard date nil gnus-local-timezone))
289 ))
290 )))
291
218(provide 'gnusmisc) 292(provide 'gnusmisc)
219 293
220;;; gnusmisc.el ends here 294;;; gnusmisc.el ends here
diff --git a/lisp/gnuspost.el b/lisp/gnuspost.el
index 9c00482c095..91233809c55 100644
--- a/lisp/gnuspost.el
+++ b/lisp/gnuspost.el
@@ -32,10 +32,11 @@
32(defvar gnus-winconf-post-news nil) 32(defvar gnus-winconf-post-news nil)
33 33
34(autoload 'news-reply-mode "rnewspost") 34(autoload 'news-reply-mode "rnewspost")
35(autoload 'timezone-make-date-arpa-standard "timezone")
35 36
36;;; Post news commands of GNUS Group Mode and Subject Mode 37;;; Post news commands of GNUS Group Mode and Summary Mode
37 38
38(defun gnus-Group-post-news () 39(defun gnus-group-post-news ()
39 "Post an article." 40 "Post an article."
40 (interactive) 41 (interactive)
41 ;; Save window configuration. 42 ;; Save window configuration.
@@ -46,21 +47,21 @@
46 (not (zerop (buffer-size)))) 47 (not (zerop (buffer-size))))
47 ;; Restore last window configuration. 48 ;; Restore last window configuration.
48 (set-window-configuration gnus-winconf-post-news))) 49 (set-window-configuration gnus-winconf-post-news)))
49 ;; We don't want to return to Subject buffer nor Article buffer later. 50 ;; We don't want to return to Summary buffer nor Article buffer later.
50 (if (get-buffer gnus-Subject-buffer) 51 (if (get-buffer gnus-summary-buffer)
51 (bury-buffer gnus-Subject-buffer)) 52 (bury-buffer gnus-summary-buffer))
52 (if (get-buffer gnus-Article-buffer) 53 (if (get-buffer gnus-article-buffer)
53 (bury-buffer gnus-Article-buffer))) 54 (bury-buffer gnus-article-buffer)))
54 55
55(defun gnus-Subject-post-news () 56(defun gnus-summary-post-news ()
56 "Post an article." 57 "Post an article."
57 (interactive) 58 (interactive)
58 (gnus-Subject-select-article t nil) 59 (gnus-summary-select-article t nil)
59 ;; Save window configuration. 60 ;; Save window configuration.
60 (setq gnus-winconf-post-news (current-window-configuration)) 61 (setq gnus-winconf-post-news (current-window-configuration))
61 (unwind-protect 62 (unwind-protect
62 (progn 63 (progn
63 (switch-to-buffer gnus-Article-buffer) 64 (switch-to-buffer gnus-article-buffer)
64 (widen) 65 (widen)
65 (delete-other-windows) 66 (delete-other-windows)
66 (gnus-post-news)) 67 (gnus-post-news))
@@ -69,26 +70,26 @@
69 ;; Restore last window configuration. 70 ;; Restore last window configuration.
70 (set-window-configuration gnus-winconf-post-news))) 71 (set-window-configuration gnus-winconf-post-news)))
71 ;; We don't want to return to Article buffer later. 72 ;; We don't want to return to Article buffer later.
72 (bury-buffer gnus-Article-buffer)) 73 (bury-buffer gnus-article-buffer))
73 74
74(defun gnus-Subject-post-reply (yank) 75(defun gnus-summary-followup (yank)
75 "Post a reply article. 76 "Post a reply article.
76If prefix argument YANK is non-nil, original article is yanked automatically." 77If prefix argument YANK is non-nil, original article is yanked automatically."
77 (interactive "P") 78 (interactive "P")
78 (gnus-Subject-select-article t nil) 79 (gnus-summary-select-article t nil)
79 ;; Check Followup-To: poster. 80 ;; Check Followup-To: poster.
80 (set-buffer gnus-Article-buffer) 81 (set-buffer gnus-article-buffer)
81 (if (and gnus-use-followup-to 82 (if (and gnus-use-followup-to
82 (string-equal "poster" (gnus-fetch-field "followup-to")) 83 (string-equal "poster" (gnus-fetch-field "followup-to"))
83 (or (not (eq gnus-use-followup-to t)) 84 (or (not (eq gnus-use-followup-to t))
84 (not (y-or-n-p "Do you want to ignore `Followup-To: poster'? ")))) 85 (not (y-or-n-p "Do you want to ignore `Followup-To: poster'? "))))
85 ;; Mail to the poster. GNUS is now RFC1036 compliant. 86 ;; Mail to the poster. GNUS is now RFC1036 compliant.
86 (gnus-Subject-mail-reply yank) 87 (gnus-summary-reply yank)
87 ;; Save window configuration. 88 ;; Save window configuration.
88 (setq gnus-winconf-post-news (current-window-configuration)) 89 (setq gnus-winconf-post-news (current-window-configuration))
89 (unwind-protect 90 (unwind-protect
90 (progn 91 (progn
91 (switch-to-buffer gnus-Article-buffer) 92 (switch-to-buffer gnus-article-buffer)
92 (widen) 93 (widen)
93 (delete-other-windows) 94 (delete-other-windows)
94 (gnus-news-reply yank)) 95 (gnus-news-reply yank))
@@ -97,27 +98,29 @@ If prefix argument YANK is non-nil, original article is yanked automatically."
97 ;; Restore last window configuration. 98 ;; Restore last window configuration.
98 (set-window-configuration gnus-winconf-post-news))) 99 (set-window-configuration gnus-winconf-post-news)))
99 ;; We don't want to return to Article buffer later. 100 ;; We don't want to return to Article buffer later.
100 (bury-buffer gnus-Article-buffer))) 101 (bury-buffer gnus-article-buffer)))
101 102
102(defun gnus-Subject-post-reply-with-original () 103(defun gnus-summary-followup-with-original ()
103 "Post a reply article with original article." 104 "Post a reply article with original article."
104 (interactive) 105 (interactive)
105 (gnus-Subject-post-reply t)) 106 (gnus-summary-followup t))
106 107
107(defun gnus-Subject-cancel-article () 108(defun gnus-summary-cancel-article ()
108 "Cancel an article you posted." 109 "Cancel an article you posted."
109 (interactive) 110 (interactive)
110 (gnus-Subject-select-article t nil) 111 (gnus-summary-select-article t nil)
111 (gnus-eval-in-buffer-window gnus-Article-buffer 112 (gnus-eval-in-buffer-window gnus-article-buffer
112 (gnus-cancel-news))) 113 (gnus-cancel-news)))
113 114
114 115
115;;; Post a News using NNTP 116;;; Post a News using NNTP
116 117
117;;;###autoload 118;;;###autoload
118(defalias 'sendnews 'gnus-post-news) 119(fset 'sendnews 'gnus-post-news)
120
119;;;###autoload 121;;;###autoload
120(defalias 'postnews 'gnus-post-news) 122(fset 'postnews 'gnus-post-news)
123
121;;;###autoload 124;;;###autoload
122(defun gnus-post-news () 125(defun gnus-post-news ()
123 "Begin editing a new USENET news article to be posted. 126 "Begin editing a new USENET news article to be posted.
@@ -127,16 +130,24 @@ Type \\[describe-mode] once editing the article to get a list of commands."
127 (y-or-n-p "Are you sure you want to post to all of USENET? ")) 130 (y-or-n-p "Are you sure you want to post to all of USENET? "))
128 (let ((artbuf (current-buffer)) 131 (let ((artbuf (current-buffer))
129 (newsgroups ;Default newsgroup. 132 (newsgroups ;Default newsgroup.
130 (if (eq major-mode 'gnus-Article-mode) gnus-newsgroup-name)) 133 (if (eq major-mode 'gnus-article-mode) gnus-newsgroup-name))
131 (subject nil) 134 (subject nil)
132 (distribution nil)) 135 ;; Get default distribution.
136 (distribution (car gnus-local-distributions)))
137 ;; Connect to NNTP server if not connected yet, and get
138 ;; several information.
139 (if (not (gnus-server-opened))
140 (progn
141 (gnus-start-news-server t) ;Confirm server.
142 (gnus-setup-news)))
143 ;; Get current article information.
133 (save-restriction 144 (save-restriction
134 (and (not (zerop (buffer-size))) 145 (and (not (zerop (buffer-size)))
135 ;;(equal major-mode 'news-mode) 146 ;;(equal major-mode 'news-mode)
136 (equal major-mode 'gnus-Article-mode) 147 (equal major-mode 'gnus-article-mode)
137 (progn 148 (progn
138 ;;(news-show-all-headers) 149 ;;(news-show-all-headers)
139 (gnus-Article-show-all-headers) 150 (gnus-article-show-all-headers)
140 (narrow-to-region (point-min) 151 (narrow-to-region (point-min)
141 (progn (goto-char (point-min)) 152 (progn (goto-char (point-min))
142 (search-forward "\n\n") 153 (search-forward "\n\n")
@@ -165,20 +176,25 @@ Type \\[describe-mode] once editing the article to get a list of commands."
165 ;; (setq newsgroups (read-string "Newsgroups: " "general")) 176 ;; (setq newsgroups (read-string "Newsgroups: " "general"))
166 (or newsgroups ;Use the default newsgroup. 177 (or newsgroups ;Use the default newsgroup.
167 (setq newsgroups 178 (setq newsgroups
168 (completing-read "Newsgroup: " gnus-newsrc-assoc 179 (completing-read "Newsgroup: "
180 gnus-newsrc-assoc
169 nil 'require-match 181 nil 'require-match
170 newsgroups ;Default newsgroup. 182 newsgroups ;Default newsgroup.
171 ))) 183 )))
172 (setq subject (read-string "Subject: ")) 184 (setq subject (read-string "Subject: "))
185 ;; Choose a distribution from gnus-distribution-list.
186 ;; completing-read should not be used with
187 ;; 'require-match functionality in order to allow use
188 ;; of unknow distribution.
173 (setq distribution 189 (setq distribution
174 (substring newsgroups 0 (string-match "\\." newsgroups))) 190 (if (consp gnus-distribution-list)
175 (if (string-equal distribution newsgroups) 191 (completing-read "Distribution: "
176 ;; Newsgroup may be general or control. In this 192 gnus-distribution-list
177 ;; case, use default distribution. 193 nil nil ;Never 'require-match
178 (setq distribution gnus-default-distribution)) 194 distribution ;Default distribution.
179 (setq distribution 195 )
180 (read-string "Distribution: " distribution)) 196 (read-string "Distribution: ")))
181 ;; An empty string is ok to ignore gnus-default-distribution. 197 ;; Empty string is okay.
182 ;;(if (string-equal distribution "") 198 ;;(if (string-equal distribution "")
183 ;; (setq distribution nil)) 199 ;; (setq distribution nil))
184 )) 200 ))
@@ -189,7 +205,7 @@ Type \\[describe-mode] once editing the article to get a list of commands."
189 ;; Insert Distribution: field. 205 ;; Insert Distribution: field.
190 ;; Suggested by ichikawa@flab.fujitsu.junet. 206 ;; Suggested by ichikawa@flab.fujitsu.junet.
191 (mail-position-on-field "Distribution") 207 (mail-position-on-field "Distribution")
192 (insert (or distribution gnus-default-distribution "")) 208 (insert (or distribution ""))
193 ;; Handle author copy using FCC field. 209 ;; Handle author copy using FCC field.
194 (if gnus-author-copy 210 (if gnus-author-copy
195 (progn 211 (progn
@@ -217,10 +233,10 @@ original message into it."
217 (save-restriction 233 (save-restriction
218 (and (not (zerop (buffer-size))) 234 (and (not (zerop (buffer-size)))
219 ;;(equal major-mode 'news-mode) 235 ;;(equal major-mode 'news-mode)
220 (equal major-mode 'gnus-Article-mode) 236 (equal major-mode 'gnus-article-mode)
221 (progn 237 (progn
222 ;; (news-show-all-headers) 238 ;; (news-show-all-headers)
223 (gnus-Article-show-all-headers) 239 (gnus-article-show-all-headers)
224 (narrow-to-region (point-min) 240 (narrow-to-region (point-min)
225 (progn (goto-char (point-min)) 241 (progn (goto-char (point-min))
226 (search-forward "\n\n") 242 (search-forward "\n\n")
@@ -291,11 +307,18 @@ original message into it."
291 (progn 307 (progn
292 (mail-position-on-field "FCC") 308 (mail-position-on-field "FCC")
293 (insert gnus-author-copy))) 309 (insert gnus-author-copy)))
310 ;; Insert To: FROM field, which is expected to mail the
311 ;; message to the author of the article too.
312 (if (and gnus-auto-mail-to-author from)
313 (progn
314 (goto-char (point-min))
315 (insert "To: " from "\n")))
294 (goto-char (point-max))) 316 (goto-char (point-max)))
295 ;; Yank original article automatically. 317 ;; Yank original article automatically.
296 (if yank 318 (if yank
297 (let ((last (point))) 319 (let ((last (point)))
298 (goto-char (point-max)) 320 ;;(goto-char (point-max))
321 ;; Insert at current point.
299 (news-reply-yank-original nil) 322 (news-reply-yank-original nil)
300 (goto-char last))) 323 (goto-char last)))
301 ) 324 )
@@ -307,30 +330,37 @@ original message into it."
307 (let* ((case-fold-search nil) 330 (let* ((case-fold-search nil)
308 (server-running (gnus-server-opened))) 331 (server-running (gnus-server-opened)))
309 (save-excursion 332 (save-excursion
310 ;; It is possible to post a news without reading news using 333 ;; Connect to default NNTP server if necessary.
311 ;; `gnus' before.
312 ;; Suggested by yuki@flab.fujitsu.junet. 334 ;; Suggested by yuki@flab.fujitsu.junet.
313 (gnus-start-news-server) ;Use default server. 335 (gnus-start-news-server) ;Use default server.
314 ;; NNTP server must be opened before current buffer is modified. 336 ;; NNTP server must be opened before current buffer is modified.
315 (widen) 337 (widen)
316 (goto-char (point-min)) 338 (goto-char (point-min))
317 (run-hooks 'news-inews-hook) 339 (run-hooks 'news-inews-hook)
318 (goto-char (point-min)) 340 ;; Mail the message too if To: or Cc: exists.
319 (search-forward (concat "\n" mail-header-separator "\n")) 341 (if (save-restriction
320 (replace-match "\n\n") 342 (narrow-to-region
321 (goto-char (point-max)) 343 (point-min)
322 ;; require a newline at the end for inews to append .signature to 344 (progn
323 (or (= (preceding-char) ?\n) 345 (goto-char (point-min))
324 (insert ?\n)) 346 (search-forward (concat "\n" mail-header-separator "\n"))
347 (point)))
348 (or (mail-fetch-field "to" nil t)
349 (mail-fetch-field "cc" nil t)))
350 (if gnus-mail-send-method
351 (progn
352 (message "Sending via mail...")
353 (funcall gnus-mail-send-method)
354 (message "Sending via mail... done"))
355 (ding)
356 (message "No mailer defined. To: and/or Cc: fields ignored.")
357 (sit-for 1)))
358 ;; Send to NNTP server.
325 (message "Posting to USENET...") 359 (message "Posting to USENET...")
326 ;; Post to NNTP server.
327 (if (gnus-inews-article) 360 (if (gnus-inews-article)
328 (message "Posting to USENET... done") 361 (message "Posting to USENET... done")
329 ;; We cannot signal an error. 362 ;; We cannot signal an error.
330 (ding) (message "Article rejected: %s" (gnus-status-message))) 363 (ding) (message "Article rejected: %s" (gnus-status-message)))
331 (goto-char (point-min)) ;restore internal header separator
332 (search-forward "\n\n")
333 (replace-match (concat "\n" mail-header-separator "\n"))
334 (set-buffer-modified-p nil)) 364 (set-buffer-modified-p nil))
335 ;; If NNTP server is opened by gnus-inews-news, close it by myself. 365 ;; If NNTP server is opened by gnus-inews-news, close it by myself.
336 (or server-running 366 (or server-running
@@ -353,9 +383,9 @@ original message into it."
353 (save-excursion 383 (save-excursion
354 ;; Get header info. from original article. 384 ;; Get header info. from original article.
355 (save-restriction 385 (save-restriction
356 (gnus-Article-show-all-headers) 386 (gnus-article-show-all-headers)
357 (goto-char (point-min)) 387 (goto-char (point-min))
358 (search-forward "\n\n") 388 (search-forward "\n\n" nil 'move)
359 (narrow-to-region (point-min) (point)) 389 (narrow-to-region (point-min) (point))
360 (setq from (mail-fetch-field "from")) 390 (setq from (mail-fetch-field "from"))
361 (setq newsgroups (mail-fetch-field "newsgroups")) 391 (setq newsgroups (mail-fetch-field "newsgroups"))
@@ -368,30 +398,27 @@ original message into it."
368 (downcase (mail-strip-quoted-names from)) 398 (downcase (mail-strip-quoted-names from))
369 (downcase (mail-strip-quoted-names (gnus-inews-user-name))))) 399 (downcase (mail-strip-quoted-names (gnus-inews-user-name)))))
370 (progn 400 (progn
371 (ding) (message "This article is not yours")) 401 (ding) (message "This article is not yours."))
372 ;; Make control article. 402 ;; Make control article.
373 (set-buffer (get-buffer-create " *GNUS-posting*")) 403 (set-buffer (get-buffer-create " *GNUS-canceling*"))
374 (buffer-flush-undo (current-buffer)) 404 (buffer-flush-undo (current-buffer))
375 (erase-buffer) 405 (erase-buffer)
376 (insert "Newsgroups: " newsgroups "\n" 406 (insert "Newsgroups: " newsgroups "\n"
377 "Subject: cancel " message-id "\n" 407 "Subject: cancel " message-id "\n"
378 "Control: cancel " message-id "\n" 408 "Control: cancel " message-id "\n"
379 ;; We should not use the value of 409 ;; We should not use the first value of
380 ;; `gnus-default-distribution' as default value, 410 ;; `gnus-distribution-list' as default value,
381 ;; because distribution must be as same as original 411 ;; because distribution must be as same as original
382 ;; article. 412 ;; article.
383 "Distribution: " (or distribution "") "\n" 413 "Distribution: " (or distribution "") "\n"
414 mail-header-separator "\n"
384 ) 415 )
385 ;; Prepare article headers.
386 (gnus-inews-insert-headers)
387 (goto-char (point-max))
388 ;; Insert empty line.
389 (insert "\n")
390 ;; Send the control article to NNTP server. 416 ;; Send the control article to NNTP server.
391 (message "Canceling your article...") 417 (message "Canceling your article...")
392 (if (gnus-request-post) 418 (if (gnus-inews-article)
393 (message "Canceling your article... done") 419 (message "Canceling your article... done")
394 (ding) (message "Failed to cancel your article")) 420 (ding) (message "Failed to cancel your article"))
421 ;; Kill the article buffer.
395 (kill-buffer (current-buffer)) 422 (kill-buffer (current-buffer))
396 ))) 423 )))
397 )) 424 ))
@@ -400,55 +427,35 @@ original message into it."
400;;; Lowlevel inews interface 427;;; Lowlevel inews interface
401 428
402(defun gnus-inews-article () 429(defun gnus-inews-article ()
403 "NNTP inews interface." 430 "Post an article in current buffer using NNTP protocol."
404 (let ((signature 431 (let ((artbuf (current-buffer))
405 (if gnus-signature-file
406 (expand-file-name gnus-signature-file nil)))
407 (distribution nil)
408 (artbuf (current-buffer))
409 (tmpbuf (get-buffer-create " *GNUS-posting*"))) 432 (tmpbuf (get-buffer-create " *GNUS-posting*")))
410 (save-excursion 433 (save-excursion
411 (set-buffer tmpbuf) 434 (set-buffer tmpbuf)
412 (buffer-flush-undo (current-buffer)) 435 (buffer-flush-undo (current-buffer))
413 (erase-buffer) 436 (erase-buffer)
414 (insert-buffer-substring artbuf) 437 (insert-buffer-substring artbuf)
415 ;; Get distribution. 438 ;; Remove the header separator.
416 (save-restriction 439 (goto-char (point-min))
417 (goto-char (point-min)) 440 (search-forward (concat "\n" mail-header-separator "\n"))
418 (search-forward "\n\n") 441 (replace-match "\n\n")
419 (narrow-to-region (point-min) (point)) 442 (goto-char (point-max))
420 (setq distribution (mail-fetch-field "distribution"))) 443 ;; require a newline at the end for inews to append .signature to
421 (widen) 444 (or (= (preceding-char) ?\n)
422 (if signature 445 (insert ?\n))
423 (progn 446 ;; This hook may insert a signature.
424 ;; Change signature file by distribution. 447 (run-hooks 'gnus-prepare-article-hook)
425 ;; Suggested by hyoko@flab.fujitsu.junet. 448 ;; Prepare article headers. All message body such as signature
426 (if (file-exists-p (concat signature "-" distribution)) 449 ;; must be inserted before Lines: field is prepared.
427 (setq signature (concat signature "-" distribution)))
428 ;; Insert signature.
429 (if (file-exists-p signature)
430 (progn
431 (goto-char (point-max))
432 (insert "--\n")
433 (insert-file-contents signature)))
434 ))
435 ;; Prepare article headers.
436 (save-restriction 450 (save-restriction
437 (goto-char (point-min)) 451 (goto-char (point-min))
438 (search-forward "\n\n") 452 (search-forward "\n\n")
439 (narrow-to-region (point-min) (point)) 453 (narrow-to-region (point-min) (point))
440 (gnus-inews-insert-headers) 454 (gnus-inews-insert-headers))
441 ;; Save author copy of posted article. The article must be 455 ;; Run final inews hooks. This hook may do FCC.
442 ;; copied before being posted because `gnus-request-post' 456 ;; The article must be saved before being posted because
443 ;; modifies the buffer. 457 ;; `gnus-request-post' modifies the buffer.
444 (let ((case-fold-search t)) 458 (run-hooks 'gnus-inews-article-hook)
445 ;; Find and handle any FCC fields.
446 (goto-char (point-min))
447 (if (re-search-forward "^FCC:" nil t)
448 (gnus-inews-do-fcc))))
449 (widen)
450 ;; Run final inews hooks.
451 (run-hooks 'gnus-Inews-article-hook)
452 ;; Post an article to NNTP server. 459 ;; Post an article to NNTP server.
453 ;; Return NIL if post failed. 460 ;; Return NIL if post failed.
454 (prog1 461 (prog1
@@ -456,21 +463,115 @@ original message into it."
456 (kill-buffer (current-buffer))) 463 (kill-buffer (current-buffer)))
457 ))) 464 )))
458 465
466(defun gnus-inews-insert-headers ()
467 "Prepare article headers.
468Fields already prepared in the buffer are not modified.
469Fields in gnus-required-headers will be generated."
470 (save-excursion
471 (let ((date (gnus-inews-date))
472 (message-id (gnus-inews-message-id))
473 (organization (gnus-inews-organization)))
474 (goto-char (point-min))
475 (or (mail-fetch-field "path")
476 (and (memq 'Path gnus-required-headers)
477 (insert "Path: " (gnus-inews-path) "\n")))
478 (or (mail-fetch-field "from")
479 (and (memq 'From gnus-required-headers)
480 (insert "From: " (gnus-inews-user-name) "\n")))
481 ;; If there is no subject, make Subject: field.
482 (or (mail-fetch-field "subject")
483 (and (memq 'Subject gnus-required-headers)
484 (insert "Subject: \n")))
485 ;; If there is no newsgroups, make Newsgroups: field.
486 (or (mail-fetch-field "newsgroups")
487 (and (memq 'Newsgroups gnus-required-headers)
488 (insert "Newsgroups: \n")))
489 (or (mail-fetch-field "message-id")
490 (and message-id
491 (memq 'Message-ID gnus-required-headers)
492 (insert "Message-ID: " message-id "\n")))
493 (or (mail-fetch-field "date")
494 (and date
495 (memq 'Date gnus-required-headers)
496 (insert "Date: " date "\n")))
497 ;; Optional fields in RFC977 and RFC1036
498 (or (mail-fetch-field "organization")
499 (and organization
500 (memq 'Organization gnus-required-headers)
501 (let ((begin (point))
502 (fill-column 79)
503 (fill-prefix "\t"))
504 (insert "Organization: " organization "\n")
505 (fill-region-as-paragraph begin (point)))))
506 (or (mail-fetch-field "distribution")
507 (and (memq 'Distribution gnus-required-headers)
508 (insert "Distribution: \n")))
509 (or (mail-fetch-field "lines")
510 (and (memq 'Lines gnus-required-headers)
511 (insert "Lines: " (gnus-inews-lines) "\n")))
512 )))
513
514
515;; Utility functions.
516
517(defun gnus-inews-insert-signature ()
518 "Insert signature file in current article buffer.
519If there is a file named .signature-DISTRIBUTION, it is used instead
520of usual .signature when the distribution of the article is
521DISTRIBUTION. Set the variable to nil to prevent appending the
522signature file automatically.
523Signature file is specified by the variable gnus-signature-file."
524 (save-excursion
525 (save-restriction
526 ;; Change signature file by distribution.
527 ;; Suggested by hyoko@flab.fujitsu.co.jp.
528 (let ((signature
529 (if gnus-signature-file
530 (expand-file-name gnus-signature-file nil)))
531 (distribution nil))
532 (goto-char (point-min))
533 (search-forward "\n\n")
534 (narrow-to-region (point-min) (point))
535 (setq distribution (mail-fetch-field "distribution"))
536 (widen)
537 (if signature
538 (progn
539 (if (file-exists-p (concat signature "-" distribution))
540 (setq signature (concat signature "-" distribution)))
541 ;; Insert signature.
542 (if (file-exists-p signature)
543 (progn
544 (goto-char (point-max))
545 (insert "--\n")
546 (insert-file-contents signature)))
547 ))))))
548
459(defun gnus-inews-do-fcc () 549(defun gnus-inews-do-fcc ()
460 "Process FCC: fields." 550 "Process FCC: fields in current article buffer.
551Unless the first character of the field is `|', the article is saved
552to the specified file using the function specified by the variable
553gnus-author-copy-saver. The default function rmail-output saves in
554Unix mailbox format.
555If the first character is `|', the contents of the article is send to
556a program specified by the rest of the value."
461 (let ((fcc-list nil) 557 (let ((fcc-list nil)
462 (fcc-file nil) 558 (fcc-file nil)
463 (case-fold-search t)) ;Should ignore case. 559 (case-fold-search t)) ;Should ignore case.
464 (save-excursion 560 (save-excursion
465 (save-restriction 561 (save-restriction
466 (goto-char (point-min)) 562 (goto-char (point-min))
563 (search-forward "\n\n")
564 (narrow-to-region (point-min) (point))
565 (goto-char (point-min))
467 (while (re-search-forward "^FCC:[ \t]*" nil t) 566 (while (re-search-forward "^FCC:[ \t]*" nil t)
468 (setq fcc-list (cons (buffer-substring (point) 567 (setq fcc-list
469 (progn 568 (cons (buffer-substring
470 (end-of-line) 569 (point)
471 (skip-chars-backward " \t") 570 (progn
472 (point))) 571 (end-of-line)
473 fcc-list)) 572 (skip-chars-backward " \t")
573 (point)))
574 fcc-list))
474 (delete-region (match-beginning 0) 575 (delete-region (match-beginning 0)
475 (progn (forward-line 1) (point)))) 576 (progn (forward-line 1) (point))))
476 ;; Process FCC operations. 577 ;; Process FCC operations.
@@ -495,36 +596,6 @@ original message into it."
495 )) 596 ))
496 )) 597 ))
497 598
498(defun gnus-inews-insert-headers ()
499 "Prepare article headers.
500Path:, From:, Subject: and Distribution: are generated.
501Message-ID:, Date: and Organization: are optional."
502 (save-excursion
503 (let ((date (gnus-inews-date))
504 (message-id (gnus-inews-message-id))
505 (organization (gnus-inews-organization)))
506 ;; Insert from the top of headers.
507 (goto-char (point-min))
508 (insert "Path: " (gnus-inews-path) "\n")
509 (insert "From: " (gnus-inews-user-name) "\n")
510 ;; If there is no subject, make Subject: field.
511 (or (mail-fetch-field "subject")
512 (insert "Subject: \n"))
513 ;; Insert random headers.
514 (if message-id
515 (insert "Message-ID: " message-id "\n"))
516 (if date
517 (insert "Date: " date "\n"))
518 (if organization
519 (let ((begin (point))
520 (fill-column 79)
521 (fill-prefix "\t"))
522 (insert "Organization: " organization "\n")
523 (fill-region-as-paragraph begin (point))))
524 (or (mail-fetch-field "distribution")
525 (insert "Distribution: \n"))
526 )))
527
528(defun gnus-inews-path () 599(defun gnus-inews-path ()
529 "Return uucp path." 600 "Return uucp path."
530 (let ((login-name (gnus-inews-login-name))) 601 (let ((login-name (gnus-inews-login-name)))
@@ -551,15 +622,15 @@ Message-ID:, Date: and Organization: are optional."
551 622
552(defun gnus-inews-login-name () 623(defun gnus-inews-login-name ()
553 "Return user login name. 624 "Return user login name.
554Got from the variable `gnus-user-login-name', the environment variables 625Got from the variable gnus-user-login-name, the environment variables
555USER and LOGNAME, and the function `user-login-name'." 626USER and LOGNAME, and the function user-login-name."
556 (or gnus-user-login-name 627 (or gnus-user-login-name
557 (getenv "USER") (getenv "LOGNAME") (user-login-name))) 628 (getenv "USER") (getenv "LOGNAME") (user-login-name)))
558 629
559(defun gnus-inews-full-name () 630(defun gnus-inews-full-name ()
560 "Return user full name. 631 "Return user full name.
561Got from the variable `gnus-user-full-name', the environment variable 632Got from the variable gnus-user-full-name, the environment variable
562NAME, and the function `user-full-name'." 633NAME, and the function user-full-name."
563 (or gnus-user-full-name 634 (or gnus-user-full-name
564 (getenv "NAME") (user-full-name))) 635 (getenv "NAME") (user-full-name)))
565 636
@@ -569,9 +640,14 @@ If optional argument GENERICFROM is a string, use it as the domain
569name; if it is non-nil, strip of local host name from the domain name. 640name; if it is non-nil, strip of local host name from the domain name.
570If the function `system-name' returns full internet name and the 641If the function `system-name' returns full internet name and the
571domain is undefined, the domain name is got from it." 642domain is undefined, the domain name is got from it."
643 ;; Note: compatibility hack. This will be removed in the next version.
644 (and (null gnus-local-domain)
645 (boundp 'gnus-your-domain)
646 (setq gnus-local-domain gnus-your-domain))
647 ;; End of compatibility hack.
572 (let ((domain (or (if (stringp genericfrom) genericfrom) 648 (let ((domain (or (if (stringp genericfrom) genericfrom)
573 (getenv "DOMAINNAME") 649 (getenv "DOMAINNAME")
574 gnus-your-domain 650 gnus-local-domain
575 ;; Function `system-name' may return full internet name. 651 ;; Function `system-name' may return full internet name.
576 ;; Suggested by Mike DeCorte <mrd@sun.soe.clarkson.edu>. 652 ;; Suggested by Mike DeCorte <mrd@sun.soe.clarkson.edu>.
577 (if (string-match "\\." (system-name)) 653 (if (string-match "\\." (system-name))
@@ -582,8 +658,8 @@ domain is undefined, the domain name is got from it."
582 (system-name)))) 658 (system-name))))
583 (if (string-equal "." (substring domain 0 1)) 659 (if (string-equal "." (substring domain 0 1))
584 (setq domain (substring domain 1))) 660 (setq domain (substring domain 1)))
585 (if (null gnus-your-domain) 661 (if (null gnus-local-domain)
586 (setq gnus-your-domain domain)) 662 (setq gnus-local-domain domain))
587 ;; Support GENERICFROM as same as standard Bnews system. 663 ;; Support GENERICFROM as same as standard Bnews system.
588 ;; Suggested by ohm@kaba.junet and vixie@decwrl.dec.com. 664 ;; Suggested by ohm@kaba.junet and vixie@decwrl.dec.com.
589 (cond ((null genericfrom) 665 (cond ((null genericfrom)
@@ -616,7 +692,27 @@ domain is undefined, the domain name is got from it."
616 )) 692 ))
617 693
618(defun gnus-inews-date () 694(defun gnus-inews-date ()
619 "Bnews date format string of today. Time zone is ignored." 695 "Date string of today.
696If the variable gnus-local-timezone is non-nil, valid date will be
697generated in terms of RFC822. Otherwise, buggy date in which time
698zone is ignored will be generated. If you are using with Cnews, you
699must use valid date."
700 (cond (gnus-local-timezone
701 ;; Gnus can generate valid date.
702 (gnus-inews-valid-date))
703 (t
704 ;; No timezone info.
705 (gnus-inews-buggy-date))
706 ))
707
708(defun gnus-inews-valid-date ()
709 "Date string of today represented in GMT.
710Local timezone is specified by the variable gnus-local-timezone."
711 (timezone-make-date-arpa-standard
712 (current-time-string) gnus-local-timezone "GMT"))
713
714(defun gnus-inews-buggy-date ()
715 "Buggy date string of today. Time zone is ignored, but fast."
620 ;; Insert buggy date (time zone is ignored), but I don't worry about 716 ;; Insert buggy date (time zone is ignored), but I don't worry about
621 ;; it since inews will rewrite it. 717 ;; it since inews will rewrite it.
622 (let ((date (current-time-string))) 718 (let ((date (current-time-string)))
@@ -635,17 +731,22 @@ domain is undefined, the domain name is got from it."
635(defun gnus-inews-organization () 731(defun gnus-inews-organization ()
636 "Return user's organization. 732 "Return user's organization.
637The ORGANIZATION environment variable is used if defined. 733The ORGANIZATION environment variable is used if defined.
638If not, the variable `gnus-your-organization' is used instead. 734If not, the variable gnus-local-organization is used instead.
639If the value begins with a slash, it is taken as the name of a file 735If the value begins with a slash, it is taken as the name of a file
640containing the organization." 736containing the organization."
641 ;; The organization must be got in this order since the ORGANIZATION 737 ;; The organization must be got in this order since the ORGANIZATION
642 ;; environment variable is intended for user specific while 738 ;; environment variable is intended for user specific while
643 ;; gnus-your-organization is for machine or organization specific. 739 ;; gnus-local-organization is for machine or organization specific.
644 (let ((organization (or (getenv "ORGANIZATION") 740
645 gnus-your-organization 741 ;; Note: compatibility hack. This will be removed in the next version.
646 (expand-file-name "~/.organization" nil)))) 742 (and (null gnus-local-organization)
647 (if (equal organization "") 743 (boundp 'gnus-your-organization)
648 (setq organization nil)) 744 (setq gnus-local-organization gnus-your-organization))
745 ;; End of compatibility hack.
746 (let* ((private-file (expand-file-name "~/.organization" nil))
747 (organization (or (getenv "ORGANIZATION")
748 gnus-local-organization
749 private-file)))
649 (and (stringp organization) 750 (and (stringp organization)
650 (string-equal (substring organization 0 1) "/") 751 (string-equal (substring organization 0 1) "/")
651 ;; Get it from the user and system file. 752 ;; Get it from the user and system file.
@@ -672,9 +773,19 @@ containing the organization."
672 (prog1 (buffer-string) 773 (prog1 (buffer-string)
673 (kill-buffer tmpbuf)) 774 (kill-buffer tmpbuf))
674 ))) 775 )))
776 ((string-equal organization private-file) nil) ;No such file
675 (t organization)) 777 (t organization))
676 )) 778 ))
677 779
780(defun gnus-inews-lines ()
781 "Count the number of lines and return numeric string."
782 (save-excursion
783 (save-restriction
784 (widen)
785 (goto-char (point-min))
786 (search-forward "\n\n" nil 'move)
787 (int-to-string (count-lines (point) (point-max))))))
788
678(provide 'gnuspost) 789(provide 'gnuspost)
679 790
680;;; gnuspost.el ends here 791;;; gnuspost.el ends here
diff --git a/lisp/mhspool.el b/lisp/mhspool.el
index 514fa6f88e9..900d8eb0c99 100644
--- a/lisp/mhspool.el
+++ b/lisp/mhspool.el
@@ -1,6 +1,6 @@
1;;; mhspool.el --- MH folder access using NNTP for GNU Emacs 1;;; mhspool.el --- MH folder access using NNTP for GNU Emacs
2 2
3;; Copyright (C) 1988, 1989, 1990 Free Software Foundation, Inc. 3;; Copyright (C) 1988, 1989, 1990, 1993 Free Software Foundation, Inc.
4 4
5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6;; Maintainer: FSF 6;; Maintainer: FSF
@@ -39,13 +39,22 @@
39 39
40(require 'nntp) 40(require 'nntp)
41 41
42(defvar mhspool-list-folders-method
43 (function mhspool-list-folders-using-sh)
44 "*Function to list files in folders.
45The function should accept a directory as its argument, and fill the
46current buffer with file and directory names. The output format must
47be the same as that of 'ls -R1'. Two functions
48mhspool-list-folders-using-ls and mhspool-list-folders-using-sh are
49provided now. I suppose the later is faster.")
50
42(defvar mhspool-list-directory-switches '("-R") 51(defvar mhspool-list-directory-switches '("-R")
43 "*Switches for `nntp-request-list' to pass to `ls' for gettting file lists. 52 "*Switches for mhspool-list-folders-using-ls to pass to `ls' for gettting file lists.
44One entry should appear on one line. You may need to add `-1' option.") 53One entry should appear on one line. You may need to add `-1' option.")
45 54
46 55
47 56
48(defconst mhspool-version "MHSPOOL 1.5" 57(defconst mhspool-version "MHSPOOL 1.8"
49 "Version numbers of this version of MHSPOOL.") 58 "Version numbers of this version of MHSPOOL.")
50 59
51(defvar mhspool-spool-directory "~/Mail" 60(defvar mhspool-spool-directory "~/Mail"
@@ -62,9 +71,10 @@ One entry should appear on one line. You may need to add `-1' option.")
62 "Return list of article headers specified by SEQUENCE of article id. 71 "Return list of article headers specified by SEQUENCE of article id.
63The format of list is 72The format of list is
64 `([NUMBER SUBJECT FROM XREF LINES DATE MESSAGE-ID REFERENCES] ...)'. 73 `([NUMBER SUBJECT FROM XREF LINES DATE MESSAGE-ID REFERENCES] ...)'.
74If there is no References: field, In-Reply-To: field is used instead.
65Reader macros for the vector are defined as `nntp-header-FIELD'. 75Reader macros for the vector are defined as `nntp-header-FIELD'.
66Writer macros for the vector are defined as `nntp-set-header-FIELD'. 76Writer macros for the vector are defined as `nntp-set-header-FIELD'.
67News group must be selected before calling me." 77Newsgroup must be selected before calling this."
68 (save-excursion 78 (save-excursion
69 (set-buffer nntp-server-buffer) 79 (set-buffer nntp-server-buffer)
70 ;;(erase-buffer) 80 ;;(erase-buffer)
@@ -136,7 +146,12 @@ News group must be selected before calling me."
136 (buffer-substring 146 (buffer-substring
137 (point) 147 (point)
138 (save-excursion (end-of-line) (point))))) 148 (save-excursion (end-of-line) (point)))))
139 (setq lines 0)) 149 ;; Count lines since there is no lines field in most cases.
150 (setq lines
151 (save-restriction
152 (goto-char (point-max))
153 (widen)
154 (count-lines (point) (point-max)))))
140 ;; Extract Xref: 155 ;; Extract Xref:
141 (goto-char (point-min)) 156 (goto-char (point-min))
142 (if (search-forward "\nXref: " nil t) 157 (if (search-forward "\nXref: " nil t)
@@ -154,22 +169,25 @@ News group must be selected before calling me."
154 (point) 169 (point)
155 (save-excursion (end-of-line) (point)))) 170 (save-excursion (end-of-line) (point))))
156 (setq references nil)) 171 (setq references nil))
157 (setq headers 172 ;; Collect valid article only.
158 (cons (vector article subject from 173 (and article
159 xref lines date 174 message-id
160 message-id references) headers)) 175 (setq headers
176 (cons (vector article subject from
177 xref lines date
178 message-id references) headers)))
161 )) 179 ))
162 (setq sequence (cdr sequence)) 180 (setq sequence (cdr sequence))
163 (setq count (1+ count)) 181 (setq count (1+ count))
164 (and (numberp nntp-large-newsgroup) 182 (and (numberp nntp-large-newsgroup)
165 (> number nntp-large-newsgroup) 183 (> number nntp-large-newsgroup)
166 (zerop (% count 20)) 184 (zerop (% count 20))
167 (message "MHSPOOL: %d%% of headers received." 185 (message "MHSPOOL: Receiving headers... %d%%"
168 (/ (* count 100) number))) 186 (/ (* count 100) number)))
169 ) 187 )
170 (and (numberp nntp-large-newsgroup) 188 (and (numberp nntp-large-newsgroup)
171 (> number nntp-large-newsgroup) 189 (> number nntp-large-newsgroup)
172 (message "MHSPOOL: 100%% of headers received.")) 190 (message "MHSPOOL: Receiving headers... done"))
173 (nreverse headers) 191 (nreverse headers)
174 ))) 192 )))
175 193
@@ -194,20 +212,20 @@ If optional argument SERVICE is non-nil, open by the service name."
194 (expand-file-name "~/" nil)))) 212 (expand-file-name "~/" nil))))
195 (setq host (system-name))) 213 (setq host (system-name)))
196 (setq mhspool-spool-directory nil)) 214 (setq mhspool-spool-directory nil))
197 (setq nntp-status-message-string "") 215 (setq nntp-status-string "")
198 (cond ((and (stringp host) 216 (cond ((and (stringp host)
199 (stringp mhspool-spool-directory) 217 (stringp mhspool-spool-directory)
200 (file-directory-p mhspool-spool-directory) 218 (file-directory-p mhspool-spool-directory)
201 (string-equal host (system-name))) 219 (string-equal host (system-name)))
202 (setq status (mhspool-open-server-internal host service))) 220 (setq status (mhspool-open-server-internal host service)))
203 ((string-equal host (system-name)) 221 ((string-equal host (system-name))
204 (setq nntp-status-message-string 222 (setq nntp-status-string
205 (format "No such directory: %s. Goodbye." 223 (format "No such directory: %s. Goodbye."
206 mhspool-spool-directory))) 224 mhspool-spool-directory)))
207 ((null host) 225 ((null host)
208 (setq nntp-status-message-string "NNTP server is not specified.")) 226 (setq nntp-status-string "NNTP server is not specified."))
209 (t 227 (t
210 (setq nntp-status-message-string 228 (setq nntp-status-string
211 (format "MHSPOOL: cannot talk to %s." host))) 229 (format "MHSPOOL: cannot talk to %s." host)))
212 ) 230 )
213 status 231 status
@@ -227,7 +245,7 @@ If the stream is opened, return T, otherwise return NIL."
227 245
228(defun mhspool-status-message () 246(defun mhspool-status-message ()
229 "Return server status response as string." 247 "Return server status response as string."
230 nntp-status-message-string 248 nntp-status-string
231 ) 249 )
232 250
233(defun mhspool-request-article (id) 251(defun mhspool-request-article (id)
@@ -266,7 +284,9 @@ If the stream is opened, return T, otherwise return NIL."
266 284
267(defun mhspool-request-stat (id) 285(defun mhspool-request-stat (id)
268 "Select article by message ID (or number)." 286 "Select article by message ID (or number)."
269 (error "MHSPOOL: STAT is not implemented.")) 287 (setq nntp-status-string "MHSPOOL: STAT is not implemented.")
288 nil
289 )
270 290
271(defun mhspool-request-group (group) 291(defun mhspool-request-group (group)
272 "Select news GROUP." 292 "Select news GROUP."
@@ -285,21 +305,22 @@ If the stream is opened, return T, otherwise return NIL."
285 )) 305 ))
286 306
287(defun mhspool-request-list () 307(defun mhspool-request-list ()
288 "List valid newsgoups." 308 "List active newsgoups."
289 (save-excursion 309 (save-excursion
290 (let* ((newsgroup nil) 310 (let* ((newsgroup nil)
291 (articles nil) 311 (articles nil)
292 (directory (file-name-as-directory 312 (directory (file-name-as-directory
293 (expand-file-name mhspool-spool-directory nil))) 313 (expand-file-name mhspool-spool-directory nil)))
294 (folder-regexp (concat "^" (regexp-quote directory) "\\(.+\\):$")) 314 (folder-regexp (concat "^" (regexp-quote directory) "\\(.+\\):$"))
295 (buffer (get-buffer-create " *GNUS file listing*"))) 315 (buffer (get-buffer-create " *MHSPOOL File List*")))
296 (set-buffer nntp-server-buffer) 316 (set-buffer nntp-server-buffer)
297 (erase-buffer) 317 (erase-buffer)
298 (set-buffer buffer) 318 (set-buffer buffer)
299 (erase-buffer) 319 (erase-buffer)
300 (apply 'call-process 320;; (apply 'call-process
301 "ls" nil t nil 321;; "ls" nil t nil
302 (append mhspool-list-directory-switches (list directory))) 322;; (append mhspool-list-directory-switches (list directory)))
323 (funcall mhspool-list-folders-method directory)
303 (goto-char (point-min)) 324 (goto-char (point-min))
304 (while (re-search-forward folder-regexp nil t) 325 (while (re-search-forward folder-regexp nil t)
305 (setq newsgroup 326 (setq newsgroup
@@ -328,17 +349,34 @@ If the stream is opened, return T, otherwise return NIL."
328 (buffer-size) 349 (buffer-size)
329 ))) 350 )))
330 351
352(defun mhspool-request-list-newsgroups ()
353 "List newsgoups (defined in NNTP2)."
354 (setq nntp-status-string "MHSPOOL: LIST NEWSGROUPS is not implemented.")
355 nil
356 )
357
358(defun mhspool-request-list-distributions ()
359 "List distributions (defined in NNTP2)."
360 (setq nntp-status-string "MHSPOOL: LIST DISTRIBUTIONS is not implemented.")
361 nil
362 )
363
331(defun mhspool-request-last () 364(defun mhspool-request-last ()
332 "Set current article pointer to the previous article in the current newsgroup." 365 "Set current article pointer to the previous article
333 (error "MHSPOOL: LAST is not implemented.")) 366in the current news group."
367 (setq nntp-status-string "MHSPOOL: LAST is not implemented.")
368 nil
369 )
334 370
335(defun mhspool-request-next () 371(defun mhspool-request-next ()
336 "Advance current article pointer." 372 "Advance current article pointer."
337 (error "MHSPOOL: NEXT is not implemented.")) 373 (setq nntp-status-string "MHSPOOL: NEXT is not implemented.")
374 nil
375 )
338 376
339(defun mhspool-request-post () 377(defun mhspool-request-post ()
340 "Post a new news in current buffer." 378 "Post a new news in current buffer."
341 (setq nntp-status-message-string "MHSPOOL: what do you mean post?") 379 (setq nntp-status-string "MHSPOOL: POST: what do you mean?")
342 nil 380 nil
343 ) 381 )
344 382
@@ -408,6 +446,45 @@ If the stream is opened, return T, otherwise return NIL."
408 string 446 string
409 )) 447 ))
410 448
449
450;; Methods for listing files in folders.
451
452(defun mhspool-list-folders-using-ls (directory)
453 "List files in folders under DIRECTORY using 'ls'."
454 (apply 'call-process
455 "ls" nil t nil
456 (append mhspool-list-directory-switches (list directory))))
457
458;; Basic ideas by tanaka@flab.fujitsu.co.jp (Hiroshi TANAKA)
459
460(defun mhspool-list-folders-using-sh (directory)
461 "List files in folders under DIRECTORY using '/bin/sh'."
462 (let ((buffer (current-buffer))
463 (script (get-buffer-create " *MHSPOOL Shell Script Buffer*")))
464 (save-excursion
465 (save-restriction
466 (set-buffer script)
467 (erase-buffer)
468 ;; /bin/sh script which does 'ls -R'.
469 (insert
470 "PS2=
471 ffind() {
472 cd $1; echo $1:
473 ls -1
474 echo
475 for j in `echo *[a-zA-Z]*`
476 do
477 if [ -d $1/$j ]; then
478 ffind $1/$j
479 fi
480 done
481 }
482 cd " directory "; ffind `pwd`; exit 0\n")
483 (call-process-region (point-min) (point-max) "sh" nil buffer nil)
484 ))
485 (kill-buffer script)
486 ))
487
411(provide 'mhspool) 488(provide 'mhspool)
412 489
413;;; mhspool.el ends here 490;;; mhspool.el ends here
diff --git a/lisp/nnspool.el b/lisp/nnspool.el
index 8e113432e9e..6235aff7dba 100644
--- a/lisp/nnspool.el
+++ b/lisp/nnspool.el
@@ -1,6 +1,6 @@
1;;; nnspool.el --- spool access using NNTP for GNU Emacs 1;;; nnspool.el --- spool access using NNTP for GNU Emacs
2 2
3;; Copyright (C) 1988, 1989, 1990 Free Software Foundation, Inc. 3;; Copyright (C) 1988, 1989, 1990, 1993 Free Software Foundation, Inc.
4 4
5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6;; Keywords: news 6;; Keywords: news
@@ -37,12 +37,18 @@
37(defvar nnspool-active-file "/usr/lib/news/active" 37(defvar nnspool-active-file "/usr/lib/news/active"
38 "*Local news active file.") 38 "*Local news active file.")
39 39
40(defvar nnspool-newsgroups-file "/usr/lib/news/newsgroups"
41 "*Local news newsgroups file.")
42
43(defvar nnspool-distributions-file "/usr/lib/news/distributions"
44 "*Local news distributions file.")
45
40(defvar nnspool-history-file "/usr/lib/news/history" 46(defvar nnspool-history-file "/usr/lib/news/history"
41 "*Local news history file.") 47 "*Local news history file.")
42 48
43 49
44 50
45(defconst nnspool-version "NNSPOOL 1.10" 51(defconst nnspool-version "NNSPOOL 1.12"
46 "Version numbers of this version of NNSPOOL.") 52 "Version numbers of this version of NNSPOOL.")
47 53
48(defvar nnspool-current-directory nil 54(defvar nnspool-current-directory nil
@@ -56,9 +62,10 @@
56 "Return list of article headers specified by SEQUENCE of article id. 62 "Return list of article headers specified by SEQUENCE of article id.
57The format of list is 63The format of list is
58 `([NUMBER SUBJECT FROM XREF LINES DATE MESSAGE-ID REFERENCES] ...)'. 64 `([NUMBER SUBJECT FROM XREF LINES DATE MESSAGE-ID REFERENCES] ...)'.
65If there is no References: field, In-Reply-To: field is used instead.
59Reader macros for the vector are defined as `nntp-header-FIELD'. 66Reader macros for the vector are defined as `nntp-header-FIELD'.
60Writer macros for the vector are defined as `nntp-set-header-FIELD'. 67Writer macros for the vector are defined as `nntp-set-header-FIELD'.
61News group must be selected before calling me." 68Newsgroup must be selected before calling this."
62 (save-excursion 69 (save-excursion
63 (set-buffer nntp-server-buffer) 70 (set-buffer nntp-server-buffer)
64 ;;(erase-buffer) 71 ;;(erase-buffer)
@@ -139,28 +146,33 @@ News group must be selected before calling me."
139 (save-excursion (end-of-line) (point)))) 146 (save-excursion (end-of-line) (point))))
140 (setq xref nil)) 147 (setq xref nil))
141 ;; Extract References: 148 ;; Extract References:
149 ;; If no References: field, use In-Reply-To: field instead.
142 (goto-char (point-min)) 150 (goto-char (point-min))
143 (if (search-forward "\nReferences: " nil t) 151 (if (or (search-forward "\nReferences: " nil t)
152 (search-forward "\nIn-Reply-To: " nil t))
144 (setq references (buffer-substring 153 (setq references (buffer-substring
145 (point) 154 (point)
146 (save-excursion (end-of-line) (point)))) 155 (save-excursion (end-of-line) (point))))
147 (setq references nil)) 156 (setq references nil))
148 (setq headers 157 ;; Collect valid article only.
149 (cons (vector article subject from 158 (and article
150 xref lines date 159 message-id
151 message-id references) headers)) 160 (setq headers
161 (cons (vector article subject from
162 xref lines date
163 message-id references) headers)))
152 )) 164 ))
153 (setq sequence (cdr sequence)) 165 (setq sequence (cdr sequence))
154 (setq count (1+ count)) 166 (setq count (1+ count))
155 (and (numberp nntp-large-newsgroup) 167 (and (numberp nntp-large-newsgroup)
156 (> number nntp-large-newsgroup) 168 (> number nntp-large-newsgroup)
157 (zerop (% count 20)) 169 (zerop (% count 20))
158 (message "NNSPOOL: %d%% of headers received." 170 (message "NNSPOOL: Receiving headers... %d%%"
159 (/ (* count 100) number))) 171 (/ (* count 100) number)))
160 ) 172 )
161 (and (numberp nntp-large-newsgroup) 173 (and (numberp nntp-large-newsgroup)
162 (> number nntp-large-newsgroup) 174 (> number nntp-large-newsgroup)
163 (message "NNSPOOL: 100%% of headers received.")) 175 (message "NNSPOOL: Receiving headers... done"))
164 (nreverse headers) 176 (nreverse headers)
165 ))) 177 )))
166 178
@@ -175,18 +187,18 @@ If HOST is nil, use value of environment variable `NNTPSERVER'.
175If optional argument SERVICE is non-nil, open by the service name." 187If optional argument SERVICE is non-nil, open by the service name."
176 (let ((host (or host (getenv "NNTPSERVER"))) 188 (let ((host (or host (getenv "NNTPSERVER")))
177 (status nil)) 189 (status nil))
178 (setq nntp-status-message-string "") 190 (setq nntp-status-string "")
179 (cond ((and (file-directory-p nnspool-spool-directory) 191 (cond ((and (file-directory-p nnspool-spool-directory)
180 (file-exists-p nnspool-active-file) 192 (file-exists-p nnspool-active-file)
181 (string-equal host (system-name))) 193 (string-equal host (system-name)))
182 (setq status (nnspool-open-server-internal host service))) 194 (setq status (nnspool-open-server-internal host service)))
183 ((string-equal host (system-name)) 195 ((string-equal host (system-name))
184 (setq nntp-status-message-string 196 (setq nntp-status-string
185 (format "%s has no news spool. Goodbye." host))) 197 (format "%s has no news spool. Goodbye." host)))
186 ((null host) 198 ((null host)
187 (setq nntp-status-message-string "NNTP server is not specified.")) 199 (setq nntp-status-string "NNTP server is not specified."))
188 (t 200 (t
189 (setq nntp-status-message-string 201 (setq nntp-status-string
190 (format "NNSPOOL: cannot talk to %s." host))) 202 (format "NNSPOOL: cannot talk to %s." host)))
191 ) 203 )
192 status 204 status
@@ -206,7 +218,7 @@ If the stream is opened, return T, otherwise return NIL."
206 218
207(defun nnspool-status-message () 219(defun nnspool-status-message ()
208 "Return server status response as string." 220 "Return server status response as string."
209 nntp-status-message-string 221 nntp-status-string
210 ) 222 )
211 223
212(defun nnspool-request-article (id) 224(defun nnspool-request-article (id)
@@ -247,7 +259,9 @@ If the stream is opened, return T, otherwise return NIL."
247 259
248(defun nnspool-request-stat (id) 260(defun nnspool-request-stat (id)
249 "Select article by message ID (or number)." 261 "Select article by message ID (or number)."
250 (error "NNSPOOL: STAT is not implemented.")) 262 (setq nntp-status-string "NNSPOOL: STAT is not implemented.")
263 nil
264 )
251 265
252(defun nnspool-request-group (group) 266(defun nnspool-request-group (group)
253 "Select news GROUP." 267 "Select news GROUP."
@@ -258,17 +272,32 @@ If the stream is opened, return T, otherwise return NIL."
258 )) 272 ))
259 273
260(defun nnspool-request-list () 274(defun nnspool-request-list ()
261 "List valid newsgoups." 275 "List active newsgoups."
262 (save-excursion 276 (save-excursion
263 (nnspool-find-file nnspool-active-file))) 277 (nnspool-find-file nnspool-active-file)))
264 278
279(defun nnspool-request-list-newsgroups ()
280 "List newsgroups (defined in NNTP2)."
281 (save-excursion
282 (nnspool-find-file nnspool-newsgroups-file)))
283
284(defun nnspool-request-list-distributions ()
285 "List distributions (defined in NNTP2)."
286 (save-excursion
287 (nnspool-find-file nnspool-distributions-file)))
288
265(defun nnspool-request-last () 289(defun nnspool-request-last ()
266 "Set current article pointer to the previous article in the current news group." 290 "Set current article pointer to the previous article
267 (error "NNSPOOL: LAST is not implemented.")) 291in the current news group."
292 (setq nntp-status-string "NNSPOOL: LAST is not implemented.")
293 nil
294 )
268 295
269(defun nnspool-request-next () 296(defun nnspool-request-next ()
270 "Advance current article pointer." 297 "Advance current article pointer."
271 (error "NNSPOOL: NEXT is not implemented.")) 298 (setq nntp-status-string "NNSPOOL: NEXT is not implemented.")
299 nil
300 )
272 301
273(defun nnspool-request-post () 302(defun nnspool-request-post ()
274 "Post a new news in current buffer." 303 "Post a new news in current buffer."
@@ -276,7 +305,7 @@ If the stream is opened, return T, otherwise return NIL."
276 ;; We have to work in the server buffer because of NEmacs hack. 305 ;; We have to work in the server buffer because of NEmacs hack.
277 (copy-to-buffer nntp-server-buffer (point-min) (point-max)) 306 (copy-to-buffer nntp-server-buffer (point-min) (point-max))
278 (set-buffer nntp-server-buffer) 307 (set-buffer nntp-server-buffer)
279 (apply 'call-process-region 308 (apply (function call-process-region)
280 (point-min) (point-max) 309 (point-min) (point-max)
281 nnspool-inews-program 'delete t nil nnspool-inews-switches) 310 nnspool-inews-program 'delete t nil nnspool-inews-switches)
282 (prog1 311 (prog1
@@ -289,7 +318,7 @@ If the stream is opened, return T, otherwise return NIL."
289 (string-match "spooled" (buffer-string))) 318 (string-match "spooled" (buffer-string)))
290 ;; Make status message by unfolding lines. 319 ;; Make status message by unfolding lines.
291 (subst-char-in-region (point-min) (point-max) ?\n ?\\ 'noundo) 320 (subst-char-in-region (point-min) (point-max) ?\n ?\\ 'noundo)
292 (setq nntp-status-message-string (buffer-string)) 321 (setq nntp-status-string (buffer-string))
293 (erase-buffer)) 322 (erase-buffer))
294 )) 323 ))
295 324
@@ -327,7 +356,7 @@ If the stream is opened, return T, otherwise return NIL."
327 (setq nntp-server-process nil)) 356 (setq nntp-server-process nil))
328 357
329(defun nnspool-find-article-by-message-id (id) 358(defun nnspool-find-article-by-message-id (id)
330 "Return full pathname of an article identified by message-ID." 359 "Return full pathname of an artilce identified by message-ID."
331 (save-excursion 360 (save-excursion
332 (let ((buffer (get-file-buffer nnspool-history-file))) 361 (let ((buffer (get-file-buffer nnspool-history-file)))
333 (if buffer 362 (if buffer
diff --git a/lisp/nntp.el b/lisp/nntp.el
index 14a0f99af3a..d14a91a64b7 100644
--- a/lisp/nntp.el
+++ b/lisp/nntp.el
@@ -1,6 +1,6 @@
1;;; nntp.el --- NNTP (RFC977) Interface for GNU Emacs 1;;; nntp.el --- NNTP (RFC977) Interface for GNU Emacs
2 2
3;; Copyright (C) 1987, 1988, 1989, 1990, 1992 Free Software Foundation, Inc. 3;; Copyright (C) 1987, 1988, 1989, 1990, 1992, 1993 Free Software Foundation, Inc.
4 4
5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6;; Keywords: news 6;; Keywords: news
@@ -55,14 +55,20 @@ code, the correct kanji code of the buffer associated with the NNTP
55server must be specified as follows: 55server must be specified as follows:
56 56
57(setq nntp-server-hook 57(setq nntp-server-hook
58 '(lambda () 58 (function
59 (lambda ()
59 ;; Server's Kanji code is EUC (NEmacs hack). 60 ;; Server's Kanji code is EUC (NEmacs hack).
60 (make-local-variable 'kanji-fileio-code) 61 (make-local-variable 'kanji-fileio-code)
61 (setq kanji-fileio-code 0))) 62 (setq kanji-fileio-code 0))))
62 63
63If you'd like to change something depending on the server in this 64If you'd like to change something depending on the server in this
64hook, use the variable `nntp-server-name'.") 65hook, use the variable `nntp-server-name'.")
65 66
67(defvar nntp-large-newsgroup 50
68 "*The number of the articles which indicates a large newsgroup.
69If the number of the articles is greater than the value, verbose
70messages will be shown to indicate the current status.")
71
66(defvar nntp-buggy-select (memq system-type '(usg-unix-v fujitsu-uts)) 72(defvar nntp-buggy-select (memq system-type '(usg-unix-v fujitsu-uts))
67 "*T if your select routine is buggy. 73 "*T if your select routine is buggy.
68If the select routine signals error or fall into infinite loop while 74If the select routine signals error or fall into infinite loop while
@@ -75,13 +81,12 @@ doesn't work properly.")
75If Emacs hangs up while retrieving headers, set the variable to a 81If Emacs hangs up while retrieving headers, set the variable to a
76lower value.") 82lower value.")
77 83
78(defvar nntp-large-newsgroup 50 84(defvar nntp-debug-read 10000
79 "*The number of the articles which indicates a large newsgroup. 85 "*Display '...' every 10Kbytes of a message being received if it is non-nil.
80If the number of the articles is greater than the value, verbose 86If it is a number, dots are displayed per the number.")
81messages will be shown to indicate the current status.")
82 87
83 88
84(defconst nntp-version "NNTP 3.10" 89(defconst nntp-version "NNTP 3.12"
85 "Version numbers of this version of NNTP.") 90 "Version numbers of this version of NNTP.")
86 91
87(defvar nntp-server-name nil 92(defvar nntp-server-name nil
@@ -95,7 +100,7 @@ messages will be shown to indicate the current status.")
95You'd better not use this variable in NNTP front-end program but 100You'd better not use this variable in NNTP front-end program but
96instead use `nntp-server-buffer'.") 101instead use `nntp-server-buffer'.")
97 102
98(defvar nntp-status-message-string nil 103(defvar nntp-status-string nil
99 "Save the server response message. 104 "Save the server response message.
100You'd better not use this variable in NNTP front-end program but 105You'd better not use this variable in NNTP front-end program but
101instead call function `nntp-status-message' to get status message.") 106instead call function `nntp-status-message' to get status message.")
@@ -163,7 +168,7 @@ instead call function `nntp-status-message' to get status message.")
163 (` (aset (, header) 6 (, id)))) 168 (` (aset (, header) 6 (, id))))
164 169
165(defmacro nntp-header-references (header) 170(defmacro nntp-header-references (header)
166 "Return references in HEADER." 171 "Return references (or in-reply-to) in HEADER."
167 (` (aref (, header) 7))) 172 (` (aref (, header) 7)))
168 173
169(defmacro nntp-set-header-references (header ref) 174(defmacro nntp-set-header-references (header ref)
@@ -174,9 +179,10 @@ instead call function `nntp-status-message' to get status message.")
174 "Return list of article headers specified by SEQUENCE of article id. 179 "Return list of article headers specified by SEQUENCE of article id.
175The format of list is 180The format of list is
176 `([NUMBER SUBJECT FROM XREF LINES DATE MESSAGE-ID REFERENCES] ...)'. 181 `([NUMBER SUBJECT FROM XREF LINES DATE MESSAGE-ID REFERENCES] ...)'.
182If there is no References: field, In-Reply-To: field is used instead.
177Reader macros for the vector are defined as `nntp-header-FIELD'. 183Reader macros for the vector are defined as `nntp-header-FIELD'.
178Writer macros for the vector are defined as `nntp-set-header-FIELD'. 184Writer macros for the vector are defined as `nntp-set-header-FIELD'.
179News group must be selected before calling me." 185Newsgroup must be selected before calling this."
180 (save-excursion 186 (save-excursion
181 (set-buffer nntp-server-buffer) 187 (set-buffer nntp-server-buffer)
182 (erase-buffer) 188 (erase-buffer)
@@ -216,7 +222,7 @@ News group must be selected before calling me."
216 (and (numberp nntp-large-newsgroup) 222 (and (numberp nntp-large-newsgroup)
217 (> number nntp-large-newsgroup) 223 (> number nntp-large-newsgroup)
218 (zerop (% received 20)) 224 (zerop (% received 20))
219 (message "NNTP: %d%% of headers received." 225 (message "NNTP: Receiving headers... %d%%"
220 (/ (* received 100) number))) 226 (/ (* received 100) number)))
221 (nntp-accept-response)) 227 (nntp-accept-response))
222 )) 228 ))
@@ -231,7 +237,7 @@ News group must be selected before calling me."
231 (nntp-accept-response))) 237 (nntp-accept-response)))
232 (and (numberp nntp-large-newsgroup) 238 (and (numberp nntp-large-newsgroup)
233 (> number nntp-large-newsgroup) 239 (> number nntp-large-newsgroup)
234 (message "NNTP: 100%% of headers received.")) 240 (message "NNTP: Receiving headers... done"))
235 ;; Now all of replies are received. 241 ;; Now all of replies are received.
236 (setq received number) 242 (setq received number)
237 ;; First, fold continuation lines. 243 ;; First, fold continuation lines.
@@ -263,7 +269,7 @@ News group must be selected before calling me."
263 ;; Thanks go to mly@AI.MIT.EDU (Richard Mlynarik) 269 ;; Thanks go to mly@AI.MIT.EDU (Richard Mlynarik)
264 (while (and (not (eobp)) 270 (while (and (not (eobp))
265 (not (memq (following-char) '(?2 ?3)))) 271 (not (memq (following-char) '(?2 ?3))))
266 (if (looking-at "\\(From\\|Subject\\|Date\\|Lines\\|Xref\\|References\\):[ \t]+\\([^ \t\n]+.*\\)\r$") 272 (if (looking-at "\\(From\\|Subject\\|Date\\|Lines\\|Xref\\|References\\|In-Reply-To\\):[ \t]+\\([^ \t\n]+.*\\)\r$")
267 (let ((s (buffer-substring 273 (let ((s (buffer-substring
268 (match-beginning 2) (match-end 2))) 274 (match-beginning 2) (match-end 2)))
269 (c (char-after (match-beginning 0)))) 275 (c (char-after (match-beginning 0))))
@@ -280,6 +286,11 @@ News group must be selected before calling me."
280 (setq xref s)) 286 (setq xref s))
281 ((char-equal c ?R) ;References: 287 ((char-equal c ?R) ;References:
282 (setq references s)) 288 (setq references s))
289 ;; In-Reply-To: should be used only when
290 ;; there is no References: field.
291 ((and (char-equal c ?I) ;In-Reply-To:
292 (null references))
293 (setq references s))
283 ))) 294 )))
284 (forward-line 1)) 295 (forward-line 1))
285 ;; Finished to parse one header. 296 ;; Finished to parse one header.
@@ -287,10 +298,13 @@ News group must be selected before calling me."
287 (setq subject "(None)")) 298 (setq subject "(None)"))
288 (if (null from) 299 (if (null from)
289 (setq from "(Unknown User)")) 300 (setq from "(Unknown User)"))
290 (setq headers 301 ;; Collect valid article only.
291 (cons (vector article subject from 302 (and article
292 xref lines date 303 message-id
293 message-id references) headers)) 304 (setq headers
305 (cons (vector article subject from
306 xref lines date
307 message-id references) headers)))
294 ) 308 )
295 (t (forward-line 1)) 309 (t (forward-line 1))
296 ) 310 )
@@ -318,7 +332,7 @@ If HOST is nil, use value of environment variable `NNTPSERVER'.
318If optional argument SERVICE is non-nil, open by the service name." 332If optional argument SERVICE is non-nil, open by the service name."
319 (let ((host (or host (getenv "NNTPSERVER"))) 333 (let ((host (or host (getenv "NNTPSERVER")))
320 (status nil)) 334 (status nil))
321 (setq nntp-status-message-string "") 335 (setq nntp-status-string "")
322 (cond ((and host (nntp-open-server-internal host service)) 336 (cond ((and host (nntp-open-server-internal host service))
323 (setq status (nntp-wait-for-response "^[23].*\r$")) 337 (setq status (nntp-wait-for-response "^[23].*\r$"))
324 ;; Do check unexpected close of connection. 338 ;; Do check unexpected close of connection.
@@ -331,7 +345,7 @@ If optional argument SERVICE is non-nil, open by the service name."
331 (nntp-close-server-internal) 345 (nntp-close-server-internal)
332 )) 346 ))
333 ((null host) 347 ((null host)
334 (setq nntp-status-message-string "NNTP server is not specified.")) 348 (setq nntp-status-string "NNTP server is not specified."))
335 ) 349 )
336 status 350 status
337 )) 351 ))
@@ -362,11 +376,11 @@ If the stream is opened, return T, otherwise return NIL."
362 376
363(defun nntp-status-message () 377(defun nntp-status-message ()
364 "Return server status response as string." 378 "Return server status response as string."
365 (if (and nntp-status-message-string 379 (if (and nntp-status-string
366 ;; NNN MESSAGE 380 ;; NNN MESSAGE
367 (string-match "[0-9][0-9][0-9][ \t]+\\([^\r]*\\).*$" 381 (string-match "[0-9][0-9][0-9][ \t]+\\([^\r]*\\).*$"
368 nntp-status-message-string)) 382 nntp-status-string))
369 (substring nntp-status-message-string (match-beginning 1) (match-end 1)) 383 (substring nntp-status-string (match-beginning 1) (match-end 1))
370 ;; Empty message if nothing. 384 ;; Empty message if nothing.
371 "" 385 ""
372 )) 386 ))
@@ -405,14 +419,29 @@ If the stream is opened, return T, otherwise return NIL."
405 (nntp-send-command "^[23].*$" "GROUP" group)) 419 (nntp-send-command "^[23].*$" "GROUP" group))
406 420
407(defun nntp-request-list () 421(defun nntp-request-list ()
408 "List valid newsgoups." 422 "List active newsgroups."
409 (prog1 423 (prog1
410 (nntp-send-command "^\\.\r$" "LIST") 424 (nntp-send-command "^\\.\r$" "LIST")
411 (nntp-decode-text) 425 (nntp-decode-text)
412 )) 426 ))
413 427
428(defun nntp-request-list-newsgroups ()
429 "List newsgroups (defined in NNTP2)."
430 (prog1
431 (nntp-send-command "^\\.\r$" "LIST NEWSGROUPS")
432 (nntp-decode-text)
433 ))
434
435(defun nntp-request-list-distributions ()
436 "List distributions (defined in NNTP2)."
437 (prog1
438 (nntp-send-command "^\\.\r$" "LIST DISTRIBUTIONS")
439 (nntp-decode-text)
440 ))
441
414(defun nntp-request-last () 442(defun nntp-request-last ()
415 "Set current article pointer to the previous article in the current news group." 443 "Set current article pointer to the previous article
444in the current news group."
416 (nntp-send-command "^[23].*\r$" "LAST")) 445 (nntp-send-command "^[23].*\r$" "LAST"))
417 446
418(defun nntp-request-next () 447(defun nntp-request-next ()
@@ -514,7 +543,10 @@ If the stream is opened, return T, otherwise return NIL."
514 "Wait for server response which matches REGEXP." 543 "Wait for server response which matches REGEXP."
515 (save-excursion 544 (save-excursion
516 (let ((status t) 545 (let ((status t)
517 (wait t)) 546 (wait t)
547 (dotnum 0) ;Number of "." being displayed.
548 (dotsize ;How often "." displayed.
549 (if (numberp nntp-debug-read) nntp-debug-read 10000)))
518 (set-buffer nntp-server-buffer) 550 (set-buffer nntp-server-buffer)
519 ;; Wait for status response (RFC977). 551 ;; Wait for status response (RFC977).
520 ;; 1xx - Informative message. 552 ;; 1xx - Informative message.
@@ -536,7 +568,7 @@ If the stream is opened, return T, otherwise return NIL."
536 )) 568 ))
537 ;; Save status message. 569 ;; Save status message.
538 (end-of-line) 570 (end-of-line)
539 (setq nntp-status-message-string 571 (setq nntp-status-string
540 (buffer-substring (point-min) (point))) 572 (buffer-substring (point-min) (point)))
541 (if status 573 (if status
542 (progn 574 (progn
@@ -549,10 +581,19 @@ If the stream is opened, return T, otherwise return NIL."
549 ;; (save-excursion (end-of-line) (point)))) 581 ;; (save-excursion (end-of-line) (point))))
550 (if (looking-at regexp) 582 (if (looking-at regexp)
551 (setq wait nil) 583 (setq wait nil)
552 (message "NNTP: Reading...") 584 (if nntp-debug-read
585 (let ((newnum (/ (buffer-size) dotsize)))
586 (if (not (= dotnum newnum))
587 (progn
588 (setq dotnum newnum)
589 (message "NNTP: Reading %s"
590 (make-string dotnum ?.))))))
553 (nntp-accept-response) 591 (nntp-accept-response)
554 (message "") 592 ;;(if nntp-debug-read (message ""))
555 )) 593 ))
594 ;; Remove "...".
595 (if (and nntp-debug-read (> dotnum 0))
596 (message ""))
556 ;; Successfully received server response. 597 ;; Successfully received server response.
557 t 598 t
558 )) 599 ))
@@ -572,7 +613,7 @@ If the stream is opened, return T, otherwise return NIL."
572 (setq cmd (concat cmd " " (car strings))) 613 (setq cmd (concat cmd " " (car strings)))
573 (setq strings (cdr strings))) 614 (setq strings (cdr strings)))
574 ;; Command line must be terminated by a CR-LF. 615 ;; Command line must be terminated by a CR-LF.
575 (process-send-string nntp-server-process (concat cmd "\n")) 616 (process-send-string nntp-server-process (concat cmd "\r\n"))
576 )) 617 ))
577 618
578(defun nntp-send-region-to-server (begin end) 619(defun nntp-send-region-to-server (begin end)