1 ;;; gnus.el --- a newsreader for GNU Emacs
2 ;; Copyright (C) 1987,88,89,90,93,94,95 Free Software Foundation, Inc.
4 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
5 ;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26 ;; Although Gnus looks suspiciously like GNUS, it isn't quite the same
27 ;; beast. Most internal structures have been changed. If you have
28 ;; written packages that depend on any of the hash tables,
29 ;; `gnus-newsrc-alist', `gnus-killed-assoc', marked lists, the .newsrc
30 ;; buffer, or internal knowledge of the `nntp-header-' macros, or
31 ;; dependence on the buffers having a certain format, your code will
36 (eval '(run-hooks 'gnus-load-hook
))
42 ;; Site dependent variables. These variables should be defined in
45 (defvar gnus-default-nntp-server nil
46 "Specify a default NNTP server.
47 This variable should be defined in paths.el, and should never be set
49 If you want to change servers, you should use `gnus-select-method'.
50 See the documentation to that variable.")
52 (defconst gnus-backup-default-subscribed-newsgroups
53 '("news.announce.newusers" "news.groups.questions" "gnu.emacs.gnus")
54 "Default default new newsgroups the first time Gnus is run.
55 Should be set in paths.el, and shouldn't be touched by the user.")
57 (defvar gnus-local-domain nil
58 "Local domain name without a host name.
59 The DOMAINNAME environment variable is used instead if it is defined.
60 If the `system-name' function returns the full Internet name, there is
61 no need to set this variable.")
63 (defvar gnus-local-organization nil
64 "String with a description of what organization (if any) the user belongs to.
65 The ORGANIZATION environment variable is used instead if it is defined.
66 If this variable contains a function, this function will be called
67 with the current newsgroup name as the argument. The function should
70 In any case, if the string (either in the variable, in the environment
71 variable, or returned by the function) is a file name, the contents of
72 this file will be used as the organization.")
74 (defvar gnus-use-generic-from nil
75 "If nil, the full host name will be the system name prepended to the domain name.
76 If this is a string, the full host name will be this string.
77 If this is non-nil, non-string, the domain name will be used as the
80 (defvar gnus-use-generic-path nil
81 "If nil, use the NNTP server name in the Path header.
82 If stringp, use this; if non-nil, use no host name (user name only).")
85 ;; Customization variables
87 ;; Don't touch this variable.
88 (defvar gnus-nntp-service
"nntp"
89 "*NNTP service name (\"nntp\" or 119).
90 This is an obsolete variable, which is scarcely used. If you use an
91 nntp server for your newsgroup and want to change the port number
92 used to 899, you would say something along these lines:
94 (setq gnus-select-method '(nntp \"my.nntp.server\" (nntp-port-number 899)))")
96 (defvar gnus-select-method
98 (list 'nntp
(or (getenv "NNTPSERVER")
99 (if (and gnus-default-nntp-server
100 (not (string= gnus-default-nntp-server
"")))
101 gnus-default-nntp-server
)
103 (if (or (null gnus-nntp-service
)
104 (equal gnus-nntp-service
"nntp"))
106 (list gnus-nntp-service
)))
107 "*Default method for selecting a newsgroup.
108 This variable should be a list, where the first element is how the
109 news is to be fetched, the second is the address.
111 For instance, if you want to get your news via NNTP from
112 \"flab.flab.edu\", you could say:
114 (setq gnus-select-method '(nntp \"flab.flab.edu\"))
116 If you want to use your local spool, say:
118 (setq gnus-select-method (list 'nnspool (system-name)))
120 If you use this variable, you must set `gnus-nntp-server' to nil.
122 There is a lot more to know about select methods and virtual servers -
123 see the manual for details.")
125 ;; Added by Sudish Joseph <joseph@cis.ohio-state.edu>.
126 (defvar gnus-post-method nil
127 "*Preferred method for posting USENET news.
128 If this variable is nil, Gnus will use the current method to decide
129 which method to use when posting. If it is non-nil, it will override
130 the current method. This method will not be used in mail groups and
131 the like, only in \"real\" newsgroups.
133 The value must be a valid method as discussed in the documentation of
134 `gnus-select-method'.")
136 (defvar gnus-refer-article-method nil
137 "*Preferred method for fetching an article by Message-ID.
138 If you are reading news from the local spool (with nnspool), fetching
139 articles by Message-ID is painfully slow. By setting this method to an
140 nntp method, you might get acceptable results.
142 The value of this variable must be a valid select method as discussed
143 in the documentation of `gnus-select-method'")
145 (defvar gnus-secondary-select-methods nil
146 "*A list of secondary methods that will be used for reading news.
147 This is a list where each element is a complete select method (see
148 `gnus-select-method').
150 If, for instance, you want to read your mail with the nnml backend,
151 you could set this variable:
153 (setq gnus-secondary-select-methods '((nnml \"\")))")
155 (defvar gnus-secondary-servers nil
156 "*List of NNTP servers that the user can choose between interactively.
157 To make Gnus query you for a server, you have to give `gnus' a
158 non-numeric prefix - `C-u M-x gnus', in short.")
160 (defvar gnus-nntp-server nil
161 "*The name of the host running the NNTP server.
162 This variable is semi-obsolete. Use the `gnus-select-method'
165 (defvar gnus-startup-file
"~/.newsrc"
166 "*Your `.newsrc' file.
167 `.newsrc-SERVER' will be used instead if that exists.")
169 (defvar gnus-init-file
"~/.gnus"
170 "*Your Gnus elisp startup file.
171 If a file with the .el or .elc suffixes exist, it will be read
174 (defvar gnus-group-faq-directory
175 "/ftp@mirrors.aol.com:/pub/rtfm/usenet/"
176 "*Directory where the group FAQs are stored.
177 This will most commonly be on a remote machine, and the file will be
180 Note that Gnus uses an aol machine as the default directory. If this
181 feels fundamentally unclean, just think of it as a way to finally get
182 something of value back from them.
184 If the default site is too slow, try one of these:
186 North America: ftp.uu.net /usenet/news.answers
187 mirrors.aol.com /pub/rtfm/usenet
188 ftp.seas.gwu.edu /pub/rtfm
189 rtfm.mit.edu /pub/usenet/news.answers
190 Europe: ftp.uni-paderborn.de /pub/FAQ
191 ftp.Germany.EU.net /pub/newsarchive/news.answers
192 ftp.sunet.se /pub/usenet
193 Asia: nctuccca.edu.tw /USENET/FAQ
194 hwarang.postech.ac.kr /pub/usenet/news.answers
195 ftp.hk.super.net /mirror/faqs")
197 (defvar gnus-group-archive-directory
198 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
199 "*The address of the (ding) archives.")
201 (defvar gnus-group-recent-archive-directory
202 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/"
203 "*The address of the most recent (ding) articles.")
205 (defvar gnus-default-subscribed-newsgroups nil
206 "*This variable lists what newsgroups should be subscribed the first time Gnus is used.
207 It should be a list of strings.
208 If it is `t', Gnus will not do anything special the first time it is
209 started; it'll just use the normal newsgroups subscription methods.")
211 (defvar gnus-use-cross-reference t
212 "*Non-nil means that cross referenced articles will be marked as read.
213 If nil, ignore cross references. If t, mark articles as read in
214 subscribed newsgroups. If neither t nor nil, mark as read in all
217 (defvar gnus-use-dribble-file t
218 "*Non-nil means that Gnus will use a dribble file to store user updates.
219 If Emacs should crash without saving the .newsrc files, complete
220 information can be restored from the dribble file.")
222 (defvar gnus-asynchronous nil
223 "*If non-nil, Gnus will supply backends with data needed for async article fetching.")
225 (defvar gnus-asynchronous-article-function nil
226 "*Function for picking articles to pre-fetch, possibly.")
228 (defvar gnus-score-file-single-match-alist nil
229 "*Alist mapping regexps to lists of score files.
230 Each element of this alist should be of the form
231 (\"REGEXP\" [ \"SCORE-FILE-1\" ] [ \"SCORE-FILE-2\" ] ... )
233 If the name of a group is matched by REGEXP, the corresponding scorefiles
234 will be used for that group.
235 The first match found is used, subsequent matching entries are ignored (to
236 use multiple matches, see gnus-score-file-multiple-match-alist).
238 These score files are loaded in addition to any files returned by
239 gnus-score-find-score-files-function (which see).")
241 (defvar gnus-score-file-multiple-match-alist nil
242 "*Alist mapping regexps to lists of score files.
243 Each element of this alist should be of the form
244 (\"REGEXP\" [ \"SCORE-FILE-1\" ] [ \"SCORE-FILE-2\" ] ... )
246 If the name of a group is matched by REGEXP, the corresponding scorefiles
247 will be used for that group.
248 If multiple REGEXPs match a group, the score files corresponding to each
249 match will be used (for only one match to be used, see
250 gnus-score-file-single-match-alist).
252 These score files are loaded in addition to any files returned by
253 gnus-score-find-score-files-function (which see).")
256 (defvar gnus-score-file-suffix
"SCORE"
257 "*Suffix of the score files.")
259 (defvar gnus-adaptive-file-suffix
"ADAPT"
260 "*Suffix of the adaptive score files.")
262 (defvar gnus-score-find-score-files-function
'gnus-score-find-bnews
263 "*Function used to find score files.
264 The function will be called with the group name as the argument, and
265 should return a list of score files to apply to that group. The score
266 files do not actually have to exist.
268 Predefined values are:
270 gnus-score-find-single: Only apply the group's own score file.
271 gnus-score-find-hierarchical: Also apply score files from parent groups.
272 gnus-score-find-bnews: Apply score files whose names matches.
274 See the documentation to these functions for more information.
276 This variable can also be a list of functions to be called. Each
277 function should either return a list of score files, or a list of
280 (defvar gnus-score-interactive-default-score
1000
281 "*Scoring commands will raise/lower the score with this number as the default.")
283 (defvar gnus-large-newsgroup
200
284 "*The number of articles which indicates a large newsgroup.
285 If the number of articles in a newsgroup is greater than this value,
286 confirmation is required for selecting the newsgroup.")
288 ;; Suggested by Andrew Eskilsson <pi92ae@lelle.pt.hk-r.se>.
289 (defvar gnus-no-groups-message
"No news is horrible news"
290 "*Message displayed by Gnus when no groups are available.")
292 (defvar gnus-use-long-file-name
(not (memq system-type
'(usg-unix-v xenix
)))
293 "*Non-nil means that the default name of a file to save articles in is the group name.
294 If it's nil, the directory form of the group name is used instead.
296 If this variable is a list, and the list contains the element
297 `not-score', long file names will not be used for score files; if it
298 contains the element `not-save', long file names will not be used for
299 saving; and if it contains the element `not-kill', long file names
300 will not be used for kill files.")
302 (defvar gnus-article-save-directory
(or (getenv "SAVEDIR") "~/News/")
303 "*Name of the directory articles will be saved in (default \"~/News\").
304 Initialized from the SAVEDIR environment variable.")
306 (defvar gnus-kill-files-directory
(or (getenv "SAVEDIR") "~/News/")
307 "*Name of the directory where kill files will be stored (default \"~/News\").
308 Initialized from the SAVEDIR environment variable.")
310 (defvar gnus-default-article-saver
'gnus-summary-save-in-rmail
311 "*A function to save articles in your favorite format.
312 The function must be interactively callable (in other words, it must
313 be an Emacs command).
315 Gnus provides the following functions:
317 * gnus-summary-save-in-rmail (Rmail format)
318 * gnus-summary-save-in-mail (Unix mail format)
319 * gnus-summary-save-in-folder (MH folder)
320 * gnus-summary-save-in-file (article format).
321 * gnus-summary-save-in-vm (use VM's folder format).")
323 (defvar gnus-rmail-save-name
(function gnus-plain-save-name
)
324 "*A function generating a file name to save articles in Rmail format.
325 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
327 (defvar gnus-mail-save-name
(function gnus-plain-save-name
)
328 "*A function generating a file name to save articles in Unix mail format.
329 The function is called with NEWSGROUP, HEADERS, and optional LAST-FILE.")
331 (defvar gnus-folder-save-name
(function gnus-folder-save-name
)
332 "*A function generating a file name to save articles in MH folder.
333 The function is called with NEWSGROUP, HEADERS, and optional LAST-FOLDER.")
335 (defvar gnus-file-save-name
(function gnus-numeric-save-name
)
336 "*A function generating a file name to save articles in article format.
337 The function is called with NEWSGROUP, HEADERS, and optional
340 (defvar gnus-split-methods nil
341 "*Variable used to suggest where articles are to be saved.
342 The syntax of this variable is the same as `nnmail-split-methods'.
344 For instance, if you would like to save articles related to Gnus in
345 the file \"gnus-stuff\", and articles related to VM in \"vm-stuff\",
346 you could set this variable to something like:
348 '((\"^Subject:.*gnus\\|^Newsgroups:.*gnus\" \"gnus-stuff\")
349 (\"^Subject:.*vm\\|^Xref:.*vm\" \"vm-stuff\"))")
351 (defvar gnus-save-score nil
352 "*If non-nil, save group scoring info.")
354 (defvar gnus-use-adaptive-scoring nil
355 "*If non-nil, use some adaptive scoring scheme.")
357 (defvar gnus-use-cache nil
358 "*If non-nil, Gnus will cache (some) articles locally.")
360 (defvar gnus-use-scoring t
361 "*If non-nil, enable scoring.")
363 (defvar gnus-fetch-old-headers nil
364 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
365 If an unread article in the group refers to an older, already read (or
366 just marked as read) article, the old article will not normally be
367 displayed in the Summary buffer. If this variable is non-nil, Gnus
368 will attempt to grab the headers to the old articles, and thereby
369 build complete threads. If it has the value `some', only enough
370 headers to connect otherwise loose threads will be displayed.
372 The server has to support XOVER for any of this to work.")
375 ;(defvar gnus-visual t
376 ; "*If non-nil, will do various highlighting.
377 ;If nil, no mouse highlights (or any other highlights) will be
378 ;performed. This might speed up Gnus some when generating large group
379 ;and summary buffers.")
381 (defvar gnus-novice-user t
382 "*Non-nil means that you are a usenet novice.
383 If non-nil, verbose messages may be displayed and confirmations may be
386 (defvar gnus-expert-user nil
387 "*Non-nil means that you will never be asked for confirmation about anything.
388 And that means *anything*.")
390 (defvar gnus-verbose
7
391 "*Integer that says how verbose Gnus should be.
392 The higher the number, the more messages Gnus will flash to say what
393 it's doing. At zero, Gnus will be totally mute; at five, Gnus will
394 display most important messages; and at ten, Gnus will keep on
395 jabbering all the time.")
397 (defvar gnus-keep-same-level nil
398 "*Non-nil means that the next newsgroup after the current will be on the same level.
399 When you type, for instance, `n' after reading the last article in the
400 current newsgroup, you will go to the next newsgroup. If this variable
401 is nil, the next newsgroup will be the next from the group
403 If this variable is non-nil, Gnus will either put you in the
404 next newsgroup with the same level, or, if no such newsgroup is
405 available, the next newsgroup with the lowest possible level higher
406 than the current level.
407 If this variable is `best', Gnus will make the next newsgroup the one
408 with the best level.")
410 (defvar gnus-summary-make-false-root
'adopt
411 "*nil means that Gnus won't gather loose threads.
412 If the root of a thread has expired or been read in a previous
413 session, the information necessary to build a complete thread has been
414 lost. Instead of having many small sub-threads from this original thread
415 scattered all over the summary buffer, Gnus can gather them.
417 If non-nil, Gnus will try to gather all loose sub-threads from an
418 original thread into one large thread.
420 If this variable is non-nil, it should be one of `none', `adopt',
423 If this variable is `none', Gnus will not make a false root, but just
424 present the sub-threads after another.
425 If this variable is `dummy', Gnus will create a dummy root that will
426 have all the sub-threads as children.
427 If this variable is `adopt', Gnus will make one of the \"children\"
428 the parent and mark all the step-children as such.
429 If this variable is `empty', the \"children\" are printed with empty
430 subject fields. (Or rather, they will be printed with a string
431 given by the `gnus-summary-same-subject' variable.)")
433 (defvar gnus-summary-gather-subject-limit nil
434 "*Maximum length of subject comparisons when gathering loose threads.
435 Use nil to compare full subjects. Setting this variable to a low
436 number will help gather threads that have been corrupted by
437 newsreaders chopping off subject lines, but it might also mean that
438 unrelated articles that have subject that happen to begin with the
439 same few characters will be incorrectly gathered.
441 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
442 comparing subjects.")
444 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
445 (defvar gnus-summary-same-subject
""
446 "*String indicating that the current article has the same subject as the previous.
447 This variable will only be used if the value of
448 `gnus-summary-make-false-root' is `empty'.")
450 (defvar gnus-summary-goto-unread t
451 "*If non-nil, marking commands will go to the next unread article.")
453 (defvar gnus-group-goto-unread t
454 "*If non-nil, movement commands will go to the next unread and subscribed group.")
456 (defvar gnus-check-new-newsgroups t
457 "*Non-nil means that Gnus will add new newsgroups at startup.
458 If this variable is `ask-server', Gnus will ask the server for new
459 groups since the last time it checked. This means that the killed list
460 is no longer necessary, so you could set `gnus-save-killed-list' to
463 A variant is to have this variable be a list of select methods. Gnus
464 will then use the `ask-server' method on all these select methods to
465 query for new groups from all those servers.
468 (setq gnus-check-new-newsgroups
469 '((nntp \"some.server\") (nntp \"other.server\")))
471 If this variable is nil, then you have to tell Gnus explicitly to
472 check for new newsgroups with \\<gnus-group-mode-map>\\[gnus-find-new-newsgroups].")
474 (defvar gnus-check-bogus-newsgroups nil
475 "*Non-nil means that Gnus will check and remove bogus newsgroup at startup.
476 If this variable is nil, then you have to tell Gnus explicitly to
477 check for bogus newsgroups with \\<gnus-group-mode-map>\\[gnus-group-check-bogus-groups].")
479 (defvar gnus-read-active-file t
480 "*Non-nil means that Gnus will read the entire active file at startup.
481 If this variable is nil, Gnus will only know about the groups in your
484 If this variable is `some', Gnus will try to only read the relevant
485 parts of the active file from the server. Not all servers support
486 this, and it might be quite slow with other servers, but this should
487 generally be faster than both the t and nil value.
489 If you set this variable to nil or `some', you probably still want to
490 be told about new newsgroups that arrive. To do that, set
491 `gnus-check-new-newsgroups' to `ask-server'. This may not work
492 properly with all servers.")
494 (defvar gnus-level-subscribed
5
495 "*Groups with levels less than or equal to this variable are subscribed.")
497 (defvar gnus-level-unsubscribed
7
498 "*Groups with levels less than or equal to this variable are unsubscribed.
499 Groups with levels less than `gnus-level-subscribed', which should be
500 less than this variable, are subscribed.")
502 (defvar gnus-level-zombie
8
503 "*Groups with this level are zombie groups.")
505 (defvar gnus-level-killed
9
506 "*Groups with this level are killed.")
508 (defvar gnus-level-default-subscribed
3
509 "*New subscribed groups will be subscribed at this level.")
511 (defvar gnus-level-default-unsubscribed
6
512 "*New unsubscribed groups will be unsubscribed at this level.")
514 (defvar gnus-activate-foreign-newsgroups
4
515 "*If nil, Gnus will not check foreign newsgroups at startup.
516 If it is non-nil, it should be a number between one and nine. Foreign
517 newsgroups that have a level lower or equal to this number will be
518 activated on startup. For instance, if you want to active all
519 subscribed newsgroups, but not the rest, you'd set this variable to
520 `gnus-level-subscribed'.
522 If you subscribe to lots of newsgroups from different servers, startup
523 might take a while. By setting this variable to nil, you'll save time,
524 but you won't be told how many unread articles there are in the
527 (defvar gnus-save-newsrc-file t
528 "*Non-nil means that Gnus will save the `.newsrc' file.
529 Gnus always saves its own startup file, which is called
530 \".newsrc.eld\". The file called \".newsrc\" is in a format that can
531 be readily understood by other newsreaders. If you don't plan on
532 using other newsreaders, set this variable to nil to save some time on
535 (defvar gnus-save-killed-list t
536 "*If non-nil, save the list of killed groups to the startup file.
537 This will save both time (when starting and quitting) and space (both
538 memory and disk), but it will also mean that Gnus has no record of
539 which groups are new and which are old, so the automatic new
540 newsgroups subscription methods become meaningless. You should always
541 set `gnus-check-new-newsgroups' to `ask-server' or nil if you set this
544 (defvar gnus-interactive-catchup t
545 "*If non-nil, require your confirmation when catching up a group.")
547 (defvar gnus-interactive-post t
548 "*If non-nil, group name will be asked for when posting.")
550 (defvar gnus-interactive-exit t
551 "*If non-nil, require your confirmation when exiting Gnus.")
553 (defvar gnus-kill-killed t
554 "*If non-nil, Gnus will apply kill files to already killed articles.
555 If it is nil, Gnus will never apply kill files to articles that have
556 already been through the scoring process, which might very well save lots
559 (defvar gnus-extract-address-components
'gnus-extract-address-components
560 "*Function for extracting address components from a From header.
561 Two pre-defined function exist: `gnus-extract-address-components',
562 which is the default, quite fast, and too simplistic solution, and
563 `mail-extract-address-components', which works much better, but is
566 (defvar gnus-summary-default-score
0
567 "*Default article score level.
568 If this variable is nil, scoring will be disabled.")
570 (defvar gnus-summary-zcore-fuzz
0
571 "*Fuzziness factor for the zcore in the summary buffer.
572 Articles with scores closer than this to `gnus-summary-default-score'
573 will not be marked.")
575 (defvar gnus-simplify-subject-fuzzy-regexp nil
576 "*Regular expression that will be removed from subject strings if
577 fuzzy subject simplification is selected.")
579 (defvar gnus-group-default-list-level gnus-level-subscribed
580 "*Default listing level.
581 Ignored if `gnus-group-use-permanent-levels' is non-nil.")
583 (defvar gnus-group-use-permanent-levels nil
584 "*If non-nil, once you set a level, Gnus will use this level.")
586 (defvar gnus-show-mime nil
587 "*If non-nil, do mime processing of articles.
588 The articles will simply be fed to the function given by
589 `gnus-show-mime-method'.")
591 (defvar gnus-strict-mime t
592 "*If nil, decode MIME header even if there is not Mime-Version field.")
594 (defvar gnus-show-mime-method
(function metamail-buffer
)
595 "*Function to process a MIME message.
596 The function is called from the article buffer.")
598 (defvar gnus-show-threads t
599 "*If non-nil, display threads in summary mode.")
601 (defvar gnus-thread-hide-subtree nil
602 "*If non-nil, hide all threads initially.
603 If threads are hidden, you have to run the command
604 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
605 to expose hidden threads.")
607 (defvar gnus-thread-hide-killed t
608 "*If non-nil, hide killed threads automatically.")
610 (defvar gnus-thread-ignore-subject nil
611 "*If non-nil, ignore subjects and do all threading based on the Reference header.
612 If nil, which is the default, articles that have different subjects
613 from their parents will start separate threads.")
615 (defvar gnus-thread-indent-level
4
616 "*Number that says how much each sub-thread should be indented.")
618 (defvar gnus-ignored-newsgroups
619 (purecopy (mapconcat 'identity
620 '("^to\\." ; not "real" groups
621 "^[0-9. \t]+ " ; all digits in name
622 "[][\"#'()]" ; bogus characters
625 "*A regexp to match uninteresting newsgroups in the active file.
626 Any lines in the active file matching this regular expression are
627 removed from the newsgroup list before anything else is done to it,
628 thus making them effectively non-existent.")
630 (defvar gnus-ignored-headers
631 "^Path:\\|^Posting-Version:\\|^Article-I.D.:\\|^Expires:\\|^Date-Received:\\|^References:\\|^Control:\\|^Xref:\\|^Lines:\\|^Posted:\\|^Relay-Version:\\|^Message-ID:\\|^Nf-ID:\\|^Nf-From:\\|^Approved:\\|^Sender:\\|^Received:\\|^Mail-from:"
632 "*All headers that match this regexp will be hidden.
633 If `gnus-visible-headers' is non-nil, this variable will be ignored.")
635 (defvar gnus-visible-headers
"^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^Cc:"
636 "*All headers that do not match this regexp will be hidden.
637 If this variable is non-nil, `gnus-ignored-headers' will be ignored.")
639 (defvar gnus-sorted-header-list
640 '("^From:" "^Subject:" "^Summary:" "^Keywords:" "^Newsgroups:" "^To:"
641 "^Cc:" "^Date:" "^Organization:")
642 "*This variable is a list of regular expressions.
643 If it is non-nil, headers that match the regular expressions will
644 be placed first in the article buffer in the sequence specified by
647 (defvar gnus-show-all-headers nil
648 "*If non-nil, don't hide any headers.")
650 (defvar gnus-save-all-headers t
651 "*If non-nil, don't remove any headers before saving.")
653 (defvar gnus-inhibit-startup-message nil
654 "*If non-nil, the startup message will not be displayed.")
656 (defvar gnus-signature-separator
"^-- *$"
657 "Regexp matching signature separator.")
659 (defvar gnus-auto-extend-newsgroup t
660 "*If non-nil, extend newsgroup forward and backward when requested.")
662 (defvar gnus-auto-select-first t
663 "*If non-nil, select the first unread article when entering a group.
664 If you want to prevent automatic selection of the first unread article
665 in some newsgroups, set the variable to nil in
666 `gnus-select-group-hook'.")
668 (defvar gnus-auto-select-next t
669 "*If non-nil, offer to go to the next group from the end of the previous.
670 If the value is t and the next newsgroup is empty, Gnus will exit
671 summary mode and go back to group mode. If the value is neither nil
672 nor t, Gnus will select the following unread newsgroup. In
673 particular, if the value is the symbol `quietly', the next unread
674 newsgroup will be selected without any confirmations.")
676 (defvar gnus-auto-select-same nil
677 "*If non-nil, select the next article with the same subject.")
679 (defvar gnus-summary-check-current nil
680 "*If non-nil, consider the current article when moving.
681 The \"unread\" movement commands will stay on the same line if the
682 current article is unread.")
684 (defvar gnus-auto-center-summary t
685 "*If non-nil, always center the current summary buffer.")
687 (defvar gnus-break-pages t
688 "*If non-nil, do page breaking on articles.
689 The page delimiter is specified by the `gnus-page-delimiter'
692 (defvar gnus-page-delimiter
"^\^L"
693 "*Regexp describing what to use as article page delimiters.
694 The default value is \"^\^L\", which is a form linefeed at the
695 beginning of a line.")
697 (defvar gnus-use-full-window t
698 "*If non-nil, use the entire Emacs screen.")
700 (defvar gnus-window-configuration nil
701 "Obsolete variable. See `gnus-buffer-configuration'.")
703 (defvar gnus-buffer-configuration
704 '((group ([group
1.0 point
]
705 (if gnus-carpal
[group-carpal
4])))
706 (summary ([summary
1.0 point
]
707 (if gnus-carpal
[summary-carpal
4])))
708 (article ([summary
0.25 point
]
709 (if gnus-carpal
[summary-carpal
4])
711 (server ([server
1.0 point
]
712 (if gnus-carpal
[server-carpal
2])))
713 (browse ([browse
1.0 point
]
714 (if gnus-carpal
[browse-carpal
2])))
715 (group-mail ([mail
1.0 point
]))
716 (summary-mail ([mail
1.0 point
]))
717 (summary-reply ([article
0.5]
719 (info ([nil
1.0 point
]))
720 (summary-faq ([summary
0.25]
722 (edit-group ([group
0.5]
723 [edit-group
1.0 point
]))
724 (edit-server ([server
0.5]
725 [edit-server
1.0 point
]))
726 (edit-score ([summary
0.25]
727 [edit-score
1.0 point
]))
728 (post ([post
1.0 point
]))
729 (reply ([article
0.5]
731 (mail-forward ([mail
1.0 point
]))
732 (post-forward ([post
1.0 point
]))
733 (reply-yank ([mail
1.0 point
]))
734 (followup ([article
0.5]
736 (followup-yank ([post
1.0 point
])))
737 "Window configuration for all possible Gnus buffers.
738 This variable is a list of lists. Each of these lists has a NAME and
739 a RULE. The NAMEs are common-sense names like `group', which names a
740 rule used when displaying the group buffer; `summary', which names a
741 rule for what happens when you enter a group and do not display an
742 article buffer; and so on. See the value of this variable for a
743 complete list of NAMEs.
745 Each RULE is a list of vectors. The first element in this vector is
746 the name of the buffer to be displayed; the second element is the
747 percentage of the screen this buffer is to occupy (a number in the
748 0.0-0.99 range); the optional third element is `point', which should
749 be present to denote which buffer point is to go to after making this
750 buffer configuration.")
752 (defvar gnus-window-to-buffer
753 '((group . gnus-group-buffer
)
754 (summary . gnus-summary-buffer
)
755 (article . gnus-article-buffer
)
756 (server . gnus-server-buffer
)
757 (browse .
"*Gnus Browse Server*")
758 (edit-group . gnus-group-edit-buffer
)
759 (edit-server . gnus-server-edit-buffer
)
760 (group-carpal . gnus-carpal-group-buffer
)
761 (summary-carpal . gnus-carpal-summary-buffer
)
762 (server-carpal . gnus-carpal-server-buffer
)
763 (browse-carpal . gnus-carpal-browse-buffer
)
764 (edit-score . gnus-score-edit-buffer
)
765 (mail . gnus-mail-buffer
)
766 (post . gnus-post-news-buffer
)
767 (faq . gnus-faq-buffer
))
768 "Mapping from short symbols to buffer names or buffer variables.")
770 (defvar gnus-carpal nil
771 "*If non-nil, display clickable icons.")
773 (defvar gnus-subscribe-newsgroup-method
'gnus-subscribe-zombies
774 "*Function called with a group name when new group is detected.
775 A few pre-made functions are supplied: `gnus-subscribe-randomly'
776 inserts new groups at the beginning of the list of groups;
777 `gnus-subscribe-alphabetically' inserts new groups in strict
778 alphabetic order; `gnus-subscribe-hierarchically' inserts new groups
779 in hierarchical newsgroup order; `gnus-subscribe-interactively' asks
782 ;; Suggested by a bug report by Hallvard B Furuseth.
783 ;; <h.b.furuseth@usit.uio.no>.
784 (defvar gnus-subscribe-options-newsgroup-method
785 (function gnus-subscribe-alphabetically
)
786 "*This function is called to subscribe newsgroups mentioned on \"options -n\" lines.
787 If, for instance, you want to subscribe to all newsgroups in the
788 \"no\" and \"alt\" hierarchies, you'd put the following in your
791 options -n no.all alt.all
793 Gnus will the subscribe all new newsgroups in these hierarchies with
794 the subscription method in this variable.")
796 (defvar gnus-subscribe-hierarchical-interactive nil
797 "*If non-nil, Gnus will offer to subscribe hierarchically.
798 When a new hierarchy appears, Gnus will ask the user:
800 'alt.binaries': Do you want to subscribe to this hierarchy? ([d]ys):
802 If the user pressed `d', Gnus will descend the hierarchy, `y' will
803 subscribe to all newsgroups in the hierarchy and `s' will skip this
804 hierarchy in its entirety.")
806 (defvar gnus-group-sort-function
'gnus-group-sort-by-alphabet
807 "*Function used for sorting the group buffer.
808 This function will be called with group info entries as the arguments
809 for the groups to be sorted. Pre-made functions include
810 `gnus-group-sort-by-alphabet', `gnus-group-sort-by-unread' and
811 `gnus-group-sort-by-level'")
813 ;; Mark variables suggested by Thomas Michanek
814 ;; <Thomas.Michanek@telelogic.se>.
815 (defvar gnus-unread-mark ?
816 "*Mark used for unread articles.")
817 (defvar gnus-ticked-mark ?
!
818 "*Mark used for ticked articles.")
819 (defvar gnus-dormant-mark ??
820 "*Mark used for dormant articles.")
821 (defvar gnus-del-mark ?r
822 "*Mark used for del'd articles.")
823 (defvar gnus-read-mark ?R
824 "*Mark used for read articles.")
825 (defvar gnus-expirable-mark ?E
826 "*Mark used for expirable articles.")
827 (defvar gnus-killed-mark ?K
828 "*Mark used for killed articles.")
829 (defvar gnus-kill-file-mark ?X
830 "*Mark used for articles killed by kill files.")
831 (defvar gnus-low-score-mark ?Y
832 "*Mark used for articles with a low score.")
833 (defvar gnus-catchup-mark ?C
834 "*Mark used for articles that are caught up.")
835 (defvar gnus-replied-mark ?A
836 "*Mark used for articles that have been replied to.")
837 (defvar gnus-process-mark ?
#
839 (defvar gnus-ancient-mark ?O
840 "*Mark used for ancient articles.")
841 (defvar gnus-canceled-mark ?G
842 "*Mark used for canceled articles.")
843 (defvar gnus-score-over-mark ?
+
844 "*Score mark used for articles with high scores.")
845 (defvar gnus-score-below-mark ?-
846 "*Score mark used for articles with low scores.")
847 (defvar gnus-empty-thread-mark ?
848 "*There is no thread under the article.")
849 (defvar gnus-not-empty-thread-mark ?
=
850 "*There is a thread under the article.")
851 (defvar gnus-dummy-mark ?Z
852 "*This is a dummy article.")
854 (defvar gnus-view-pseudo-asynchronously nil
855 "*If non-nil, Gnus will view pseudo-articles asynchronously.")
857 (defvar gnus-view-pseudos nil
858 "*If `automatic', pseudo-articles will be viewed automatically.
859 If `not-confirm', pseudos will be viewed automatically, and the user
860 will not be asked to confirm the command.")
862 (defvar gnus-view-pseudos-separately t
863 "*If non-nil, one pseudo-article will be created for each file to be viewed.
864 If nil, all files that use the same viewing command will be given as a
865 list of parameters to that command.")
867 (defvar gnus-group-line-format
"%M%S%p%5y: %(%g%)\n"
868 "*Format of group lines.
869 It works along the same lines as a normal formatting string,
870 with some simple extensions.
872 %M Only marked articles (character, \"*\" or \" \")
873 %S Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \")
874 %L Level of subscribedness (integer)
875 %N Number of unread articles (integer)
876 %I Number of dormant articles (integer)
877 %i Number of ticked and dormant (integer)
878 %T Number of ticked articles (integer)
879 %R Number of read articles (integer)
880 %t Total number of articles (integer)
881 %y Number of unread, unticked articles (integer)
882 %G Group name (string)
883 %g Qualified group name (string)
884 %D Group description (string)
885 %s Select method (string)
886 %o Moderated group (char, \"m\")
887 %p Process mark (char)
888 %O Moderated group (string, \"(m)\" or \"\")
889 %n Select from where (string)
890 %z A string that look like `<%s:%n>' if a foreign select method is used
891 %u User defined specifier. The next character in the format string should
892 be a letter. Gnus will call the function gnus-user-format-function-X,
893 where X is the letter following %u. The function will be passed the
894 current header as argument. The function should return a string, which
895 will be inserted into the buffer just like information from any other
898 Text between %( and %) will be highlighted with `gnus-mouse-face' when
899 the mouse point move inside the area. There can only be one such area.
901 Note that this format specification is not always respected. For
902 reasons of efficiency, when listing killed groups, this specification
903 is ignored altogether. If the spec is changed considerably, your
904 output may end up looking strange when listing both alive and killed
907 If you use %o or %O, reading the active file will be slower and quite
908 a bit of extra memory will be used. %D will also worsen performance.
909 Also note that if you change the format specification to include any
910 of these specs, you must probably re-start Gnus to see them go into
913 (defvar gnus-summary-line-format
"%U%R%z%I%(%[%4L: %-20,20n%]%) %s\n"
914 "*The format specification of the lines in the summary buffer.
916 It works along the same lines as a normal formatting string,
917 with some simple extensions.
919 %N Article number, left padded with spaces (string)
921 %s Subject if it is at the root of a thread, and \"\" otherwise (string)
922 %n Name of the poster (string)
923 %a Extracted name of the poster (string)
924 %A Extracted address of the poster (string)
925 %F Contents of the From: header (string)
926 %x Contents of the Xref: header (string)
927 %D Date of the article (string)
928 %d Date of the article (string) in DD-MMM format
929 %M Message-id of the article (string)
930 %r References of the article (string)
931 %c Number of characters in the article (integer)
932 %L Number of lines in the article (integer)
933 %I Indentation based on thread level (a string of spaces)
934 %T A string with two possible values: 80 spaces if the article
935 is on thread level two or larger and 0 spaces on level one
936 %R \"A\" if this article has been replied to, \" \" otherwise (character)
937 %U Status of this article (character, \"R\", \"K\", \"-\" or \" \")
938 %[ Opening bracket (character, \"[\" or \"<\")
939 %] Closing bracket (character, \"]\" or \">\")
940 %> Spaces of length thread-level (string)
941 %< Spaces of length (- 20 thread-level) (string)
942 %i Article score (number)
943 %z Article zcore (character)
944 %t Number of articles under the current thread (number).
945 %e Whether the thread is empty or not (character).
946 %u User defined specifier. The next character in the format string should
947 be a letter. Gnus will call the function gnus-user-format-function-X,
948 where X is the letter following %u. The function will be passed the
949 current header as argument. The function should return a string, which
950 will be inserted into the summary just like information from any other
953 Text between %( and %) will be highlighted with `gnus-mouse-face'
954 when the mouse point is placed inside the area. There can only be one
957 The %U (status), %R (replied) and %z (zcore) specs have to be handled
958 with care. For reasons of efficiency, Gnus will compute what column
959 these characters will end up in, and \"hard-code\" that. This means that
960 it is illegal to have these specs after a variable-length spec. Well,
961 you might not be arrested, but your summary buffer will look strange,
964 The smart choice is to have these specs as for to the left as
967 This restriction may disappear in later versions of Gnus.")
969 (defvar gnus-summary-dummy-line-format
"* : : %S\n"
970 "*The format specification for the dummy roots in the summary buffer.
971 It works along the same lines as a normal formatting string,
972 with some simple extensions.
976 (defvar gnus-summary-mode-line-format
"Gnus: %b [%A] %Z"
977 "*The format specification for the summary mode line.")
979 (defvar gnus-article-mode-line-format
"Gnus: %b %S"
980 "*The format specification for the article mode line.")
982 (defvar gnus-group-mode-line-format
"Gnus: %b {%M:%S} "
983 "*The format specification for the group mode line.")
985 (defvar gnus-valid-select-methods
986 '(("nntp" post address prompt-address
)
988 ("nnvirtual" none virtual prompt-address
)
989 ("nnmbox" mail respool
)
990 ("nnml" mail respool
)
991 ("nnmh" mail respool
)
992 ("nndir" none prompt-address address
)
993 ("nneething" none prompt-address
)
995 ("nndoc" none prompt-address
)
996 ("nnbabyl" mail respool
)
997 ("nnkiboze" post virtual
)
999 ("nnfolder" mail respool
))
1000 "An alist of valid select methods.
1001 The first element of each list lists should be a string with the name
1002 of the select method. The other elements may be be the category of
1003 this method (ie. `post', `mail', `none' or whatever) or other
1004 properties that this method has (like being respoolable).
1005 If you implement a new select method, all you should have to change is
1006 this variable. I think.")
1008 (defvar gnus-updated-mode-lines
'(group article summary
)
1009 "*List of buffers that should update their mode lines.
1010 The list may contain the symbols `group', `article' and `summary'. If
1011 the corresponding symbol is present, Gnus will keep that mode line
1012 updated with information that may be pertinent.
1013 If this variable is nil, screen refresh may be quicker.")
1015 ;; Added by Keinonen Kari <kk85613@cs.tut.fi>.
1016 (defvar gnus-mode-non-string-length nil
1017 "*Max length of mode-line non-string contents.
1018 If this is nil, Gnus will take space as is needed, leaving the rest
1019 of the modeline intact.")
1022 ;(defvar gnus-mouse-face 'highlight
1023 ; "*Face used for mouse highlighting in Gnus.
1024 ;No mouse highlights will be done if `gnus-visual' is nil.")
1026 (defvar gnus-summary-mark-below nil
1027 "*Mark all articles with a score below this variable as read.
1028 This variable is local to each summary buffer and usually set by the
1031 (defvar gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
1032 "*List of functions used for sorting threads in the summary buffer.
1033 By default, threads are sorted by article number.
1035 Each function takes two threads and return non-nil if the first thread
1036 should be sorted before the other. If you use more than one function,
1037 the primary sort function should be the last.
1039 Ready-mady functions include `gnus-thread-sort-by-number',
1040 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
1041 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
1042 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').")
1044 (defvar gnus-thread-score-function
'+
1045 "*Function used for calculating the total score of a thread.
1047 The function is called with the scores of the article and each
1048 subthread and should then return the score of the thread.
1050 Some functions you can use are `+', `max', or `min'.")
1052 (defvar gnus-options-subscribe nil
1053 "*All new groups matching this regexp will be subscribed unconditionally.
1054 Note that this variable deals only with new newsgroups. This variable
1055 does not affect old newsgroups.")
1057 (defvar gnus-options-not-subscribe nil
1058 "*All new groups matching this regexp will be ignored.
1059 Note that this variable deals only with new newsgroups. This variable
1060 does not affect old (already subscribed) newsgroups.")
1062 (defvar gnus-auto-expirable-newsgroups nil
1063 "*Groups in which to automatically mark read articles as expirable.
1064 If non-nil, this should be a regexp that should match all groups in
1065 which to perform auto-expiry. This only makes sense for mail groups.")
1067 (defvar gnus-hidden-properties
'(invisible t intangible t
)
1068 "Property list to use for hiding text.")
1070 (defvar gnus-modtime-botch nil
1071 "*Non-nil means .newsrc should be deleted prior to save. Its use is
1072 due to the bogus appearance that .newsrc was modified on disc.")
1076 (defvar gnus-group-mode-hook nil
1077 "*A hook for Gnus group mode.")
1079 (defvar gnus-summary-mode-hook nil
1080 "*A hook for Gnus summary mode.
1081 This hook is run before any variables are set in the summary buffer.")
1083 (defvar gnus-article-mode-hook nil
1084 "*A hook for Gnus article mode.")
1086 (defun gnus-summary-prepare-exit-hook nil
1087 "*A hook called when preparing to exit from the summary buffer.
1088 It calls `gnus-summary-expire-articles' by default.")
1089 (add-hook 'gnus-summary-prepare-exit-hook
'gnus-summary-expire-articles
)
1091 (defun gnus-summary-exit-hook nil
1092 "*A hook called on exit from the summary buffer.")
1094 (defvar gnus-open-server-hook nil
1095 "*A hook called just before opening connection to the news server.")
1097 (defvar gnus-load-hook nil
1098 "*A hook run while Gnus is loaded.")
1100 (defvar gnus-startup-hook nil
1101 "*A hook called at startup.
1102 This hook is called after Gnus is connected to the NNTP server.")
1104 (defvar gnus-get-new-news-hook nil
1105 "*A hook run just before Gnus checks for new news.")
1107 (defvar gnus-group-prepare-function
'gnus-group-prepare-flat
1108 "*A function that is called to generate the group buffer.
1109 The function is called with three arguments: The first is a number;
1110 all group with a level less or equal to that number should be listed,
1111 if the second is non-nil, empty groups should also be displayed. If
1112 the third is non-nil, it is a number. No groups with a level lower
1113 than this number should be displayed.
1115 The only current function implemented is `gnus-group-prepare-flat'.")
1117 (defvar gnus-group-prepare-hook nil
1118 "*A hook called after the group buffer has been generated.
1119 If you want to modify the group buffer, you can use this hook.")
1121 (defvar gnus-summary-prepare-hook nil
1122 "*A hook called after the summary buffer has been generated.
1123 If you want to modify the summary buffer, you can use this hook.")
1125 (defvar gnus-article-prepare-hook nil
1126 "*A hook called after an article has been prepared in the article buffer.
1127 If you want to run a special decoding program like nkf, use this hook.")
1129 ;(defvar gnus-article-display-hook nil
1130 ; "*A hook called after the article is displayed in the article buffer.
1131 ;The hook is designed to change the contents of the article
1132 ;buffer. Typical functions that this hook may contain are
1133 ;`gnus-article-hide-headers' (hide selected headers),
1134 ;`gnus-article-maybe-highlight' (perform fancy article highlighting),
1135 ;`gnus-article-hide-signature' (hide signature) and
1136 ;`gnus-article-treat-overstrike' (turn \"^H_\" into bold characters).")
1137 ;(add-hook 'gnus-article-display-hook 'gnus-article-hide-headers-if-wanted)
1138 ;(add-hook 'gnus-article-display-hook 'gnus-article-treat-overstrike)
1139 ;(add-hook 'gnus-article-display-hook 'gnus-article-maybe-highlight)
1141 (defvar gnus-article-x-face-command
1142 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | xv -quit -"
1143 "String or function to be executed to display an X-Face header.
1144 If it is a string, the command will be executed in a sub-shell
1145 asynchronously. The compressed face will be piped to this command.")
1147 (defvar gnus-article-x-face-too-ugly nil
1148 "Regexp matching posters whose face shouldn't be shown automatically.")
1150 (defvar gnus-select-group-hook nil
1151 "*A hook called when a newsgroup is selected.
1153 If you'd like to simplify subjects like the
1154 `gnus-summary-next-same-subject' command does, you can use the
1157 (setq gnus-select-group-hook
1160 (mapcar (lambda (header)
1161 (mail-header-set-subject
1163 (gnus-simplify-subject
1164 (mail-header-subject header) 're-only)))
1165 gnus-newsgroup-headers))))")
1167 (defvar gnus-select-article-hook
1168 '(gnus-summary-show-thread)
1169 "*A hook called when an article is selected.
1170 The default hook shows conversation thread subtrees of the selected
1171 article automatically using `gnus-summary-show-thread'.")
1173 (defvar gnus-apply-kill-hook
'(gnus-apply-kill-file)
1174 "*A hook called to apply kill files to a group.
1175 This hook is intended to apply a kill file to the selected newsgroup.
1176 The function `gnus-apply-kill-file' is called by default.
1178 Since a general kill file is too heavy to use only for a few
1179 newsgroups, I recommend you to use a lighter hook function. For
1180 example, if you'd like to apply a kill file to articles which contains
1181 a string `rmgroup' in subject in newsgroup `control', you can use the
1184 (setq gnus-apply-kill-hook
1187 (cond ((string-match \"control\" gnus-newsgroup-name)
1188 (gnus-kill \"Subject\" \"rmgroup\")
1189 (gnus-expunge \"X\"))))))")
1191 (defvar gnus-visual-mark-article-hook
1192 (list 'gnus-highlight-selected-summary
)
1193 "*Hook run after selecting an article in the summary buffer.
1194 It is meant to be used for highlighting the article in some way. It
1195 is not run if `gnus-visual' is nil.")
1197 (defun gnus-parse-headers-hook nil
1198 "*A hook called before parsing the headers.")
1200 (defvar gnus-exit-group-hook nil
1201 "*A hook called when exiting (not quitting) summary mode.")
1203 (defvar gnus-suspend-gnus-hook nil
1204 "*A hook called when suspending (not exiting) Gnus.")
1206 (defvar gnus-exit-gnus-hook nil
1207 "*A hook called when exiting Gnus.")
1209 (defvar gnus-save-newsrc-hook nil
1210 "*A hook called when saving the newsrc file.")
1212 (defvar gnus-summary-update-hook
1213 (list 'gnus-summary-highlight-line
)
1214 "*A hook called when a summary line is changed.
1215 The hook will not be called if `gnus-visual' is nil.
1217 The default function `gnus-summary-highlight-line' will
1218 highlight the line according to the `gnus-summary-highlight'
1221 (defvar gnus-mark-article-hook
(list 'gnus-summary-mark-unread-as-read
)
1222 "*A hook called when an article is selected for the first time.
1223 The hook is intended to mark an article as read (or unread)
1224 automatically when it is selected.")
1226 ;; Remove any hilit infestation.
1227 (add-hook 'gnus-startup-hook
1229 (remove-hook 'gnus-summary-prepare-hook
1230 'hilit-rehighlight-buffer-quietly
)
1231 (remove-hook 'gnus-summary-prepare-hook
'hilit-install-line-hooks
)
1232 (setq gnus-mark-article-hook
'(gnus-summary-mark-unread-as-read))
1233 (remove-hook 'gnus-article-prepare-hook
1234 'hilit-rehighlight-buffer-quietly
)))
1238 ;; Internal variables
1240 ;; Avoid highlighting in kill files.
1241 (defvar gnus-summary-inhibit-highlight nil
)
1242 (defvar gnus-newsgroup-selected-overlay nil
)
1244 (defvar gnus-article-mode-map nil
)
1245 (defvar gnus-dribble-buffer nil
)
1246 (defvar gnus-headers-retrieved-by nil
)
1247 (defvar gnus-article-reply nil
)
1248 (defvar gnus-override-method nil
)
1249 (defvar gnus-article-check-size nil
)
1251 (defvar gnus-current-score-file nil
)
1252 (defvar gnus-internal-global-score-files nil
)
1253 (defvar gnus-score-file-list nil
)
1254 (defvar gnus-scores-exclude-files nil
)
1256 (defvar gnus-current-move-group nil
)
1258 (defvar gnus-newsgroup-dependencies nil
)
1259 (defvar gnus-newsgroup-threads nil
)
1260 (defvar gnus-newsgroup-async nil
)
1261 (defconst gnus-group-edit-buffer
"*Gnus edit newsgroup*")
1263 (defvar gnus-newsgroup-adaptive nil
)
1265 (defvar gnus-summary-display-table nil
)
1267 (defconst gnus-group-line-format-alist
1268 (list (list ?M
'marked ?c
)
1269 (list ?S
'subscribed ?c
)
1271 (list ?N
'number ?s
)
1272 (list ?I
'number-of-dormant ?d
)
1273 (list ?T
'number-of-ticked ?d
)
1274 (list ?R
'number-of-read ?s
)
1275 (list ?t
'number-total ?d
)
1276 (list ?y
'number-of-unread-unticked ?s
)
1277 (list ?i
'number-of-ticked-and-dormant ?d
)
1279 (list ?G
'qualified-group ?s
)
1280 (list ?D
'newsgroup-description ?s
)
1281 (list ?o
'moderated ?c
)
1282 (list ?O
'moderated-string ?s
)
1283 (list ?p
'process-marked ?c
)
1284 (list ?s
'news-server ?s
)
1285 (list ?n
'news-method ?s
)
1286 (list ?z
'news-method-string ?s
)
1287 (list ?u
'user-defined ?s
)))
1289 (defconst gnus-summary-line-format-alist
1290 (list (list ?N
'number ?d
)
1291 (list ?S
'subject ?s
)
1292 (list ?s
'subject-or-nil ?s
)
1294 (list ?A
'(car (cdr (funcall gnus-extract-address-components from
)))
1296 (list ?a
'(or (car (funcall gnus-extract-address-components from
))
1299 (list ?x
(macroexpand '(mail-header-xref header
)) ?s
)
1300 (list ?D
(macroexpand '(mail-header-date header
)) ?s
)
1301 (list ?d
'(gnus-dd-mmm (mail-header-date header
)) ?s
)
1302 (list ?M
(macroexpand '(mail-header-id header
)) ?s
)
1303 (list ?r
(macroexpand '(mail-header-references header
)) ?s
)
1304 (list ?c
'(or (mail-header-chars header
) 0) ?d
)
1306 (list ?I
'indentation ?s
)
1307 (list ?T
'(if (= level
0) "" (make-string (frame-width) ?
)) ?s
)
1308 (list ?R
'replied ?c
)
1309 (list ?\
[ 'opening-bracket ?c
)
1310 (list ?\
] 'closing-bracket ?c
)
1311 (list ?\
> '(make-string level ?
) ?s
)
1312 (list ?\
< '(make-string (max 0 (- 20 level
)) ?
) ?s
)
1314 (list ?z
'score-char ?c
)
1315 (list ?U
'unread ?c
)
1316 (list ?t
'(gnus-summary-number-of-articles-in-thread
1317 (and (boundp 'thread
) (car thread
)))
1319 (list ?e
'(gnus-summary-number-of-articles-in-thread
1320 (and (boundp 'thread
) (car thread
)) t
)
1322 (list ?u
'user-defined ?s
))
1323 "An alist of format specifications that can appear in summary lines,
1324 and what variables they correspond with, along with the type of the
1325 variable (string, integer, character, etc).")
1327 (defconst gnus-summary-dummy-line-format-alist
1328 (list (list ?S
'subject ?s
)
1329 (list ?N
'number ?d
)
1330 (list ?u
'user-defined ?s
)))
1332 (defconst gnus-summary-mode-line-format-alist
1333 (list (list ?G
'group-name ?s
)
1334 (list ?g
'(gnus-short-group-name group-name
) ?s
)
1335 (list ?A
'article-number ?d
)
1336 (list ?Z
'unread-and-unselected ?s
)
1337 (list ?V
'gnus-version ?s
)
1338 (list ?U
'unread ?d
)
1339 (list ?S
'subject ?s
)
1340 (list ?e
'unselected ?d
)
1341 (list ?u
'user-defined ?s
)
1342 (list ?b
'buffer-name ?s
)
1343 (list ?s
'(gnus-current-score-file-nondirectory) ?s
)))
1345 (defconst gnus-group-mode-line-format-alist
1346 (list (list ?S
'news-server ?s
)
1347 (list ?M
'news-method ?s
)
1348 (list ?b
'(buffer-name) ?s
)
1349 (list ?u
'user-defined ?s
)))
1351 (defvar gnus-have-read-active-file nil
)
1353 (defconst gnus-maintainer
1354 "gnus-bug@ifi.uio.no (The Gnus Bugfixing Girls + Boys)"
1355 "The mail address of the Gnus maintainers.")
1357 (defconst gnus-version
"Gnus v5.1"
1358 "Version number for this version of Gnus.")
1360 (defvar gnus-info-nodes
1361 '((gnus-group-mode "(gnus)The Group Buffer")
1362 (gnus-summary-mode "(gnus)The Summary Buffer")
1363 (gnus-article-mode "(gnus)The Article Buffer"))
1364 "Assoc list of major modes and related Info nodes.")
1366 (defvar gnus-group-buffer
"*Group*")
1367 (defvar gnus-summary-buffer
"*Summary*")
1368 (defvar gnus-article-buffer
"*Article*")
1369 (defvar gnus-server-buffer
"*Server*")
1371 (defvar gnus-work-buffer
" *gnus work*")
1373 (defvar gnus-buffer-list nil
1374 "Gnus buffers that should be killed on exit.")
1376 (defvar gnus-server-alist nil
1377 "List of available servers.")
1379 (defvar gnus-variable-list
1380 '(gnus-newsrc-options gnus-newsrc-options-n
1381 gnus-newsrc-last-checked-date
1382 gnus-newsrc-alist gnus-server-alist
1383 gnus-killed-list gnus-zombie-list
)
1384 "Gnus variables saved in the quick startup file.")
1386 (defvar gnus-overload-functions
1387 '((news-inews gnus-inews-news
"rnewspost"))
1388 "Functions overloaded by gnus.
1389 It is a list of `(original overload &optional file)'.")
1391 (defvar gnus-newsrc-options nil
1392 "Options line in the .newsrc file.")
1394 (defvar gnus-newsrc-options-n nil
1395 "List of regexps representing groups to be subscribed/ignored unconditionally.")
1397 (defvar gnus-newsrc-last-checked-date nil
1398 "Date Gnus last asked server for new newsgroups.")
1400 (defvar gnus-newsrc-alist nil
1401 "Assoc list of read articles.
1402 gnus-newsrc-hashtb should be kept so that both hold the same information.")
1404 (defvar gnus-newsrc-hashtb nil
1405 "Hashtable of gnus-newsrc-alist.")
1407 (defvar gnus-killed-list nil
1408 "List of killed newsgroups.")
1410 (defvar gnus-killed-hashtb nil
1411 "Hash table equivalent of gnus-killed-list.")
1413 (defvar gnus-zombie-list nil
1414 "List of almost dead newsgroups.")
1416 (defvar gnus-description-hashtb nil
1417 "Descriptions of newsgroups.")
1419 (defvar gnus-list-of-killed-groups nil
1420 "List of newsgroups that have recently been killed by the user.")
1422 (defvar gnus-active-hashtb nil
1423 "Hashtable of active articles.")
1425 (defvar gnus-moderated-list nil
1426 "List of moderated newsgroups.")
1428 (defvar gnus-group-marked nil
)
1430 (defvar gnus-current-startup-file nil
1431 "Startup file for the current host.")
1433 (defvar gnus-last-search-regexp nil
1434 "Default regexp for article search command.")
1436 (defvar gnus-last-shell-command nil
1437 "Default shell command on article.")
1439 (defvar gnus-current-select-method nil
1440 "The current method for selecting a newsgroup.")
1442 (defvar gnus-group-list-mode nil
)
1444 (defvar gnus-article-internal-prepare-hook nil
)
1446 (defvar gnus-newsgroup-name nil
)
1447 (defvar gnus-newsgroup-begin nil
)
1448 (defvar gnus-newsgroup-end nil
)
1449 (defvar gnus-newsgroup-last-rmail nil
)
1450 (defvar gnus-newsgroup-last-mail nil
)
1451 (defvar gnus-newsgroup-last-folder nil
)
1452 (defvar gnus-newsgroup-last-file nil
)
1453 (defvar gnus-newsgroup-auto-expire nil
)
1454 (defvar gnus-newsgroup-active nil
)
1456 (defvar gnus-newsgroup-unreads nil
1457 "List of unread articles in the current newsgroup.")
1459 (defvar gnus-newsgroup-unselected nil
1460 "List of unselected unread articles in the current newsgroup.")
1462 (defvar gnus-newsgroup-reads nil
1463 "Alist of read articles and article marks in the current newsgroup.")
1465 (defvar gnus-newsgroup-marked nil
1466 "List of ticked articles in the current newsgroup (a subset of unread art).")
1468 (defvar gnus-newsgroup-killed nil
1469 "List of ranges of articles that have been through the scoring process.")
1471 (defvar gnus-newsgroup-kill-headers nil
)
1473 (defvar gnus-newsgroup-replied nil
1474 "List of articles that have been replied to in the current newsgroup.")
1476 (defvar gnus-newsgroup-expirable nil
1477 "List of articles in the current newsgroup that can be expired.")
1479 (defvar gnus-newsgroup-processable nil
1480 "List of articles in the current newsgroup that can be processed.")
1482 (defvar gnus-newsgroup-bookmarks nil
1483 "List of articles in the current newsgroup that have bookmarks.")
1485 (defvar gnus-newsgroup-dormant nil
1486 "List of dormant articles in the current newsgroup.")
1488 (defvar gnus-newsgroup-scored nil
1489 "List of scored articles in the current newsgroup.")
1491 (defvar gnus-newsgroup-headers nil
1492 "List of article headers in the current newsgroup.")
1493 (defvar gnus-newsgroup-headers-hashtb-by-number nil
)
1495 (defvar gnus-newsgroup-ancient nil
1496 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1498 (defvar gnus-current-article nil
)
1499 (defvar gnus-article-current nil
)
1500 (defvar gnus-current-headers nil
)
1501 (defvar gnus-have-all-headers nil
)
1502 (defvar gnus-last-article nil
)
1503 (defvar gnus-newsgroup-history nil
)
1504 (defvar gnus-current-kill-article nil
)
1506 ;; Save window configuration.
1507 (defvar gnus-prev-winconf nil
)
1510 (defvar gnus-summary-line-format-spec nil
)
1511 (defvar gnus-summary-dummy-line-format-spec nil
)
1512 (defvar gnus-group-line-format-spec nil
)
1513 (defvar gnus-summary-mode-line-format-spec nil
)
1514 (defvar gnus-article-mode-line-format-spec nil
)
1515 (defvar gnus-group-mode-line-format-spec nil
)
1516 (defvar gnus-summary-mark-positions nil
)
1517 (defvar gnus-group-mark-positions nil
)
1519 (defvar gnus-summary-expunge-below nil
)
1520 (defvar gnus-reffed-article-number nil
)
1522 ; Let the byte-compiler know that we know about this variable.
1523 (defvar rmail-default-rmail-file
)
1525 (defvar gnus-cache-removable-articles nil
)
1527 (defconst gnus-summary-local-variables
1528 '(gnus-newsgroup-name
1529 gnus-newsgroup-begin gnus-newsgroup-end
1530 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1531 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1532 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1533 gnus-newsgroup-unselected gnus-newsgroup-marked
1534 gnus-newsgroup-reads
1535 gnus-newsgroup-replied gnus-newsgroup-expirable
1536 gnus-newsgroup-processable gnus-newsgroup-killed
1537 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1538 gnus-newsgroup-headers gnus-newsgroup-headers-hashtb-by-number
1539 gnus-current-article gnus-current-headers gnus-have-all-headers
1540 gnus-last-article gnus-article-internal-prepare-hook
1541 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1542 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1543 gnus-newsgroup-threads gnus-newsgroup-async
1544 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
1545 gnus-summary-mark-below gnus-newsgroup-active gnus-scores-exclude-files
1546 gnus-newsgroup-history gnus-newsgroup-ancient
1547 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1548 gnus-cache-removable-articles
)
1549 "Variables that are buffer-local to the summary buffers.")
1551 (defconst gnus-bug-message
1552 "Sending a bug report to the Gnus Towers.
1553 ========================================
1555 The buffer below is a mail buffer. When you press `C-c C-c', it will
1556 be sent to the Gnus Bug Exterminators.
1558 At the bottom of the buffer you'll see lots of variable settings.
1559 Please do not delete those. They will tell the Bug People what your
1560 environment is, so that it will be easier to locate the bugs.
1562 If you have found a bug that makes Emacs go \"beep\", set
1563 debug-on-error to t (`M-x set-variable RET debug-on-error RET t RET')
1564 and include the backtrace in your bug report.
1566 Please describe the bug in annoying, painstaking detail.
1568 Thank you for your help in stamping out bugs.
1571 ;;; End of variables.
1573 ;; Define some autoload functions Gnus might use.
1577 (autoload 'metamail-buffer
"metamail")
1578 (autoload 'Info-goto-node
"info")
1579 (autoload 'hexl-hex-string-to-integer
"hexl")
1581 (autoload 'pp-to-string
"pp")
1582 (autoload 'pp-eval-expression
"pp")
1583 (autoload 'mail-extract-address-components
"mail-extr")
1585 (autoload 'nnmail-split-fancy
"nnmail")
1586 (autoload 'nnvirtual-catchup-group
"nnvirtual")
1589 (autoload 'timezone-make-date-arpa-standard
"timezone")
1590 (autoload 'timezone-fix-time
"timezone")
1591 (autoload 'timezone-make-sortable-date
"timezone")
1592 (autoload 'timezone-make-time-string
"timezone")
1595 (autoload 'mail-position-on-field
"sendmail")
1596 (autoload 'mail-setup
"sendmail")
1597 (autoload 'rmail-output
"rmailout")
1598 (autoload 'news-mail-other-window
"rnewspost")
1599 (autoload 'news-reply-yank-original
"rnewspost")
1600 (autoload 'news-caesar-buffer-body
"rnewspost")
1601 (autoload 'rmail-insert-rmail-file-header
"rmail")
1602 (autoload 'rmail-count-new-messages
"rmail")
1603 (autoload 'rmail-show-message
"rmail")
1606 ;;(autoload 'gnus-group-brew-soup "gnus-soup" nil t)
1607 ;;(autoload 'gnus-brew-soup "gnus-soup" nil t)
1608 ;;(autoload 'gnus-soup-add-article "gnus-soup" nil t)
1609 ;;(autoload 'gnus-soup-send-replies "gnus-soup" nil t)
1610 ;;(autoload 'gnus-soup-save-areas "gnus-soup" nil t)
1611 ;;(autoload 'gnus-soup-pack-packet "gnus-soup" nil t)
1612 ;;(autoload 'nnsoup-pack-replies "nnsoup" nil t)
1615 (autoload 'gnus-mail-reply-using-mhe
"gnus-mh")
1616 (autoload 'gnus-mail-forward-using-mhe
"gnus-mh")
1617 (autoload 'gnus-mail-other-window-using-mhe
"gnus-mh")
1618 (autoload 'gnus-summary-save-in-folder
"gnus-mh" nil t
)
1619 (autoload 'gnus-summary-save-article-folder
"gnus-mh")
1620 (autoload 'gnus-Folder-save-name
"gnus-mh")
1621 (autoload 'gnus-folder-save-name
"gnus-mh")
1624 (autoload 'gnus-group-make-menu-bar
"gnus-vis")
1625 (autoload 'gnus-summary-make-menu-bar
"gnus-vis")
1626 (autoload 'gnus-server-make-menu-bar
"gnus-vis")
1627 (autoload 'gnus-article-make-menu-bar
"gnus-vis")
1628 (autoload 'gnus-browse-make-menu-bar
"gnus-vis")
1629 (autoload 'gnus-highlight-selected-summary
"gnus-vis")
1630 (autoload 'gnus-summary-highlight-line
"gnus-vis")
1631 (autoload 'gnus-carpal-setup-buffer
"gnus-vis")
1634 (autoload 'gnus-article-push-button
"gnus-vis" nil t
)
1635 (autoload 'gnus-article-press-button
"gnus-vis" nil t
)
1636 (autoload 'gnus-article-highlight
"gnus-vis" nil t
)
1637 (autoload 'gnus-article-highlight-some
"gnus-vis" nil t
)
1638 (autoload 'gnus-article-hide
"gnus-vis" nil t
)
1639 (autoload 'gnus-article-hide-signature
"gnus-vis" nil t
)
1640 (autoload 'gnus-article-highlight-headers
"gnus-vis" nil t
)
1641 (autoload 'gnus-article-highlight-signature
"gnus-vis" nil t
)
1642 (autoload 'gnus-article-add-buttons
"gnus-vis" nil t
)
1643 (autoload 'gnus-article-next-button
"gnus-vis" nil t
)
1644 (autoload 'gnus-article-add-button
"gnus-vis")
1647 (autoload 'gnus-article-highlight-citation
"gnus-cite" nil t
)
1648 (autoload 'gnus-article-hide-citation-maybe
"gnus-cite" nil t
)
1649 (autoload 'gnus-article-hide-citation
"gnus-cite" nil t
)
1652 (autoload 'gnus-kill
"gnus-kill")
1653 (autoload 'gnus-apply-kill-file-internal
"gnus-kill")
1654 (autoload 'gnus-kill-file-edit-file
"gnus-kill")
1655 (autoload 'gnus-kill-file-raise-followups-to-author
"gnus-kill")
1656 (autoload 'gnus-execute
"gnus-kill")
1657 (autoload 'gnus-expunge
"gnus-kill")
1660 (autoload 'gnus-cache-possibly-enter-article
"gnus-cache")
1661 (autoload 'gnus-cache-save-buffers
"gnus-cache")
1662 (autoload 'gnus-cache-possibly-remove-articles
"gnus-cache")
1663 (autoload 'gnus-cache-request-article
"gnus-cache")
1664 (autoload 'gnus-cache-retrieve-headers
"gnus-cache")
1665 (autoload 'gnus-cache-possibly-alter-active
"gnus-cache")
1666 (autoload 'gnus-jog-cache
"gnus-cache" nil t
)
1667 (autoload 'gnus-cache-enter-remove-article
"gnus-cache")
1670 (autoload 'gnus-summary-increase-score
"gnus-score" nil t
)
1671 (autoload 'gnus-summary-lower-score
"gnus-score" nil t
)
1672 (autoload 'gnus-summary-score-map
"gnus-score" nil nil
'keymap
)
1673 (autoload 'gnus-score-save
"gnus-score")
1674 (autoload 'gnus-score-headers
"gnus-score")
1675 (autoload 'gnus-current-score-file-nondirectory
"gnus-score")
1676 (autoload 'gnus-score-adaptive
"gnus-score")
1677 (autoload 'gnus-score-remove-lines-adaptive
"gnus-score")
1678 (autoload 'gnus-score-find-trace
"gnus-score")
1681 (autoload 'gnus-score-customize
"gnus-edit" nil t
)
1684 (autoload 'gnus-uu-extract-map
"gnus-uu" nil nil
'keymap
)
1685 (autoload 'gnus-uu-mark-map
"gnus-uu" nil nil
'keymap
)
1686 (autoload 'gnus-uu-digest-mail-forward
"gnus-uu" nil t
)
1687 (autoload 'gnus-uu-digest-post-forward
"gnus-uu" nil t
)
1688 (autoload 'gnus-uu-mark-series
"gnus-uu" nil t
)
1689 (autoload 'gnus-uu-mark-region
"gnus-uu" nil t
)
1690 (autoload 'gnus-uu-mark-by-regexp
"gnus-uu" nil t
)
1691 (autoload 'gnus-uu-mark-all
"gnus-uu" nil t
)
1692 (autoload 'gnus-uu-mark-sparse
"gnus-uu" nil t
)
1693 (autoload 'gnus-uu-mark-thread
"gnus-uu" nil t
)
1694 (autoload 'gnus-uu-decode-uu
"gnus-uu" nil t
)
1695 (autoload 'gnus-uu-decode-uu-and-save
"gnus-uu" nil t
)
1696 (autoload 'gnus-uu-decode-unshar
"gnus-uu" nil t
)
1697 (autoload 'gnus-uu-decode-unshar-and-save
"gnus-uu" nil t
)
1698 (autoload 'gnus-uu-decode-save
"gnus-uu" nil t
)
1699 (autoload 'gnus-uu-decode-binhex
"gnus-uu" nil t
)
1700 (autoload 'gnus-uu-decode-uu-view
"gnus-uu" nil t
)
1701 (autoload 'gnus-uu-decode-uu-and-save-view
"gnus-uu" nil t
)
1702 (autoload 'gnus-uu-decode-unshar-view
"gnus-uu" nil t
)
1703 (autoload 'gnus-uu-decode-unshar-and-save-view
"gnus-uu" nil t
)
1704 (autoload 'gnus-uu-decode-save-view
"gnus-uu" nil t
)
1705 (autoload 'gnus-uu-decode-binhex-view
"gnus-uu" nil t
)
1708 (autoload 'gnus-summary-send-map
"gnus-msg" nil nil
'keymap
)
1709 (autoload 'gnus-group-post-news
"gnus-msg" nil t
)
1710 (autoload 'gnus-group-mail
"gnus-msg" nil t
)
1711 (autoload 'gnus-summary-post-news
"gnus-msg" nil t
)
1712 (autoload 'gnus-summary-followup
"gnus-msg" nil t
)
1713 (autoload 'gnus-summary-followup-with-original
"gnus-msg" nil t
)
1714 (autoload 'gnus-summary-followup-and-reply
"gnus-msg" nil t
)
1715 (autoload 'gnus-summary-followup-and-reply-with-original
"gnus-msg" nil t
)
1716 (autoload 'gnus-summary-cancel-article
"gnus-msg" nil t
)
1717 (autoload 'gnus-summary-supersede-article
"gnus-msg" nil t
)
1718 (autoload 'gnus-post-news
"gnus-msg" nil t
)
1719 (autoload 'gnus-inews-news
"gnus-msg" nil t
)
1720 (autoload 'gnus-cancel-news
"gnus-msg" nil t
)
1721 (autoload 'gnus-summary-reply
"gnus-msg" nil t
)
1722 (autoload 'gnus-summary-reply-with-original
"gnus-msg" nil t
)
1723 (autoload 'gnus-summary-mail-forward
"gnus-msg" nil t
)
1724 (autoload 'gnus-summary-mail-other-window
"gnus-msg" nil t
)
1725 (autoload 'gnus-mail-reply-using-mail
"gnus-msg")
1726 (autoload 'gnus-mail-yank-original
"gnus-msg")
1727 (autoload 'gnus-mail-send-and-exit
"gnus-msg")
1728 (autoload 'gnus-mail-forward-using-mail
"gnus-msg")
1729 (autoload 'gnus-mail-other-window-using-mail
"gnus-msg")
1730 (autoload 'gnus-article-mail
"gnus-msg")
1731 (autoload 'gnus-bug
"gnus-msg" nil t
)
1734 (autoload 'gnus-summary-save-in-vm
"gnus-vm" nil t
)
1735 (autoload 'gnus-summary-save-article-vm
"gnus-vm" nil t
)
1736 (autoload 'gnus-mail-forward-using-vm
"gnus-vm")
1737 (autoload 'gnus-mail-reply-using-vm
"gnus-vm")
1738 (autoload 'gnus-mail-other-window-using-vm
"gnus-vm" nil t
)
1739 (autoload 'gnus-yank-article
"gnus-vm" nil t
)
1745 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
1746 ;; If you want the cursor to go somewhere else, set these two
1747 ;; functions in some startup hook to whatever you want.
1748 (defalias 'gnus-summary-position-cursor
'gnus-goto-colon
)
1749 (defalias 'gnus-group-position-cursor
'gnus-goto-colon
)
1751 ;;; Various macros and substs.
1753 (defmacro gnus-eval-in-buffer-window
(buffer &rest forms
)
1754 "Pop to BUFFER, evaluate FORMS, and then returns to original window."
1755 (` (let ((GnusStartBufferWindow (selected-window)))
1758 (pop-to-buffer (, buffer
))
1760 (select-window GnusStartBufferWindow
)))))
1762 (defmacro gnus-gethash
(string hashtable
)
1763 "Get hash value of STRING in HASHTABLE."
1764 ;;(` (symbol-value (abbrev-symbol (, string) (, hashtable))))
1765 ;;(` (abbrev-expansion (, string) (, hashtable)))
1766 (` (symbol-value (intern-soft (, string
) (, hashtable
)))))
1768 (defmacro gnus-sethash
(string value hashtable
)
1769 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
1770 ;; We cannot use define-abbrev since it only accepts string as value.
1771 ;; (set (intern string hashtable) value))
1772 (` (set (intern (, string
) (, hashtable
)) (, value
))))
1774 (defsubst gnus-buffer-substring
(beg end
)
1775 (buffer-substring (match-beginning beg
) (match-end end
)))
1777 ;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
1778 ;; function `substring' might cut on a middle of multi-octet
1780 (defun gnus-truncate-string (str width
)
1781 (substring str
0 width
))
1783 ;; Added by Geoffrey T. Dairiki <dairiki@u.washington.edu>. A safe way
1784 ;; to limit the length of a string. This function is necessary since
1785 ;; `(substr "abc" 0 30)' pukes with "Args out of range".
1786 (defsubst gnus-limit-string
(str width
)
1787 (if (> (length str
) width
)
1788 (substring str
0 width
)
1791 (defsubst gnus-simplify-subject-re
(subject)
1792 "Remove \"Re:\" from subject lines."
1793 (let ((case-fold-search t
))
1794 (if (string-match "^re: *" subject
)
1795 (substring subject
(match-end 0))
1798 (defsubst gnus-goto-char
(point)
1799 (and point
(goto-char point
)))
1801 (defmacro gnus-buffer-exists-p
(buffer)
1803 (funcall (if (stringp (, buffer
)) 'get-buffer
'buffer-name
)
1806 (defmacro gnus-kill-buffer
(buffer)
1807 (` (if (gnus-buffer-exists-p (, buffer
))
1808 (kill-buffer (, buffer
)))))
1810 (defsubst gnus-point-at-bol
()
1811 "Return point at the beginning of line."
1818 (defsubst gnus-point-at-eol
()
1819 "Return point at the beginning of line."
1826 ;; Delete the current line (and the next N lines.);
1827 (defmacro gnus-delete-line
(&optional n
)
1828 (` (delete-region (progn (beginning-of-line) (point))
1829 (progn (forward-line (, (or n
1))) (point)))))
1831 ;; Suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
1832 (defvar gnus-init-inhibit nil
)
1833 (defun gnus-read-init-file (&optional inhibit-next
)
1834 (if gnus-init-inhibit
1835 (setq gnus-init-inhibit nil
)
1836 (setq gnus-init-inhibit inhibit-next
)
1838 (or (and (file-exists-p gnus-init-file
)
1839 ;; Don't try to load a directory.
1840 (not (file-directory-p gnus-init-file
)))
1841 (file-exists-p (concat gnus-init-file
".el"))
1842 (file-exists-p (concat gnus-init-file
".elc")))
1843 (load gnus-init-file nil t
))))
1845 ;;; Load the user startup file.
1846 ;; (eval '(gnus-read-init-file 'inhibit))
1848 ;;; Load the compatibility functions.
1855 ;;; Gnus Utility Functions
1858 (defun gnus-extract-address-components (from)
1860 ;; First find the address - the thing with the @ in it. This may
1861 ;; not be accurate in mail addresses, but does the trick most of
1862 ;; the time in news messages.
1863 (if (string-match "\\b[^@ \t<>]+[!@][^@ \t<>]+\\b" from
)
1864 (setq address
(substring from
(match-beginning 0) (match-end 0))))
1865 ;; Then we check whether the "name <address>" format is used.
1867 ;; Fix by MORIOKA Tomohiko <morioka@jaist.ac.jp>
1868 ;; Linear white space is not required.
1869 (string-match (concat "[ \t]*<" (regexp-quote address
) ">") from
)
1870 (and (setq name
(substring from
0 (match-beginning 0)))
1871 ;; Strip any quotes from the name.
1872 (string-match "\".*\"" name
)
1873 (setq name
(substring name
1 (1- (match-end 0))))))
1874 ;; If not, then "address (name)" is used.
1876 (and (string-match "(.+)" from
)
1877 (setq name
(substring from
(1+ (match-beginning 0))
1878 (1- (match-end 0)))))
1879 (and (string-match "()" from
)
1880 (setq name address
))
1881 ;; Fix by MORIOKA Tomohiko <morioka@jaist.ac.jp>.
1882 ;; XOVER might not support folded From headers.
1883 (and (string-match "(.*" from
)
1884 (setq name
(substring from
(1+ (match-beginning 0))
1886 ;; Fix by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
1887 (list (or name from
) (or address from
))))
1889 (defun gnus-fetch-field (field)
1890 "Return the value of the header FIELD of current article."
1893 (let ((case-fold-search t
))
1894 (gnus-narrow-to-headers)
1895 (mail-fetch-field field
)))))
1897 (defun gnus-goto-colon ()
1899 (search-forward ":" (gnus-point-at-eol) t
))
1901 (defun gnus-narrow-to-headers ()
1905 (goto-char (point-min))
1906 (if (search-forward "\n\n" nil t
)
1910 (defvar gnus-old-specs nil
)
1912 (defun gnus-update-format-specifications ()
1913 (gnus-make-thread-indent-array)
1915 (let ((formats '(summary summary-dummy group
1916 summary-mode group-mode article-mode
))
1917 old-format new-format
)
1919 (setq new-format
(symbol-value
1920 (intern (format "gnus-%s-line-format" (car formats
)))))
1921 (or (and (setq old-format
(cdr (assq (car formats
) gnus-old-specs
)))
1922 (equal old-format new-format
))
1923 (set (intern (format "gnus-%s-line-format-spec" (car formats
)))
1927 (intern (format "gnus-%s-line-format-alist"
1928 (if (eq (car formats
) 'article-mode
)
1929 'summary-mode
(car formats
))))))))
1930 (setq gnus-old-specs
(cons (cons (car formats
) new-format
)
1931 (delq (car formats
) gnus-old-specs
)))
1932 (setq formats
(cdr formats
))))
1934 (gnus-update-group-mark-positions)
1935 (gnus-update-summary-mark-positions)
1937 (if (and (string-match "%D" gnus-group-line-format
)
1938 (not gnus-description-hashtb
)
1939 gnus-read-active-file
)
1940 (gnus-read-all-descriptions-files)))
1942 (defun gnus-update-summary-mark-positions ()
1944 (let ((gnus-replied-mark 129)
1945 (gnus-score-below-mark 130)
1946 (gnus-score-over-mark 130)
1949 (gnus-set-work-buffer)
1950 (gnus-summary-insert-line
1951 nil
[0 "" "" "" "" "" 0 0 ""] 0 nil
128 t nil
"" nil
1)
1952 (goto-char (point-min))
1953 (setq pos
(list (cons 'unread
(and (search-forward "\200" nil t
)
1955 (goto-char (point-min))
1956 (setq pos
(cons (cons 'replied
(and (search-forward "\201" nil t
)
1957 (- (point) 2))) pos
))
1958 (goto-char (point-min))
1959 (setq pos
(cons (cons 'score
(and (search-forward "\202" nil t
)
1960 (- (point) 2))) pos
))
1961 (setq gnus-summary-mark-positions pos
))))
1963 (defun gnus-update-group-mark-positions ()
1965 (let ((gnus-process-mark 128)
1966 (gnus-group-marked '("dummy.group")))
1967 (gnus-sethash "dummy.group" '(0 .
0) gnus-active-hashtb
)
1968 (gnus-set-work-buffer)
1969 (gnus-group-insert-group-line nil
"dummy.group" 0 nil
0 nil
)
1970 (goto-char (point-min))
1971 (setq gnus-group-mark-positions
1972 (list (cons 'process
(and (search-forward "\200" nil t
)
1973 (- (point) 2))))))))
1975 (defun gnus-mouse-face-function (form)
1976 (` (let ((string (, form
)))
1977 (put-text-property 0 (length string
) 'mouse-face gnus-mouse-face string
)
1980 (defun gnus-max-width-function (el max-width
)
1981 (or (numberp max-width
) (signal 'wrong-type-argument
'(numberp max-width
)))
1982 (` (let* ((val (eval (, el
)))
1983 (valstr (if (numberp val
)
1984 (int-to-string val
) val
)))
1985 (if (> (length valstr
) (, max-width
))
1986 (substring valstr
0 (, max-width
))
1989 (defun gnus-parse-format (format spec-alist
)
1990 ;; This function parses the FORMAT string with the help of the
1991 ;; SPEC-ALIST and returns a list that can be eval'ed to return the
1992 ;; string. If the FORMAT string contains the specifiers %( and %)
1993 ;; the text between them will have the mouse-face text property.
1994 (if (string-match "\\`\\(.*\\)%(\\(.*\\)%)\\(.*\n?\\)\\'" format
)
1995 (if (and gnus-visual gnus-mouse-face
)
1996 (let ((pre (substring format
(match-beginning 1) (match-end 1)))
1997 (button (substring format
(match-beginning 2) (match-end 2)))
1998 (post (substring format
(match-beginning 3) (match-end 3))))
2000 (gnus-parse-simple-format pre spec-alist
)
2001 (gnus-mouse-face-function
2002 (gnus-parse-simple-format button spec-alist
))
2003 (gnus-parse-simple-format post spec-alist
)))
2004 (gnus-parse-simple-format
2005 (concat (substring format
(match-beginning 1) (match-end 1))
2006 (substring format
(match-beginning 2) (match-end 2))
2007 (substring format
(match-beginning 3) (match-end 3)))
2009 (gnus-parse-simple-format format spec-alist
)))
2011 (defun gnus-parse-simple-format (format spec-alist
)
2012 ;; This function parses the FORMAT string with the help of the
2013 ;; SPEC-ALIST and returns a list that can be eval'ed to return the
2014 ;; string. The list will consist of the symbol `format', a format
2015 ;; specification string, and a list of forms depending on the
2018 spec flist fstring newspec elem beg
)
2020 (gnus-set-work-buffer)
2022 (goto-char (point-min))
2023 (while (re-search-forward "%[-0-9]*\\(,[0-9]+\\)?\\([^0-9]\\)\\(.\\)?" nil t
)
2024 (setq spec
(string-to-char (buffer-substring (match-beginning 2)
2026 ;; First check if there are any specs that look anything like
2027 ;; "%12,12A", ie. with a "max width specification". These have
2028 ;; to be treated specially.
2029 (if (setq beg
(match-beginning 1))
2032 (buffer-substring (1+ (match-beginning 1)) (match-end 1))))
2034 (setq beg
(match-beginning 2)))
2035 ;; Find the specification from `spec-alist'.
2036 (if (not (setq elem
(cdr (assq spec spec-alist
))))
2037 (setq elem
'("*" ?s
)))
2038 ;; Treat user defined format specifiers specially
2039 (and (eq (car elem
) 'user-defined
)
2042 (list (intern (concat "gnus-user-format-function-"
2048 (delete-region (match-beginning 3) (match-end 3)))
2049 (if (not (zerop max-width
))
2050 (let ((el (car elem
)))
2051 (cond ((= (car (cdr elem
)) ?c
)
2052 (setq el
(list 'char-to-string el
)))
2053 ((= (car (cdr elem
)) ?d
)
2054 (numberp el
) (setq el
(list 'int-to-string el
))))
2055 (setq flist
(cons (gnus-max-width-function el max-width
)
2058 (setq flist
(cons (car elem
) flist
))
2059 (setq newspec
(car (cdr elem
))))
2060 ;; Remove the old specification (and possibly a ",12" string).
2061 (delete-region beg
(match-end 2))
2062 ;; Insert the new specification.
2065 (setq fstring
(buffer-substring 1 (point-max))))
2066 (cons 'format
(cons fstring
(nreverse flist
)))))
2068 (defun gnus-set-work-buffer ()
2069 (if (get-buffer gnus-work-buffer
)
2071 (set-buffer gnus-work-buffer
)
2073 (set-buffer (get-buffer-create gnus-work-buffer
))
2074 (kill-all-local-variables)
2075 (buffer-disable-undo (current-buffer))
2076 (gnus-add-current-to-buffer-list)))
2078 ;; Article file names when saving.
2080 (defun gnus-Numeric-save-name (newsgroup headers
&optional last-file
)
2081 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
2082 If variable `gnus-use-long-file-name' is nil, it is ~/News/News.group/num.
2083 Otherwise, it is like ~/News/news/group/num."
2086 (concat (if (gnus-use-long-file-name 'not-save
)
2087 (gnus-capitalize-newsgroup newsgroup
)
2088 (gnus-newsgroup-directory-form newsgroup
))
2089 "/" (int-to-string (mail-header-number headers
)))
2090 (or gnus-article-save-directory
"~/News"))))
2092 (string-equal (file-name-directory default
)
2093 (file-name-directory last-file
))
2094 (string-match "^[0-9]+$" (file-name-nondirectory last-file
)))
2096 (or last-file default
))))
2098 (defun gnus-numeric-save-name (newsgroup headers
&optional last-file
)
2099 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
2100 If variable `gnus-use-long-file-name' is non-nil, it is
2101 ~/News/news.group/num. Otherwise, it is like ~/News/news/group/num."
2104 (concat (if (gnus-use-long-file-name 'not-save
)
2106 (gnus-newsgroup-directory-form newsgroup
))
2107 "/" (int-to-string (mail-header-number headers
)))
2108 (or gnus-article-save-directory
"~/News"))))
2110 (string-equal (file-name-directory default
)
2111 (file-name-directory last-file
))
2112 (string-match "^[0-9]+$" (file-name-nondirectory last-file
)))
2114 (or last-file default
))))
2116 (defun gnus-Plain-save-name (newsgroup headers
&optional last-file
)
2117 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
2118 If variable `gnus-use-long-file-name' is non-nil, it is
2119 ~/News/News.group. Otherwise, it is like ~/News/news/group/news."
2122 (if (gnus-use-long-file-name 'not-save
)
2123 (gnus-capitalize-newsgroup newsgroup
)
2124 (concat (gnus-newsgroup-directory-form newsgroup
) "/news"))
2125 (or gnus-article-save-directory
"~/News"))))
2127 (defun gnus-plain-save-name (newsgroup headers
&optional last-file
)
2128 "Generate file name from NEWSGROUP, HEADERS, and optional LAST-FILE.
2129 If variable `gnus-use-long-file-name' is non-nil, it is
2130 ~/News/news.group. Otherwise, it is like ~/News/news/group/news."
2133 (if (gnus-use-long-file-name 'not-save
)
2135 (concat (gnus-newsgroup-directory-form newsgroup
) "/news"))
2136 (or gnus-article-save-directory
"~/News"))))
2138 ;; For subscribing new newsgroup
2140 (defun gnus-subscribe-hierarchical-interactive (groups)
2141 (let ((groups (sort groups
'string
<))
2142 prefixes prefix start ans group starts
)
2144 (setq prefixes
(list "^"))
2145 (while (and groups prefixes
)
2146 (while (not (string-match (car prefixes
) (car groups
)))
2147 (setq prefixes
(cdr prefixes
)))
2148 (setq prefix
(car prefixes
))
2149 (setq start
(1- (length prefix
)))
2150 (if (and (string-match "[^\\.]\\." (car groups
) start
)
2153 (concat "^" (substring (car groups
) 0 (match-end 0))))
2154 (string-match prefix
(car (cdr groups
))))
2156 (setq prefixes
(cons prefix prefixes
))
2157 (message "Descend hierarchy %s? ([y]nsq): "
2158 (substring prefix
1 (1- (length prefix
))))
2159 (setq ans
(read-char))
2162 (string-match prefix
2163 (setq group
(car groups
))))
2164 (setq gnus-killed-list
2165 (cons group gnus-killed-list
))
2166 (gnus-sethash group group gnus-killed-hashtb
)
2167 (setq groups
(cdr groups
)))
2168 (setq starts
(cdr starts
)))
2171 (string-match prefix
2172 (setq group
(car groups
))))
2173 (gnus-sethash group group gnus-killed-hashtb
)
2174 (gnus-subscribe-alphabetically (car groups
))
2175 (setq groups
(cdr groups
)))
2176 (setq starts
(cdr starts
)))
2179 (setq group
(car groups
))
2180 (setq gnus-killed-list
(cons group gnus-killed-list
))
2181 (gnus-sethash group group gnus-killed-hashtb
)
2182 (setq groups
(cdr groups
))))
2184 (message "Subscribe %s? ([n]yq)" (car groups
))
2185 (setq ans
(read-char))
2186 (setq group
(car groups
))
2188 (gnus-subscribe-alphabetically (car groups
))
2189 (gnus-sethash group group gnus-killed-hashtb
))
2192 (setq group
(car groups
))
2193 (setq gnus-killed-list
(cons group gnus-killed-list
))
2194 (gnus-sethash group group gnus-killed-hashtb
)
2195 (setq groups
(cdr groups
))))
2197 (setq gnus-killed-list
(cons group gnus-killed-list
))
2198 (gnus-sethash group group gnus-killed-hashtb
)))
2199 (setq groups
(cdr groups
)))))))
2201 (defun gnus-subscribe-randomly (newsgroup)
2202 "Subscribe new NEWSGROUP by making it the first newsgroup."
2203 (gnus-subscribe-newsgroup newsgroup
))
2205 (defun gnus-subscribe-alphabetically (newgroup)
2206 "Subscribe new NEWSGROUP and insert it in alphabetical order."
2207 ;; Basic ideas by mike-w@cs.aukuni.ac.nz (Mike Williams)
2208 (let ((groups (cdr gnus-newsrc-alist
))
2210 (while (and (not before
) groups
)
2211 (if (string< newgroup
(car (car groups
)))
2212 (setq before
(car (car groups
)))
2213 (setq groups
(cdr groups
))))
2214 (gnus-subscribe-newsgroup newgroup before
)))
2216 (defun gnus-subscribe-hierarchically (newgroup)
2217 "Subscribe new NEWSGROUP and insert it in hierarchical newsgroup order."
2218 ;; Basic ideas by mike-w@cs.aukuni.ac.nz (Mike Williams)
2220 (set-buffer (find-file-noselect gnus-current-startup-file
))
2221 (let ((groupkey newgroup
)
2223 (while (and (not before
) groupkey
)
2224 (goto-char (point-min))
2226 (concat "^\\(" (regexp-quote groupkey
) ".*\\)[!:]")))
2227 (while (and (re-search-forward groupkey-re nil t
)
2229 (setq before
(buffer-substring
2230 (match-beginning 1) (match-end 1)))
2231 (string< before newgroup
)))))
2232 ;; Remove tail of newsgroup name (eg. a.b.c -> a.b)
2234 (if (string-match "^\\(.*\\)\\.[^.]+$" groupkey
)
2235 (substring groupkey
(match-beginning 1) (match-end 1)))))
2236 (gnus-subscribe-newsgroup newgroup before
))))
2238 (defun gnus-subscribe-interactively (newsgroup)
2239 "Subscribe new NEWSGROUP interactively.
2240 It is inserted in hierarchical newsgroup order if subscribed. If not,
2242 (if (gnus-y-or-n-p (format "Subscribe new newsgroup: %s " newsgroup
))
2243 (gnus-subscribe-hierarchically newsgroup
)
2244 (setq gnus-killed-list
(cons newsgroup gnus-killed-list
))))
2246 (defun gnus-subscribe-zombies (newsgroup)
2247 "Make new NEWSGROUP a zombie group."
2248 (setq gnus-zombie-list
(cons newsgroup gnus-zombie-list
)))
2250 (defun gnus-subscribe-newsgroup (newsgroup &optional next
)
2251 "Subscribe new NEWSGROUP.
2252 If NEXT is non-nil, it is inserted before NEXT. Otherwise it is made
2253 the first newsgroup."
2254 ;; We subscribe the group by changing its level to `subscribed'.
2255 (gnus-group-change-level
2256 newsgroup gnus-level-default-subscribed
2257 gnus-level-killed
(gnus-gethash (or next
"dummy.group") gnus-newsrc-hashtb
))
2258 (gnus-message 5 "Subscribe newsgroup: %s" newsgroup
))
2262 (defun gnus-newsgroup-directory-form (newsgroup)
2263 "Make hierarchical directory name from NEWSGROUP name."
2264 (let ((newsgroup (gnus-newsgroup-savable-name newsgroup
))
2265 (len (length newsgroup
))
2267 ;; If this is a foreign group, we don't want to translate the
2269 (if (setq idx
(string-match ":" newsgroup
))
2270 (aset newsgroup idx ?
/)
2272 ;; Replace all occurrences of `.' with `/'.
2274 (if (= (aref newsgroup idx
) ?.
)
2275 (aset newsgroup idx ?
/))
2276 (setq idx
(1+ idx
)))
2279 (defun gnus-newsgroup-savable-name (group)
2280 ;; Replace any slashes in a group name (eg. an ange-ftp nndoc group)
2282 (gnus-replace-chars-in-string group ?
/ ?.
))
2284 (defun gnus-make-directory (dir)
2285 "Make DIRECTORY recursively."
2286 ;; Why don't we use `(make-directory dir 'parents)'? That's just one
2287 ;; of the many mysteries of the universe.
2288 (let* ((dir (expand-file-name dir default-directory
))
2290 (if (string-match "/$" dir
)
2291 (setq dir
(substring dir
0 (match-beginning 0))))
2292 ;; First go down the path until we find a directory that exists.
2293 (while (not (file-exists-p dir
))
2294 (setq dirs
(cons dir dirs
))
2295 (string-match "/[^/]+$" dir
)
2296 (setq dir
(substring dir
0 (match-beginning 0))))
2297 ;; Then create all the subdirs.
2298 (while (and dirs
(not err
))
2300 (make-directory (car dirs
))
2301 (error (setq err t
)))
2302 (setq dirs
(cdr dirs
)))
2303 ;; We return whether we were successful or not.
2306 (defun gnus-capitalize-newsgroup (newsgroup)
2307 "Capitalize NEWSGROUP name."
2308 (and (not (zerop (length newsgroup
)))
2309 (concat (char-to-string (upcase (aref newsgroup
0)))
2310 (substring newsgroup
1))))
2314 (defun gnus-simplify-subject (subject &optional re-only
)
2315 "Remove `Re:' and words in parentheses.
2316 If optional argument RE-ONLY is non-nil, strip `Re:' only."
2317 (let ((case-fold-search t
)) ;Ignore case.
2318 ;; Remove `Re:' and `Re^N:'.
2319 (if (string-match "^re:[ \t]*" subject
)
2320 (setq subject
(substring subject
(match-end 0))))
2321 ;; Remove words in parentheses from end.
2323 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
2324 (setq subject
(substring subject
0 (match-beginning 0)))))
2325 ;; Return subject string.
2328 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
2330 (defun gnus-simplify-subject-fuzzy (subject)
2331 (let ((case-fold-search t
))
2333 (gnus-set-work-buffer)
2335 (inline (gnus-simplify-buffer-fuzzy))
2338 (defun gnus-simplify-buffer-fuzzy ()
2339 (goto-char (point-min))
2340 ;; Fix by Stainless Steel Rat <ratinox@ccs.neu.edu>.
2341 (while (re-search-forward "^[ \t]*\\(re\\|fwd\\)[[{(^0-9]*[])}]?[:;][ \t]*"
2343 (replace-match "" t t
))
2344 (goto-char (point-min))
2345 (while (re-search-forward "[ \t\n]*([^()]*)[ \t\n]*$" nil t
)
2346 (replace-match "" t t
))
2347 (goto-char (point-min))
2348 (while (re-search-forward "[ \t]+" nil t
)
2349 (replace-match " " t t
))
2350 (goto-char (point-min))
2351 (while (re-search-forward "[ \t]+$" nil t
)
2352 (replace-match "" t t
))
2353 (goto-char (point-min))
2354 (while (re-search-forward "^[ \t]+" nil t
)
2355 (replace-match "" t t
))
2356 (if gnus-simplify-subject-fuzzy-regexp
2357 (while (re-search-forward gnus-simplify-subject-fuzzy-regexp nil t
)
2358 (replace-match "" t t
))))
2360 ;; Add the current buffer to the list of buffers to be killed on exit.
2361 (defun gnus-add-current-to-buffer-list ()
2362 (or (memq (current-buffer) gnus-buffer-list
)
2363 (setq gnus-buffer-list
(cons (current-buffer) gnus-buffer-list
))))
2365 (defun gnus-string> (s1 s2
)
2366 (not (or (string< s1 s2
)
2369 ;; Functions accessing headers.
2370 ;; Functions are more convenient than macros in some cases.
2372 (defun gnus-header-number (header)
2373 (mail-header-number header
))
2375 (defun gnus-header-subject (header)
2376 (mail-header-subject header
))
2378 (defun gnus-header-from (header)
2379 (mail-header-from header
))
2381 (defun gnus-header-xref (header)
2382 (mail-header-xref header
))
2384 (defun gnus-header-lines (header)
2385 (mail-header-lines header
))
2387 (defun gnus-header-date (header)
2388 (mail-header-date header
))
2390 (defun gnus-header-id (header)
2391 (mail-header-id header
))
2393 (defun gnus-header-message-id (header)
2394 (mail-header-id header
))
2396 (defun gnus-header-chars (header)
2397 (mail-header-chars header
))
2399 (defun gnus-header-references (header)
2400 (mail-header-references header
))
2402 ;;; General various misc type functions.
2404 (defun gnus-clear-system ()
2405 "Clear all variables and buffers."
2406 ;; Clear Gnus variables.
2407 (let ((variables gnus-variable-list
))
2409 (set (car variables
) nil
)
2410 (setq variables
(cdr variables
))))
2411 ;; Clear other internal variables.
2412 (setq gnus-list-of-killed-groups nil
2413 gnus-have-read-active-file nil
2414 gnus-newsrc-alist nil
2415 gnus-newsrc-hashtb nil
2416 gnus-killed-list nil
2417 gnus-zombie-list nil
2418 gnus-killed-hashtb nil
2419 gnus-active-hashtb nil
2420 gnus-moderated-list nil
2421 gnus-description-hashtb nil
2422 gnus-newsgroup-headers nil
2423 gnus-newsgroup-headers-hashtb-by-number nil
2424 gnus-newsgroup-name nil
2425 gnus-server-alist nil
2426 gnus-current-select-method nil
)
2427 ;; Reset any score variables.
2428 (and (boundp 'gnus-score-cache
)
2429 (set 'gnus-score-cache nil
))
2430 (and (boundp 'gnus-internal-global-score-files
)
2431 (set 'gnus-internal-global-score-files nil
))
2432 ;; Kill the startup file.
2433 (and gnus-current-startup-file
2434 (get-file-buffer gnus-current-startup-file
)
2435 (kill-buffer (get-file-buffer gnus-current-startup-file
)))
2436 ;; Save any cache buffers.
2437 (and gnus-use-cache
(gnus-cache-save-buffers))
2438 ;; Clear the dribble buffer.
2439 (gnus-dribble-clear)
2440 ;; Kill global KILL file buffer.
2441 (if (get-file-buffer (gnus-newsgroup-kill-file nil
))
2442 (kill-buffer (get-file-buffer (gnus-newsgroup-kill-file nil
))))
2443 (gnus-kill-buffer nntp-server-buffer
)
2444 ;; Kill Gnus buffers.
2445 (while gnus-buffer-list
2446 (gnus-kill-buffer (car gnus-buffer-list
))
2447 (setq gnus-buffer-list
(cdr gnus-buffer-list
))))
2449 (defun gnus-windows-old-to-new (setting)
2450 ;; First we take care of the really, really old Gnus 3 actions.
2451 (if (symbolp setting
)
2453 (cond ((memq setting
'(SelectArticle))
2455 ((memq setting
'(SelectSubject ExpandSubject
))
2457 ((memq setting
'(SelectNewsgroup ExitNewsgroup
))
2460 (if (or (listp setting
)
2461 (not (and gnus-window-configuration
2462 (memq setting
'(group summary article
)))))
2464 (let* ((setting (if (eq setting
'group
)
2465 (if (assq 'newsgroup gnus-window-configuration
)
2467 'newsgroups
) setting
))
2468 (elem (car (cdr (assq setting gnus-window-configuration
))))
2469 (total (apply '+ elem
))
2470 (types '(group summary article
))
2471 (pbuf (if (eq setting
'newsgroups
) 'group
'summary
))
2476 (or (not (numberp (nth i elem
)))
2477 (zerop (nth i elem
))
2479 (setq perc
(/ (* 1.0 (nth 0 elem
)) total
))
2480 (setq out
(cons (if (eq pbuf
(nth i types
))
2481 (vector (nth i types
) perc
'point
)
2482 (vector (nth i types
) perc
))
2485 (list (nreverse out
)))))
2487 (defun gnus-add-configuration (conf)
2488 (setq gnus-buffer-configuration
2489 (cons conf
(delq (assq (car conf
) gnus-buffer-configuration
)
2490 gnus-buffer-configuration
))))
2492 (defun gnus-configure-windows (setting &optional force
)
2493 (setq setting
(gnus-windows-old-to-new setting
))
2494 (let ((r (if (symbolp setting
)
2495 (cdr (assq setting gnus-buffer-configuration
))
2497 (in-buf (current-buffer))
2498 rule val w height hor ohor heights sub jump-buffer
2499 rel total to-buf all-visible
)
2500 (or r
(error "No such setting: %s" setting
))
2502 (if (and (not force
) (setq all-visible
(gnus-all-windows-visible-p r
)))
2503 ;; All the windows mentioned are already visible, so we just
2504 ;; put point in the assigned buffer, and do not touch the
2506 (select-window (get-buffer-window all-visible t
))
2509 ;; Either remove all windows or just remove all Gnus windows.
2510 (if gnus-use-full-window
2511 (delete-other-windows)
2512 (gnus-remove-some-windows)
2513 (switch-to-buffer nntp-server-buffer
))
2519 ;; We have to do the (possible) horizontal splitting before the
2521 (if (and (listp (car hor
))
2522 (eq (car (car hor
)) 'horizontal
))
2526 (if (integerp (nth 1 (car hor
)))
2528 (- (frame-width) (floor (* (frame-width) (nth 1 (car hor
))))))
2530 (setq hor
(cdr hor
))))
2532 ;; Go through the rules and eval the elements that are to be
2535 (if (setq val
(if (vectorp (car hor
)) (car hor
) (eval (car hor
))))
2537 ;; Expand short buffer name.
2538 (setq w
(aref val
0))
2539 (and (setq w
(cdr (assq w gnus-window-to-buffer
)))
2541 (setq val
(apply 'vector
(mapcar 'identity val
)))
2543 (setq ohor
(cons val ohor
))))
2544 (setq hor
(cdr hor
)))
2545 (setq rule
(cons (nreverse ohor
) rule
))
2547 (setq rule
(nreverse rule
))
2549 ;; We tally the window sizes.
2550 (setq total
(window-height))
2552 (setq hor
(car rule
))
2553 (if (and (listp (car hor
)) (eq (car (car hor
)) 'horizontal
))
2554 (setq hor
(cdr hor
)))
2557 (setq rel
(aref (car hor
) 1)
2559 (cond ((and (floatp rel
) (= 1.0 rel
))
2564 (max (floor (* total rel
)) 4)))
2566 sub
(+ sub
(if (numberp (car heights
)) (car heights
) 0))
2568 (setq heights
(nreverse heights
)
2571 ;; We then go through these heights and create windows for them.
2573 (setq height
(car heights
)
2574 heights
(cdr heights
))
2576 (setq height
(- total sub
)))
2578 (split-window nil height
))
2579 (setq to-buf
(aref (car hor
) 0))
2584 (symbol-value (aref (car hor
) 0)))
2586 (aref (car hor
) 0))))
2587 (and (> (length (car hor
)) 2)
2588 (eq (aref (car hor
) 2) 'point
)
2589 (setq jump-buffer
(current-buffer)))
2591 (setq hor
(cdr hor
)))
2593 (setq rule
(cdr rule
)))
2595 ;; Finally, we pop to the buffer that's supposed to have point.
2596 (or jump-buffer
(error "Missing `point' in spec for %s" setting
))
2598 (select-window (get-buffer-window jump-buffer t
))
2599 (set-buffer jump-buffer
))))
2601 (defun gnus-all-windows-visible-p (rule)
2602 (let (invisible hor jump-buffer val buffer
)
2603 ;; Go through the rules and eval the elements that are to be
2605 (while (and rule
(not invisible
))
2606 (setq hor
(car rule
)
2608 (while (and hor
(not invisible
))
2609 (if (setq val
(if (vectorp (car hor
))
2611 (if (not (eq (car (car hor
)) 'horizontal
))
2614 ;; Expand short buffer name.
2615 (setq buffer
(or (cdr (assq (aref val
0) gnus-window-to-buffer
))
2617 (setq buffer
(if (symbolp buffer
) (symbol-value buffer
)
2619 (and (> (length val
) 2) (eq 'point
(aref val
2))
2620 (setq jump-buffer buffer
))
2621 (setq invisible
(not (and buffer
(get-buffer-window buffer
))))))
2622 (setq hor
(cdr hor
))))
2623 (and (not invisible
) jump-buffer
)))
2625 (defun gnus-window-top-edge (&optional window
)
2626 (nth 1 (window-edges window
)))
2628 (defun gnus-remove-some-windows ()
2629 (let ((buffers gnus-window-to-buffer
)
2630 buf bufs lowest-buf lowest
)
2632 ;; Remove windows on all known Gnus buffers.
2634 (setq buf
(cdr (car buffers
)))
2636 (setq buf
(and (boundp buf
) (symbol-value buf
))))
2638 (get-buffer-window buf
)
2640 (setq bufs
(cons buf bufs
))
2642 (if (or (not lowest
)
2643 (< (gnus-window-top-edge) lowest
))
2645 (setq lowest
(gnus-window-top-edge))
2646 (setq lowest-buf buf
)))))
2647 (setq buffers
(cdr buffers
)))
2648 ;; Remove windows on *all* summary buffers.
2652 (let ((buf (window-buffer win
)))
2653 (if (string-match "^\\*Summary" (buffer-name buf
))
2655 (setq bufs
(cons buf bufs
))
2657 (if (or (not lowest
)
2658 (< (gnus-window-top-edge) lowest
))
2660 (setq lowest-buf buf
)
2661 (setq lowest
(gnus-window-top-edge))))))))))
2664 (pop-to-buffer lowest-buf
)
2665 (switch-to-buffer nntp-server-buffer
)))
2667 (and (not (eq (car bufs
) lowest-buf
))
2668 (delete-windows-on (car bufs
)))
2669 (setq bufs
(cdr bufs
))))))
2671 (defun gnus-version ()
2672 "Version numbers of this version of Gnus."
2674 (let ((methods gnus-valid-select-methods
)
2677 ;; Go through all the legal select methods and add their version
2678 ;; numbers to the total version string. Only the backends that are
2679 ;; currently in use will have their message numbers taken into
2682 (setq meth
(intern (concat (car (car methods
)) "-version")))
2684 (stringp (symbol-value meth
))
2685 (setq mess
(concat mess
"; " (symbol-value meth
))))
2686 (setq methods
(cdr methods
)))
2687 (gnus-message 2 mess
)))
2689 (defun gnus-info-find-node ()
2690 "Find Info documentation of Gnus."
2692 ;; Enlarge info window if needed.
2693 (let ((mode major-mode
))
2694 (gnus-configure-windows 'info
)
2695 (Info-goto-node (car (cdr (assq mode gnus-info-nodes
))))))
2697 (defun gnus-overload-functions (&optional overloads
)
2698 "Overload functions specified by optional argument OVERLOADS.
2699 If nothing is specified, use the variable gnus-overload-functions."
2701 (overloads (or overloads gnus-overload-functions
)))
2703 (setq defs
(car overloads
))
2704 (setq overloads
(cdr overloads
))
2705 ;; Load file before overloading function if necessary. Make
2706 ;; sure we cannot use `require' always.
2707 (and (not (fboundp (car defs
)))
2708 (car (cdr (cdr defs
)))
2709 (load (car (cdr (cdr defs
))) nil
'nomessage
))
2710 (fset (car defs
) (car (cdr defs
))))))
2712 (defun gnus-replace-chars-in-string (string &rest pairs
)
2713 "Replace characters in STRING from FROM to TO."
2714 (let ((string (substring string
0)) ;Copy string.
2715 (len (length string
))
2718 (or (zerop (%
(length pairs
) 2))
2719 (error "Odd number of translation pairs"))
2720 (setplist 'sym pairs
)
2721 ;; Replace all occurrences of FROM with TO.
2723 (if (setq to
(get 'sym
(aref string idx
)))
2724 (aset string idx to
))
2725 (setq idx
(1+ idx
)))
2728 (defun gnus-days-between (date1 date2
)
2729 ;; Return the number of days between date1 and date2.
2730 (- (gnus-day-number date1
) (gnus-day-number date2
)))
2732 (defun gnus-day-number (date)
2733 (let ((dat (mapcar (lambda (s) (and s
(string-to-int s
)) )
2734 (timezone-parse-date date
))))
2735 (timezone-absolute-from-gregorian
2736 (nth 1 dat
) (nth 2 dat
) (car dat
))))
2738 ;; Returns a floating point number that says how many seconds have
2739 ;; lapsed between Jan 1 12:00:00 1970 and DATE.
2740 (defun gnus-seconds-since-epoch (date)
2741 (let* ((tdate (mapcar (lambda (ti) (and ti
(string-to-int ti
)))
2742 (timezone-parse-date date
)))
2743 (ttime (mapcar (lambda (ti) (and ti
(string-to-int ti
)))
2744 (timezone-parse-time
2745 (aref (timezone-parse-date date
) 3))))
2746 (edate (mapcar (lambda (ti) (and ti
(string-to-int ti
)))
2747 (timezone-parse-date "Jan 1 12:00:00 1970")))
2748 (tday (- (timezone-absolute-from-gregorian
2749 (nth 1 tdate
) (nth 2 tdate
) (nth 0 tdate
))
2750 (timezone-absolute-from-gregorian
2751 (nth 1 edate
) (nth 2 edate
) (nth 0 edate
)))))
2753 (* (nth 1 ttime
) 60)
2754 (* 1.0 (nth 0 ttime
) 60 60)
2755 (* 1.0 tday
60 60 24))))
2757 (defun gnus-file-newer-than (file date
)
2758 (let ((fdate (nth 5 (file-attributes file
))))
2759 (or (> (car fdate
) (car date
))
2760 (and (= (car fdate
) (car date
))
2761 (> (nth 1 fdate
) (nth 1 date
))))))
2763 (defun gnus-group-read-only-p (&optional group
)
2764 "Check whether GROUP supports editing or not.
2765 If GROUP is nil, `gnus-newsgroup-name' will be checked instead. Note
2766 that that variable is buffer-local to the summary buffers."
2767 (let ((group (or group gnus-newsgroup-name
)))
2768 (not (gnus-check-backend-function 'request-replace-article group
))))
2770 ;; Two silly functions to ensure that all `y-or-n-p' questions clear
2772 (defun gnus-y-or-n-p (prompt)
2777 (defun gnus-yes-or-no-p (prompt)
2779 (yes-or-no-p prompt
)
2782 ;; Check whether to use long file names.
2783 (defun gnus-use-long-file-name (symbol)
2784 ;; The variable has to be set...
2785 (and gnus-use-long-file-name
2786 ;; If it isn't a list, then we return t.
2787 (or (not (listp gnus-use-long-file-name
))
2788 ;; If it is a list, and the list contains `symbol', we
2790 (not (memq symbol gnus-use-long-file-name
)))))
2792 ;; I suspect there's a better way, but I haven't taken the time to do
2793 ;; it yet. -erik selberg@cs.washington.edu
2794 (defun gnus-dd-mmm (messy-date)
2795 "Return a string like DD-MMM from a big messy string"
2796 (let ((datevec (timezone-parse-date messy-date
)))
2798 (or (aref datevec
2) "??")
2801 (nth (1- (string-to-number (aref datevec
1)))
2802 timezone-months-assoc
))
2805 ;; Make a hash table (default and minimum size is 255).
2806 ;; Optional argument HASHSIZE specifies the table size.
2807 (defun gnus-make-hashtable (&optional hashsize
)
2808 (make-vector (if hashsize
(max (gnus-create-hash-size hashsize
) 255) 255) 0))
2810 ;; Make a number that is suitable for hashing; bigger than MIN and one
2812 (defun gnus-create-hash-size (min)
2818 ;; Show message if message has a lower level than `gnus-verbose'.
2819 ;; Guide-line for numbers:
2820 ;; 1 - error messages, 3 - non-serious error messages, 5 - messages
2821 ;; for things that take a long time, 7 - not very important messages
2822 ;; on stuff, 9 - messages inside loops.
2823 (defun gnus-message (level &rest args
)
2824 (if (<= level gnus-verbose
)
2825 (apply 'message args
)
2826 ;; We have to do this format thingy here even if the result isn't
2827 ;; shown - the return value has to be the same as the return value
2829 (apply 'format args
)))
2831 ;; Generate a unique new group name.
2832 (defun gnus-generate-new-group-name (leaf)
2835 (while (gnus-gethash name gnus-newsrc-hashtb
)
2836 (setq name
(concat leaf
"<" (int-to-string (setq num
(1+ num
))) ">")))
2839 (defun gnus-ephemeral-group-p (group)
2840 "Say whether GROUP is ephemeral or not."
2841 (assoc 'quit-config
(gnus-find-method-for-group group
)))
2843 (defun gnus-group-quit-config (group)
2844 "Return the quit-config of GROUP."
2845 (nth 1 (assoc 'quit-config
(gnus-find-method-for-group group
))))
2847 (defun gnus-simplify-mode-line ()
2848 "Make mode lines a bit simpler."
2849 (setq mode-line-modified
"-- ")
2850 (if (listp mode-line-format
)
2852 (make-local-variable 'mode-line-format
)
2853 (setq mode-line-format
(copy-sequence mode-line-format
))
2854 (and (equal (nth 3 mode-line-format
) " ")
2855 (setcar (nthcdr 3 mode-line-format
) "")))))
2857 ;;; List and range functions
2859 (defun gnus-last-element (list)
2860 "Return last element of LIST."
2862 (setq list
(cdr list
)))
2865 (defun gnus-copy-sequence (list)
2866 "Do a complete, total copy of a list."
2867 (if (and (consp list
) (not (consp (cdr list
))))
2868 (cons (car list
) (cdr list
))
2869 (mapcar (lambda (elem) (if (consp elem
)
2870 (if (consp (cdr elem
))
2871 (gnus-copy-sequence elem
)
2872 (cons (car elem
) (cdr elem
)))
2876 (defun gnus-set-difference (list1 list2
)
2877 "Return a list of elements of LIST1 that do not appear in LIST2."
2878 (let ((list1 (copy-sequence list1
)))
2880 (setq list1
(delq (car list2
) list1
))
2881 (setq list2
(cdr list2
)))
2884 (defun gnus-sorted-complement (list1 list2
)
2885 "Return a list of elements of LIST1 that do not appear in LIST2.
2886 Both lists have to be sorted over <."
2888 (if (or (null list1
) (null list2
))
2890 (while (and list1 list2
)
2891 (cond ((= (car list1
) (car list2
))
2892 (setq list1
(cdr list1
)
2894 ((< (car list1
) (car list2
))
2895 (setq out
(cons (car list1
) out
))
2896 (setq list1
(cdr list1
)))
2898 (setq out
(cons (car list2
) out
))
2899 (setq list2
(cdr list2
)))))
2900 (nconc (nreverse out
) (or list1 list2
)))))
2902 (defun gnus-intersection (list1 list2
)
2905 (if (memq (car list2
) list1
)
2906 (setq result
(cons (car list2
) result
)))
2907 (setq list2
(cdr list2
)))
2910 (defun gnus-sorted-intersection (list1 list2
)
2911 ;; LIST1 and LIST2 have to be sorted over <.
2913 (while (and list1 list2
)
2914 (cond ((= (car list1
) (car list2
))
2915 (setq out
(cons (car list1
) out
)
2918 ((< (car list1
) (car list2
))
2919 (setq list1
(cdr list1
)))
2921 (setq list2
(cdr list2
)))))
2924 (defun gnus-set-sorted-intersection (list1 list2
)
2925 ;; LIST1 and LIST2 have to be sorted over <.
2926 ;; This function modifies LIST1.
2927 (let* ((top (cons nil list1
))
2929 (while (and list1 list2
)
2930 (cond ((= (car list1
) (car list2
))
2934 ((< (car list1
) (car list2
))
2935 (setcdr prev
(cdr list1
))
2936 (setq list1
(cdr list1
)))
2938 (setq list2
(cdr list2
)))))
2942 (defun gnus-compress-sequence (numbers &optional always-list
)
2943 "Convert list of numbers to a list of ranges or a single range.
2944 If ALWAYS-LIST is non-nil, this function will always release a list of
2946 (let* ((first (car numbers
))
2947 (last (car numbers
))
2951 (if (not (listp (cdr numbers
)))
2954 (cond ((= last
(car numbers
)) nil
) ;Omit duplicated number
2955 ((= (1+ last
) (car numbers
)) ;Still in sequence
2956 (setq last
(car numbers
)))
2957 (t ;End of one sequence
2959 (cons (if (= first last
) first
2960 (cons first last
)) result
))
2961 (setq first
(car numbers
))
2962 (setq last
(car numbers
))))
2963 (setq numbers
(cdr numbers
)))
2964 (if (and (not always-list
) (null result
))
2965 (if (= first last
) (list first
) (cons first last
))
2966 (nreverse (cons (if (= first last
) first
(cons first last
))
2969 (defalias 'gnus-uncompress-sequence
'gnus-uncompress-range
)
2970 (defun gnus-uncompress-range (ranges)
2971 "Expand a list of ranges into a list of numbers.
2972 RANGES is either a single range on the form `(num . num)' or a list of
2974 (let (first last result
)
2978 ((not (listp (cdr ranges
)))
2979 (setq first
(car ranges
))
2980 (setq last
(cdr ranges
))
2981 (while (<= first last
)
2982 (setq result
(cons first result
))
2983 (setq first
(1+ first
)))
2987 (if (atom (car ranges
))
2988 (if (numberp (car ranges
))
2989 (setq result
(cons (car ranges
) result
)))
2990 (setq first
(car (car ranges
)))
2991 (setq last
(cdr (car ranges
)))
2992 (while (<= first last
)
2993 (setq result
(cons first result
))
2994 (setq first
(1+ first
))))
2995 (setq ranges
(cdr ranges
)))
2996 (nreverse result
)))))
2998 (defun gnus-add-to-range (ranges list
)
2999 "Return a list of ranges that has all articles from both RANGES and LIST.
3000 Note: LIST has to be sorted over `<'."
3002 (gnus-compress-sequence list t
)
3003 (setq list
(copy-sequence list
))
3004 (or (listp (cdr ranges
))
3005 (setq ranges
(list ranges
)))
3007 ilist lowest highest temp
)
3008 (while (and ranges list
)
3010 (setq lowest
(or (and (atom (car ranges
)) (car ranges
))
3011 (car (car ranges
))))
3012 (while (and list
(cdr list
) (< (car (cdr list
)) lowest
))
3013 (setq list
(cdr list
)))
3014 (if (< (car ilist
) lowest
)
3017 (setq list
(cdr list
))
3019 (setq out
(nconc (gnus-compress-sequence ilist t
) out
))))
3020 (setq highest
(or (and (atom (car ranges
)) (car ranges
))
3021 (cdr (car ranges
))))
3022 (while (and list
(<= (car list
) highest
))
3023 (setq list
(cdr list
)))
3024 (setq ranges
(cdr ranges
)))
3026 (setq out
(nconc (gnus-compress-sequence list t
) out
)))
3027 (setq out
(sort out
(lambda (r1 r2
)
3028 (< (or (and (atom r1
) r1
) (car r1
))
3029 (or (and (atom r2
) r2
) (car r2
))))))
3032 (if (atom (car ranges
))
3034 (if (atom (car (cdr ranges
)))
3035 (if (= (1+ (car ranges
)) (car (cdr ranges
)))
3037 (setcar ranges
(cons (car ranges
)
3038 (car (cdr ranges
))))
3039 (setcdr ranges
(cdr (cdr ranges
)))))
3040 (if (= (1+ (car ranges
)) (car (car (cdr ranges
))))
3042 (setcar (car (cdr ranges
)) (car ranges
))
3043 (setcar ranges
(car (cdr ranges
)))
3044 (setcdr ranges
(cdr (cdr ranges
)))))))
3046 (if (atom (car (cdr ranges
)))
3047 (if (= (1+ (cdr (car ranges
))) (car (cdr ranges
)))
3049 (setcdr (car ranges
) (car (cdr ranges
)))
3050 (setcdr ranges
(cdr (cdr ranges
)))))
3051 (if (= (1+ (cdr (car ranges
))) (car (car (cdr ranges
))))
3053 (setcdr (car ranges
) (cdr (car (cdr ranges
))))
3054 (setcdr ranges
(cdr (cdr ranges
))))))))
3055 (setq ranges
(cdr ranges
)))
3058 (defun gnus-remove-from-range (ranges list
)
3059 "Return a list of ranges that has all articles from LIST removed from RANGES.
3060 Note: LIST has to be sorted over `<'."
3061 ;; !!! This function shouldn't look like this, but I've got a headache.
3062 (gnus-compress-sequence
3063 (gnus-sorted-complement
3064 (gnus-uncompress-range ranges
) list
)))
3066 (defun gnus-member-of-range (number ranges
)
3067 (if (not (listp (cdr ranges
)))
3068 (and (>= number
(car ranges
))
3069 (<= number
(cdr ranges
)))
3072 (if (numberp (car ranges
))
3073 (>= number
(car ranges
))
3074 (>= number
(car (car ranges
))))
3076 (if (if (numberp (car ranges
))
3077 (= number
(car ranges
))
3078 (and (>= number
(car (car ranges
)))
3079 (<= number
(cdr (car ranges
)))))
3080 (setq not-stop nil
))
3081 (setq ranges
(cdr ranges
)))
3089 (defvar gnus-group-mode-map nil
)
3090 (defvar gnus-group-group-map nil
)
3091 (defvar gnus-group-mark-map nil
)
3092 (defvar gnus-group-list-map nil
)
3093 (defvar gnus-group-help-map nil
)
3094 (defvar gnus-group-sub-map nil
)
3095 (put 'gnus-group-mode
'mode-class
'special
)
3097 (if gnus-group-mode-map
3099 (setq gnus-group-mode-map
(make-keymap))
3100 (suppress-keymap gnus-group-mode-map
)
3101 (define-key gnus-group-mode-map
" " 'gnus-group-read-group
)
3102 (define-key gnus-group-mode-map
"=" 'gnus-group-select-group
)
3103 (define-key gnus-group-mode-map
"\r" 'gnus-group-select-group
)
3104 (define-key gnus-group-mode-map
"j" 'gnus-group-jump-to-group
)
3105 (define-key gnus-group-mode-map
"n" 'gnus-group-next-unread-group
)
3106 (define-key gnus-group-mode-map
"p" 'gnus-group-prev-unread-group
)
3107 (define-key gnus-group-mode-map
"\177" 'gnus-group-prev-unread-group
)
3108 (define-key gnus-group-mode-map
"N" 'gnus-group-next-group
)
3109 (define-key gnus-group-mode-map
"P" 'gnus-group-prev-group
)
3110 (define-key gnus-group-mode-map
3111 "\M-n" 'gnus-group-next-unread-group-same-level
)
3112 (define-key gnus-group-mode-map
3113 "\M-p" 'gnus-group-prev-unread-group-same-level
)
3114 (define-key gnus-group-mode-map
"," 'gnus-group-best-unread-group
)
3115 (define-key gnus-group-mode-map
"." 'gnus-group-first-unread-group
)
3116 (define-key gnus-group-mode-map
"u" 'gnus-group-unsubscribe-current-group
)
3117 (define-key gnus-group-mode-map
"U" 'gnus-group-unsubscribe-group
)
3118 (define-key gnus-group-mode-map
"c" 'gnus-group-catchup-current
)
3119 (define-key gnus-group-mode-map
"C" 'gnus-group-catchup-current-all
)
3120 (define-key gnus-group-mode-map
"l" 'gnus-group-list-groups
)
3121 (define-key gnus-group-mode-map
"L" 'gnus-group-list-all-groups
)
3122 (define-key gnus-group-mode-map
"m" 'gnus-group-mail
)
3123 (define-key gnus-group-mode-map
"g" 'gnus-group-get-new-news
)
3124 (define-key gnus-group-mode-map
"\M-g" 'gnus-group-get-new-news-this-group
)
3125 (define-key gnus-group-mode-map
"R" 'gnus-group-restart
)
3126 (define-key gnus-group-mode-map
"r" 'gnus-group-read-init-file
)
3127 (define-key gnus-group-mode-map
"B" 'gnus-group-browse-foreign-server
)
3128 (define-key gnus-group-mode-map
"b" 'gnus-group-check-bogus-groups
)
3129 (define-key gnus-group-mode-map
"F" 'gnus-find-new-newsgroups
)
3130 (define-key gnus-group-mode-map
"\C-c\C-d" 'gnus-group-describe-group
)
3131 (define-key gnus-group-mode-map
"\M-d" 'gnus-group-describe-all-groups
)
3132 (define-key gnus-group-mode-map
"\C-c\C-a" 'gnus-group-apropos
)
3133 (define-key gnus-group-mode-map
"\C-c\M-\C-a" 'gnus-group-description-apropos
)
3134 (define-key gnus-group-mode-map
"a" 'gnus-group-post-news
)
3135 (define-key gnus-group-mode-map
"\ek" 'gnus-group-edit-local-kill
)
3136 (define-key gnus-group-mode-map
"\eK" 'gnus-group-edit-global-kill
)
3137 (define-key gnus-group-mode-map
"\C-k" 'gnus-group-kill-group
)
3138 (define-key gnus-group-mode-map
"\C-y" 'gnus-group-yank-group
)
3139 (define-key gnus-group-mode-map
"\C-w" 'gnus-group-kill-region
)
3140 (define-key gnus-group-mode-map
"\C-x\C-t" 'gnus-group-transpose-groups
)
3141 (define-key gnus-group-mode-map
"\C-c\C-l" 'gnus-group-list-killed
)
3142 (define-key gnus-group-mode-map
"\C-c\C-x" 'gnus-group-expire-articles
)
3143 (define-key gnus-group-mode-map
"\C-c\M-\C-x" 'gnus-group-expire-all-groups
)
3144 (define-key gnus-group-mode-map
"V" 'gnus-version
)
3145 (define-key gnus-group-mode-map
"s" 'gnus-group-save-newsrc
)
3146 (define-key gnus-group-mode-map
"z" 'gnus-group-suspend
)
3147 (define-key gnus-group-mode-map
"Z" 'gnus-group-clear-dribble
)
3148 (define-key gnus-group-mode-map
"q" 'gnus-group-exit
)
3149 (define-key gnus-group-mode-map
"Q" 'gnus-group-quit
)
3150 (define-key gnus-group-mode-map
"?" 'gnus-group-describe-briefly
)
3151 (define-key gnus-group-mode-map
"\C-c\C-i" 'gnus-info-find-node
)
3152 (define-key gnus-group-mode-map
"\M-e" 'gnus-group-edit-group-method
)
3153 (define-key gnus-group-mode-map
"^" 'gnus-group-enter-server-mode
)
3154 (define-key gnus-group-mode-map gnus-mouse-2
'gnus-mouse-pick-group
)
3155 (define-key gnus-group-mode-map
"<" 'beginning-of-buffer
)
3156 (define-key gnus-group-mode-map
">" 'end-of-buffer
)
3157 (define-key gnus-group-mode-map
"\C-c\C-b" 'gnus-bug
)
3158 (define-key gnus-group-mode-map
"\C-c\C-s" 'gnus-group-sort-groups
)
3160 (define-key gnus-group-mode-map
"#" 'gnus-group-mark-group
)
3161 (define-key gnus-group-mode-map
"\M-#" 'gnus-group-unmark-group
)
3162 (define-prefix-command 'gnus-group-mark-map
)
3163 (define-key gnus-group-mode-map
"M" 'gnus-group-mark-map
)
3164 (define-key gnus-group-mark-map
"m" 'gnus-group-mark-group
)
3165 (define-key gnus-group-mark-map
"u" 'gnus-group-unmark-group
)
3166 (define-key gnus-group-mark-map
"w" 'gnus-group-mark-region
)
3168 (define-prefix-command 'gnus-group-group-map
)
3169 (define-key gnus-group-mode-map
"G" 'gnus-group-group-map
)
3170 (define-key gnus-group-group-map
"d" 'gnus-group-make-directory-group
)
3171 (define-key gnus-group-group-map
"h" 'gnus-group-make-help-group
)
3172 (define-key gnus-group-group-map
"a" 'gnus-group-make-archive-group
)
3173 (define-key gnus-group-group-map
"k" 'gnus-group-make-kiboze-group
)
3174 (define-key gnus-group-group-map
"m" 'gnus-group-make-group
)
3175 (define-key gnus-group-group-map
"E" 'gnus-group-edit-group
)
3176 (define-key gnus-group-group-map
"e" 'gnus-group-edit-group-method
)
3177 (define-key gnus-group-group-map
"p" 'gnus-group-edit-group-parameters
)
3178 (define-key gnus-group-group-map
"v" 'gnus-group-add-to-virtual
)
3179 (define-key gnus-group-group-map
"V" 'gnus-group-make-empty-virtual
)
3180 (define-key gnus-group-group-map
"D" 'gnus-group-enter-directory
)
3181 (define-key gnus-group-group-map
"f" 'gnus-group-make-doc-group
)
3182 ;;(define-key gnus-group-group-map "sb" 'gnus-group-brew-soup)
3183 ;;(define-key gnus-group-group-map "sw" 'gnus-soup-save-areas)
3184 ;;(define-key gnus-group-group-map "ss" 'gnus-soup-send-replies)
3185 ;;(define-key gnus-group-group-map "sp" 'gnus-soup-pack-packet)
3186 ;;(define-key gnus-group-group-map "sr" 'nnsoup-pack-replies)
3188 (define-prefix-command 'gnus-group-list-map
)
3189 (define-key gnus-group-mode-map
"A" 'gnus-group-list-map
)
3190 (define-key gnus-group-list-map
"k" 'gnus-group-list-killed
)
3191 (define-key gnus-group-list-map
"z" 'gnus-group-list-zombies
)
3192 (define-key gnus-group-list-map
"s" 'gnus-group-list-groups
)
3193 (define-key gnus-group-list-map
"u" 'gnus-group-list-all-groups
)
3194 (define-key gnus-group-list-map
"a" 'gnus-group-apropos
)
3195 (define-key gnus-group-list-map
"d" 'gnus-group-description-apropos
)
3196 (define-key gnus-group-list-map
"m" 'gnus-group-list-matching
)
3197 (define-key gnus-group-list-map
"M" 'gnus-group-list-all-matching
)
3199 (define-prefix-command 'gnus-group-help-map
)
3200 (define-key gnus-group-mode-map
"H" 'gnus-group-help-map
)
3201 (define-key gnus-group-help-map
"f" 'gnus-group-fetch-faq
)
3203 (define-prefix-command 'gnus-group-sub-map
)
3204 (define-key gnus-group-mode-map
"S" 'gnus-group-sub-map
)
3205 (define-key gnus-group-sub-map
"l" 'gnus-group-set-current-level
)
3206 (define-key gnus-group-sub-map
"t" 'gnus-group-unsubscribe-current-group
)
3207 (define-key gnus-group-sub-map
"s" 'gnus-group-unsubscribe-group
)
3208 (define-key gnus-group-sub-map
"k" 'gnus-group-kill-group
)
3209 (define-key gnus-group-sub-map
"y" 'gnus-group-yank-group
)
3210 (define-key gnus-group-sub-map
"w" 'gnus-group-kill-region
)
3211 (define-key gnus-group-sub-map
"z" 'gnus-group-kill-all-zombies
))
3213 (defun gnus-group-mode ()
3214 "Major mode for reading news.
3216 All normal editing commands are switched off.
3217 \\<gnus-group-mode-map>
3218 The group buffer lists (some of) the groups available. For instance,
3219 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
3220 lists all zombie groups.
3222 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
3223 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
3225 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
3227 The following commands are available:
3229 \\{gnus-group-mode-map}"
3231 (if gnus-visual
(gnus-group-make-menu-bar))
3232 (kill-all-local-variables)
3233 (gnus-simplify-mode-line)
3234 (setq major-mode
'gnus-group-mode
)
3235 (setq mode-name
"Group")
3236 (gnus-group-set-mode-line)
3237 (setq mode-line-process nil
)
3238 (use-local-map gnus-group-mode-map
)
3239 (buffer-disable-undo (current-buffer))
3240 (setq truncate-lines t
)
3241 (setq buffer-read-only t
)
3242 (run-hooks 'gnus-group-mode-hook
))
3244 (defun gnus-mouse-pick-group (e)
3247 (gnus-group-read-group nil
))
3249 ;; Look at LEVEL and find out what the level is really supposed to be.
3250 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
3251 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
3252 (defun gnus-group-default-level (&optional level number-or-nil
)
3254 (gnus-group-use-permanent-levels
3255 (setq gnus-group-default-list-level
3256 (or level gnus-group-default-list-level
))
3257 (or gnus-group-default-list-level gnus-level-subscribed
))
3261 (or level gnus-group-default-list-level gnus-level-subscribed
))))
3264 (defvar gnus-tmp-prev-perm nil
)
3267 (defun gnus-no-server (&optional arg
)
3269 If ARG is a positive number, Gnus will use that as the
3270 startup level. If ARG is nil, Gnus will be started at level 2.
3271 If ARG is non-nil and not a positive number, Gnus will
3272 prompt the user for the name of an NNTP server to use.
3273 As opposed to `gnus', this command will not connect to the local server."
3276 (cons gnus-group-use-permanent-levels gnus-group-default-list-level
)))
3277 (setq gnus-tmp-prev-perm nil
)
3278 (setq gnus-group-use-permanent-levels t
)
3279 (gnus (or arg
(1- gnus-level-default-subscribed
)) t
)
3280 (setq gnus-tmp-prev-perm perm
)))
3283 (defun gnus (&optional arg dont-connect
)
3285 If ARG is non-nil and a positive number, Gnus will use that as the
3286 startup level. If ARG is non-nil and not a positive number, Gnus will
3287 prompt the user for the name of an NNTP server to use."
3289 (if (get-buffer gnus-group-buffer
)
3291 (switch-to-buffer gnus-group-buffer
)
3292 (gnus-group-get-new-news))
3296 (nnheader-init-server-buffer)
3297 ;; We do this if `gnus-no-server' has been run.
3298 (if gnus-tmp-prev-perm
3299 (setq gnus-group-use-permanent-levels
(car gnus-tmp-prev-perm
)
3300 gnus-group-default-list-level
(cdr gnus-tmp-prev-perm
)
3301 gnus-tmp-prev-perm nil
))
3302 (gnus-read-init-file)
3304 (gnus-group-setup-buffer)
3305 (let ((buffer-read-only nil
))
3307 (if (not gnus-inhibit-startup-message
)
3309 (gnus-group-startup-message)
3312 (let ((level (and arg
(numberp arg
) (> arg
0) arg
))
3318 (gnus-start-news-server (and arg
(not level
))))))
3319 (if (and (not dont-connect
)
3322 (run-hooks 'gnus-startup-hook
)
3323 ;; NNTP server is successfully open.
3325 ;; Find the current startup file name.
3326 (setq gnus-current-startup-file
3327 (gnus-make-newsrc-file gnus-startup-file
))
3329 ;; Read the dribble file.
3330 (and gnus-use-dribble-file
(gnus-dribble-read-file))
3332 (gnus-summary-make-display-table)
3333 (gnus-setup-news nil level
)
3334 (gnus-group-list-groups level
)
3335 (gnus-configure-windows 'group
))))))
3337 (defun gnus-unload ()
3338 "Unload all Gnus features."
3340 (or (boundp 'load-history
)
3341 (error "Sorry, `gnus-unload' is not implemented in this Emacs version."))
3342 (let ((history load-history
)
3345 (and (string-match "^gnus" (car (car history
)))
3346 (setq feature
(cdr (assq 'provide
(car history
))))
3347 (unload-feature feature
'force
))
3348 (setq history
(cdr history
)))))
3350 (defun gnus-group-startup-message (&optional x y
)
3351 "Insert startup message in current buffer."
3352 ;; Insert the message.
3357 _ ___ __ ___ __ _ ___
3375 Gnus * A newsreader for Emacsen
3376 A Praxis release * larsi@ifi.uio.no
3379 ;; And then hack it.
3380 ;; 18 is the longest line.
3381 (indent-rigidly (point-min) (point-max)
3382 (/ (max (- (window-width) (or x
46)) 0) 2))
3383 (goto-char (point-min))
3384 (let* ((pheight (count-lines (point-min) (point-max)))
3385 (wheight (window-height))
3386 (rest (- wheight pheight
)))
3387 (insert (make-string (max 0 (* 2 (/ rest
3))) ?
\n)))
3392 (goto-char (point-min))
3393 (search-forward "Praxis")
3394 (put-text-property (match-beginning 0) (match-end 0) 'face
'bold
)
3395 (goto-char (point-min)))
3397 (defun gnus-group-startup-message-old (&optional x y
)
3398 "Insert startup message in current buffer."
3399 ;; Insert the message.
3415 ;; And then hack it.
3416 ;; 18 is the longest line.
3417 (indent-rigidly (point-min) (point-max)
3418 (/ (max (- (window-width) (or x
28)) 0) 2))
3419 (goto-char (point-min))
3420 ;; +4 is fuzzy factor.
3421 (insert-char ?
\n (/ (max (- (window-height) (or y
12)) 0) 2))
3424 (goto-char (point-min))
3425 (search-forward "Praxis")
3426 (put-text-property (match-beginning 0) (match-end 0) 'face
'bold
)
3427 (goto-char (point-min)))
3429 (defun gnus-group-setup-buffer ()
3430 (or (get-buffer gnus-group-buffer
)
3432 (switch-to-buffer gnus-group-buffer
)
3433 (gnus-add-current-to-buffer-list)
3435 (and gnus-carpal
(gnus-carpal-setup-buffer 'group
)))))
3437 (defun gnus-group-list-groups (&optional level unread
)
3438 "List newsgroups with level LEVEL or lower that have unread articles.
3439 Default is all subscribed groups.
3440 If argument UNREAD is non-nil, groups with no unread articles are also
3442 (interactive (list (if current-prefix-arg
3443 (prefix-numeric-value current-prefix-arg
)
3445 (gnus-group-default-level nil t
)
3446 gnus-group-default-list-level
3447 gnus-level-subscribed
))))
3449 (setq level
(car gnus-group-list-mode
)
3450 unread
(cdr gnus-group-list-mode
)))
3451 (setq level
(gnus-group-default-level level
))
3452 (gnus-group-setup-buffer) ;May call from out of group buffer
3453 (let ((case-fold-search nil
)
3454 (group (gnus-group-group-name)))
3455 (funcall gnus-group-prepare-function level unread nil
)
3456 (if (zerop (buffer-size))
3457 (gnus-message 5 gnus-no-groups-message
)
3458 (goto-char (point-min))
3460 ;; Go to the first group with unread articles.
3461 (gnus-group-search-forward nil nil nil t
)
3462 ;; Find the right group to put point on. If the current group
3463 ;; has disappeared in the new listing, try to find the next
3464 ;; one. If no next one can be found, just leave point at the
3465 ;; first newsgroup in the buffer.
3466 (if (not (gnus-goto-char
3467 (text-property-any (point-min) (point-max)
3468 'gnus-group
(intern group
))))
3469 (let ((newsrc (nthcdr 3 (gnus-gethash group gnus-newsrc-hashtb
))))
3471 (not (gnus-goto-char
3473 (point-min) (point-max) 'gnus-group
3474 (intern (car (car newsrc
)))))))
3475 (setq newsrc
(cdr newsrc
)))
3476 (or newsrc
(progn (goto-char (point-max))
3477 (forward-line -
1))))))
3478 ;; Adjust cursor point.
3479 (gnus-group-position-cursor))))
3481 (defun gnus-group-prepare-flat (level &optional all lowest regexp
)
3482 "List all newsgroups with unread articles of level LEVEL or lower.
3483 If ALL is non-nil, list groups that have no unread articles.
3484 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
3485 If REGEXP, only list groups matching REGEXP."
3486 (set-buffer gnus-group-buffer
)
3487 (let ((buffer-read-only nil
)
3488 (newsrc (cdr gnus-newsrc-alist
))
3489 (lowest (or lowest
1))
3490 info clevel unread group
)
3492 (if (< lowest gnus-level-zombie
)
3493 ;; List living groups.
3495 (setq info
(car newsrc
)
3498 unread
(car (gnus-gethash group gnus-newsrc-hashtb
)))
3499 (and unread
; This group might be bogus
3501 (string-match regexp group
))
3502 (<= (setq clevel
(car (cdr info
))) level
)
3504 (or all
; We list all groups?
3505 (eq unread t
) ; We list unactivated groups
3506 (> unread
0) ; We list groups with unread articles
3507 (cdr (assq 'tick
(nth 3 info
)))) ; And ticked groups
3508 (gnus-group-insert-group-line
3509 nil group
(car (cdr info
)) (nth 3 info
) unread
(nth 4 info
)))))
3511 ;; List dead groups.
3512 (and (>= level gnus-level-zombie
) (<= lowest gnus-level-zombie
)
3513 (gnus-group-prepare-flat-list-dead
3514 (setq gnus-zombie-list
(sort gnus-zombie-list
'string
<))
3515 gnus-level-zombie ?Z
3517 (and (>= level gnus-level-killed
) (<= lowest gnus-level-killed
)
3518 (gnus-group-prepare-flat-list-dead
3519 (setq gnus-killed-list
(sort gnus-killed-list
'string
<))
3520 gnus-level-killed ?K regexp
))
3522 (gnus-group-set-mode-line)
3523 (setq gnus-group-list-mode
(cons level all
))
3524 (run-hooks 'gnus-group-prepare-hook
)))
3526 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp
)
3527 ;; List zombies and killed lists somewhat faster, which was
3528 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
3529 ;; this by ignoring the group format specification altogether.
3532 (setq group
(car groups
)
3533 groups
(cdr groups
))
3534 (if (or (not regexp
)
3535 (string-match regexp group
))
3538 (insert (format " %c *: %s\n" mark group
))
3539 (add-text-properties
3541 (list 'gnus-group
(intern group
)
3543 'gnus-level level
)))))))
3545 (defun gnus-group-real-name (group)
3546 "Find the real name of a foreign newsgroup."
3547 (if (string-match ":[^:]+$" group
)
3548 (substring group
(1+ (match-beginning 0)))
3551 (defun gnus-group-prefixed-name (group method
)
3552 "Return the whole name from GROUP and METHOD."
3553 (and (stringp method
) (setq method
(gnus-server-to-method method
)))
3554 (concat (format "%s" (car method
))
3556 (assoc (format "%s" (car method
)) (gnus-methods-using 'address
))
3557 (not (string= (nth 1 method
) "")))
3558 (concat "+" (nth 1 method
)))
3561 (defun gnus-group-real-prefix (group)
3562 "Return the prefix of the current group name."
3563 (if (string-match "^[^:]+:" group
)
3564 (substring group
0 (match-end 0))
3567 (defun gnus-group-method-name (group)
3568 "Return the method used for selecting GROUP."
3569 (let ((prefix (gnus-group-real-prefix group
)))
3570 (if (equal prefix
"")
3572 (if (string-match "^[^\\+]+\\+" prefix
)
3573 (list (intern (substring prefix
0 (1- (match-end 0))))
3574 (substring prefix
(match-end 0) (1- (length prefix
))))
3575 (list (intern (substring prefix
0 (1- (length prefix
)))) "")))))
3577 (defun gnus-group-foreign-p (group)
3578 "Return nil if GROUP is native, non-nil if it is foreign."
3579 (string-match ":" group
))
3581 (defun gnus-group-set-info (info &optional method-only-group part
)
3582 (let* ((entry (gnus-gethash
3583 (or method-only-group
(car info
)) gnus-newsrc-hashtb
))
3585 (info (if method-only-group
(nth 2 entry
) info
)))
3586 (if (not method-only-group
)
3589 (error "Trying to change non-existent group %s" method-only-group
))
3590 ;; We have received parts of the actual group info - either the
3591 ;; select method or the group parameters. We first check
3592 ;; whether we have to extend the info, and if so, do that.
3593 (let ((len (length info
))
3594 (total (if (eq part
'method
) 5 6)))
3596 (setcdr (nthcdr (1- len
) info
)
3597 (make-list (- total len
) nil
)))
3598 ;; Then we enter the new info.
3599 (setcar (nthcdr (1- total
) info
) part-info
)))
3600 ;; We uncompress some lists of marked articles.
3602 (if (not (setq marked
(nth 3 info
)))
3605 (or (eq 'score
(car (car marked
)))
3606 (eq 'bookmark
(car (car marked
)))
3607 (eq 'killed
(car (car marked
)))
3608 (setcdr (car marked
)
3609 (gnus-uncompress-range (cdr (car marked
)))))
3610 (setq marked
(cdr marked
)))))
3613 ;; This is a new group, so we just create it.
3615 (set-buffer gnus-group-buffer
)
3617 ;; It's a foreign group...
3618 (gnus-group-make-group
3619 (gnus-group-real-name (car info
))
3620 (prin1-to-string (car (nth 4 info
)))
3621 (nth 1 (nth 4 info
)))
3622 ;; It's a native group.
3623 (gnus-group-make-group (car info
)))
3624 (gnus-message 6 "Note: New group created")
3626 (gnus-gethash (gnus-group-prefixed-name
3627 (gnus-group-real-name (car info
))
3628 (or (nth 4 info
) gnus-select-method
))
3629 gnus-newsrc-hashtb
))))
3630 ;; Whether it was a new group or not, we now have the entry, so we
3631 ;; can do the update.
3634 (setcar (nthcdr 2 entry
) info
)
3635 (if (and (not (eq (car entry
) t
))
3636 (gnus-gethash (car info
) gnus-active-hashtb
))
3637 (let ((marked (nth 3 info
)))
3639 (max 0 (- (length (gnus-list-of-unread-articles
3641 (length (cdr (assq 'tick marked
)))
3642 (length (cdr (assq 'dormant marked
)))))))))
3643 (error "No such group: %s" (car info
)))))
3645 (defun gnus-group-set-method-info (group select-method
)
3646 (gnus-group-set-info select-method group
'method
))
3648 (defun gnus-group-set-params-info (group params
)
3649 (gnus-group-set-info params group
'params
))
3651 (defun gnus-group-update-group-line ()
3652 "This function updates the current line in the newsgroup buffer and
3653 moves the point to the colon."
3654 (let* ((buffer-read-only nil
)
3655 (group (gnus-group-group-name))
3656 (entry (and group
(gnus-gethash group gnus-newsrc-hashtb
))))
3657 (if (and entry
(not (gnus-ephemeral-group-p group
)))
3659 (concat "(gnus-group-set-info '" (prin1-to-string (nth 2 entry
))
3662 (delete-region (point) (progn (forward-line 1) (point)))
3663 (gnus-group-insert-group-line-info group
)
3665 (gnus-group-position-cursor)))
3667 (defun gnus-group-insert-group-line-info (group)
3668 (let ((entry (gnus-gethash group gnus-newsrc-hashtb
))
3672 (setq info
(nth 2 entry
))
3673 (gnus-group-insert-group-line
3674 nil group
(nth 1 info
) (nth 3 info
) (car entry
) (nth 4 info
)))
3675 (setq active
(gnus-gethash group gnus-active-hashtb
))
3676 (gnus-group-insert-group-line
3678 (if (member group gnus-zombie-list
) gnus-level-zombie gnus-level-killed
)
3679 nil
(if active
(- (1+ (cdr active
)) (car active
)) 0) nil
))))
3681 (defun gnus-group-insert-group-line (gformat group level marked number method
)
3682 (let* ((gformat (or gformat gnus-group-line-format-spec
))
3683 (active (gnus-gethash group gnus-active-hashtb
))
3684 (number-total (if active
(1+ (- (cdr active
) (car active
))) 0))
3685 (number-of-dormant (length (cdr (assq 'dormant marked
))))
3686 (number-of-ticked (length (cdr (assq 'tick marked
))))
3687 (number-of-ticked-and-dormant
3688 (+ number-of-ticked number-of-dormant
))
3689 (number-of-unread-unticked
3690 (if (numberp number
) (int-to-string (max 0 number
))
3693 (if (numberp number
)
3694 (max 0 (- number-total number
))
3696 (subscribed (cond ((<= level gnus-level-subscribed
) ?
)
3697 ((<= level gnus-level-unsubscribed
) ?U
)
3698 ((= level gnus-level-zombie
) ?Z
)
3700 (qualified-group (gnus-group-real-name group
))
3701 (newsgroup-description
3702 (if gnus-description-hashtb
3703 (or (gnus-gethash group gnus-description-hashtb
) "")
3705 (moderated (if (member group gnus-moderated-list
) ?m ?
))
3706 (moderated-string (if (eq moderated ?m
) "(m)" ""))
3707 (method (gnus-server-get-method group method
))
3708 (news-server (or (car (cdr method
)) ""))
3709 (news-method (or (car method
) ""))
3711 (if method
(format "(%s:%s)" (car method
) (car (cdr method
))) ""))
3715 (> number-of-ticked
0))
3717 (number (if (eq number t
) "*" (+ number number-of-dormant
3719 (process-marked (if (member group gnus-group-marked
)
3720 gnus-process-mark ?
))
3721 (buffer-read-only nil
)
3722 header
; passed as parameter to user-funcs.
3727 (insert (eval gformat
))
3729 (add-text-properties
3730 b
(1+ b
) (list 'gnus-group
(intern group
)
3731 'gnus-unread
(if (numberp number
)
3732 (string-to-int number-of-unread-unticked
)
3735 'gnus-level level
))))
3737 (defun gnus-group-update-group (group &optional visible-only
)
3738 "Update newsgroup info of GROUP.
3739 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't already."
3741 (set-buffer gnus-group-buffer
)
3742 (let ((buffer-read-only nil
)
3744 (let ((entry (gnus-gethash group gnus-newsrc-hashtb
)))
3746 (not (gnus-ephemeral-group-p group
)))
3748 (concat "(gnus-group-set-info '" (prin1-to-string (nth 2 entry
))
3750 ;; Buffer may be narrowed.
3753 ;; Search a line to modify. If the buffer is large, the search
3754 ;; takes long time. In most cases, current point is on the line
3755 ;; we are looking for. So, first of all, check current line.
3758 (eq (get-text-property (point) 'gnus-group
)
3763 (point-min) (point-max) 'gnus-group
(intern group
)))))
3764 ;; GROUP is listed in current buffer. So, delete old line.
3768 (delete-region (point) (progn (forward-line 1) (point))))
3769 ;; No such line in the buffer, find out where it's supposed to
3770 ;; go, and insert it there (or at the end of the buffer).
3771 ;; Fix by Per Abrahamsen <amanda@iesd.auc.dk>.
3774 (cdr (cdr (gnus-gethash group gnus-newsrc-hashtb
)))))
3780 (point-min) (point-max)
3781 'gnus-group
(intern (car (car entry
)))))))
3782 (setq entry
(cdr entry
)))
3783 (or entry
(goto-char (point-max)))))))
3784 (if (or visible
(not visible-only
))
3785 (gnus-group-insert-group-line-info group
))
3786 (gnus-group-set-mode-line))))
3788 (defun gnus-group-set-mode-line ()
3789 (if (memq 'group gnus-updated-mode-lines
)
3790 (let* ((gformat (or gnus-group-mode-line-format-spec
3791 (setq gnus-group-mode-line-format-spec
3793 gnus-group-mode-line-format
3794 gnus-group-mode-line-format-alist
))))
3795 (news-server (car (cdr gnus-select-method
)))
3796 (news-method (car gnus-select-method
))
3798 header
;Dummy binding for user-defined specs.
3799 (mode-string (eval gformat
)))
3800 (setq mode-string
(eval gformat
))
3801 (if (> (length mode-string
) max-len
)
3802 (setq mode-string
(substring mode-string
0 (- max-len
4))))
3803 (setq mode-line-buffer-identification mode-string
)
3804 (set-buffer-modified-p t
))))
3806 (defun gnus-group-group-name ()
3807 "Get the name of the newsgroup on the current line."
3808 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group
)))
3809 (and group
(symbol-name group
))))
3811 (defun gnus-group-group-level ()
3812 "Get the level of the newsgroup on the current line."
3813 (get-text-property (gnus-point-at-bol) 'gnus-level
))
3815 (defun gnus-group-group-unread ()
3816 "Get the number of unread articles of the newsgroup on the current line."
3817 (get-text-property (gnus-point-at-bol) 'gnus-unread
))
3819 (defun gnus-group-search-forward (&optional backward all level first-too
)
3820 "Find the next newsgroup with unread articles.
3821 If BACKWARD is non-nil, find the previous newsgroup instead.
3822 If ALL is non-nil, just find any newsgroup.
3823 If LEVEL is non-nil, find group with level LEVEL, or higher if no such
3825 If FIRST-TOO, the current line is also eligible as a target."
3826 (let ((way (if backward -
1 1))
3827 (low gnus-level-killed
)
3830 (if (and backward
(progn (beginning-of-line)) (bobp))
3832 (or first-too
(forward-line way
))
3840 (get-text-property (point) 'gnus-unread
)))
3841 (or (eq unread t
) (and unread
(> unread
0))))
3842 (setq lev
(get-text-property (point)
3844 (<= lev gnus-level-subscribed
)))
3846 (and (setq lev
(get-text-property (point)
3855 (zerop (forward-line way
)))))
3857 (progn (gnus-group-position-cursor) t
)
3858 (goto-char (or pos beg
))
3861 ;;; Gnus group mode commands
3865 (defun gnus-group-mark-group (n &optional unmark no-advance
)
3866 "Mark the current group."
3868 (let ((buffer-read-only nil
)
3872 (setq group
(gnus-group-group-name))
3876 (or (cdr (assq 'process gnus-group-mark-positions
)) 2))
3881 (setq gnus-group-marked
(delete group gnus-group-marked
)))
3883 (setq gnus-group-marked
3884 (cons group
(delete group gnus-group-marked
))))
3886 (or no-advance
(zerop (gnus-group-next-group 1))))
3888 (gnus-summary-position-cursor)
3891 (defun gnus-group-unmark-group (n)
3892 "Remove the mark from the current group."
3894 (gnus-group-mark-group n
'unmark
))
3896 (defun gnus-group-mark-region (unmark beg end
)
3897 "Mark all groups between point and mark.
3898 If UNMARK, remove the mark instead."
3899 (interactive "P\nr")
3900 (let ((num (count-lines beg end
)))
3903 (- num
(gnus-group-mark-group num unmark
)))))
3905 (defun gnus-group-remove-mark (group)
3906 (and (gnus-group-goto-group group
)
3908 (gnus-group-mark-group 1 'unmark t
))))
3910 ;; Return a list of groups to work on. Take into consideration N (the
3911 ;; prefix) and the list of marked groups.
3912 (defun gnus-group-process-prefix (n)
3914 (setq n
(prefix-numeric-value n
))
3915 ;; There is a prefix, so we return a list of the N next
3917 (let ((way (if (< n
0) -
1 1))
3922 (setq group
(gnus-group-group-name)))
3923 (setq groups
(cons group groups
))
3925 (forward-line way
)))
3928 ;; No prefix, but a list of marked articles.
3929 (reverse gnus-group-marked
))
3931 ;; Neither marked articles or a prefix, so we return the
3933 (let ((group (gnus-group-group-name)))
3934 (and group
(list group
))))))
3936 ;; Selecting groups.
3938 (defun gnus-group-read-group (&optional all no-article group
)
3939 "Read news in this newsgroup.
3940 If the prefix argument ALL is non-nil, already read articles become
3941 readable. If the optional argument NO-ARTICLE is non-nil, no article
3942 will be auto-selected upon group entry."
3944 (let ((group (or group
(gnus-group-group-name)))
3945 number active marked entry
)
3946 (or group
(error "No group on current line"))
3948 (nth 3 (nth 2 (setq entry
(gnus-gethash group gnus-newsrc-hashtb
)))))
3949 ;; This group might be a dead group. In that case we have to get
3950 ;; the number of unread articles from `gnus-active-hashtb'.
3952 (setq number
(car entry
))
3953 (if (setq active
(gnus-gethash group gnus-active-hashtb
))
3954 (setq number
(- (1+ (cdr active
)) (car active
)))))
3955 (gnus-summary-read-group
3956 group
(or all
(and (numberp number
)
3957 (zerop (+ number
(length (cdr (assq 'tick marked
)))
3958 (length (cdr (assq 'dormant marked
)))))))
3961 (defun gnus-group-select-group (&optional all
)
3962 "Select this newsgroup.
3963 No article is selected automatically.
3964 If argument ALL is non-nil, already read articles become readable."
3966 (gnus-group-read-group all t
))
3968 (defun gnus-group-select-group-all ()
3969 "Select the current group and display all articles in it."
3971 (gnus-group-select-group 'all
))
3973 ;; Enter a group that is not in the group buffer. Non-nil is returned
3974 ;; if selection was successful.
3975 (defun gnus-group-read-ephemeral-group
3976 (group method
&optional activate quit-config
)
3977 (let ((group (if (gnus-group-foreign-p group
) group
3978 (gnus-group-prefixed-name group method
))))
3981 (list t nil
(list group gnus-level-default-subscribed nil nil
3985 (if quit-config quit-config
3986 (cons (current-buffer) 'summary
)))))))
3988 (set-buffer gnus-group-buffer
)
3989 (or (gnus-check-server method
)
3990 (error "Unable to contact server: %s" (gnus-status-message method
)))
3991 (if activate
(or (gnus-request-group group
)
3992 (error "Couldn't request group")))
3994 (gnus-group-read-group t t group
)
3997 (not (equal major-mode
'gnus-group-mode
))))
3999 (defun gnus-group-jump-to-group (group)
4000 "Jump to newsgroup GROUP."
4002 (list (completing-read
4003 "Group: " gnus-active-hashtb nil
4004 (memq gnus-select-method gnus-have-read-active-file
))))
4006 (if (equal group
"")
4007 (error "Empty group name"))
4009 (let ((b (text-property-any
4010 (point-min) (point-max) 'gnus-group
(intern group
))))
4012 ;; Either go to the line in the group buffer...
4014 ;; ... or insert the line.
4016 (gnus-gethash group gnus-active-hashtb
)
4017 (gnus-activate-group group
)
4018 (error "%s error: %s" group
(gnus-status-message group
)))
4020 (gnus-group-update-group group
)
4021 (goto-char (text-property-any
4022 (point-min) (point-max) 'gnus-group
(intern group
)))))
4023 ;; Adjust cursor point.
4024 (gnus-group-position-cursor))
4026 (defun gnus-group-goto-group (group)
4027 "Goto to newsgroup GROUP."
4028 (let ((b (text-property-any (point-min) (point-max)
4029 'gnus-group
(intern group
))))
4030 (and b
(goto-char b
))))
4032 (defun gnus-group-next-group (n)
4033 "Go to next N'th newsgroup.
4034 If N is negative, search backward instead.
4035 Returns the difference between N and the number of skips actually
4038 (gnus-group-next-unread-group n t
))
4040 (defun gnus-group-next-unread-group (n &optional all level
)
4041 "Go to next N'th unread newsgroup.
4042 If N is negative, search backward instead.
4043 If ALL is non-nil, choose any newsgroup, unread or not.
4044 If LEVEL is non-nil, choose the next group with level LEVEL, or, if no
4045 such group can be found, the next group with a level higher than
4047 Returns the difference between N and the number of skips actually
4050 (let ((backward (< n
0))
4053 (gnus-group-search-forward
4054 backward
(or (not gnus-group-goto-unread
) all
) level
))
4056 (if (/= 0 n
) (gnus-message 7 "No more%s newsgroups%s" (if all
"" " unread")
4057 (if level
" on this level or higher" "")))
4060 (defun gnus-group-prev-group (n)
4061 "Go to previous N'th newsgroup.
4062 Returns the difference between N and the number of skips actually
4065 (gnus-group-next-unread-group (- n
) t
))
4067 (defun gnus-group-prev-unread-group (n)
4068 "Go to previous N'th unread newsgroup.
4069 Returns the difference between N and the number of skips actually
4072 (gnus-group-next-unread-group (- n
)))
4074 (defun gnus-group-next-unread-group-same-level (n)
4075 "Go to next N'th unread newsgroup on the same level.
4076 If N is negative, search backward instead.
4077 Returns the difference between N and the number of skips actually
4080 (gnus-group-next-unread-group n t
(gnus-group-group-level))
4081 (gnus-group-position-cursor))
4083 (defun gnus-group-prev-unread-group-same-level (n)
4084 "Go to next N'th unread newsgroup on the same level.
4085 Returns the difference between N and the number of skips actually
4088 (gnus-group-next-unread-group (- n
) t
(gnus-group-group-level))
4089 (gnus-group-position-cursor))
4091 (defun gnus-group-best-unread-group (&optional exclude-group
)
4092 "Go to the group with the highest level.
4093 If EXCLUDE-GROUP, do not go to that group."
4095 (goto-char (point-min))
4098 (while (setq unread
(get-text-property (point) 'gnus-unread
))
4099 (if (and (numberp unread
) (> unread
0))
4101 (if (and (< (get-text-property (point) 'gnus-level
) best
)
4102 (or (not exclude-group
)
4103 (not (equal exclude-group
(gnus-group-group-name)))))
4105 (setq best
(get-text-property (point) 'gnus-level
))
4106 (setq best-point
(point))))))
4108 (if best-point
(goto-char best-point
))
4109 (gnus-summary-position-cursor)
4110 (and best-point
(gnus-group-group-name))))
4112 (defun gnus-group-first-unread-group ()
4113 "Go to the first group with unread articles."
4116 (let ((opoint (point))
4118 (goto-char (point-min))
4119 (if (or (eq (setq unread
(gnus-group-group-unread)) t
) ; Not active.
4120 (not (zerop unread
)) ; Has unread articles.
4121 (zerop (gnus-group-next-unread-group 1))) ; Next unread group.
4124 nil
)) ; Not success.
4125 (gnus-group-position-cursor)))
4127 (defun gnus-group-enter-server-mode ()
4128 "Jump to the server buffer."
4130 (gnus-server-setup-buffer)
4131 (gnus-configure-windows 'server
)
4132 (gnus-server-prepare))
4134 (defun gnus-group-make-group (name &optional method address
)
4135 "Add a new newsgroup.
4136 The user will be prompted for a NAME, for a select METHOD, and an
4140 (read-string "Group name: ")
4143 "Method: " (append gnus-valid-select-methods gnus-server-alist
)
4145 (if (assoc method gnus-valid-select-methods
)
4147 (if (memq 'prompt-address
4148 (assoc method gnus-valid-select-methods
))
4149 (read-string "Address: ")
4151 (list method nil
)))))
4153 (let* ((meth (and method
(if address
(list (intern method
) address
) method
)))
4154 (nname (if method
(gnus-group-prefixed-name name meth
) name
))
4156 (and (gnus-gethash nname gnus-newsrc-hashtb
)
4157 (error "Group %s already exists" nname
))
4158 (gnus-group-change-level
4159 (setq info
(list t nname gnus-level-default-subscribed nil nil meth
))
4160 gnus-level-default-subscribed gnus-level-killed
4161 (and (gnus-group-group-name)
4162 (gnus-gethash (gnus-group-group-name)
4163 gnus-newsrc-hashtb
))
4165 (gnus-sethash nname
(cons 1 0) gnus-active-hashtb
)
4166 (or (gnus-ephemeral-group-p name
)
4168 (concat "(gnus-group-set-info '" (prin1-to-string (cdr info
)) ")")))
4169 (gnus-group-insert-group-line-info nname
)
4171 (if (assoc method gnus-valid-select-methods
)
4172 (require (intern method
)))
4173 (and (gnus-check-backend-function 'request-create-group nname
)
4174 (gnus-request-create-group nname
))))
4176 (defun gnus-group-edit-group (group &optional part
)
4177 "Edit the group on the current line."
4178 (interactive (list (gnus-group-group-name)))
4179 (let ((done-func '(lambda ()
4180 "Exit editing mode and update the information."
4182 (gnus-group-edit-group-done 'part
'group
)))
4183 (part (or part
'info
))
4184 (winconf (current-window-configuration))
4186 (or group
(error "No group on current line"))
4187 (or (setq info
(nth 2 (gnus-gethash group gnus-newsrc-hashtb
)))
4188 (error "Killed group; can't be edited"))
4189 (set-buffer (get-buffer-create gnus-group-edit-buffer
))
4190 (gnus-configure-windows 'edit-group
)
4191 (gnus-add-current-to-buffer-list)
4193 ;; Suggested by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4194 (use-local-map (copy-keymap emacs-lisp-mode-map
))
4195 (local-set-key "\C-c\C-c" done-func
)
4196 (make-local-variable 'gnus-prev-winconf
)
4197 (setq gnus-prev-winconf winconf
)
4198 ;; We modify the func to let it know what part it is editing.
4199 (setcar (cdr (nth 4 done-func
)) (list 'quote part
))
4200 (setcar (cdr (cdr (nth 4 done-func
))) group
)
4205 ";; Type `C-c C-c' after editing the select method.\n\n")
4207 ";; Type `C-c C-c' after editing the group parameters.\n\n")
4209 ";; Type `C-c C-c' after editing the group info.\n\n")))
4210 (let ((cinfo (gnus-copy-sequence info
))
4212 (if (not (setq marked
(nth 3 cinfo
)))
4215 (or (eq 'score
(car (car marked
)))
4216 (eq 'bookmark
(car (car marked
)))
4217 (eq 'killed
(car (car marked
)))
4218 (not (numberp (car (cdr (car marked
)))))
4219 (setcdr (car marked
)
4220 (gnus-compress-sequence (sort (cdr (car marked
)) '<) t
)))
4221 (setq marked
(cdr marked
))))
4224 (cond ((eq part
'method
)
4225 (or (nth 4 info
) "native"))
4232 (defun gnus-group-edit-group-method (group)
4233 "Edit the select method of GROUP."
4234 (interactive (list (gnus-group-group-name)))
4235 (gnus-group-edit-group group
'method
))
4237 (defun gnus-group-edit-group-parameters (group)
4238 "Edit the group parameters of GROUP."
4239 (interactive (list (gnus-group-group-name)))
4240 (gnus-group-edit-group group
'params
))
4242 (defun gnus-group-edit-group-done (part group
)
4243 "Get info from buffer, update variables and jump to the group buffer."
4244 (set-buffer (get-buffer-create gnus-group-edit-buffer
))
4245 (goto-char (point-min))
4246 (let ((form (read (current-buffer)))
4247 (winconf gnus-prev-winconf
))
4249 (gnus-group-set-info form
)
4250 (gnus-group-set-info form group part
))
4251 (kill-buffer (current-buffer))
4252 (and winconf
(set-window-configuration winconf
))
4253 (set-buffer gnus-group-buffer
)
4254 (gnus-group-update-group (gnus-group-group-name))
4255 (gnus-group-position-cursor)))
4257 (defun gnus-group-make-help-group ()
4258 "Create the Gnus documentation group."
4260 (let ((path (cons (concat installation-directory
"etc/") load-path
))
4261 (name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
4263 (and (gnus-gethash name gnus-newsrc-hashtb
)
4264 (error "Documentation group already exists"))
4267 (setq file
(concat (file-name-as-directory (car path
))
4269 (setq path
(cdr path
)))
4271 (message "Couldn't find doc group")
4272 (gnus-group-make-group
4273 (gnus-group-real-name name
)
4275 (list 'nndoc-address file
)
4276 (list 'nndoc-article-type
'mbox
)))))
4277 (gnus-group-position-cursor))
4279 (defun gnus-group-make-doc-group (file type
)
4280 "Create a group that uses a single file as the source."
4282 (list (read-file-name "File name: ")
4286 (message "%sFile type (mbox, babyl, digest) [mbd]: " err
)
4287 (setq found
(cond ((= (setq char
(read-char)) ?m
) 'mbox
)
4288 ((= char ?b
) 'babyl
)
4289 ((= char ?d
) 'digest
)
4290 (t (setq err
(format "%c unknown. " char
))
4293 (let* ((file (expand-file-name file
))
4294 (name (gnus-generate-new-group-name
4295 (gnus-group-prefixed-name
4296 (file-name-nondirectory file
) '(nndoc "")))))
4297 (gnus-group-make-group
4298 (gnus-group-real-name name
)
4300 (list 'nndoc-address file
)
4301 (list 'nndoc-article-type type
)))))
4303 (defun gnus-group-make-archive-group (&optional all
)
4304 "Create the (ding) Gnus archive group of the most recent articles.
4305 Given a prefix, create a full group."
4307 (let ((group (gnus-group-prefixed-name
4308 (if all
"ding.archives" "ding.recent") '(nndir ""))))
4309 (and (gnus-gethash group gnus-newsrc-hashtb
)
4310 (error "Archive group already exists"))
4311 (gnus-group-make-group
4312 (gnus-group-real-name group
)
4314 (if all gnus-group-archive-directory
4315 gnus-group-recent-archive-directory
)))
4316 (gnus-group-position-cursor))
4318 (defun gnus-group-make-directory-group (dir)
4319 "Create an nndir group.
4320 The user will be prompted for a directory. The contents of this
4321 directory will be used as a newsgroup. The directory should contain
4322 mail messages or news articles in files that have numeric names."
4324 (list (read-file-name "Create group from directory: ")))
4325 (or (file-exists-p dir
) (error "No such directory"))
4326 (or (file-directory-p dir
) (error "Not a directory"))
4327 (gnus-group-make-group dir
"nndir" dir
)
4328 (gnus-group-position-cursor))
4330 (defun gnus-group-make-kiboze-group (group address scores
)
4331 "Create an nnkiboze group.
4332 The user will be prompted for a name, a regexp to match groups, and
4333 score file entries for articles to include in the group."
4336 (read-string "nnkiboze group name: ")
4337 (read-string "Source groups (regexp): ")
4338 (let ((headers (mapcar (lambda (group) (list group
))
4339 '("subject" "from" "number" "date" "message-id"
4340 "references" "chars" "lines" "xref")))
4341 scores header regexp regexps
)
4342 (while (not (equal "" (setq header
(completing-read
4343 "Match on header: " headers nil t
))))
4345 (while (not (equal "" (setq regexp
(read-string
4346 (format "Match on %s (string): "
4348 (setq regexps
(cons (list regexp nil nil
'r
) regexps
)))
4349 (setq scores
(cons (cons header regexps
) scores
)))
4351 (gnus-group-make-group group
"nnkiboze" address
)
4353 (gnus-set-work-buffer)
4354 (let (emacs-lisp-mode-hook)
4355 (pp scores
(current-buffer)))
4356 (write-region (point-min) (point-max)
4357 (concat (or gnus-kill-files-directory
"~/News")
4358 "nnkiboze:" group
"." gnus-score-file-suffix
)))
4359 (gnus-group-position-cursor))
4361 (defun gnus-group-add-to-virtual (n vgroup
)
4362 "Add the current group to a virtual group."
4364 (list current-prefix-arg
4365 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
4367 (or (eq (car (gnus-find-method-for-group vgroup
)) 'nnvirtual
)
4368 (error "%s is not an nnvirtual group" vgroup
))
4369 (let* ((groups (gnus-group-process-prefix n
))
4370 (method (nth 4 (nth 2 (gnus-gethash vgroup gnus-newsrc-hashtb
)))))
4371 (setcar (cdr method
)
4373 (nth 1 method
) "\\|"
4376 (gnus-group-remove-mark s
)
4377 (concat "\\(^" (regexp-quote s
) "$\\)"))
4379 (gnus-group-position-cursor))
4381 (defun gnus-group-make-empty-virtual (group)
4382 "Create a new, fresh, empty virtual group."
4383 (interactive "sCreate new, empty virtual group: ")
4384 (let* ((method (list 'nnvirtual
"^$"))
4385 (pgroup (gnus-group-prefixed-name group method
)))
4386 ;; Check whether it exists already.
4387 (and (gnus-gethash pgroup gnus-newsrc-hashtb
)
4388 (error "Group %s already exists." pgroup
))
4389 ;; Subscribe the new group after the group on the current line.
4390 (gnus-subscribe-group pgroup
(gnus-group-group-name) method
)
4391 (gnus-group-update-group pgroup
)
4393 (gnus-group-position-cursor)))
4395 (defun gnus-group-enter-directory (dir)
4396 "Enter an ephemeral nneething group."
4397 (interactive "DDirectory to read: ")
4398 (let* ((method (list 'nneething dir
))
4399 (leaf (gnus-group-prefixed-name
4400 (file-name-nondirectory (directory-file-name dir
))
4402 (name (gnus-generate-new-group-name leaf
)))
4403 (let ((nneething-read-only t
))
4404 (or (gnus-group-read-ephemeral-group
4406 (cons (current-buffer) (if (eq major-mode
'gnus-summary-mode
)
4408 (error "Couldn't enter %s" dir
)))))
4410 ;; Group sorting commands
4411 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
4413 (defun gnus-group-sort-groups ()
4414 "Sort the group buffer using `gnus-group-sort-function'."
4416 (setq gnus-newsrc-alist
4417 (sort (cdr gnus-newsrc-alist
) gnus-group-sort-function
))
4418 (gnus-make-hashtable-from-newsrc-alist)
4419 (gnus-group-list-groups))
4421 (defun gnus-group-sort-by-alphabet (info1 info2
)
4422 (string< (car info1
) (car info2
)))
4424 (defun gnus-group-sort-by-unread (info1 info2
)
4425 (let ((n1 (car (gnus-gethash (car info1
) gnus-newsrc-hashtb
)))
4426 (n2 (car (gnus-gethash (car info2
) gnus-newsrc-hashtb
))))
4427 (< (or (and (numberp n1
) n1
) 0)
4428 (or (and (numberp n2
) n2
) 0))))
4430 (defun gnus-group-sort-by-level (info1 info2
)
4431 (< (nth 1 info1
) (nth 1 info2
)))
4433 ;; Group catching up.
4435 (defun gnus-group-catchup-current (&optional n all
)
4436 "Mark all articles not marked as unread in current newsgroup as read.
4437 If prefix argument N is numeric, the ARG next newsgroups will be
4438 caught up. If ALL is non-nil, marked articles will also be marked as
4439 read. Cross references (Xref: header) of articles are ignored.
4440 The difference between N and actual number of newsgroups that were
4441 caught up is returned."
4443 (if (not (or (not gnus-interactive-catchup
) ;Without confirmation?
4447 "Do you really want to mark all articles as read? "
4448 "Mark all unread articles as read? "))))
4450 (let ((groups (gnus-group-process-prefix n
))
4453 ;; Virtual groups have to be given special treatment.
4454 (let ((method (gnus-find-method-for-group (car groups
))))
4455 (if (eq 'nnvirtual
(car method
))
4456 (nnvirtual-catchup-group
4457 (gnus-group-real-name (car groups
)) (nth 1 method
) all
)))
4458 (gnus-group-remove-mark (car groups
))
4460 (gnus-group-goto-group (car groups
))
4461 (gnus-group-catchup (car groups
) all
))
4462 (gnus-group-update-group-line)
4463 (setq ret
(1+ ret
)))
4464 (setq groups
(cdr groups
)))
4465 (gnus-group-next-unread-group 1)
4468 (defun gnus-group-catchup-current-all (&optional n
)
4469 "Mark all articles in current newsgroup as read.
4470 Cross references (Xref: header) of articles are ignored."
4472 (gnus-group-catchup-current n
'all
))
4474 (defun gnus-group-catchup (group &optional all
)
4475 "Mark all articles in GROUP as read.
4476 If ALL is non-nil, all articles are marked as read.
4477 The return value is the number of articles that were marked as read,
4478 or nil if no action could be taken."
4479 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb
))
4481 (marked (nth 3 (nth 2 entry
))))
4482 (if (not (numberp (car entry
)))
4483 (gnus-message 1 "Can't catch up; non-active group")
4484 ;; Do the updating only if the newsgroup isn't killed.
4487 (gnus-update-read-articles
4488 group
(and (not all
) (append (cdr (assq 'tick marked
))
4489 (cdr (assq 'dormant marked
))))
4490 nil
(and (not all
) (cdr (assq 'tick marked
))))
4492 (setq marked
(nth 3 (nth 2 entry
)))
4493 (setcar (nthcdr 3 (nth 2 entry
))
4494 (delq (assq 'dormant marked
)
4495 (nth 3 (nth 2 entry
)))))))
4498 (defun gnus-group-expire-articles (&optional n
)
4499 "Expire all expirable articles in the current newsgroup."
4501 (let ((groups (gnus-group-process-prefix n
))
4503 (or groups
(error "No groups to expire"))
4505 (setq group
(car groups
)
4506 groups
(cdr groups
))
4507 (gnus-group-remove-mark group
)
4508 (if (not (gnus-check-backend-function 'request-expire-articles group
))
4510 (let* ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb
)))
4511 (expirable (if (memq 'total-expire
(nth 5 info
))
4512 (cons nil
(gnus-list-of-read-articles group
))
4513 (assq 'expire
(nth 3 info
)))))
4516 (gnus-request-expire-articles
4517 (cdr expirable
) group
))))))))
4519 (defun gnus-group-expire-all-groups ()
4520 "Expire all expirable articles in all newsgroups."
4523 (gnus-message 5 "Expiring...")
4524 (let ((gnus-group-marked (mapcar (lambda (info) (car info
))
4525 (cdr gnus-newsrc-alist
))))
4526 (gnus-group-expire-articles nil
)))
4527 (gnus-group-position-cursor)
4528 (gnus-message 5 "Expiring...done"))
4530 (defun gnus-group-set-current-level (n level
)
4531 "Set the level of the next N groups to LEVEL."
4532 (interactive "P\nnLevel: ")
4533 (or (and (>= level
1) (<= level gnus-level-killed
))
4534 (error "Illegal level: %d" level
))
4535 (let ((groups (gnus-group-process-prefix n
))
4538 (setq group
(car groups
)
4539 groups
(cdr groups
))
4540 (gnus-group-remove-mark group
)
4541 (gnus-message 6 "Changed level of %s from %d to %d"
4542 group
(gnus-group-group-level) level
)
4543 (gnus-group-change-level group level
4544 (gnus-group-group-level))
4545 (gnus-group-update-group-line)))
4546 (gnus-group-position-cursor))
4548 (defun gnus-group-unsubscribe-current-group (&optional n
)
4549 "Toggle subscription of the current group.
4550 If given numerical prefix, toggle the N next groups."
4552 (let ((groups (gnus-group-process-prefix n
))
4555 (setq group
(car groups
)
4556 groups
(cdr groups
))
4557 (gnus-group-remove-mark group
)
4558 (gnus-group-unsubscribe-group
4559 group
(if (<= (gnus-group-group-level) gnus-level-subscribed
)
4560 gnus-level-default-unsubscribed
4561 gnus-level-default-subscribed
))
4562 (gnus-group-update-group-line))
4563 (gnus-group-next-group 1)))
4565 (defun gnus-group-unsubscribe-group (group &optional level
)
4566 "Toggle subscribe from/to unsubscribe GROUP.
4567 New newsgroup is added to .newsrc automatically."
4569 (list (completing-read
4570 "Group: " gnus-active-hashtb nil
4571 (memq gnus-select-method gnus-have-read-active-file
))))
4572 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb
)))
4574 ((string-match "^[ \t]$" group
)
4575 (error "Empty group name"))
4577 ;; Toggle subscription flag.
4578 (gnus-group-change-level
4579 newsrc
(if level level
(if (<= (nth 1 (nth 2 newsrc
))
4580 gnus-level-subscribed
)
4581 (1+ gnus-level-subscribed
)
4582 gnus-level-default-subscribed
)))
4583 (gnus-group-update-group group
))
4584 ((and (stringp group
)
4585 (or (not (memq gnus-select-method gnus-have-read-active-file
))
4586 (gnus-gethash group gnus-active-hashtb
)))
4587 ;; Add new newsgroup.
4588 (gnus-group-change-level
4590 (if level level gnus-level-default-subscribed
)
4591 (or (and (member group gnus-zombie-list
)
4594 (and (gnus-group-group-name)
4595 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb
)))
4596 (gnus-group-update-group group
))
4597 (t (error "No such newsgroup: %s" group
)))
4598 (gnus-group-position-cursor)))
4600 (defun gnus-group-transpose-groups (n)
4601 "Move the current newsgroup up N places.
4602 If given a negative prefix, move down instead. The difference between
4603 N and the number of steps taken is returned."
4605 (or (gnus-group-group-name)
4606 (error "No group on current line"))
4607 (gnus-group-kill-group 1)
4609 (forward-line (- n
))
4610 (gnus-group-yank-group)
4611 (gnus-group-position-cursor)))
4613 (defun gnus-group-kill-all-zombies ()
4614 "Kill all zombie newsgroups."
4616 (setq gnus-killed-list
(nconc gnus-zombie-list gnus-killed-list
))
4617 (setq gnus-zombie-list nil
)
4618 (gnus-group-list-groups))
4620 (defun gnus-group-kill-region (begin end
)
4621 "Kill newsgroups in current region (excluding current point).
4622 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
4637 (beginning-of-line) ;Important when LINES < 1
4638 (gnus-group-kill-group lines
)))
4640 (defun gnus-group-kill-group (&optional n
)
4641 "The the next N groups.
4642 The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
4643 However, only groups that were alive can be yanked; already killed
4644 groups or zombie groups can't be yanked.
4645 The return value is the name of the (last) group that was killed."
4647 (let ((buffer-read-only nil
)
4648 (groups (gnus-group-process-prefix n
))
4651 (setq group
(car groups
)
4652 groups
(cdr groups
))
4653 (gnus-group-remove-mark group
)
4654 (setq level
(gnus-group-group-level))
4656 (if (setq entry
(gnus-gethash group gnus-newsrc-hashtb
))
4657 (setq gnus-list-of-killed-groups
4658 (cons (cons (car entry
) (nth 2 entry
))
4659 gnus-list-of-killed-groups
)))
4660 (gnus-group-change-level
4661 (if entry entry group
) gnus-level-killed
(if entry nil level
)))
4662 (gnus-group-position-cursor)
4665 (defun gnus-group-yank-group (&optional arg
)
4666 "Yank the last newsgroups killed with \\[gnus-group-kill-group],
4667 inserting it before the current newsgroup. The numeric ARG specifies
4668 how many newsgroups are to be yanked. The name of the (last)
4669 newsgroup yanked is returned."
4671 (if (not arg
) (setq arg
1))
4672 (let (info group prev
)
4673 (while (>= (setq arg
(1- arg
)) 0)
4674 (if (not (setq info
(car gnus-list-of-killed-groups
)))
4675 (error "No more newsgroups to yank"))
4676 (setq group
(nth 2 info
))
4677 ;; Find which newsgroup to insert this one before - search
4678 ;; backward until something suitable is found. If there are no
4679 ;; other newsgroups in this buffer, just make this newsgroup the
4681 (setq prev
(gnus-group-group-name))
4682 (gnus-group-change-level
4683 info
(nth 2 info
) gnus-level-killed
4684 (and prev
(gnus-gethash prev gnus-newsrc-hashtb
))
4686 (gnus-group-insert-group-line-info (nth 1 info
))
4687 (setq gnus-list-of-killed-groups
4688 (cdr gnus-list-of-killed-groups
)))
4690 (gnus-group-position-cursor)
4693 (defun gnus-group-list-all-groups (&optional arg
)
4694 "List all newsgroups with level ARG or lower.
4695 Default is gnus-level-unsubscribed, which lists all subscribed and most
4696 unsubscribed groups."
4698 (gnus-group-list-groups (or arg gnus-level-unsubscribed
) t
))
4700 (defun gnus-group-list-killed ()
4701 "List all killed newsgroups in the group buffer."
4703 (if (not gnus-killed-list
)
4704 (gnus-message 6 "No killed groups")
4705 (let (gnus-group-list-mode)
4706 (funcall gnus-group-prepare-function
4707 gnus-level-killed t gnus-level-killed
))
4708 (goto-char (point-min)))
4709 (gnus-group-position-cursor))
4711 (defun gnus-group-list-zombies ()
4712 "List all zombie newsgroups in the group buffer."
4714 (if (not gnus-zombie-list
)
4715 (gnus-message 6 "No zombie groups")
4716 (let (gnus-group-list-mode)
4717 (funcall gnus-group-prepare-function
4718 gnus-level-zombie t gnus-level-zombie
))
4719 (goto-char (point-min)))
4720 (gnus-group-position-cursor))
4722 (defun gnus-group-get-new-news (&optional arg
)
4723 "Get newly arrived articles.
4724 If ARG is non-nil, it should be a number between one and nine to
4725 specify which levels you are interested in re-scanning."
4727 (run-hooks 'gnus-get-new-news-hook
)
4728 (setq arg
(gnus-group-default-level arg t
))
4729 (if (and gnus-read-active-file
(not arg
))
4731 (gnus-read-active-file)
4732 (gnus-get-unread-articles (or arg
(1+ gnus-level-subscribed
))))
4733 (let ((gnus-read-active-file (if arg nil gnus-read-active-file
)))
4734 (gnus-get-unread-articles (or arg
(1+ gnus-level-subscribed
)))))
4735 (gnus-group-list-groups))
4737 (defun gnus-group-get-new-news-this-group (&optional n
)
4738 "Check for newly arrived news in the current group (and the N-1 next groups).
4739 The difference between N and the number of newsgroup checked is returned.
4740 If N is negative, this group and the N-1 previous groups will be checked."
4742 (let* ((groups (gnus-group-process-prefix n
))
4743 (ret (if (numberp n
) (- n
(length groups
)) 0))
4746 (setq group
(car groups
)
4747 groups
(cdr groups
))
4748 (gnus-group-remove-mark group
)
4749 (or (gnus-get-new-news-in-group group
)
4752 (message "%s error: %s" group
(gnus-status-message group
))
4754 (gnus-group-next-unread-group 1 t
)
4755 (gnus-summary-position-cursor)
4758 (defun gnus-get-new-news-in-group (group)
4760 (gnus-activate-group group
)
4762 (gnus-get-unread-articles-in-group
4763 (nth 2 (gnus-gethash group gnus-newsrc-hashtb
))
4764 (gnus-gethash group gnus-active-hashtb
))
4765 (gnus-group-update-group-line)
4768 (defun gnus-group-fetch-faq (group)
4769 "Fetch the FAQ for the current group."
4770 (interactive (list (gnus-group-real-name (gnus-group-group-name))))
4771 (or group
(error "No group name given"))
4772 (let ((file (concat gnus-group-faq-directory
(gnus-group-real-name group
))))
4773 (if (not (file-exists-p file
))
4774 (error "No such file: %s" file
)
4777 (defun gnus-group-describe-group (force &optional group
)
4778 "Display a description of the current newsgroup."
4779 (interactive (list current-prefix-arg
(gnus-group-group-name)))
4780 (and force
(setq gnus-description-hashtb nil
))
4781 (let ((method (gnus-find-method-for-group group
))
4783 (or group
(error "No group name given"))
4784 (and (or (and gnus-description-hashtb
4785 ;; We check whether this group's method has been
4786 ;; queried for a description file.
4788 (gnus-group-prefixed-name "" method
)
4789 gnus-description-hashtb
))
4790 (setq desc
(gnus-group-get-description group
))
4791 (gnus-read-descriptions-file method
))
4793 (or desc
(gnus-gethash group gnus-description-hashtb
)
4794 "No description available")))))
4796 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
4797 (defun gnus-group-describe-all-groups (&optional force
)
4798 "Pop up a buffer with descriptions of all newsgroups."
4800 (and force
(setq gnus-description-hashtb nil
))
4801 (if (not (or gnus-description-hashtb
4802 (gnus-read-all-descriptions-files)))
4803 (error "Couldn't request descriptions file"))
4804 (let ((buffer-read-only nil
)
4810 (insert (format " *: %-20s %s\n" (symbol-name group
)
4811 (symbol-value group
)))
4812 (add-text-properties
4813 b
(1+ b
) (list 'gnus-group group
4814 'gnus-unread t
'gnus-marked nil
4815 'gnus-level
(1+ gnus-level-subscribed
))))
4816 gnus-description-hashtb
)
4817 (goto-char (point-min))
4818 (gnus-group-position-cursor)))
4820 ;; Suggested by by Daniel Quinlan <quinlan@best.com>.
4821 (defun gnus-group-apropos (regexp &optional search-description
)
4822 "List all newsgroups that have names that match a regexp."
4823 (interactive "sGnus apropos (regexp): ")
4825 (obuf (current-buffer))
4827 ;; Go through all newsgroups that are known to Gnus.
4830 (and (symbol-name group
)
4831 (string-match regexp
(symbol-name group
))
4832 (setq groups
(cons (symbol-name group
) groups
))))
4834 ;; Go through all descriptions that are known to Gnus.
4835 (if search-description
4838 (and (string-match regexp
(symbol-value group
))
4839 (gnus-gethash (symbol-name group
) gnus-active-hashtb
)
4840 (setq groups
(cons (symbol-name group
) groups
))))
4841 gnus-description-hashtb
))
4843 (gnus-message 3 "No groups matched \"%s\"." regexp
)
4844 ;; Print out all the groups.
4846 (pop-to-buffer "*Gnus Help*")
4847 (buffer-disable-undo (current-buffer))
4849 (setq groups
(sort groups
'string
<))
4851 ;; Groups may be entered twice into the list of groups.
4852 (if (not (string= (car groups
) prev
))
4854 (insert (setq prev
(car groups
)) "\n")
4855 (if (and gnus-description-hashtb
4856 (setq des
(gnus-gethash (car groups
)
4857 gnus-description-hashtb
)))
4858 (insert " " des
"\n"))))
4859 (setq groups
(cdr groups
)))
4860 (goto-char (point-min))))
4861 (pop-to-buffer obuf
)))
4863 (defun gnus-group-description-apropos (regexp)
4864 "List all newsgroups that have names or descriptions that match a regexp."
4865 (interactive "sGnus description apropos (regexp): ")
4866 (if (not (or gnus-description-hashtb
4867 (gnus-read-all-descriptions-files)))
4868 (error "Couldn't request descriptions file"))
4869 (gnus-group-apropos regexp t
))
4871 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
4872 (defun gnus-group-list-matching (level regexp
&optional all lowest
)
4873 "List all groups with unread articles that match REGEXP.
4874 If the prefix LEVEL is non-nil, it should be a number that says which
4875 level to cut off listing groups.
4876 If ALL, also list groups with no unread articles.
4877 If LOWEST, don't list groups with level lower than LOWEST."
4878 (interactive "P\nsList newsgroups matching: ")
4879 (gnus-group-prepare-flat (or level gnus-level-subscribed
)
4880 all
(or lowest
1) regexp
)
4881 (goto-char (point-min))
4882 (gnus-group-position-cursor))
4884 (defun gnus-group-list-all-matching (level regexp
&optional lowest
)
4885 "List all groups that match REGEXP.
4886 If the prefix LEVEL is non-nil, it should be a number that says which
4887 level to cut off listing groups.
4888 If LOWEST, don't list groups with level lower than LOWEST."
4889 (interactive "P\nsList newsgroups matching: ")
4890 (gnus-group-list-matching (or level gnus-level-killed
) regexp t lowest
))
4892 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
4893 (defun gnus-group-save-newsrc ()
4894 "Save the Gnus startup files."
4896 (gnus-save-newsrc-file))
4898 (defun gnus-group-restart (&optional arg
)
4899 "Force Gnus to read the .newsrc file."
4901 (gnus-save-newsrc-file)
4902 (gnus-setup-news 'force
)
4903 (gnus-group-list-groups arg
))
4905 (defun gnus-group-read-init-file ()
4906 "Read the Gnus elisp init file."
4908 (gnus-read-init-file))
4910 (defun gnus-group-check-bogus-groups (&optional silent
)
4911 "Check bogus newsgroups.
4912 If given a prefix, don't ask for confirmation before removing a bogus
4915 (gnus-check-bogus-newsgroups (and (not silent
) (not gnus-expert-user
)))
4916 (gnus-group-list-groups))
4918 (defun gnus-group-edit-global-kill (&optional article group
)
4919 "Edit the global kill file.
4920 If GROUP, edit that local kill file instead."
4922 (setq gnus-current-kill-article article
)
4923 (gnus-kill-file-edit-file group
)
4926 (substitute-command-keys
4927 "Editing a global kill file (Type \\[gnus-kill-file-exit] to exit)")))
4929 (defun gnus-group-edit-local-kill (article group
)
4930 "Edit a local kill file."
4931 (interactive (list nil
(gnus-group-group-name)))
4932 (gnus-group-edit-global-kill article group
))
4934 (defun gnus-group-force-update ()
4935 "Update `.newsrc' file."
4937 (gnus-save-newsrc-file))
4939 (defun gnus-group-suspend ()
4940 "Suspend the current Gnus session.
4941 In fact, cleanup buffers except for group mode buffer.
4942 The hook gnus-suspend-gnus-hook is called before actually suspending."
4944 (run-hooks 'gnus-suspend-gnus-hook
)
4945 ;; Kill Gnus buffers except for group mode buffer.
4946 (let ((group-buf (get-buffer gnus-group-buffer
)))
4947 ;; Do this on a separate list in case the user does a ^G before we finish
4948 (let ((gnus-buffer-list
4949 (delq group-buf
(delq gnus-dribble-buffer
4950 (append gnus-buffer-list nil
)))))
4951 (while gnus-buffer-list
4952 (gnus-kill-buffer (car gnus-buffer-list
))
4953 (setq gnus-buffer-list
(cdr gnus-buffer-list
))))
4956 (setq gnus-buffer-list
(list group-buf
))
4957 (bury-buffer group-buf
)
4958 (delete-windows-on group-buf t
)))))
4960 (defun gnus-group-clear-dribble ()
4961 "Clear all information from the dribble buffer."
4963 (gnus-dribble-clear))
4965 (defun gnus-group-exit ()
4966 "Quit reading news after updating .newsrc.eld and .newsrc.
4967 The hook `gnus-exit-gnus-hook' is called before actually exiting."
4969 (if (or noninteractive
;For gnus-batch-kill
4970 (not (gnus-server-opened gnus-select-method
)) ;NNTP connection closed
4971 (not gnus-interactive-exit
) ;Without confirmation
4973 (gnus-y-or-n-p "Are you sure you want to quit reading news? "))
4975 (run-hooks 'gnus-exit-gnus-hook
)
4976 ;; Offer to save data from non-quitted summary buffers.
4977 (gnus-offer-save-summaries)
4978 ;; Save the newsrc file(s).
4979 (gnus-save-newsrc-file)
4981 (gnus-close-backends)
4982 ;; Reset everything.
4983 (gnus-clear-system))))
4985 (defun gnus-close-backends ()
4986 ;; Send a close request to all backends that support such a request.
4987 (let ((methods gnus-valid-select-methods
)
4990 (if (fboundp (setq func
(intern (concat (car (car methods
))
4991 "-request-close"))))
4993 (setq methods
(cdr methods
)))))
4995 (defun gnus-group-quit ()
4996 "Quit reading news without updating .newsrc.eld or .newsrc.
4997 The hook `gnus-exit-gnus-hook' is called before actually exiting."
4999 (if (or noninteractive
;For gnus-batch-kill
5000 (zerop (buffer-size))
5001 (not (gnus-server-opened gnus-select-method
))
5003 (not gnus-current-startup-file
)
5005 (format "Quit reading news without saving %s? "
5006 (file-name-nondirectory gnus-current-startup-file
))))
5008 (run-hooks 'gnus-exit-gnus-hook
)
5009 (if gnus-use-full-window
5010 (delete-other-windows)
5011 (gnus-remove-some-windows))
5013 (gnus-close-backends)
5014 (gnus-clear-system))))
5016 (defun gnus-offer-save-summaries ()
5018 (let ((buflist (buffer-list))
5021 (and (setq bufname
(buffer-name (car buflist
)))
5022 (string-match "Summary" bufname
)
5024 (set-buffer bufname
)
5025 ;; We check that this is, indeed, a summary buffer.
5026 (eq major-mode
'gnus-summary-mode
))
5027 (setq buffers
(cons bufname buffers
)))
5028 (setq buflist
(cdr buflist
)))
5031 "Update summary buffer %s? "
5034 (gnus-summary-exit))
5037 (defun gnus-group-describe-briefly ()
5038 "Give a one line description of the group mode commands."
5040 (gnus-message 7 (substitute-command-keys "\\<gnus-group-mode-map>\\[gnus-group-read-group]:Select \\[gnus-group-next-unread-group]:Forward \\[gnus-group-prev-unread-group]:Backward \\[gnus-group-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-group-describe-briefly]:This help")))
5042 (defun gnus-group-browse-foreign-server (method)
5043 "Browse a foreign news server.
5044 If called interactively, this function will ask for a select method
5045 (nntp, nnspool, etc.) and a server address (eg. nntp.some.where).
5046 If not, METHOD should be a list where the first element is the method
5047 and the second element is the address."
5049 (list (let ((how (completing-read
5051 (append gnus-valid-select-methods gnus-server-alist
)
5053 ;; We either got a backend name or a virtual server name.
5054 ;; If the first, we also need an address.
5055 (if (assoc how gnus-valid-select-methods
)
5057 ;; Suggested by mapjph@bath.ac.uk.
5060 (mapcar (lambda (server) (list server
))
5061 gnus-secondary-servers
)))
5062 ;; We got a server name, so we find the method.
5063 (gnus-server-to-method how
)))))
5064 (gnus-browse-foreign-server method
))
5068 ;;; Browse Server Mode
5071 (defvar gnus-browse-mode-hook nil
)
5072 (defvar gnus-browse-mode-map nil
)
5073 (put 'gnus-browse-mode
'mode-class
'special
)
5075 (if gnus-browse-mode-map
5077 (setq gnus-browse-mode-map
(make-keymap))
5078 (suppress-keymap gnus-browse-mode-map
)
5079 (define-key gnus-browse-mode-map
" " 'gnus-browse-read-group
)
5080 (define-key gnus-browse-mode-map
"=" 'gnus-browse-select-group
)
5081 (define-key gnus-browse-mode-map
"n" 'gnus-browse-next-group
)
5082 (define-key gnus-browse-mode-map
"p" 'gnus-browse-prev-group
)
5083 (define-key gnus-browse-mode-map
"\177" 'gnus-browse-prev-group
)
5084 (define-key gnus-browse-mode-map
"N" 'gnus-browse-next-group
)
5085 (define-key gnus-browse-mode-map
"P" 'gnus-browse-prev-group
)
5086 (define-key gnus-browse-mode-map
"\M-n" 'gnus-browse-next-group
)
5087 (define-key gnus-browse-mode-map
"\M-p" 'gnus-browse-prev-group
)
5088 (define-key gnus-browse-mode-map
"\r" 'gnus-browse-select-group
)
5089 (define-key gnus-browse-mode-map
"u" 'gnus-browse-unsubscribe-current-group
)
5090 (define-key gnus-browse-mode-map
"l" 'gnus-browse-exit
)
5091 (define-key gnus-browse-mode-map
"L" 'gnus-browse-exit
)
5092 (define-key gnus-browse-mode-map
"q" 'gnus-browse-exit
)
5093 (define-key gnus-browse-mode-map
"Q" 'gnus-browse-exit
)
5094 (define-key gnus-browse-mode-map
"\C-c\C-c" 'gnus-browse-exit
)
5095 (define-key gnus-browse-mode-map
"?" 'gnus-browse-describe-briefly
)
5096 (define-key gnus-browse-mode-map
"\C-c\C-i" 'gnus-info-find-node
)
5099 (defvar gnus-browse-current-method nil
)
5100 (defvar gnus-browse-return-buffer nil
)
5102 (defvar gnus-browse-buffer
"*Gnus Browse Server*")
5104 (defun gnus-browse-foreign-server (method &optional return-buffer
)
5105 (setq gnus-browse-current-method method
)
5106 (setq gnus-browse-return-buffer return-buffer
)
5107 (let ((gnus-select-method method
)
5109 (gnus-message 5 "Connecting to %s..." (nth 1 method
))
5110 (or (gnus-check-server method
)
5111 (error "Unable to contact server: %s" (gnus-status-message method
)))
5112 (or (gnus-request-list method
)
5113 (error "Couldn't request list: %s" (gnus-status-message method
)))
5114 (get-buffer-create gnus-browse-buffer
)
5115 (gnus-add-current-to-buffer-list)
5116 (and gnus-carpal
(gnus-carpal-setup-buffer 'browse
))
5117 (gnus-configure-windows 'browse
)
5118 (buffer-disable-undo (current-buffer))
5119 (let ((buffer-read-only nil
))
5122 (setq mode-line-buffer-identification
5124 "Gnus Browse Server {%s:%s}" (car method
) (car (cdr method
))))
5126 (set-buffer nntp-server-buffer
)
5127 (let ((cur (current-buffer)))
5128 (goto-char (point-min))
5129 (or (string= gnus-ignored-newsgroups
"")
5130 (delete-matching-lines gnus-ignored-newsgroups
))
5131 (while (re-search-forward
5132 "\\(^[^ \t]+\\)[ \t]+[0-9]+[ \t]+[0-9]+" nil t
)
5133 (goto-char (match-end 1))
5134 (setq groups
(cons (cons (buffer-substring (match-beginning 1)
5136 (max 0 (- (1+ (read cur
)) (read cur
))))
5138 (setq groups
(sort groups
5140 (string< (car l1
) (car l2
)))))
5141 (let ((buffer-read-only nil
))
5143 (setq group
(car groups
))
5145 (format "K%7d: %s\n" (cdr group
) (car group
)))
5146 (setq groups
(cdr groups
))))
5147 (switch-to-buffer (current-buffer))
5148 (goto-char (point-min))
5149 (gnus-group-position-cursor)))
5151 (defun gnus-browse-mode ()
5152 "Major mode for browsing a foreign server.
5154 All normal editing commands are switched off.
5156 \\<gnus-browse-mode-map>
5157 The only things you can do in this buffer is
5159 1) `\\[gnus-browse-unsubscribe-current-group]' to subscribe to a group.
5160 The group will be inserted into the group buffer upon exit from this
5163 2) `\\[gnus-browse-read-group]' to read a group ephemerally.
5165 3) `\\[gnus-browse-exit]' to return to the group buffer."
5167 (kill-all-local-variables)
5168 (if gnus-visual
(gnus-browse-make-menu-bar))
5169 (gnus-simplify-mode-line)
5170 (setq major-mode
'gnus-browse-mode
)
5171 (setq mode-name
"Browse Server")
5172 (setq mode-line-process nil
)
5173 (use-local-map gnus-browse-mode-map
)
5174 (buffer-disable-undo (current-buffer))
5175 (setq truncate-lines t
)
5176 (setq buffer-read-only t
)
5177 (run-hooks 'gnus-browse-mode-hook
))
5179 (defun gnus-browse-read-group (&optional no-article
)
5180 "Enter the group at the current line."
5182 (let ((group (gnus-browse-group-name)))
5183 (or (gnus-group-read-ephemeral-group
5184 group gnus-browse-current-method nil
5185 (cons (current-buffer) 'browse
))
5186 (error "Couldn't enter %s" group
))))
5188 (defun gnus-browse-select-group ()
5189 "Select the current group."
5191 (gnus-browse-read-group 'no
))
5193 (defun gnus-browse-next-group (n)
5194 "Go to the next group."
5198 (gnus-group-position-cursor)))
5200 (defun gnus-browse-prev-group (n)
5201 "Go to the next group."
5203 (gnus-browse-next-group (- n
)))
5205 (defun gnus-browse-unsubscribe-current-group (arg)
5206 "(Un)subscribe to the next ARG groups."
5209 (error "No group at current line."))
5210 (let ((ward (if (< arg
0) -
1 1))
5212 (while (and (> arg
0)
5214 (gnus-browse-unsubscribe-group)
5215 (zerop (gnus-browse-next-group ward
)))
5216 (setq arg
(1- arg
)))
5217 (gnus-group-position-cursor)
5218 (if (/= 0 arg
) (gnus-message 7 "No more newsgroups"))
5221 (defun gnus-browse-group-name ()
5224 (if (not (re-search-forward ": \\(.*\\)$" (gnus-point-at-eol) t
))
5226 (gnus-group-prefixed-name
5227 (buffer-substring (match-beginning 1) (match-end 1))
5228 gnus-browse-current-method
))))
5230 (defun gnus-browse-unsubscribe-group ()
5231 "Toggle subscription of the current group in the browse buffer."
5233 (buffer-read-only nil
)
5237 ;; If this group it killed, then we want to subscribe it.
5238 (if (= (following-char) ?K
) (setq sub t
))
5239 (setq group
(gnus-browse-group-name))
5243 (gnus-group-change-level
5244 (list t group gnus-level-default-subscribed
5245 nil nil gnus-browse-current-method
)
5246 gnus-level-default-subscribed gnus-level-killed
5247 (and (car (nth 1 gnus-newsrc-alist
))
5248 (gnus-gethash (car (nth 1 gnus-newsrc-alist
))
5249 gnus-newsrc-hashtb
))
5252 (gnus-group-change-level
5253 group gnus-level-killed gnus-level-default-subscribed
)
5257 (defun gnus-browse-exit ()
5258 "Quit browsing and return to the group buffer."
5260 (if (eq major-mode
'gnus-browse-mode
)
5261 (kill-buffer (current-buffer)))
5262 (if gnus-browse-return-buffer
5263 (gnus-configure-windows 'server
'force
)
5264 (gnus-configure-windows 'group
'force
)
5265 (gnus-group-list-groups nil
)))
5267 (defun gnus-browse-describe-briefly ()
5268 "Give a one line description of the group mode commands."
5271 (substitute-command-keys "\\<gnus-browse-mode-map>\\[gnus-group-next-group]:Forward \\[gnus-group-prev-group]:Backward \\[gnus-browse-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-browse-describe-briefly]:This help")))
5275 ;;; Gnus summary mode
5278 (defvar gnus-summary-mode-map nil
)
5279 (defvar gnus-summary-mark-map nil
)
5280 (defvar gnus-summary-mscore-map nil
)
5281 (defvar gnus-summary-article-map nil
)
5282 (defvar gnus-summary-thread-map nil
)
5283 (defvar gnus-summary-goto-map nil
)
5284 (defvar gnus-summary-exit-map nil
)
5285 (defvar gnus-summary-interest-map nil
)
5286 (defvar gnus-summary-sort-map nil
)
5287 (defvar gnus-summary-backend-map nil
)
5288 (defvar gnus-summary-save-map nil
)
5289 (defvar gnus-summary-wash-map nil
)
5290 (defvar gnus-summary-wash-hide-map nil
)
5291 (defvar gnus-summary-wash-highlight-map nil
)
5292 (defvar gnus-summary-wash-time-map nil
)
5293 (defvar gnus-summary-help-map nil
)
5295 (put 'gnus-summary-mode
'mode-class
'special
)
5297 (if gnus-summary-mode-map
5299 (setq gnus-summary-mode-map
(make-keymap))
5300 (suppress-keymap gnus-summary-mode-map
)
5302 ;; Non-orthogonal keys
5304 (define-key gnus-summary-mode-map
" " 'gnus-summary-next-page
)
5305 (define-key gnus-summary-mode-map
"\177" 'gnus-summary-prev-page
)
5306 (define-key gnus-summary-mode-map
"\r" 'gnus-summary-scroll-up
)
5307 (define-key gnus-summary-mode-map
"n" 'gnus-summary-next-unread-article
)
5308 (define-key gnus-summary-mode-map
"p" 'gnus-summary-prev-unread-article
)
5309 (define-key gnus-summary-mode-map
"N" 'gnus-summary-next-article
)
5310 (define-key gnus-summary-mode-map
"P" 'gnus-summary-prev-article
)
5311 (define-key gnus-summary-mode-map
"\M-\C-n" 'gnus-summary-next-same-subject
)
5312 (define-key gnus-summary-mode-map
"\M-\C-p" 'gnus-summary-prev-same-subject
)
5313 (define-key gnus-summary-mode-map
"\M-n" 'gnus-summary-next-unread-subject
)
5314 (define-key gnus-summary-mode-map
"\M-p" 'gnus-summary-prev-unread-subject
)
5315 (define-key gnus-summary-mode-map
"." 'gnus-summary-first-unread-article
)
5316 (define-key gnus-summary-mode-map
"," 'gnus-summary-best-unread-article
)
5317 (define-key gnus-summary-mode-map
5318 "\M-s" 'gnus-summary-search-article-forward
)
5319 (define-key gnus-summary-mode-map
5320 "\M-r" 'gnus-summary-search-article-backward
)
5321 (define-key gnus-summary-mode-map
"<" 'gnus-summary-beginning-of-article
)
5322 (define-key gnus-summary-mode-map
">" 'gnus-summary-end-of-article
)
5323 (define-key gnus-summary-mode-map
"j" 'gnus-summary-goto-subject
)
5324 (define-key gnus-summary-mode-map
"^" 'gnus-summary-refer-parent-article
)
5325 (define-key gnus-summary-mode-map
"\M-^" 'gnus-summary-refer-article
)
5326 (define-key gnus-summary-mode-map
"u" 'gnus-summary-tick-article-forward
)
5327 (define-key gnus-summary-mode-map
"!" 'gnus-summary-tick-article-forward
)
5328 (define-key gnus-summary-mode-map
"U" 'gnus-summary-tick-article-backward
)
5329 (define-key gnus-summary-mode-map
"d" 'gnus-summary-mark-as-read-forward
)
5330 (define-key gnus-summary-mode-map
"D" 'gnus-summary-mark-as-read-backward
)
5331 (define-key gnus-summary-mode-map
"E" 'gnus-summary-mark-as-expirable
)
5332 (define-key gnus-summary-mode-map
"\M-u" 'gnus-summary-clear-mark-forward
)
5333 (define-key gnus-summary-mode-map
"\M-U" 'gnus-summary-clear-mark-backward
)
5334 (define-key gnus-summary-mode-map
5335 "k" 'gnus-summary-kill-same-subject-and-select
)
5336 (define-key gnus-summary-mode-map
"\C-k" 'gnus-summary-kill-same-subject
)
5337 (define-key gnus-summary-mode-map
"\M-\C-k" 'gnus-summary-kill-thread
)
5338 (define-key gnus-summary-mode-map
"\M-\C-l" 'gnus-summary-lower-thread
)
5339 (define-key gnus-summary-mode-map
"e" 'gnus-summary-edit-article
)
5340 (define-key gnus-summary-mode-map
"#" 'gnus-summary-mark-as-processable
)
5341 (define-key gnus-summary-mode-map
"\M-#" 'gnus-summary-unmark-as-processable
)
5342 (define-key gnus-summary-mode-map
"\M-\C-t" 'gnus-summary-toggle-threads
)
5343 (define-key gnus-summary-mode-map
"\M-\C-s" 'gnus-summary-show-thread
)
5344 (define-key gnus-summary-mode-map
"\M-\C-h" 'gnus-summary-hide-thread
)
5345 (define-key gnus-summary-mode-map
"\M-\C-f" 'gnus-summary-next-thread
)
5346 (define-key gnus-summary-mode-map
"\M-\C-b" 'gnus-summary-prev-thread
)
5347 (define-key gnus-summary-mode-map
"\M-\C-u" 'gnus-summary-up-thread
)
5348 (define-key gnus-summary-mode-map
"\M-\C-d" 'gnus-summary-down-thread
)
5349 (define-key gnus-summary-mode-map
"&" 'gnus-summary-execute-command
)
5350 (define-key gnus-summary-mode-map
"c" 'gnus-summary-catchup-and-exit
)
5351 (define-key gnus-summary-mode-map
"\C-w" 'gnus-summary-mark-region-as-read
)
5352 (define-key gnus-summary-mode-map
"\C-t" 'gnus-summary-toggle-truncation
)
5353 (define-key gnus-summary-mode-map
"?" 'gnus-summary-mark-as-dormant
)
5354 (define-key gnus-summary-mode-map
5355 "\C-c\M-\C-s" 'gnus-summary-show-all-expunged
)
5356 (define-key gnus-summary-mode-map
5357 "\C-c\C-s\C-n" 'gnus-summary-sort-by-number
)
5358 (define-key gnus-summary-mode-map
5359 "\C-c\C-s\C-a" 'gnus-summary-sort-by-author
)
5360 (define-key gnus-summary-mode-map
5361 "\C-c\C-s\C-s" 'gnus-summary-sort-by-subject
)
5362 (define-key gnus-summary-mode-map
"\C-c\C-s\C-d" 'gnus-summary-sort-by-date
)
5363 (define-key gnus-summary-mode-map
"\C-c\C-s\C-i" 'gnus-summary-sort-by-score
)
5364 (define-key gnus-summary-mode-map
"=" 'gnus-summary-expand-window
)
5365 (define-key gnus-summary-mode-map
5366 "\C-x\C-s" 'gnus-summary-reselect-current-group
)
5367 (define-key gnus-summary-mode-map
"\M-g" 'gnus-summary-rescan-group
)
5368 (define-key gnus-summary-mode-map
"w" 'gnus-summary-stop-page-breaking
)
5369 (define-key gnus-summary-mode-map
"\C-c\C-r" 'gnus-summary-caesar-message
)
5370 (define-key gnus-summary-mode-map
"\M-t" 'gnus-summary-toggle-mime
)
5371 (define-key gnus-summary-mode-map
"f" 'gnus-summary-followup
)
5372 (define-key gnus-summary-mode-map
"F" 'gnus-summary-followup-with-original
)
5373 (define-key gnus-summary-mode-map
"C" 'gnus-summary-cancel-article
)
5374 (define-key gnus-summary-mode-map
"r" 'gnus-summary-reply
)
5375 (define-key gnus-summary-mode-map
"R" 'gnus-summary-reply-with-original
)
5376 (define-key gnus-summary-mode-map
"\C-c\C-f" 'gnus-summary-mail-forward
)
5377 (define-key gnus-summary-mode-map
"o" 'gnus-summary-save-article
)
5378 (define-key gnus-summary-mode-map
"\C-o" 'gnus-summary-save-article-mail
)
5379 (define-key gnus-summary-mode-map
"|" 'gnus-summary-pipe-output
)
5380 (define-key gnus-summary-mode-map
"\M-k" 'gnus-summary-edit-local-kill
)
5381 (define-key gnus-summary-mode-map
"\M-K" 'gnus-summary-edit-global-kill
)
5382 (define-key gnus-summary-mode-map
"V" 'gnus-version
)
5383 (define-key gnus-summary-mode-map
"\C-c\C-d" 'gnus-summary-describe-group
)
5384 (define-key gnus-summary-mode-map
"q" 'gnus-summary-exit
)
5385 (define-key gnus-summary-mode-map
"Q" 'gnus-summary-exit-no-update
)
5386 (define-key gnus-summary-mode-map
"\C-c\C-i" 'gnus-info-find-node
)
5387 (define-key gnus-summary-mode-map gnus-mouse-2
'gnus-mouse-pick-article
)
5388 (define-key gnus-summary-mode-map
"m" 'gnus-summary-mail-other-window
)
5389 (define-key gnus-summary-mode-map
"a" 'gnus-summary-post-news
)
5390 (define-key gnus-summary-mode-map
5391 "x" 'gnus-summary-remove-lines-marked-as-read
)
5392 ; (define-key gnus-summary-mode-map "X" 'gnus-summary-remove-lines-marked-with)
5393 (define-key gnus-summary-mode-map
"s" 'gnus-summary-isearch-article
)
5394 (define-key gnus-summary-mode-map
"t" 'gnus-summary-toggle-header
)
5395 (define-key gnus-summary-mode-map
"g" 'gnus-summary-show-article
)
5396 ; (define-key gnus-summary-mode-map "?" 'gnus-summary-describe-briefly)
5397 (define-key gnus-summary-mode-map
"l" 'gnus-summary-goto-last-article
)
5398 (define-key gnus-summary-mode-map
"\C-c\C-v\C-v" 'gnus-uu-decode-uu-view
)
5399 (define-key gnus-summary-mode-map
"\C-d" 'gnus-summary-enter-digest-group
)
5400 (define-key gnus-summary-mode-map
"v" 'gnus-summary-verbose-headers
)
5401 (define-key gnus-summary-mode-map
"\C-c\C-b" 'gnus-bug
)
5404 ;; Sort of orthogonal keymap
5405 (define-prefix-command 'gnus-summary-mark-map
)
5406 (define-key gnus-summary-mode-map
"M" 'gnus-summary-mark-map
)
5407 (define-key gnus-summary-mark-map
"t" 'gnus-summary-tick-article-forward
)
5408 (define-key gnus-summary-mark-map
"!" 'gnus-summary-tick-article-forward
)
5409 (define-key gnus-summary-mark-map
"d" 'gnus-summary-mark-as-read-forward
)
5410 (define-key gnus-summary-mark-map
"r" 'gnus-summary-mark-as-read-forward
)
5411 (define-key gnus-summary-mark-map
"c" 'gnus-summary-clear-mark-forward
)
5412 (define-key gnus-summary-mark-map
" " 'gnus-summary-clear-mark-forward
)
5413 (define-key gnus-summary-mark-map
"e" 'gnus-summary-mark-as-expirable
)
5414 (define-key gnus-summary-mark-map
"x" 'gnus-summary-mark-as-expirable
)
5415 (define-key gnus-summary-mark-map
"?" 'gnus-summary-mark-as-dormant
)
5416 (define-key gnus-summary-mark-map
"b" 'gnus-summary-set-bookmark
)
5417 (define-key gnus-summary-mark-map
"B" 'gnus-summary-remove-bookmark
)
5418 (define-key gnus-summary-mark-map
"#" 'gnus-summary-mark-as-processable
)
5419 (define-key gnus-summary-mark-map
"\M-#" 'gnus-summary-unmark-as-processable
)
5420 (define-key gnus-summary-mark-map
5421 "\M-r" 'gnus-summary-remove-lines-marked-as-read
)
5422 (define-key gnus-summary-mark-map
5423 "\M-\C-r" 'gnus-summary-remove-lines-marked-with
)
5424 (define-key gnus-summary-mark-map
"D" 'gnus-summary-show-all-dormant
)
5425 (define-key gnus-summary-mark-map
"\M-D" 'gnus-summary-hide-all-dormant
)
5426 (define-key gnus-summary-mark-map
"S" 'gnus-summary-show-all-expunged
)
5427 (define-key gnus-summary-mark-map
"C" 'gnus-summary-catchup
)
5428 (define-key gnus-summary-mark-map
"H" 'gnus-summary-catchup-to-here
)
5429 (define-key gnus-summary-mark-map
"\C-c" 'gnus-summary-catchup-all
)
5430 (define-key gnus-summary-mark-map
5431 "k" 'gnus-summary-kill-same-subject-and-select
)
5432 (define-key gnus-summary-mark-map
"K" 'gnus-summary-kill-same-subject
)
5434 (define-prefix-command 'gnus-summary-mscore-map
)
5435 (define-key gnus-summary-mark-map
"V" 'gnus-summary-mscore-map
)
5436 (define-key gnus-summary-mscore-map
"c" 'gnus-summary-clear-above
)
5437 (define-key gnus-summary-mscore-map
"u" 'gnus-summary-tick-above
)
5438 (define-key gnus-summary-mscore-map
"m" 'gnus-summary-mark-above
)
5439 (define-key gnus-summary-mscore-map
"k" 'gnus-summary-kill-below
)
5441 (define-key gnus-summary-mark-map
"P" 'gnus-uu-mark-map
)
5443 (define-key gnus-summary-mode-map
"S" 'gnus-summary-send-map
)
5445 (define-prefix-command 'gnus-summary-goto-map
)
5446 (define-key gnus-summary-mode-map
"G" 'gnus-summary-goto-map
)
5447 (define-key gnus-summary-goto-map
"n" 'gnus-summary-next-unread-article
)
5448 (define-key gnus-summary-goto-map
"p" 'gnus-summary-prev-unread-article
)
5449 (define-key gnus-summary-goto-map
"N" 'gnus-summary-next-article
)
5450 (define-key gnus-summary-goto-map
"P" 'gnus-summary-prev-article
)
5451 (define-key gnus-summary-goto-map
"\C-n" 'gnus-summary-next-same-subject
)
5452 (define-key gnus-summary-goto-map
"\C-p" 'gnus-summary-prev-same-subject
)
5453 (define-key gnus-summary-goto-map
"\M-n" 'gnus-summary-next-unread-subject
)
5454 (define-key gnus-summary-goto-map
"\M-p" 'gnus-summary-prev-unread-subject
)
5455 (define-key gnus-summary-goto-map
"f" 'gnus-summary-first-unread-article
)
5456 (define-key gnus-summary-goto-map
"b" 'gnus-summary-best-unread-article
)
5457 (define-key gnus-summary-goto-map
"g" 'gnus-summary-goto-subject
)
5458 (define-key gnus-summary-goto-map
"l" 'gnus-summary-goto-last-article
)
5459 (define-key gnus-summary-goto-map
"p" 'gnus-summary-pop-article
)
5462 (define-prefix-command 'gnus-summary-thread-map
)
5463 (define-key gnus-summary-mode-map
"T" 'gnus-summary-thread-map
)
5464 (define-key gnus-summary-thread-map
"k" 'gnus-summary-kill-thread
)
5465 (define-key gnus-summary-thread-map
"l" 'gnus-summary-lower-thread
)
5466 (define-key gnus-summary-thread-map
"i" 'gnus-summary-raise-thread
)
5467 (define-key gnus-summary-thread-map
"T" 'gnus-summary-toggle-threads
)
5468 (define-key gnus-summary-thread-map
"s" 'gnus-summary-show-thread
)
5469 (define-key gnus-summary-thread-map
"S" 'gnus-summary-show-all-threads
)
5470 (define-key gnus-summary-thread-map
"h" 'gnus-summary-hide-thread
)
5471 (define-key gnus-summary-thread-map
"H" 'gnus-summary-hide-all-threads
)
5472 (define-key gnus-summary-thread-map
"n" 'gnus-summary-next-thread
)
5473 (define-key gnus-summary-thread-map
"p" 'gnus-summary-prev-thread
)
5474 (define-key gnus-summary-thread-map
"u" 'gnus-summary-up-thread
)
5475 (define-key gnus-summary-thread-map
"d" 'gnus-summary-down-thread
)
5476 (define-key gnus-summary-thread-map
"#" 'gnus-uu-mark-thread
)
5479 (define-prefix-command 'gnus-summary-exit-map
)
5480 (define-key gnus-summary-mode-map
"Z" 'gnus-summary-exit-map
)
5481 (define-key gnus-summary-exit-map
"c" 'gnus-summary-catchup-and-exit
)
5482 (define-key gnus-summary-exit-map
"C" 'gnus-summary-catchup-all-and-exit
)
5483 (define-key gnus-summary-exit-map
"E" 'gnus-summary-exit-no-update
)
5484 (define-key gnus-summary-exit-map
"Q" 'gnus-summary-exit
)
5485 (define-key gnus-summary-exit-map
"Z" 'gnus-summary-exit
)
5486 (define-key gnus-summary-exit-map
5487 "n" 'gnus-summary-catchup-and-goto-next-group
)
5488 (define-key gnus-summary-exit-map
"R" 'gnus-summary-reselect-current-group
)
5489 (define-key gnus-summary-exit-map
"G" 'gnus-summary-rescan-group
)
5490 (define-key gnus-summary-exit-map
"N" 'gnus-summary-next-group
)
5491 (define-key gnus-summary-exit-map
"P" 'gnus-summary-prev-group
)
5494 (define-prefix-command 'gnus-summary-article-map
)
5495 (define-key gnus-summary-mode-map
"A" 'gnus-summary-article-map
)
5496 (define-key gnus-summary-article-map
" " 'gnus-summary-next-page
)
5497 (define-key gnus-summary-article-map
"n" 'gnus-summary-next-page
)
5498 (define-key gnus-summary-article-map
"\177" 'gnus-summary-prev-page
)
5499 (define-key gnus-summary-article-map
"p" 'gnus-summary-prev-page
)
5500 (define-key gnus-summary-article-map
"\r" 'gnus-summary-scroll-up
)
5501 (define-key gnus-summary-article-map
"<" 'gnus-summary-beginning-of-article
)
5502 (define-key gnus-summary-article-map
">" 'gnus-summary-end-of-article
)
5503 (define-key gnus-summary-article-map
"b" 'gnus-summary-beginning-of-article
)
5504 (define-key gnus-summary-article-map
"e" 'gnus-summary-end-of-article
)
5505 (define-key gnus-summary-article-map
"^" 'gnus-summary-refer-parent-article
)
5506 (define-key gnus-summary-article-map
"r" 'gnus-summary-refer-parent-article
)
5507 (define-key gnus-summary-article-map
"g" 'gnus-summary-show-article
)
5508 (define-key gnus-summary-article-map
"s" 'gnus-summary-isearch-article
)
5512 (define-prefix-command 'gnus-summary-wash-map
)
5513 (define-key gnus-summary-mode-map
"W" 'gnus-summary-wash-map
)
5515 (define-prefix-command 'gnus-summary-wash-hide-map
)
5516 (define-key gnus-summary-wash-map
"W" 'gnus-summary-wash-hide-map
)
5517 (define-key gnus-summary-wash-hide-map
"a" 'gnus-article-hide
)
5518 (define-key gnus-summary-wash-hide-map
"h" 'gnus-article-hide-headers
)
5519 (define-key gnus-summary-wash-hide-map
"s" 'gnus-article-hide-signature
)
5520 (define-key gnus-summary-wash-hide-map
"c" 'gnus-article-hide-citation
)
5521 (define-key gnus-summary-wash-hide-map
5522 "\C-c" 'gnus-article-hide-citation-maybe
)
5524 (define-prefix-command 'gnus-summary-wash-highlight-map
)
5525 (define-key gnus-summary-wash-map
"H" 'gnus-summary-wash-highlight-map
)
5526 (define-key gnus-summary-wash-highlight-map
"a" 'gnus-article-highlight
)
5527 (define-key gnus-summary-wash-highlight-map
5528 "h" 'gnus-article-highlight-headers
)
5529 (define-key gnus-summary-wash-highlight-map
5530 "c" 'gnus-article-highlight-citation
)
5531 (define-key gnus-summary-wash-highlight-map
5532 "s" 'gnus-article-highlight-signature
)
5534 (define-prefix-command 'gnus-summary-wash-time-map
)
5535 (define-key gnus-summary-wash-map
"T" 'gnus-summary-wash-time-map
)
5536 (define-key gnus-summary-wash-time-map
"z" 'gnus-article-date-ut
)
5537 (define-key gnus-summary-wash-time-map
"u" 'gnus-article-date-ut
)
5538 (define-key gnus-summary-wash-time-map
"l" 'gnus-article-date-local
)
5539 (define-key gnus-summary-wash-time-map
"e" 'gnus-article-date-lapsed
)
5541 (define-key gnus-summary-wash-map
"b" 'gnus-article-add-buttons
)
5542 (define-key gnus-summary-wash-map
"o" 'gnus-article-treat-overstrike
)
5543 (define-key gnus-summary-wash-map
"w" 'gnus-article-word-wrap
)
5544 (define-key gnus-summary-wash-map
"c" 'gnus-article-remove-cr
)
5545 (define-key gnus-summary-wash-map
"q" 'gnus-article-de-quoted-unreadable
)
5546 (define-key gnus-summary-wash-map
"f" 'gnus-article-display-x-face
)
5547 (define-key gnus-summary-wash-map
"l" 'gnus-summary-stop-page-breaking
)
5548 (define-key gnus-summary-wash-map
"r" 'gnus-summary-caesar-message
)
5549 (define-key gnus-summary-wash-map
"t" 'gnus-summary-toggle-header
)
5550 (define-key gnus-summary-wash-map
"m" 'gnus-summary-toggle-mime
)
5553 (define-prefix-command 'gnus-summary-help-map
)
5554 (define-key gnus-summary-mode-map
"H" 'gnus-summary-help-map
)
5555 (define-key gnus-summary-help-map
"v" 'gnus-version
)
5556 (define-key gnus-summary-help-map
"f" 'gnus-summary-fetch-faq
)
5557 (define-key gnus-summary-help-map
"d" 'gnus-summary-describe-group
)
5558 (define-key gnus-summary-help-map
"h" 'gnus-summary-describe-briefly
)
5559 (define-key gnus-summary-help-map
"i" 'gnus-info-find-node
)
5562 (define-prefix-command 'gnus-summary-backend-map
)
5563 (define-key gnus-summary-mode-map
"B" 'gnus-summary-backend-map
)
5564 (define-key gnus-summary-backend-map
"e" 'gnus-summary-expire-articles
)
5565 (define-key gnus-summary-backend-map
"\M-\C-e"
5566 'gnus-summary-expire-articles-now
)
5567 (define-key gnus-summary-backend-map
"\177" 'gnus-summary-delete-article
)
5568 (define-key gnus-summary-backend-map
"m" 'gnus-summary-move-article
)
5569 (define-key gnus-summary-backend-map
"r" 'gnus-summary-respool-article
)
5570 (define-key gnus-summary-backend-map
"w" 'gnus-summary-edit-article
)
5571 (define-key gnus-summary-backend-map
"c" 'gnus-summary-copy-article
)
5572 (define-key gnus-summary-backend-map
"q" 'gnus-summary-fancy-query
)
5573 (define-key gnus-summary-backend-map
"i" 'gnus-summary-import-article
)
5576 (define-prefix-command 'gnus-summary-save-map
)
5577 (define-key gnus-summary-mode-map
"O" 'gnus-summary-save-map
)
5578 (define-key gnus-summary-save-map
"o" 'gnus-summary-save-article
)
5579 (define-key gnus-summary-save-map
"m" 'gnus-summary-save-article-mail
)
5580 (define-key gnus-summary-save-map
"r" 'gnus-summary-save-article-rmail
)
5581 (define-key gnus-summary-save-map
"f" 'gnus-summary-save-article-file
)
5582 (define-key gnus-summary-save-map
"h" 'gnus-summary-save-article-folder
)
5583 (define-key gnus-summary-save-map
"v" 'gnus-summary-save-article-vm
)
5584 (define-key gnus-summary-save-map
"p" 'gnus-summary-pipe-output
)
5585 ; (define-key gnus-summary-save-map "s" 'gnus-soup-add-article)
5587 (define-key gnus-summary-mode-map
"X" 'gnus-uu-extract-map
)
5589 (define-key gnus-summary-mode-map
"\M-&" 'gnus-summary-universal-argument
)
5590 ; (define-key gnus-summary-various-map "\C-s" 'gnus-summary-search-article-forward)
5591 ; (define-key gnus-summary-various-map "\C-r" 'gnus-summary-search-article-backward)
5592 ; (define-key gnus-summary-various-map "r" 'gnus-summary-refer-article)
5593 ; (define-key gnus-summary-various-map "&" 'gnus-summary-execute-command)
5594 ; (define-key gnus-summary-various-map "T" 'gnus-summary-toggle-truncation)
5595 ; (define-key gnus-summary-various-map "e" 'gnus-summary-expand-window)
5596 (define-key gnus-summary-article-map
"D" 'gnus-summary-enter-digest-group
)
5597 ; (define-key gnus-summary-various-map "k" 'gnus-summary-edit-local-kill)
5598 ; (define-key gnus-summary-various-map "K" 'gnus-summary-edit-global-kill)
5600 (define-key gnus-summary-mode-map
"V" 'gnus-summary-score-map
)
5602 ; (define-prefix-command 'gnus-summary-sort-map)
5603 ; (define-key gnus-summary-various-map "s" 'gnus-summary-sort-map)
5604 ; (define-key gnus-summary-sort-map "n" 'gnus-summary-sort-by-number)
5605 ; (define-key gnus-summary-sort-map "a" 'gnus-summary-sort-by-author)
5606 ; (define-key gnus-summary-sort-map "s" 'gnus-summary-sort-by-subject)
5607 ; (define-key gnus-summary-sort-map "d" 'gnus-summary-sort-by-date)
5608 ; (define-key gnus-summary-sort-map "i" 'gnus-summary-sort-by-score)
5610 (define-key gnus-summary-mode-map
"I" 'gnus-summary-increase-score
)
5611 (define-key gnus-summary-mode-map
"L" 'gnus-summary-lower-score
)
5617 (defun gnus-summary-mode (&optional group
)
5618 "Major mode for reading articles.
5620 All normal editing commands are switched off.
5621 \\<gnus-summary-mode-map>
5622 Each line in this buffer represents one article. To read an
5623 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
5624 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
5627 You can also post articles and send mail from this buffer. To
5628 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
5629 of an article, type `\\[gnus-summary-reply]'.
5631 There are approx. one gazillion commands you can execute in this
5632 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
5634 The following commands are available:
5636 \\{gnus-summary-mode-map}"
5638 (if gnus-visual
(gnus-summary-make-menu-bar))
5639 (kill-all-local-variables)
5640 (let ((locals gnus-summary-local-variables
))
5642 (if (consp (car locals
))
5644 (make-local-variable (car (car locals
)))
5645 (set (car (car locals
)) (eval (cdr (car locals
)))))
5646 (make-local-variable (car locals
))
5647 (set (car locals
) nil
))
5648 (setq locals
(cdr locals
))))
5649 (gnus-make-thread-indent-array)
5650 (gnus-simplify-mode-line)
5651 (setq major-mode
'gnus-summary-mode
)
5652 (setq mode-name
"Summary")
5653 (make-local-variable 'minor-mode-alist
)
5654 (use-local-map gnus-summary-mode-map
)
5655 (buffer-disable-undo (current-buffer))
5656 (setq buffer-read-only t
) ;Disable modification
5657 (setq truncate-lines t
)
5658 (setq selective-display t
)
5659 (setq selective-display-ellipses t
) ;Display `...'
5660 (setq buffer-display-table gnus-summary-display-table
)
5661 (setq gnus-newsgroup-name group
)
5662 (run-hooks 'gnus-summary-mode-hook
))
5664 (defun gnus-summary-make-display-table ()
5665 ;; Change the display table. Odd characters have a tendency to mess
5666 ;; up nicely formatted displays - we make all possible glyphs
5667 ;; display only a single character.
5669 ;; We start from the standard display table, if any.
5670 (setq gnus-summary-display-table
5671 (or (copy-sequence standard-display-table
)
5672 (make-display-table)))
5673 ;; Nix out all the control chars...
5675 (while (>= (setq i
(1- i
)) 0)
5676 (aset gnus-summary-display-table i
[??
])))
5677 ;; ... but not newline and cr, of course. (cr is necessary for the
5678 ;; selective display).
5679 (aset gnus-summary-display-table ?
\n nil
)
5680 (aset gnus-summary-display-table ?
\r nil
)
5681 ;; We nix out any glyphs over 126 that are not set already.
5683 (while (>= (setq i
(1- i
)) 127)
5684 ;; Only modify if the entry is nil.
5685 (or (aref gnus-summary-display-table i
)
5686 (aset gnus-summary-display-table i
[??
])))))
5688 (defun gnus-summary-clear-local-variables ()
5689 (let ((locals gnus-summary-local-variables
))
5691 (if (consp (car locals
))
5692 (and (vectorp (car (car locals
)))
5693 (set (car (car locals
)) nil
))
5694 (and (vectorp (car locals
))
5695 (set (car locals
) nil
)))
5696 (setq locals
(cdr locals
)))))
5698 ;; Some summary mode macros.
5700 ;; Return a header specified by a NUMBER.
5701 (defun gnus-get-header-by-number (number)
5703 (set-buffer gnus-summary-buffer
)
5704 (or gnus-newsgroup-headers-hashtb-by-number
5705 (gnus-make-headers-hashtable-by-number))
5706 (gnus-gethash (int-to-string number
)
5707 gnus-newsgroup-headers-hashtb-by-number
)))
5709 ;; Fast version of the function above.
5710 (defmacro gnus-get-header-by-num
(number)
5711 (` (gnus-gethash (int-to-string (, number
))
5712 gnus-newsgroup-headers-hashtb-by-number
)))
5714 (defmacro gnus-summary-search-forward
(&optional unread subject backward
)
5715 "Search for article forward.
5716 If UNREAD is non-nil, only unread articles are selected.
5717 If SUBJECT is non-nil, the article which has the same subject will be
5719 If BACKWARD is non-nil, the search will be performed backwards instead."
5720 (` (gnus-summary-search-subject (, backward
) (, unread
) (, subject
))))
5722 (defmacro gnus-summary-search-backward
(&optional unread subject
)
5723 "Search for article backward.
5724 If 1st optional argument UNREAD is non-nil, only unread article is selected.
5725 If 2nd optional argument SUBJECT is non-nil, the article which has
5726 the same subject will be searched for."
5727 (` (gnus-summary-search-forward (, unread
) (, subject
) t
)))
5729 (defmacro gnus-summary-article-number
(&optional number-or-nil
)
5730 "The article number of the article on the current line.
5731 If there isn's an article number here, then we return the current
5734 '(get-text-property (gnus-point-at-bol) 'gnus-number
)
5735 '(or (get-text-property (gnus-point-at-bol) 'gnus-number
)
5736 gnus-current-article
)))
5738 (defmacro gnus-summary-thread-level
()
5739 "The thread level of the article on the current line."
5740 '(or (get-text-property (gnus-point-at-bol) 'gnus-level
)
5743 (defmacro gnus-summary-article-mark
()
5744 "The mark on the current line."
5745 '(get-text-property (gnus-point-at-bol) 'gnus-mark
))
5747 (defun gnus-summary-subject-string ()
5748 "Return current subject string or nil if nothing."
5749 (let ((article (gnus-summary-article-number))
5752 (setq header
(gnus-get-header-by-num article
))
5754 (mail-header-subject header
))))
5756 ;; Various summary mode internalish functions.
5758 (defun gnus-mouse-pick-article (e)
5761 (gnus-summary-next-page nil t
))
5763 (defun gnus-summary-setup-buffer (group)
5764 "Initialize summary buffer."
5765 (let ((buffer (concat "*Summary " group
"*")))
5766 (if (get-buffer buffer
)
5769 (not gnus-newsgroup-begin
))
5770 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
5771 (setq gnus-summary-buffer
(set-buffer (get-buffer-create buffer
)))
5772 (gnus-add-current-to-buffer-list)
5773 (gnus-summary-mode group
)
5774 (and gnus-carpal
(gnus-carpal-setup-buffer 'summary
))
5775 (setq gnus-newsgroup-name group
)
5778 (defun gnus-set-global-variables ()
5779 ;; Set the global equivalents of the summary buffer-local variables
5780 ;; to the latest values they had. These reflect the summary buffer
5781 ;; that was in action when the last article was fetched.
5782 (if (eq major-mode
'gnus-summary-mode
)
5784 (setq gnus-summary-buffer
(current-buffer))
5785 (let ((name gnus-newsgroup-name
)
5786 (marked gnus-newsgroup-marked
)
5787 (unread gnus-newsgroup-unreads
)
5788 (headers gnus-current-headers
)
5789 (score-file gnus-current-score-file
))
5791 (set-buffer gnus-group-buffer
)
5792 (setq gnus-newsgroup-name name
)
5793 (setq gnus-newsgroup-marked marked
)
5794 (setq gnus-newsgroup-unreads unread
)
5795 (setq gnus-current-headers headers
)
5796 (setq gnus-current-score-file score-file
))))))
5798 (defun gnus-summary-insert-dummy-line (sformat subject number
)
5800 (setq sformat gnus-summary-dummy-line-format-spec
))
5804 (insert (eval sformat
))
5805 (add-text-properties
5807 (list 'gnus-number number
5808 'gnus-mark gnus-dummy-mark
5811 (defvar gnus-thread-indent-array nil
)
5812 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
5813 (defun gnus-make-thread-indent-array ()
5815 (if (and gnus-thread-indent-array
5816 (= gnus-thread-indent-level gnus-thread-indent-array-level
))
5818 (setq gnus-thread-indent-array
(make-vector 201 "")
5819 gnus-thread-indent-array-level gnus-thread-indent-level
)
5821 (aset gnus-thread-indent-array n
5822 (make-string (* n gnus-thread-indent-level
) ?
))
5825 (defun gnus-summary-insert-line
5826 (sformat header level current unread replied expirable subject-or-nil
5827 &optional dummy score process
)
5828 (or sformat
(setq sformat gnus-summary-line-format-spec
))
5829 (let* ((indentation (aref gnus-thread-indent-array level
))
5830 (lines (mail-header-lines header
))
5831 (score (or score gnus-summary-default-score
0))
5833 (if (or (null gnus-summary-default-score
)
5834 (<= (abs (- score gnus-summary-default-score
))
5835 gnus-summary-zcore-fuzz
)) ?
5836 (if (< score gnus-summary-default-score
)
5837 gnus-score-below-mark gnus-score-over-mark
)))
5838 (replied (cond (process gnus-process-mark
)
5839 (replied gnus-replied-mark
)
5840 (t gnus-unread-mark
)))
5841 (from (mail-header-from header
))
5843 ((string-match "(.+)" from
)
5844 (substring from
(1+ (match-beginning 0)) (1- (match-end 0))))
5845 ((string-match "<[^>]+> *$" from
)
5846 (let ((beg (match-beginning 0)))
5847 (or (and (string-match "^\"[^\"]*\"" from
)
5848 (substring from
(1+ (match-beginning 0))
5849 (1- (match-end 0))))
5850 (substring from
0 beg
))))
5852 (subject (mail-header-subject header
))
5853 (number (mail-header-number header
))
5854 (opening-bracket (if dummy ?\
< ?\
[))
5855 (closing-bracket (if dummy ?\
> ?\
]))
5856 (buffer-read-only nil
)
5857 (b (progn (beginning-of-line) (point))))
5858 (or (numberp lines
) (setq lines
0))
5859 (insert (eval sformat
))
5860 (add-text-properties
5861 b
(1+ b
) (list 'gnus-number number
5862 'gnus-mark
(or unread gnus-unread-mark
)
5863 'gnus-level level
))))
5865 (defun gnus-summary-update-line (&optional dont-update
)
5866 ;; Update summary line after change.
5867 (or (not gnus-summary-default-score
)
5868 gnus-summary-inhibit-highlight
5869 (let ((gnus-summary-inhibit-highlight t
)
5870 (article (gnus-summary-article-number)))
5873 (if (and gnus-summary-mark-below
5874 (< (gnus-summary-article-score)
5875 gnus-summary-mark-below
))
5876 (and (not (memq article gnus-newsgroup-marked
))
5877 (not (memq article gnus-newsgroup-dormant
))
5878 (memq article gnus-newsgroup-unreads
)
5879 (gnus-summary-mark-article-as-read gnus-low-score-mark
))
5880 (and (eq (gnus-summary-article-mark) gnus-low-score-mark
)
5881 (gnus-summary-mark-article-as-unread gnus-unread-mark
))))
5883 (run-hooks 'gnus-summary-update-hook
))))))
5885 (defun gnus-summary-update-lines (&optional beg end
)
5886 ;; Mark article as read (or not) by taking into account scores.
5887 (let ((beg (or beg
(point-min)))
5888 (end (or end
(point-max))))
5889 (if (or (not gnus-summary-default-score
)
5890 gnus-summary-inhibit-highlight
)
5892 (let ((gnus-summary-inhibit-highlight t
)
5895 (set-buffer gnus-summary-buffer
)
5898 (while (and (not (eobp)) (< (point) end
))
5899 (if (and gnus-summary-mark-below
5901 (setq article
(get-text-property
5902 (point) 'gnus-number
))
5903 gnus-newsgroup-scored
))
5904 gnus-summary-default-score
0)
5905 gnus-summary-mark-below
))
5906 ;; We want to possibly mark it as read...
5907 (and (not (memq article gnus-newsgroup-marked
))
5908 (not (memq article gnus-newsgroup-dormant
))
5909 (memq article gnus-newsgroup-unreads
)
5910 (gnus-summary-mark-article-as-read gnus-low-score-mark
))
5911 ;; We want to possibly mark it as unread.
5912 (and (eq (get-text-property (point) 'gnus-mark
)
5913 gnus-low-score-mark
)
5914 (gnus-summary-mark-article-as-unread gnus-unread-mark
)))
5915 ;; Do the visual highlights at the same time.
5916 (and gnus-visual
(run-hooks 'gnus-summary-update-hook
))
5917 (forward-line 1)))))))
5919 (defvar gnus-tmp-gathered nil
)
5921 (defun gnus-summary-number-of-articles-in-thread (thread &optional char
)
5922 ;; Sum up all elements (and sub-elements) in a list.
5924 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
5925 (if (and (consp thread
) (cdr thread
))
5928 'gnus-summary-number-of-articles-in-thread
5932 (if (> number
1) gnus-not-empty-thread-mark
5933 gnus-empty-thread-mark
)
5936 (defun gnus-summary-read-group
5937 (group &optional show-all no-article kill-buffer
)
5938 "Start reading news in newsgroup GROUP.
5939 If SHOW-ALL is non-nil, already read articles are also listed.
5940 If NO-ARTICLE is non-nil, no article is selected initially."
5941 (gnus-message 5 "Retrieving newsgroup: %s..." group
)
5942 (let* ((new-group (gnus-summary-setup-buffer group
))
5943 (quit-config (gnus-group-quit-config group
))
5944 (did-select (and new-group
(gnus-select-newsgroup group show-all
))))
5947 (gnus-set-global-variables)
5948 (gnus-kill-buffer kill-buffer
)
5949 (gnus-configure-windows 'summary
'force
)
5950 (gnus-set-mode-line 'summary
)
5951 (gnus-summary-position-cursor)
5955 (and (eq major-mode
'gnus-summary-mode
)
5956 (not (equal (current-buffer) kill-buffer
))
5958 (kill-buffer (current-buffer))
5959 (if (not quit-config
)
5961 (set-buffer gnus-group-buffer
)
5962 (gnus-group-jump-to-group group
)
5963 (gnus-group-next-unread-group 1))
5964 (if (not (buffer-name (car quit-config
)))
5965 (gnus-configure-windows 'group
'force
)
5966 (set-buffer (car quit-config
))
5967 (and (eq major-mode
'gnus-summary-mode
)
5968 (gnus-set-global-variables))
5969 (gnus-configure-windows (cdr quit-config
))))))
5970 (message "Can't select group")
5972 ((eq did-select
'quit
)
5973 (and (eq major-mode
'gnus-summary-mode
)
5974 (not (equal (current-buffer) kill-buffer
))
5975 (kill-buffer (current-buffer)))
5976 (gnus-kill-buffer kill-buffer
)
5977 (if (not quit-config
)
5979 (set-buffer gnus-group-buffer
)
5980 (gnus-group-jump-to-group group
)
5981 (gnus-group-next-unread-group 1)
5982 (gnus-configure-windows 'group
'force
))
5983 (if (not (buffer-name (car quit-config
)))
5984 (gnus-configure-windows 'group
'force
)
5985 (set-buffer (car quit-config
))
5986 (and (eq major-mode
'gnus-summary-mode
)
5987 (gnus-set-global-variables))
5988 (gnus-configure-windows (cdr quit-config
))))
5991 (gnus-set-global-variables)
5992 ;; Save the active value in effect when the group was entered.
5993 (setq gnus-newsgroup-active
5995 (gnus-gethash gnus-newsgroup-name gnus-active-hashtb
)))
5996 ;; You can change the subjects in this hook.
5997 (run-hooks 'gnus-select-group-hook
)
5998 ;; Do score processing.
5999 (and gnus-use-scoring
(gnus-possibly-score-headers))
6000 (gnus-update-format-specifications)
6001 ;; Generate the summary buffer.
6002 (gnus-summary-prepare)
6003 (if (zerop (buffer-size))
6004 (cond (gnus-newsgroup-dormant
6005 (gnus-summary-show-all-dormant))
6006 ((and gnus-newsgroup-scored show-all
)
6007 (gnus-summary-show-all-expunged))))
6008 ;; Function `gnus-apply-kill-file' must be called in this hook.
6009 (run-hooks 'gnus-apply-kill-hook
)
6010 (if (zerop (buffer-size))
6012 ;; This newsgroup is empty.
6013 (gnus-summary-catchup-and-exit nil t
) ;Without confirmations.
6014 (gnus-message 6 "No unread news")
6015 (gnus-kill-buffer kill-buffer
)
6019 ;; (let ((gnus-summary-buffer kill-buffer))
6020 ;; (gnus-configure-windows 'group))))
6021 ;; Hide conversation thread subtrees. We cannot do this in
6022 ;; gnus-summary-prepare-hook since kill processing may not
6023 ;; work with hidden articles.
6024 (and gnus-show-threads
6025 gnus-thread-hide-subtree
6026 (gnus-summary-hide-all-threads))
6027 ;; Show first unread article if requested.
6028 (goto-char (point-min))
6029 (if (and (not no-article
)
6030 gnus-auto-select-first
6031 (gnus-summary-first-unread-article))
6033 (gnus-configure-windows 'summary
'force
))
6034 (gnus-set-mode-line 'summary
)
6035 (gnus-summary-position-cursor)
6036 ;; If in async mode, we send some info to the backend.
6037 (and gnus-newsgroup-async
6038 (setq gnus-newsgroup-threads
(nreverse gnus-newsgroup-threads
))
6039 (gnus-request-asynchronous
6041 (if (and gnus-asynchronous-article-function
6042 (fboundp gnus-asynchronous-article-function
))
6043 (funcall gnus-asynchronous-article-function
6044 gnus-newsgroup-threads
)
6045 gnus-newsgroup-threads
)))
6046 (gnus-kill-buffer kill-buffer
)
6047 (if (not (get-buffer-window gnus-group-buffer
))
6049 ;; gotta use windows, because recenter does weird stuff if
6050 ;; the current buffer ain't the displayed window.
6051 (let ((owin (selected-window)))
6052 (select-window (get-buffer-window gnus-group-buffer
))
6053 (and (gnus-group-goto-group group
)
6055 (select-window owin
))))
6058 (defun gnus-summary-prepare ()
6059 ;; Generate the summary buffer.
6060 (let ((buffer-read-only nil
))
6062 (gnus-summary-prepare-threads
6063 (if gnus-show-threads
6064 (gnus-gather-threads
6066 (if (and gnus-summary-expunge-below
6067 (not gnus-fetch-old-headers
))
6068 (gnus-make-threads-and-expunge)
6069 (gnus-make-threads))))
6070 gnus-newsgroup-headers
)
6072 (gnus-summary-update-lines)
6073 ;; Create the header hashtb.
6074 (gnus-make-headers-hashtable-by-number)
6075 ;; Call hooks for modifying summary buffer.
6076 ;; Suggested by sven@tde.LTH.Se (Sven Mattisson).
6077 (goto-char (point-min))
6078 (run-hooks 'gnus-summary-prepare-hook
)))
6080 (defun gnus-gather-threads (threads)
6081 "Gather threads that have lost their roots."
6082 (if (not gnus-summary-make-false-root
)
6084 (let ((hashtb (gnus-make-hashtable 1023))
6087 subject hthread whole-subject
)
6090 (setq subject
(mail-header-subject (car (car threads
)))))
6091 (if gnus-summary-gather-subject-limit
6092 (or (and (numberp gnus-summary-gather-subject-limit
)
6093 (> (length subject
) gnus-summary-gather-subject-limit
)
6095 (substring subject
0
6096 gnus-summary-gather-subject-limit
)))
6097 (and (eq 'fuzzy gnus-summary-gather-subject-limit
)
6098 (setq subject
(gnus-simplify-subject-fuzzy subject
))))
6099 (setq subject
(gnus-simplify-subject-re subject
)))
6101 (gnus-gethash subject hashtb
))
6103 (or (stringp (car (car hthread
)))
6104 (setcar hthread
(list whole-subject
(car hthread
))))
6105 (setcdr (car hthread
) (nconc (cdr (car hthread
))
6106 (list (car threads
))))
6107 (setcdr prev
(cdr threads
))
6108 (setq threads prev
))
6109 (gnus-sethash subject threads hashtb
))
6111 (setq threads
(cdr threads
)))
6114 (defun gnus-make-threads ()
6115 ;; This function takes the dependencies already made by
6116 ;; `gnus-get-newsgroup-headers' and builds the trees. First we go
6117 ;; through the dependencies in the hash table and finds all the
6118 ;; roots. Roots do not refer back to any valid articles.
6119 (gnus-message 6 "Threading...")
6120 (let (roots new-roots
)
6121 (and gnus-fetch-old-headers
6122 (eq gnus-headers-retrieved-by
'nov
)
6123 (gnus-build-old-threads))
6126 (if (not (car (symbol-value refs
)))
6127 (setq roots
(append (cdr (symbol-value refs
)) roots
))
6128 ;; Ok, these refer back to valid articles, but if
6129 ;; `gnus-thread-ignore-subject' is nil, we have to check that
6130 ;; the root has the same subject as its children. The children
6131 ;; that do not are made into roots and removed from the list
6133 (or gnus-thread-ignore-subject
6134 (let* ((prev (symbol-value refs
))
6135 (subject (gnus-simplify-subject-re
6136 (mail-header-subject (car prev
))))
6137 (headers (cdr prev
)))
6139 (if (not (string= subject
6140 (gnus-simplify-subject-re
6141 (mail-header-subject (car headers
)))))
6143 (setq new-roots
(cons (car headers
) new-roots
))
6144 (setcdr prev
(cdr headers
)))
6145 (setq prev headers
))
6146 (setq headers
(cdr headers
)))))))
6147 gnus-newsgroup-dependencies
)
6149 ;; We enter the new roots into the dependencies structure to
6150 ;; ensure that any possible later thread-regeneration will be
6152 (let ((r new-roots
))
6154 (gnus-sethash (concat (mail-header-id (car r
)) ".boo")
6155 (list nil
(car r
)) gnus-newsgroup-dependencies
)
6158 (setq roots
(nconc new-roots roots
))
6161 (mapcar 'gnus-trim-thread
6163 (mapcar 'gnus-cut-thread
6164 (mapcar 'gnus-make-sub-thread roots
))))
6165 (gnus-message 6 "Threading...done"))))
6168 (defun gnus-make-threads-and-expunge ()
6169 ;; This function takes the dependencies already made by
6170 ;; `gnus-get-newsgroup-headers' and builds the trees. First we go
6171 ;; through the dependencies in the hash table and finds all the
6172 ;; roots. Roots do not refer back to any valid articles.
6173 (gnus-message 6 "Threading...")
6174 (let ((default (or gnus-summary-default-score
0))
6175 (below gnus-summary-expunge-below
)
6176 roots article new-roots
)
6177 (and gnus-fetch-old-headers
6178 (eq gnus-headers-retrieved-by
'nov
)
6179 (gnus-build-old-threads))
6182 (if (not (car (symbol-value refs
)))
6183 ;; These articles do not refer back to any other articles -
6185 (let ((headers (cdr (symbol-value refs
))))
6186 ;; We weed out the low-scored articles.
6188 (if (not (< (or (cdr (assq (mail-header-number (car headers
))
6189 gnus-newsgroup-scored
)) default
)
6192 (setq roots
(cons (car headers
) roots
))
6193 ;; It is below, so we mark it as read.
6194 (setq gnus-newsgroup-unreads
6195 (delq (mail-header-number (car headers
))
6196 gnus-newsgroup-unreads
))
6197 (setq gnus-newsgroup-reads
6198 (cons (cons (mail-header-number (car headers
))
6199 gnus-low-score-mark
)
6200 gnus-newsgroup-reads
)))
6201 (setq headers
(cdr headers
))))
6202 ;; Ok, these refer back to valid articles, but if
6203 ;; `gnus-thread-ignore-subject' is nil, we have to check that
6204 ;; the root has the same subject as its children. The children
6205 ;; that do not are made into roots and removed from the list
6207 (or gnus-thread-ignore-subject
6208 (let* ((prev (symbol-value refs
))
6209 (subject (gnus-simplify-subject-re
6210 (mail-header-subject (car prev
))))
6211 (headers (cdr prev
)))
6213 (if (not (string= subject
6214 (gnus-simplify-subject-re
6215 (mail-header-subject (car headers
)))))
6217 (if (not (< (or (cdr (assq (mail-header-number
6219 gnus-newsgroup-scored
))
6221 (setq new-roots
(cons (car headers
) new-roots
))
6222 (setq gnus-newsgroup-unreads
6223 (delq (mail-header-number (car headers
))
6224 gnus-newsgroup-unreads
))
6225 (setq gnus-newsgroup-reads
6226 (cons (cons (mail-header-number (car headers
))
6227 gnus-low-score-mark
)
6228 gnus-newsgroup-reads
)))
6229 (setcdr prev
(cdr headers
)))
6230 (setq prev headers
))
6231 (setq headers
(cdr headers
)))))
6232 ;; If this article is expunged, some of the children might be
6234 (if (< (or (cdr (assq (mail-header-number (car (symbol-value refs
)))
6235 gnus-newsgroup-scored
)) default
)
6237 (let* ((prev (symbol-value refs
))
6238 (headers (cdr prev
)))
6240 (setq article
(mail-header-number (car headers
)))
6241 (if (not (< (or (cdr (assq article gnus-newsgroup-scored
))
6243 (progn (setq new-roots
(cons (car headers
) new-roots
))
6244 (setq prev headers
))
6245 (setq gnus-newsgroup-unreads
6246 (delq article gnus-newsgroup-unreads
))
6247 (setq gnus-newsgroup-reads
6248 (cons (cons article gnus-low-score-mark
)
6249 gnus-newsgroup-reads
))
6250 (setcdr prev
(cdr headers
)))
6251 (setq headers
(cdr headers
))))
6252 ;; It was not expunged, but we look at expunged children.
6253 (let* ((prev (symbol-value refs
))
6254 (headers (cdr prev
))
6257 (setq article
(mail-header-number (car headers
)))
6258 (if (not (< (or (cdr (assq article gnus-newsgroup-scored
))
6261 (setq gnus-newsgroup-unreads
6262 (delq article gnus-newsgroup-unreads
))
6263 (setq gnus-newsgroup-reads
6264 (cons (cons article gnus-low-score-mark
)
6265 gnus-newsgroup-reads
))
6266 (setcdr prev
(cdr headers
)))
6267 (setq headers
(cdr headers
)))))))
6268 gnus-newsgroup-dependencies
)
6270 ;; We enter the new roots into the dependencies structure to
6271 ;; ensure that any possible later thread-regeneration will be
6273 (let ((r new-roots
))
6275 (gnus-sethash (concat (mail-header-id (car r
)) ".boo")
6276 (list nil
(car r
)) gnus-newsgroup-dependencies
)
6279 (setq roots
(nconc new-roots roots
))
6282 (mapcar 'gnus-trim-thread
6284 (mapcar 'gnus-cut-thread
6285 (mapcar 'gnus-make-sub-thread roots
))))
6286 (gnus-message 6 "Threading...done"))))
6289 (defun gnus-cut-thread (thread)
6290 ;; Remove leaf dormant or ancient articles from THREAD.
6291 (let ((head (car thread
))
6292 (tail (apply 'append
(mapcar 'gnus-cut-thread
(cdr thread
)))))
6293 (if (and (null tail
)
6294 (let ((number (mail-header-number head
)))
6295 (or (memq number gnus-newsgroup-ancient
)
6296 (memq number gnus-newsgroup-dormant
)
6297 (and gnus-summary-expunge-below
6298 (eq gnus-fetch-old-headers
'some
)
6299 (< (or (cdr (assq number gnus-newsgroup-scored
))
6300 gnus-summary-default-score
0)
6301 gnus-summary-expunge-below
)
6303 (setq gnus-newsgroup-unreads
6304 (delq number gnus-newsgroup-unreads
))
6305 (setq gnus-newsgroup-reads
6306 (cons (cons number gnus-low-score-mark
)
6307 gnus-newsgroup-reads
))
6310 (list (cons head tail
)))))
6312 (defun gnus-trim-thread (thread)
6313 ;; Remove root ancient articles with only one child from THREAD.
6314 (if (and (eq gnus-fetch-old-headers
'some
)
6315 (memq (mail-header-number (car thread
)) gnus-newsgroup-ancient
)
6316 (= (length thread
) 2))
6317 (gnus-trim-thread (nth 1 thread
))
6320 (defun gnus-make-sub-thread (root)
6321 ;; This function makes a sub-tree for a node in the tree.
6322 (let ((children (reverse (cdr (gnus-gethash (downcase (mail-header-id root
))
6323 gnus-newsgroup-dependencies
)))))
6324 (cons root
(mapcar 'gnus-make-sub-thread children
))))
6326 (defun gnus-build-old-threads ()
6327 ;; Look at all the articles that refer back to old articles, and
6328 ;; fetch the headers for the articles that aren't there. This will
6329 ;; build complete threads - if the roots haven't been expired by the
6334 (if (not (car (symbol-value refs
)))
6336 (setq heads
(cdr (symbol-value refs
)))
6338 (if (not (memq (mail-header-number (car heads
))
6339 gnus-newsgroup-dormant
))
6341 (setq id
(symbol-name refs
))
6342 (while (and (setq id
(gnus-build-get-header id
))
6343 (not (car (gnus-gethash
6344 id gnus-newsgroup-dependencies
)))))
6346 (setq heads
(cdr heads
)))))))
6347 gnus-newsgroup-dependencies
)))
6349 (defun gnus-build-get-header (id)
6350 ;; Look through the buffer of NOV lines and find the header to
6351 ;; ID. Enter this line into the dependencies hash table, and return
6352 ;; the id of the parent article (if any).
6353 (let ((deps gnus-newsgroup-dependencies
)
6357 (set-buffer nntp-server-buffer
)
6358 (goto-char (point-min))
6359 (while (and (not found
) (search-forward id nil t
))
6361 (setq found
(looking-at
6362 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
6363 (regexp-quote id
))))
6364 (or found
(beginning-of-line 2)))
6369 (setq header
(gnus-nov-parse-line
6370 (read (current-buffer)) deps
))
6371 (setq ref
(mail-header-references header
))
6372 (string-match "\\(<[^>]+>\\) *$" ref
)
6373 (substring ref
(match-beginning 1) (match-end 1))))))
6375 (setq gnus-newsgroup-headers
(cons header gnus-newsgroup-headers
)
6376 gnus-newsgroup-ancient
(cons (mail-header-number header
)
6377 gnus-newsgroup-ancient
))))))
6379 ;; Re-build the thread containing ID.
6380 (defun gnus-rebuild-thread (id)
6381 (let ((dep gnus-newsgroup-dependencies
)
6382 (buffer-read-only nil
)
6383 parent headers refs thread art
)
6384 (while (and id
(setq headers
6385 (car (setq art
(gnus-gethash (downcase id
) dep
)))))
6387 (setq id
(and (setq refs
(mail-header-references headers
))
6388 (string-match "\\(<[^>]+>\\) *$" refs
)
6389 (substring refs
(match-beginning 1) (match-end 1)))))
6390 (setq thread
(gnus-make-sub-thread (car parent
)))
6391 (gnus-rebuild-remove-articles thread
)
6392 (let ((beg (point)))
6393 (gnus-summary-prepare-threads (list thread
))
6394 (gnus-summary-update-lines beg
(point)))))
6396 ;; Delete all lines in the summary buffer that correspond to articles
6398 (defun gnus-rebuild-remove-articles (thread)
6399 (and (gnus-summary-goto-subject (mail-header-number (car thread
)))
6401 (mapcar (lambda (th) (gnus-rebuild-remove-articles th
)) (cdr thread
)))
6403 (defun gnus-sort-threads (threads)
6404 ;; Sort threads as specified in `gnus-thread-sort-functions'.
6405 (let ((fun gnus-thread-sort-functions
))
6407 (gnus-message 6 "Sorting with %S..." fun
)
6408 (setq threads
(sort threads
(car fun
))
6410 (if gnus-thread-sort-functions
6411 (gnus-message 6 "Sorting...done"))
6414 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
6415 (defmacro gnus-thread-header
(thread)
6416 ;; Return header of first article in THREAD.
6417 ;; Note that THREAD must never, evr be anything else than a variable -
6418 ;; using some other form will lead to serious barfage.
6419 (or (symbolp thread
) (signal 'wrong-type-argument
'(symbolp thread
)))
6420 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
6421 (list 'byte-code
"\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
6424 (defun gnus-thread-sort-by-number (h1 h2
)
6425 "Sort threads by root article number."
6426 (< (mail-header-number (gnus-thread-header h1
))
6427 (mail-header-number (gnus-thread-header h2
))))
6429 (defun gnus-thread-sort-by-author (h1 h2
)
6430 "Sort threads by root author."
6432 (let ((extract (funcall
6433 gnus-extract-address-components
6434 (mail-header-from (gnus-thread-header h1
)))))
6435 (or (car extract
) (cdr extract
)))
6436 (let ((extract (funcall
6437 gnus-extract-address-components
6438 (mail-header-from (gnus-thread-header h2
)))))
6439 (or (car extract
) (cdr extract
)))))
6441 (defun gnus-thread-sort-by-subject (h1 h2
)
6442 "Sort threads by root subject."
6444 (downcase (gnus-simplify-subject-re
6445 (mail-header-subject (gnus-thread-header h1
))))
6446 (downcase (gnus-simplify-subject-re
6447 (mail-header-subject (gnus-thread-header h2
))))))
6449 (defun gnus-thread-sort-by-date (h1 h2
)
6450 "Sort threads by root article date."
6452 (gnus-sortable-date (mail-header-date (gnus-thread-header h1
)))
6453 (gnus-sortable-date (mail-header-date (gnus-thread-header h2
)))))
6455 (defun gnus-thread-sort-by-score (h1 h2
)
6456 "Sort threads by root article score.
6457 Unscored articles will be counted as having a score of zero."
6458 (> (or (cdr (assq (mail-header-number (gnus-thread-header h1
))
6459 gnus-newsgroup-scored
))
6460 gnus-summary-default-score
0)
6461 (or (cdr (assq (mail-header-number (gnus-thread-header h2
))
6462 gnus-newsgroup-scored
))
6463 gnus-summary-default-score
0)))
6465 (defun gnus-thread-sort-by-total-score (h1 h2
)
6466 "Sort threads by the sum of all scores in the thread.
6467 Unscored articles will be counted as having a score of zero."
6468 (> (gnus-thread-total-score h1
) (gnus-thread-total-score h2
)))
6470 (defun gnus-thread-total-score (thread)
6471 ;; This function find the total score of THREAD.
6473 (if (stringp (car thread
))
6474 (apply gnus-thread-score-function
0
6475 (mapcar 'gnus-thread-total-score-1
(cdr thread
)))
6476 (gnus-thread-total-score-1 thread
))
6477 (gnus-thread-total-score-1 (list thread
))))
6479 (defun gnus-thread-total-score-1 (root)
6480 ;; This function find the total score of the thread below ROOT.
6481 (setq root
(car root
))
6482 (apply gnus-thread-score-function
6483 (or (cdr (assq (mail-header-number root
) gnus-newsgroup-scored
))
6484 gnus-summary-default-score
0)
6485 (mapcar 'gnus-thread-total-score
6486 (cdr (gnus-gethash (downcase (mail-header-id root
))
6487 gnus-newsgroup-dependencies
)))))
6489 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
6490 (defvar gnus-tmp-prev-subject
"")
6492 (defun gnus-summary-prepare-threads (threads &optional cull
)
6493 "Prepare summary buffer from THREADS and indentation LEVEL.
6494 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
6495 or a straight list of headers."
6496 (message "Generating summary...")
6498 thread header number subject stack state gnus-tmp-gathered
)
6499 (if (vectorp (car threads
))
6500 ;; If this is a straight (sic) list of headers, then a
6501 ;; threaded summary display isn't required, so we just create
6502 ;; an unthreaded one.
6503 (gnus-summary-prepare-unthreaded threads cull
)
6505 ;; Do the threaded display.
6507 (while (or threads stack
)
6510 ;; If there are some threads, we do them before the
6511 ;; threads on the stack.
6512 (setq thread threads
6513 header
(car (car thread
)))
6514 ;; There were no current threads, so we pop something off
6516 (setq state
(car stack
)
6520 header
(car (car thread
))))
6522 (if (stringp header
)
6524 ;; The header is a dummy root.
6526 ((eq gnus-summary-make-false-root
'adopt
)
6527 ;; We let the first article adopt the rest.
6528 (let ((th (car (cdr (car thread
)))))
6531 (setcdr th
(cdr (cdr (car thread
))))
6532 (setq gnus-tmp-gathered
6534 (lambda (h) (mail-header-number (car h
)))
6535 (cdr (cdr (car thread
))))
6537 (setcdr (cdr (car thread
)) nil
))
6539 ((eq gnus-summary-make-false-root
'empty
)
6540 ;; We print adopted articles with empty subject fields.
6541 (setq gnus-tmp-gathered
6543 (lambda (h) (mail-header-number (car h
)))
6544 (cdr (cdr (car thread
))))
6547 ((eq gnus-summary-make-false-root
'dummy
)
6548 ;; We output a dummy root.
6549 (gnus-summary-insert-dummy-line
6550 nil header
(mail-header-number
6551 (car (car (cdr (car thread
)))))))
6553 ;; We do not make a root for the gathered
6554 ;; sub-threads at all.
6557 (setq number
(mail-header-number header
)
6558 subject
(mail-header-subject header
))
6560 ;; Do the async thing.
6561 (and gnus-newsgroup-async
6562 (setq gnus-newsgroup-threads
6563 (cons (cons number
(mail-header-lines header
))
6564 gnus-newsgroup-threads
)))
6566 ;; We may have to root out some bad articles...
6569 (cond ((and (memq (setq number
(mail-header-number header
))
6570 gnus-newsgroup-dormant
)
6573 ((and gnus-summary-expunge-below
6574 (< (or (cdr (assq number gnus-newsgroup-scored
))
6575 gnus-summary-default-score
0)
6576 gnus-summary-expunge-below
))
6578 (setq gnus-newsgroup-unreads
6579 (delq number gnus-newsgroup-unreads
))
6580 (setq gnus-newsgroup-reads
6581 (cons (cons number gnus-low-score-mark
)
6582 gnus-newsgroup-reads
)))))
6588 (gnus-summary-insert-line
6589 nil header level nil
6591 ((memq number gnus-newsgroup-marked
) gnus-ticked-mark
)
6592 ((memq number gnus-newsgroup-dormant
) gnus-dormant-mark
)
6593 ((memq number gnus-newsgroup-unreads
) gnus-unread-mark
)
6594 ((memq number gnus-newsgroup-expirable
) gnus-expirable-mark
)
6595 (t (or (cdr (assq number gnus-newsgroup-reads
))
6596 gnus-ancient-mark
)))
6597 (memq number gnus-newsgroup-replied
)
6598 (memq number gnus-newsgroup-expirable
)
6600 ((and gnus-thread-ignore-subject
6602 (gnus-simplify-subject-re gnus-tmp-prev-subject
)
6603 (gnus-simplify-subject-re subject
))))
6606 (if (and (eq gnus-summary-make-false-root
'empty
)
6607 (memq number gnus-tmp-gathered
))
6608 gnus-summary-same-subject
6610 (t gnus-summary-same-subject
))
6611 (and (eq gnus-summary-make-false-root
'adopt
)
6612 (memq number gnus-tmp-gathered
))
6613 (cdr (assq number gnus-newsgroup-scored
))
6614 (memq number gnus-newsgroup-processable
))
6616 (setq gnus-tmp-prev-subject subject
)))))
6619 (setq stack
(cons (cons (max 0 level
) (nthcdr 1 thread
)) stack
)))
6620 (setq level
(1+ level
))
6621 (setq threads
(cdr (car thread
))))))
6622 (message "Generating summary...done"))
6626 (defun gnus-summary-prepare-unthreaded (headers &optional cull
)
6627 (let (header number
)
6629 ;; Do the async thing, if that is required.
6630 (if gnus-newsgroup-async
6631 (setq gnus-newsgroup-threads
6633 (cons (mail-header-number h
) (mail-header-lines h
)))
6637 (setq header
(car headers
)
6638 headers
(cdr headers
)
6639 number
(mail-header-number header
))
6641 ;; We may have to root out some bad articles...
6644 (memq (setq number
(mail-header-number header
))
6645 gnus-newsgroup-dormant
)))
6646 ((and cull gnus-summary-expunge-below
6647 (< (or (cdr (assq number gnus-newsgroup-scored
))
6648 gnus-summary-default-score
0)
6649 gnus-summary-expunge-below
))
6650 (setq gnus-newsgroup-unreads
6651 (delq number gnus-newsgroup-unreads
))
6652 (setq gnus-newsgroup-reads
6653 (cons (cons number gnus-low-score-mark
)
6654 gnus-newsgroup-reads
)))
6656 (gnus-summary-insert-line
6658 (cond ((memq number gnus-newsgroup-marked
) gnus-ticked-mark
)
6659 ((memq number gnus-newsgroup-dormant
) gnus-dormant-mark
)
6660 ((memq number gnus-newsgroup-unreads
) gnus-unread-mark
)
6661 ((memq number gnus-newsgroup-expirable
) gnus-expirable-mark
)
6662 (t (or (cdr (assq number gnus-newsgroup-reads
))
6663 gnus-ancient-mark
)))
6664 (memq number gnus-newsgroup-replied
)
6665 (memq number gnus-newsgroup-expirable
)
6666 (mail-header-subject header
) nil
6667 (cdr (assq number gnus-newsgroup-scored
))
6668 (memq number gnus-newsgroup-processable
)))))))
6670 (defun gnus-select-newsgroup (group &optional read-all
)
6671 "Select newsgroup GROUP.
6672 If READ-ALL is non-nil, all articles in the group are selected."
6673 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb
))
6674 (info (nth 2 entry
))
6677 (or (gnus-check-server
6678 (setq gnus-current-select-method
(gnus-find-method-for-group group
)))
6679 (error "Couldn't open server"))
6681 (or (and entry
(not (eq (car entry
) t
))) ; Either it's active...
6682 (gnus-activate-group group
) ; Or we can activate it...
6683 (progn ; Or we bug out.
6684 (kill-buffer (current-buffer))
6685 (error "Couldn't request group %s: %s"
6686 group
(gnus-status-message group
))))
6688 (setq gnus-newsgroup-name group
)
6689 (setq gnus-newsgroup-unselected nil
)
6690 (setq gnus-newsgroup-unreads
(gnus-list-of-unread-articles group
))
6692 (and gnus-asynchronous
6693 (gnus-check-backend-function
6694 'request-asynchronous gnus-newsgroup-name
)
6695 (setq gnus-newsgroup-async
6696 (gnus-request-asynchronous gnus-newsgroup-name
)))
6698 (setq articles
(gnus-articles-to-read group read-all
))
6702 (gnus-message 3 "Couldn't select newsgroup")
6704 ((eq articles
0) nil
)
6706 ;; Init the dependencies hash table.
6707 (setq gnus-newsgroup-dependencies
6708 (gnus-make-hashtable (length articles
)))
6709 ;; Retrieve the headers and read them in.
6710 (gnus-message 5 "Fetching headers...")
6711 (setq gnus-newsgroup-headers
6712 (if (eq 'nov
(setq gnus-headers-retrieved-by
6713 ;; This is a naughty hack. To get the
6714 ;; retrieval of old headers to work, we
6715 ;; set `nntp-nov-gap' to nil (locally),
6716 ;; and then just retrieve the headers.
6718 (if gnus-fetch-old-headers
6720 (gnus-retrieve-headers
6721 (if (not (eq 1 (car articles
)))
6724 gnus-newsgroup-name
))
6725 (gnus-retrieve-headers
6726 articles gnus-newsgroup-name
))))
6728 (gnus-get-newsgroup-headers-xover articles
))
6729 ;; If we were to fetch old headers, but the backend didn't
6730 ;; support XOVER, then it is possible we fetched one article
6731 ;; that we shouldn't have. If that's the case, we remove it.
6732 (if (or (not gnus-fetch-old-headers
)
6733 (eq 1 (car articles
)))
6736 (set-buffer nntp-server-buffer
)
6737 (goto-char (point-min))
6739 (looking-at "[0-9]+[ \t]+1[ \t]") ; This is not a NOV line.
6740 (delete-region ; So we delete this head.
6742 (search-forward "\n.\n" nil t
)))))
6743 (gnus-get-newsgroup-headers)))
6744 (gnus-message 5 "Fetching headers...done")
6745 ;; Remove canceled articles from the list of unread articles.
6746 (setq gnus-newsgroup-unreads
6747 (gnus-set-sorted-intersection
6748 gnus-newsgroup-unreads
6749 (mapcar (lambda (headers) (mail-header-number headers
))
6750 gnus-newsgroup-headers
)))
6751 ;; Adjust and set lists of article marks.
6754 (gnus-adjust-marked-articles info
)
6755 (setq gnus-newsgroup-marked
6757 (cdr (assq 'tick
(setq marked
(nth 3 info
))))))
6758 (setq gnus-newsgroup-replied
6759 (copy-sequence (cdr (assq 'reply marked
))))
6760 (setq gnus-newsgroup-expirable
6761 (copy-sequence (cdr (assq 'expire marked
))))
6762 (setq gnus-newsgroup-killed
6763 (copy-sequence (cdr (assq 'killed marked
))))
6764 (setq gnus-newsgroup-bookmarks
6765 (copy-sequence (cdr (assq 'bookmark marked
))))
6766 (setq gnus-newsgroup-dormant
6767 (copy-sequence (cdr (assq 'dormant marked
))))
6768 (setq gnus-newsgroup-scored
6769 (copy-sequence (cdr (assq 'score marked
))))
6770 (setq gnus-newsgroup-processable nil
)))
6771 ;; Check whether auto-expire is to be done in this group.
6772 (setq gnus-newsgroup-auto-expire
6773 (or (and (stringp gnus-auto-expirable-newsgroups
)
6774 (string-match gnus-auto-expirable-newsgroups group
))
6775 (memq 'auto-expire
(nth 5 info
))))
6776 ;; First and last article in this newsgroup.
6777 (and gnus-newsgroup-headers
6778 (setq gnus-newsgroup-begin
6779 (mail-header-number (car gnus-newsgroup-headers
)))
6780 (setq gnus-newsgroup-end
6782 (gnus-last-element gnus-newsgroup-headers
))))
6783 (setq gnus-reffed-article-number -
1)
6784 ;; GROUP is successfully selected.
6785 (or gnus-newsgroup-headers t
)))))
6787 (defun gnus-articles-to-read (group read-all
)
6788 ;; Find out what articles the user wants to read.
6790 ;; Select all articles if `read-all' is non-nil, or if all the
6791 ;; unread articles are dormant articles.
6793 (= (length gnus-newsgroup-unreads
)
6794 (length gnus-newsgroup-dormant
)))
6795 (gnus-uncompress-range
6796 (gnus-gethash group gnus-active-hashtb
))
6797 gnus-newsgroup-unreads
))
6798 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles
))
6799 (scored (length scored-list
))
6800 (number (length articles
))
6801 (marked (+ (length gnus-newsgroup-marked
)
6802 (length gnus-newsgroup-dormant
)))
6809 (cond ((and (or (<= scored marked
)
6811 (numberp gnus-large-newsgroup
)
6812 (> number gnus-large-newsgroup
))
6816 "How many articles from %s (default %d): "
6817 gnus-newsgroup-name number
))))
6818 (if (string-match "^[ \t]*$" input
)
6820 ((and (> scored marked
) (< scored number
))
6824 "%s %s (%d scored, %d total): "
6825 "How many articles from"
6826 group scored number
))))
6827 (if (string-match "^[ \t]*$" input
)
6831 (setq select
(if (stringp select
) (string-to-number select
) select
))
6832 (if (or (null select
) (zerop select
))
6834 (if (and (not (zerop scored
)) (<= (abs select
) scored
))
6836 (setq articles
(sort scored-list
'<))
6837 (setq number
(length articles
)))
6838 (setq articles
(copy-sequence articles
)))
6840 (if (< (abs select
) number
)
6842 ;; Select the N oldest articles.
6843 (setcdr (nthcdr (1- (abs select
)) articles
) nil
)
6844 ;; Select the N most recent articles.
6845 (setq articles
(nthcdr (- number select
) articles
))))
6846 (setq gnus-newsgroup-unselected
6847 (gnus-sorted-intersection
6848 gnus-newsgroup-unreads
6849 (gnus-sorted-complement gnus-newsgroup-unreads articles
)))
6852 (defun gnus-killed-articles (killed articles
)
6855 (if (inline (gnus-member-of-range (car articles
) killed
))
6856 (setq out
(cons (car articles
) out
)))
6857 (setq articles
(cdr articles
)))
6860 (defun gnus-adjust-marked-articles (info &optional active
)
6861 "Remove all marked articles that are no longer legal."
6862 (let ((marked-lists (nth 3 info
))
6863 (active (or active
(gnus-gethash (car info
) gnus-active-hashtb
)))
6865 ;; There are many types of marked articles.
6867 (setq m
(cdr (setq prev
(car marked-lists
))))
6868 (cond ((or (eq 'tick
(car prev
)) (eq 'dormant
(car prev
)))
6869 ;; Make sure that all ticked articles are a subset of the
6870 ;; unread/unselected articles.
6872 (if (or (memq (car m
) gnus-newsgroup-unreads
)
6873 (memq (car m
) gnus-newsgroup-unselected
))
6875 (setcdr prev
(cdr m
)))
6877 ((eq 'score
(car prev
))
6878 ;; Scored articles should be a subset of
6879 ;; unread/unselected articles.
6881 (if (or (memq (car (car m
)) gnus-newsgroup-unreads
)
6882 (memq (car (car m
)) gnus-newsgroup-unreads
))
6884 (setcdr prev
(cdr m
)))
6886 ((eq 'bookmark
(car prev
))
6887 ;; Bookmarks should be a subset of active articles.
6889 (if (< (car (car m
)) (car active
))
6890 (setcdr prev
(cdr m
))
6893 ((eq 'killed
(car prev
))
6894 ;; Articles that have been through the kill process are
6895 ;; to be a subset of active articles.
6896 (while (and m
(< (or (and (numberp (car m
)) (car m
))
6899 (setcdr prev
(cdr m
))
6901 (if (and m
(< (or (and (numberp (car m
)) (car m
))
6904 (setcar (if (numberp (car m
)) m
(car m
)) (car active
))))
6905 ((or (eq 'reply
(car prev
)) (eq 'expire
(car prev
)))
6906 ;; The replied and expirable articles have to be articles
6909 (if (< (car m
) (car active
))
6910 (setcdr prev
(cdr m
))
6913 (setq marked-lists
(cdr marked-lists
)))
6914 ;; Remove all lists that are empty.
6915 (setq marked-lists
(nth 3 info
))
6918 (while (= 1 (length (car marked-lists
)))
6919 (setq marked-lists
(cdr marked-lists
)))
6920 (setq m
(cdr (setq prev marked-lists
)))
6922 (if (= 1 (length (car m
)))
6923 (setcdr prev
(cdr m
))
6926 (setcar (nthcdr 3 info
) marked-lists
)))
6927 ;; Finally, if there are no marked lists at all left, and if there
6928 ;; are no elements after the lists in the info list, we just chop
6929 ;; the info list off before the marked lists.
6930 (and (null marked-lists
)
6931 (not (nthcdr 4 info
))
6932 (setcdr (nthcdr 2 info
) nil
)))
6935 (defun gnus-set-marked-articles
6936 (info ticked replied expirable killed dormant bookmark score
)
6937 "Enter the various lists of marked articles into the newsgroup info list."
6939 (and ticked
(setq newmarked
(cons (cons 'tick ticked
) nil
)))
6940 (and replied
(setq newmarked
(cons (cons 'reply replied
) newmarked
)))
6941 (and expirable
(setq newmarked
(cons (cons 'expire expirable
)
6943 (and killed
(setq newmarked
(cons (cons 'killed killed
) newmarked
)))
6944 (and dormant
(setq newmarked
(cons (cons 'dormant dormant
) newmarked
)))
6945 (and bookmark
(setq newmarked
(cons (cons 'bookmark bookmark
)
6947 (and score
(setq newmarked
(cons (cons 'score score
) newmarked
)))
6950 (setcar (nthcdr 3 info
) newmarked
)
6951 (and (not newmarked
)
6952 (not (nthcdr 4 info
))
6953 (setcdr (nthcdr 2 info
) nil
)))
6955 (setcdr (nthcdr 2 info
) (list newmarked
))))))
6957 (defun gnus-add-marked-articles (group type articles
&optional info force
)
6958 ;; Add ARTICLES of TYPE to the info of GROUP.
6959 ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't
6960 ;; add, but replace marked articles of TYPE with ARTICLES.
6961 (let ((info (or info
(nth 2 (gnus-gethash group gnus-newsrc-hashtb
))))
6964 (and (not (setq marked
(nthcdr 3 info
)))
6965 (setcdr (nthcdr 2 info
) (list (list (cons type articles
)))))
6966 (and (not (setq m
(assq type
(car marked
))))
6967 (setcar marked
(cons (cons type articles
) (car marked
))))
6970 (nconc m articles
)))))
6972 (defun gnus-set-mode-line (where)
6973 "This function sets the mode line of the article or summary buffers.
6974 If WHERE is `summary', the summary mode line format will be used."
6975 (if (memq where gnus-updated-mode-lines
)
6978 (set-buffer gnus-summary-buffer
)
6979 (let* ((mformat (if (eq where
'article
)
6980 gnus-article-mode-line-format-spec
6981 gnus-summary-mode-line-format-spec
))
6982 (buffer-name (if (eq where
'article
)
6984 (get-buffer gnus-article-buffer
))
6986 (group-name gnus-newsgroup-name
)
6987 (article-number (or gnus-current-article
0))
6988 (unread (- (length gnus-newsgroup-unreads
)
6989 (length gnus-newsgroup-dormant
)))
6990 (unread-and-unticked
6991 (- unread
(length gnus-newsgroup-marked
)))
6992 (unselected (length gnus-newsgroup-unselected
))
6993 (unread-and-unselected
6994 (cond ((and (zerop unread-and-unticked
)
6995 (zerop unselected
)) "")
6997 (format "{%d more}" unread-and-unticked
))
6998 (t (format "{%d(+%d) more}"
6999 unread-and-unticked unselected
))))
7001 (if gnus-current-headers
7002 (mail-header-subject gnus-current-headers
) ""))
7003 (max-len (and gnus-mode-non-string-length
7004 (- (frame-width) gnus-mode-non-string-length
)))
7005 header
);; passed as argument to any user-format-funcs
7006 (setq mode-string
(eval mformat
))
7007 (or (numberp max-len
)
7008 (setq max-len
(length mode-string
)))
7009 (if (< max-len
4) (setq max-len
4))
7010 (if (> (length mode-string
) max-len
)
7011 ;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
7012 ;; function `substring' might cut on a middle
7013 ;; of multi-octet character.
7015 (concat (gnus-truncate-string mode-string
(- max-len
3))
7017 (setq mode-string
(format (format "%%-%ds" max-len
)
7019 (setq mode-line-buffer-identification mode-string
)
7020 (set-buffer-modified-p t
))))
7022 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads
)
7023 "Go through the HEADERS list and add all Xrefs to a hash table.
7024 The resulting hash table is returned, or nil if no Xrefs were found."
7025 (let* ((from-method (gnus-find-method-for-group from-newsgroup
))
7027 (gnus-group-foreign-p from-newsgroup
)
7029 (assoc (symbol-name (car from-method
))
7030 gnus-valid-select-methods
))))
7031 (gnus-group-real-prefix from-newsgroup
)))
7032 (xref-hashtb (make-vector 63 0))
7033 start group entry number xrefs header
)
7035 (setq header
(car headers
))
7036 (if (and (setq xrefs
(mail-header-xref header
))
7037 (not (memq (mail-header-number header
) unreads
)))
7040 (while (string-match "\\([^ ]+\\):\\([0-9]+\\)" xrefs start
)
7041 (setq start
(match-end 0))
7042 (setq group
(concat prefix
(substring xrefs
(match-beginning 1)
7045 (string-to-int (substring xrefs
(match-beginning 2)
7047 (if (setq entry
(gnus-gethash group xref-hashtb
))
7048 (setcdr entry
(cons number
(cdr entry
)))
7049 (gnus-sethash group
(cons number nil
) xref-hashtb
)))))
7050 (setq headers
(cdr headers
)))
7051 (if start xref-hashtb nil
)))
7053 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads expirable
)
7054 "Look through all the headers and mark the Xrefs as read."
7055 (let ((virtual (memq 'virtual
7056 (assoc (symbol-name (car (gnus-find-method-for-group
7058 gnus-valid-select-methods
)))
7059 name entry info xref-hashtb idlist method
7062 (set-buffer gnus-group-buffer
)
7063 (if (setq xref-hashtb
7064 (gnus-create-xref-hashtb from-newsgroup headers unreads
))
7067 (if (string= from-newsgroup
(setq name
(symbol-name group
)))
7069 (setq idlist
(symbol-value group
))
7070 ;; Dead groups are not updated.
7072 (setq entry
(gnus-gethash name gnus-newsrc-hashtb
)
7074 (if (stringp (setq nth4
(nth 4 info
)))
7075 (setq nth4
(gnus-server-to-method nth4
))))
7076 ;; Only do the xrefs if the group has the same
7077 ;; select method as the group we have just read.
7078 (or (gnus-methods-equal-p
7079 nth4
(gnus-find-method-for-group from-newsgroup
))
7082 (setq method
(gnus-find-method-for-group
7084 (and (equal (car nth4
) (car method
))
7085 (equal (nth 1 nth4
) (nth 1 method
))))
7086 gnus-use-cross-reference
7087 (or (not (eq gnus-use-cross-reference t
))
7089 ;; Only do cross-references on subscribed
7090 ;; groups, if that is what is wanted.
7091 (<= (nth 1 info
) gnus-level-subscribed
)))
7092 (gnus-group-make-articles-read name idlist expirable
))))
7095 (defun gnus-group-make-articles-read (group articles expirable
)
7097 (entry (gnus-gethash group gnus-newsrc-hashtb
))
7098 (info (nth 2 entry
))
7099 (active (gnus-gethash group gnus-active-hashtb
))
7100 exps expirable range
)
7101 ;; First peel off all illegal article numbers.
7103 (let ((ids articles
)
7104 (ticked (cdr (assq 'tick
(nth 3 info
))))
7105 (dormant (cdr (assq 'dormant
(nth 3 info
))))
7110 (if (and first
(> id
(cdr active
)))
7112 ;; We'll end up in this situation in one particular
7113 ;; obscure situation. If you re-scan a group and get
7114 ;; a new article that is cross-posted to a different
7115 ;; group that has not been re-scanned, you might get
7116 ;; crossposted article that has a higher number than
7117 ;; Gnus believes possible. So we re-activate this
7118 ;; group as well. This might mean doing the
7119 ;; crossposting thingy will *increase* the number
7120 ;; of articles in some groups. Tsk, tsk.
7121 (setq active
(or (gnus-activate-group group
) active
))))
7122 (if (or (> id
(cdr active
))
7126 (setq articles
(delq id articles
)))
7127 (and (memq id expirable
)
7128 (setq exps
(cons id exps
)))
7129 (setq ids
(cdr ids
)))))
7130 ;; Update expirable articles.
7131 (gnus-add-marked-articles nil
'expirable exps info
)
7135 (setcar (nthcdr 2 info
) (cons 1 (1- (car active
)))))
7136 (setcar (nthcdr 2 info
)
7140 (setq articles
(sort articles
'<)))))
7141 ;; Then we have to re-compute how many unread
7142 ;; articles there are in this group.
7147 (setq num
(- (1+ (cdr active
)) (car active
))))
7148 ((not (listp (cdr range
)))
7149 (setq num
(- (cdr active
) (- (1+ (cdr range
))
7153 (if (numberp (car range
))
7155 (setq num
(+ num
(- (1+ (cdr (car range
)))
7156 (car (car range
))))))
7157 (setq range
(cdr range
)))
7158 (setq num
(- (cdr active
) num
))))
7159 ;; Update the number of unread articles.
7163 (length (cdr (assq 'tick
(nth 3 info
))))
7165 (cdr (assq 'dormant
(nth 3 info
)))))))
7166 ;; Update the group buffer.
7167 (gnus-group-update-group group t
)))))
7169 (defun gnus-methods-equal-p (m1 m2
)
7170 (let ((m1 (or m1 gnus-select-method
))
7171 (m2 (or m2 gnus-select-method
)))
7173 (and (eq (car m1
) (car m2
))
7174 (or (not (memq 'address
(assoc (symbol-name (car m1
))
7175 gnus-valid-select-methods
)))
7176 (equal (nth 1 m1
) (nth 1 m2
)))))))
7178 (defsubst gnus-header-value
()
7179 (buffer-substring (match-end 0) (gnus-point-at-eol)))
7181 (defvar gnus-newsgroup-none-id
0)
7183 (defun gnus-get-newsgroup-headers ()
7184 (setq gnus-article-internal-prepare-hook nil
)
7185 (let ((cur nntp-server-buffer
)
7186 (dependencies gnus-newsgroup-dependencies
)
7187 headers id dep end ref
)
7189 (set-buffer nntp-server-buffer
)
7190 ;; Allow the user to mangle the headers before parsing them.
7191 (run-hooks 'gnus-parse-headers-hook
)
7192 (goto-char (point-min))
7193 ;; Search to the beginning of the next header. Error messages
7194 ;; do not begin with 2 or 3.
7195 (while (re-search-forward "^[23][0-9]+ " nil t
)
7196 (let ((header (make-vector 9 nil
))
7197 (case-fold-search t
)
7202 (mail-header-set-number header
(read cur
))
7203 ;; This implementation of this function, with nine
7204 ;; search-forwards instead of the one re-search-forward and
7205 ;; a case (which basically was the old function) is actually
7206 ;; about twice as fast, even though it looks messier. You
7207 ;; can't have everything, I guess. Speed and elegance
7208 ;; doesn't always come hand in hand.
7210 (narrow-to-region (point) (or (save-excursion
7211 (search-forward "\n.\n" nil t
))
7213 (if (search-forward "\nfrom: " nil t
)
7214 (mail-header-set-from header
(gnus-header-value))
7215 (mail-header-set-from header
"(nobody)"))
7217 (if (search-forward "\nsubject: " nil t
)
7218 (mail-header-set-subject header
(gnus-header-value))
7219 (mail-header-set-subject header
"(none)"))
7221 (and (search-forward "\nxref: " nil t
)
7222 (mail-header-set-xref header
(gnus-header-value)))
7224 (or (numberp (and (search-forward "\nlines: " nil t
)
7225 (mail-header-set-lines header
(read cur
))))
7226 (mail-header-set-lines header
0))
7228 (and (search-forward "\ndate: " nil t
)
7229 (mail-header-set-date header
(gnus-header-value)))
7231 (if (search-forward "\nmessage-id: " nil t
)
7232 (mail-header-set-id header
(setq id
(gnus-header-value)))
7233 ;; If there was no message-id, we just fake one to make
7234 ;; subsequent routines simpler.
7237 (setq id
(concat "none+"
7239 (setq gnus-newsgroup-none-id
7240 (1+ gnus-newsgroup-none-id
)))))))
7242 (if (search-forward "\nreferences: " nil t
)
7244 (mail-header-set-references header
(gnus-header-value))
7245 (setq end
(match-end 0))
7252 (search-backward ">" end t
)
7255 (search-backward "<" end t
)
7257 ;; Get the references from the in-reply-to header if there
7258 ;; ware no references and the in-reply-to header looks
7260 (if (and (search-forward "\nin-reply-to: " nil t
)
7261 (setq in-reply-to
(gnus-header-value))
7262 (string-match "<[^>]+>" in-reply-to
))
7264 (mail-header-set-references
7266 (setq ref
(substring in-reply-to
(match-beginning 0)
7268 (setq ref
(downcase ref
)))
7270 ;; We do some threading while we read the headers. The
7271 ;; message-id and the last reference are both entered into
7272 ;; the same hash table. Some tippy-toeing around has to be
7273 ;; done in case an article has arrived before the article
7274 ;; which it refers to.
7275 (if (boundp (setq dep
(intern (downcase id
) dependencies
)))
7276 (if (car (symbol-value dep
))
7277 ;; An article with this Message-ID has already
7278 ;; been seen, so we ignore this one, except we add
7279 ;; any additional Xrefs (in case the two articles
7280 ;; came from different servers.
7282 (mail-header-set-xref
7283 (car (symbol-value dep
))
7284 (concat (or (mail-header-xref
7285 (car (symbol-value dep
))) "")
7286 (or (mail-header-xref header
) "")))
7288 (setcar (symbol-value dep
) header
))
7289 (set dep
(list header
)))
7292 (if (boundp (setq dep
(intern ref dependencies
)))
7293 (setcdr (symbol-value dep
)
7294 (cons header
(cdr (symbol-value dep
))))
7295 (set dep
(list nil header
)))
7296 (setq headers
(cons header headers
))))
7297 (goto-char (point-max))))))
7298 (nreverse headers
)))
7300 ;; The following macros and functions were written by Felix Lee
7301 ;; <flee@cse.psu.edu>.
7303 (defmacro gnus-nov-read-integer
()
7305 (if (= (following-char) ?
\t)
7307 (let ((num (condition-case nil
(read buffer
) (error nil
))))
7308 (if (numberp num
) num
0)))
7309 (or (eobp) (forward-char 1))))
7311 (defmacro gnus-nov-skip-field
()
7312 '(search-forward "\t" eol
'move
))
7314 (defmacro gnus-nov-field
()
7315 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol
)))
7317 ;; Goes through the xover lines and returns a list of vectors
7318 (defun gnus-get-newsgroup-headers-xover (sequence)
7319 "Parse the news overview data in the server buffer, and return a
7320 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
7321 ;; Get the Xref when the users reads the articles since most/some
7322 ;; NNTP servers do not include Xrefs when using XOVER.
7323 (setq gnus-article-internal-prepare-hook
'(gnus-article-get-xrefs))
7324 (let ((cur nntp-server-buffer
)
7325 (dependencies gnus-newsgroup-dependencies
)
7326 number headers header
)
7328 (set-buffer nntp-server-buffer
)
7329 ;; Allow the user to mangle the headers before parsing them.
7330 (run-hooks 'gnus-parse-headers-hook
)
7331 (goto-char (point-min))
7332 (while (and sequence
(not (eobp)))
7333 (setq number
(read cur
))
7334 (while (and sequence
(< (car sequence
) number
))
7335 (setq sequence
(cdr sequence
)))
7337 (eq number
(car sequence
))
7339 (setq sequence
(cdr sequence
))
7341 (inline (gnus-nov-parse-line number dependencies
)))
7342 (setq headers
(cons header headers
)))))
7344 (setq headers
(nreverse headers
)))
7347 ;; This function has to be called with point after the article number
7348 ;; on the beginning of the line.
7349 (defun gnus-nov-parse-line (number dependencies
)
7351 (eol (gnus-point-at-eol))
7352 (buffer (current-buffer))
7355 ;; overview: [num subject from date id refs chars lines misc]
7356 (narrow-to-region (point) eol
)
7357 (or (eobp) (forward-char))
7363 (gnus-nov-field) ; subject
7364 (gnus-nov-field) ; from
7365 (gnus-nov-field) ; date
7366 (setq id
(or (gnus-nov-field)
7369 (setq none
(1+ none
)))))) ; id
7372 (let ((beg (point)))
7373 (search-forward "\t" eol
)
7374 (if (search-backward ">" beg t
)
7380 (search-backward "<" beg t
)
7383 (gnus-nov-field)) ; refs
7384 (gnus-nov-read-integer) ; chars
7385 (gnus-nov-read-integer) ; lines
7386 (if (= (following-char) ?
\n)
7388 (gnus-nov-field)) ; misc
7392 (message "Strange nov line.")
7398 ;; We build the thread tree.
7400 (if (boundp (setq dep
(intern (downcase id
) dependencies
)))
7401 (if (car (symbol-value dep
))
7402 ;; An article with this Message-ID has already been seen,
7403 ;; so we ignore this one, except we add any additional
7404 ;; Xrefs (in case the two articles came from different
7407 (mail-header-set-xref
7408 (car (symbol-value dep
))
7409 (concat (or (mail-header-xref (car (symbol-value dep
))) "")
7410 (or (mail-header-xref header
) "")))
7412 (setcar (symbol-value dep
) header
))
7413 (set dep
(list header
))))
7416 (if (boundp (setq dep
(intern (or ref
"none")
7418 (setcdr (symbol-value dep
)
7419 (cons header
(cdr (symbol-value dep
))))
7420 (set dep
(list nil header
)))))
7423 (defun gnus-article-get-xrefs ()
7424 "Fill in the Xref value in `gnus-current-headers', if necessary.
7425 This is meant to be called in `gnus-article-internal-prepare-hook'."
7426 (let ((headers (save-excursion (set-buffer gnus-summary-buffer
)
7427 gnus-current-headers
)))
7428 (or (not gnus-use-cross-reference
)
7430 (and (mail-header-xref headers
)
7431 (not (string= (mail-header-xref headers
) "")))
7432 (let ((case-fold-search t
)
7435 (gnus-narrow-to-headers)
7436 (goto-char (point-min))
7437 (if (or (and (eq (downcase (following-char)) ?x
)
7438 (looking-at "Xref:"))
7439 (search-forward "\nXref:" nil t
))
7441 (goto-char (1+ (match-end 0)))
7442 (setq xref
(buffer-substring (point)
7443 (progn (end-of-line) (point))))
7444 (mail-header-set-xref headers xref
))))))))
7446 (defalias 'gnus-find-header-by-number
'gnus-get-header-by-number
)
7447 (make-obsolete 'gnus-find-header-by-number
'gnus-get-header-by-number
)
7449 (defun gnus-make-headers-hashtable-by-number ()
7450 "Make hashtable for the variable gnus-newsgroup-headers by number."
7452 (set-buffer gnus-summary-buffer
)
7453 (let ((headers gnus-newsgroup-headers
)
7455 (setq gnus-newsgroup-headers-hashtb-by-number
7456 (gnus-make-hashtable (length headers
)))
7458 (setq header
(car headers
))
7459 (gnus-sethash (int-to-string (mail-header-number header
))
7460 header gnus-newsgroup-headers-hashtb-by-number
)
7461 (setq headers
(cdr headers
))))))
7463 (defun gnus-more-header-backward ()
7464 "Find new header backward."
7465 (let ((first (car (gnus-gethash gnus-newsgroup-name gnus-active-hashtb
)))
7466 (artnum gnus-newsgroup-begin
)
7468 (while (and (not header
)
7470 (setq artnum
(1- artnum
))
7471 (setq header
(gnus-read-header artnum
)))
7474 (defun gnus-more-header-forward (&optional backward
)
7475 "Find new header forward.
7476 If BACKWARD, find new header backward instead."
7478 (gnus-more-header-backward)
7479 (let ((last (cdr (gnus-gethash gnus-newsgroup-name gnus-active-hashtb
)))
7480 (artnum gnus-newsgroup-end
)
7482 (while (and (not header
)
7484 (setq artnum
(1+ artnum
))
7485 (setq header
(gnus-read-header artnum
)))
7488 (defun gnus-extend-newsgroup (header &optional backward
)
7489 "Extend newsgroup selection with HEADER.
7490 Optional argument BACKWARD means extend toward backward."
7492 (let ((artnum (mail-header-number header
)))
7493 (setq gnus-newsgroup-headers
7495 (cons header gnus-newsgroup-headers
)
7496 (nconc gnus-newsgroup-headers
(list header
))))
7497 (setq gnus-newsgroup-unselected
7498 (delq artnum gnus-newsgroup-unselected
))
7499 (setq gnus-newsgroup-begin
(min gnus-newsgroup-begin artnum
))
7500 (setq gnus-newsgroup-end
(max gnus-newsgroup-end artnum
)))))
7502 (defun gnus-summary-work-articles (n)
7503 "Return a list of articles to be worked upon. The prefix argument,
7504 the list of process marked articles, and the current article will be
7505 taken into consideration."
7507 (if (and n
(numberp n
))
7508 (let ((backward (< n
0))
7512 (setq articles
(cons (gnus-summary-article-number)
7514 (gnus-summary-search-forward nil nil backward
))
7516 (sort articles
(function <)))
7517 (or (reverse gnus-newsgroup-processable
)
7518 (list (gnus-summary-article-number))))))
7520 (defun gnus-summary-search-group (&optional backward use-level
)
7521 "Search for next unread newsgroup.
7522 If optional argument BACKWARD is non-nil, search backward instead."
7524 (set-buffer gnus-group-buffer
)
7525 (if (gnus-group-search-forward
7526 backward nil
(if use-level
(gnus-group-group-level) nil
))
7527 (gnus-group-group-name))))
7529 (defun gnus-summary-best-group (&optional exclude-group
)
7530 "Find the name of the best unread group.
7531 If EXCLUDE-GROUP, do not go to this group."
7533 (set-buffer gnus-group-buffer
)
7535 (gnus-group-best-unread-group exclude-group
))))
7537 (defun gnus-subject-equal (s1 s2
)
7539 ((null gnus-summary-gather-subject-limit
)
7540 (equal (gnus-simplify-subject-re s1
)
7541 (gnus-simplify-subject-re s2
)))
7542 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
7543 (equal (gnus-simplify-subject-fuzzy s1
)
7544 (gnus-simplify-subject-fuzzy s2
)))
7545 ((numberp gnus-summary-gather-subject-limit
)
7546 (equal (gnus-limit-string s1 gnus-summary-gather-subject-limit
)
7547 (gnus-limit-string s2 gnus-summary-gather-subject-limit
)))
7551 (defun gnus-summary-search-subject (&optional backward unread subject
)
7552 "Search for article forward.
7553 If BACKWARD is non-nil, search backward.
7554 If UNREAD is non-nil, only unread articles are selected.
7555 If SUBJECT is non-nil, the article which has the same subject will be
7557 (let ((func (if backward
'previous-single-property-change
7558 'next-single-property-change
))
7563 (and gnus-summary-check-current unread
7564 (eq (get-text-property (point) 'gnus-mark
) gnus-unread-mark
)
7568 (forward-char (if backward
(if (bobp) 0 -
1) (if (eobp) 0 1)))
7571 (setq pos
(funcall func
(point) 'gnus-number
))
7572 (goto-char (if backward
(1- pos
) pos
))
7576 (eq (get-text-property (point) 'gnus-mark
)
7580 (inline (gnus-summary-subject-string)))
7582 (gnus-subject-equal subject psubject
)))))))
7583 (if backward
(if (bobp) nil
(forward-char -
1) t
)
7584 (if (eobp) nil
(forward-char 1) t
)))))
7586 (progn (goto-char beg
) nil
)
7588 (get-text-property (point) 'gnus-number
)
7589 (gnus-summary-show-thread)
7590 (gnus-summary-position-cursor)))))
7592 (defun gnus-summary-pseudo-article ()
7593 "The thread level of the article on the current line."
7594 (get-text-property (gnus-point-at-bol) 'gnus-pseudo
))
7596 (defalias 'gnus-summary-score
'gnus-summary-article-score
)
7597 (make-obsolete 'gnus-summary-score
'gnus-summary-article-score
)
7598 (defun gnus-summary-article-score ()
7599 "Return current article score."
7600 (or (cdr (assq (gnus-summary-article-number) gnus-newsgroup-scored
))
7601 gnus-summary-default-score
0))
7603 (defun gnus-summary-recenter ()
7604 "Center point in the summary window.
7605 If `gnus-auto-center-summary' is nil, or the article buffer isn't
7606 displayed, no centering will be performed."
7607 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
7608 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
7609 (let* ((top (cond ((< (window-height) 4) 0)
7610 ((< (window-height) 7) 1)
7612 (height (1- (window-height)))
7613 (bottom (save-excursion (goto-char (point-max))
7614 (forward-line (- height
))
7616 (window (get-buffer-window (current-buffer))))
7618 ;; The user has to want it,
7619 gnus-auto-center-summary
7620 ;; the article buffer must be displayed,
7621 (get-buffer-window gnus-article-buffer
)
7622 ;; Set the window start to either `bottom', which is the biggest
7623 ;; possible valid number, or the second line from the top,
7624 ;; whichever is the least.
7626 window
(min bottom
(save-excursion (forward-line (- top
)) (point)))))))
7628 ;; Function written by Stainless Steel Rat <ratinox@ccs.neu.edu>.
7629 (defun gnus-short-group-name (group &optional levels
)
7630 "Collapse GROUP name LEVELS."
7631 (let* ((name "") (foreign "") (depth -
1) (skip 1)
7634 (while (string-match "\\." group skip
)
7635 (setq skip
(match-end 0)
7638 (if (string-match ":" group
)
7639 (setq foreign
(substring group
0 (match-end 0))
7640 group
(substring group
(match-end 0))))
7642 (if (and (string-match "\\." group
) (> levels
0))
7643 (setq name
(concat name
(substring group
0 1))
7644 group
(substring group
(match-end 0))
7646 name
(concat name
"."))
7647 (setq name
(concat foreign name group
)
7651 (defun gnus-summary-jump-to-group (newsgroup)
7652 "Move point to NEWSGROUP in group mode buffer."
7653 ;; Keep update point of group mode buffer if visible.
7654 (if (eq (current-buffer) (get-buffer gnus-group-buffer
))
7655 (save-window-excursion
7656 ;; Take care of tree window mode.
7657 (if (get-buffer-window gnus-group-buffer
)
7658 (pop-to-buffer gnus-group-buffer
))
7659 (gnus-group-jump-to-group newsgroup
))
7661 ;; Take care of tree window mode.
7662 (if (get-buffer-window gnus-group-buffer
)
7663 (pop-to-buffer gnus-group-buffer
)
7664 (set-buffer gnus-group-buffer
))
7665 (gnus-group-jump-to-group newsgroup
))))
7667 ;; This function returns a list of article numbers based on the
7668 ;; difference between the ranges of read articles in this group and
7669 ;; the range of active articles.
7670 (defun gnus-list-of-unread-articles (group)
7671 (let* ((read (nth 2 (nth 2 (gnus-gethash group gnus-newsrc-hashtb
))))
7672 (active (gnus-gethash group gnus-active-hashtb
))
7675 ;; If none are read, then all are unread.
7677 (setq first
(car active
))
7678 ;; If the range of read articles is a single range, then the
7679 ;; first unread article is the article after the last read
7680 ;; article. Sounds logical, doesn't it?
7681 (if (not (listp (cdr read
)))
7682 (setq first
(1+ (cdr read
)))
7683 ;; `read' is a list of ranges.
7684 (if (/= (setq nlast
(or (and (numberp (car read
)) (car read
))
7685 (car (car read
)))) 1)
7689 (while (< first nlast
)
7690 (setq unread
(cons first unread
))
7691 (setq first
(1+ first
))))
7692 (setq first
(1+ (if (atom (car read
)) (car read
) (cdr (car read
)))))
7693 (setq nlast
(if (atom (car (cdr read
)))
7695 (car (car (cdr read
)))))
7696 (setq read
(cdr read
)))))
7697 ;; And add the last unread articles.
7698 (while (<= first last
)
7699 (setq unread
(cons first unread
))
7700 (setq first
(1+ first
)))
7701 ;; Return the list of unread articles.
7704 (defun gnus-list-of-read-articles (group)
7705 (let ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb
)))
7706 (active (gnus-gethash group gnus-active-hashtb
)))
7708 (gnus-sorted-complement
7709 (gnus-uncompress-range active
)
7710 (gnus-list-of-unread-articles group
)))))
7712 ;; Various summary commands
7714 (defun gnus-summary-universal-argument ()
7715 "Perform any operation on all articles marked with the process mark."
7717 (gnus-set-global-variables)
7718 (let ((articles (reverse gnus-newsgroup-processable
))
7720 (or articles
(error "No articles marked"))
7721 (or (setq func
(key-binding (read-key-sequence "C-c C-u")))
7722 (error "Undefined key"))
7724 (gnus-summary-goto-subject (car articles
))
7725 (command-execute func
)
7726 (gnus-summary-remove-process-mark (car articles
))
7727 (setq articles
(cdr articles
)))))
7729 (defun gnus-summary-toggle-truncation (&optional arg
)
7730 "Toggle truncation of summary lines.
7731 With arg, turn line truncation on iff arg is positive."
7733 (setq truncate-lines
7734 (if (null arg
) (not truncate-lines
)
7735 (> (prefix-numeric-value arg
) 0)))
7738 (defun gnus-summary-reselect-current-group (&optional all
)
7739 "Once exit and then reselect the current newsgroup.
7740 The prefix argument ALL means to select all articles."
7742 (gnus-set-global-variables)
7743 (let ((current-subject (gnus-summary-article-number))
7744 (group gnus-newsgroup-name
))
7745 (setq gnus-newsgroup-begin nil
)
7746 (gnus-summary-exit t
)
7747 ;; We have to adjust the point of group mode buffer because the
7748 ;; current point was moved to the next unread newsgroup by
7750 (gnus-summary-jump-to-group group
)
7751 (gnus-group-read-group all t
)
7752 (gnus-summary-goto-subject current-subject
)))
7754 (defun gnus-summary-rescan-group (&optional all
)
7755 "Exit the newsgroup, ask for new articles, and select the newsgroup."
7757 (gnus-set-global-variables)
7758 ;; Fix by Ilja Weis <kult@uni-paderborn.de>.
7759 (let ((group gnus-newsgroup-name
))
7761 (gnus-summary-jump-to-group group
)
7763 (set-buffer gnus-group-buffer
)
7764 (gnus-group-get-new-news-this-group 1))
7765 (gnus-summary-jump-to-group group
)
7766 (gnus-group-read-group all
)))
7768 (defun gnus-summary-update-info ()
7769 (let* ((group gnus-newsgroup-name
))
7770 (if gnus-newsgroup-kill-headers
7771 (setq gnus-newsgroup-killed
7772 (gnus-compress-sequence
7774 (gnus-set-sorted-intersection
7775 (gnus-uncompress-range gnus-newsgroup-killed
)
7776 (setq gnus-newsgroup-unselected
7777 (sort gnus-newsgroup-unselected
'<)))
7778 (setq gnus-newsgroup-unreads
7779 (sort gnus-newsgroup-unreads
'<))) t
)))
7780 (or (listp (cdr gnus-newsgroup-killed
))
7781 (setq gnus-newsgroup-killed
(list gnus-newsgroup-killed
)))
7782 (let ((headers gnus-newsgroup-headers
))
7783 (gnus-close-group group
)
7784 (run-hooks 'gnus-exit-group-hook
)
7785 (gnus-update-read-articles
7786 group gnus-newsgroup-unreads gnus-newsgroup-unselected
7787 gnus-newsgroup-marked
7788 t gnus-newsgroup-replied gnus-newsgroup-expirable
7789 gnus-newsgroup-killed gnus-newsgroup-dormant
7790 gnus-newsgroup-bookmarks
7791 (and gnus-save-score gnus-newsgroup-scored
))
7792 (and gnus-use-cross-reference
7793 (gnus-mark-xrefs-as-read
7794 group headers gnus-newsgroup-unreads gnus-newsgroup-expirable
))
7795 ;; Do adaptive scoring, and possibly save score files.
7796 (and gnus-newsgroup-adaptive
7797 (gnus-score-adaptive))
7798 (and gnus-use-scoring
7799 (fboundp 'gnus-score-save
)
7800 (funcall 'gnus-score-save
))
7801 ;; Do not switch windows but change the buffer to work.
7802 (set-buffer gnus-group-buffer
)
7803 (or (gnus-ephemeral-group-p gnus-newsgroup-name
)
7804 (gnus-group-update-group group
)))))
7806 (defun gnus-summary-exit (&optional temporary
)
7807 "Exit reading current newsgroup, and then return to group selection mode.
7808 gnus-exit-group-hook is called with no arguments if that value is non-nil."
7810 (gnus-set-global-variables)
7811 (gnus-kill-save-kill-buffer)
7812 (let* ((group gnus-newsgroup-name
)
7813 (quit-config (gnus-group-quit-config gnus-newsgroup-name
))
7815 (buf (current-buffer)))
7816 (run-hooks 'gnus-summary-prepare-exit-hook
)
7817 ;; Make all changes in this group permanent.
7818 (gnus-summary-update-info)
7820 (and gnus-use-cache
(gnus-cache-possibly-remove-articles))
7821 ;; Make sure where I was, and go to next newsgroup.
7822 (set-buffer gnus-group-buffer
)
7825 (gnus-group-jump-to-group group
)
7826 (gnus-group-next-unread-group 1)))
7829 ;; We set all buffer-local variables to nil. It is unclear why
7830 ;; this is needed, but if we don't, buffer-local variables are
7831 ;; not garbage-collected, it seems. This would the lead to en
7832 ;; ever-growing Emacs.
7834 (gnus-summary-clear-local-variables)
7835 ;; We clear the global counterparts of the buffer-local
7836 ;; variables as well, just to be on the safe side.
7837 (gnus-configure-windows 'group
'force
)
7838 (gnus-summary-clear-local-variables)
7839 ;; Return to group mode buffer.
7840 (if (eq mode
'gnus-summary-mode
)
7841 (gnus-kill-buffer buf
))
7842 (if (get-buffer gnus-article-buffer
)
7843 (bury-buffer gnus-article-buffer
))
7844 (setq gnus-current-select-method gnus-select-method
)
7845 (pop-to-buffer gnus-group-buffer
)
7846 (if (not quit-config
)
7848 (gnus-group-jump-to-group group
)
7849 (gnus-group-next-unread-group 1))
7850 (if (not (buffer-name (car quit-config
)))
7851 (gnus-configure-windows 'group
'force
)
7852 (set-buffer (car quit-config
))
7853 (and (eq major-mode
'gnus-summary-mode
)
7854 (gnus-set-global-variables))
7855 (gnus-configure-windows (cdr quit-config
))))
7856 (run-hooks 'gnus-summary-exit-hook
))))
7858 (defalias 'gnus-summary-quit
'gnus-summary-exit-no-update
)
7859 (defun gnus-summary-exit-no-update (&optional no-questions
)
7860 "Quit reading current newsgroup without updating read article info."
7862 (gnus-set-global-variables)
7863 (let* ((group gnus-newsgroup-name
)
7864 (quit-config (gnus-group-quit-config group
)))
7865 (if (or no-questions
7867 (gnus-y-or-n-p "Do you really wanna quit reading this group? "))
7869 (gnus-close-group group
)
7870 (gnus-summary-clear-local-variables)
7871 (set-buffer gnus-group-buffer
)
7872 (gnus-summary-clear-local-variables)
7873 ;; Return to group selection mode.
7874 (gnus-configure-windows 'group
'force
)
7875 (if (get-buffer gnus-summary-buffer
)
7876 (kill-buffer gnus-summary-buffer
))
7877 (if (get-buffer gnus-article-buffer
)
7878 (bury-buffer gnus-article-buffer
))
7879 (if (equal (gnus-group-group-name) group
)
7880 (gnus-group-next-unread-group 1))
7883 (if (not (buffer-name (car quit-config
)))
7884 (gnus-configure-windows 'group
'force
)
7885 (set-buffer (car quit-config
))
7886 (and (eq major-mode
'gnus-summary-mode
)
7887 (gnus-set-global-variables))
7888 (gnus-configure-windows (cdr quit-config
)))))))))
7890 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7891 (defun gnus-summary-fetch-faq (group)
7892 "Fetch the FAQ for the current group."
7893 (interactive (list gnus-newsgroup-name
))
7894 (let (gnus-faq-buffer)
7895 (and (setq gnus-faq-buffer
(gnus-group-fetch-faq group
))
7896 (gnus-configure-windows 'summary-faq
))))
7898 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7899 (defun gnus-summary-describe-group (&optional force
)
7900 "Describe the current newsgroup."
7902 (gnus-group-describe-group force gnus-newsgroup-name
))
7904 (defun gnus-summary-describe-briefly ()
7905 "Describe summary mode commands briefly."
7908 (substitute-command-keys "\\<gnus-summary-mode-map>\\[gnus-summary-next-page]:Select \\[gnus-summary-next-unread-article]:Forward \\[gnus-summary-prev-unread-article]:Backward \\[gnus-summary-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-summary-describe-briefly]:This help")))
7910 ;; Walking around group mode buffer from summary mode.
7912 (defun gnus-summary-next-group (&optional no-article target-group backward
)
7913 "Exit current newsgroup and then select next unread newsgroup.
7914 If prefix argument NO-ARTICLE is non-nil, no article is selected
7915 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
7916 previous group instead."
7918 (gnus-set-global-variables)
7919 (let ((current-group gnus-newsgroup-name
)
7920 (current-buffer (current-buffer))
7922 ;; First we semi-exit this group to update Xrefs and all variables.
7923 ;; We can't do a real exit, because the window conf must remain
7924 ;; the same in case the user is prompted for info, and we don't
7925 ;; want the window conf to change before that...
7926 (gnus-summary-exit t
)
7927 (while (not entered
)
7928 ;; Then we find what group we are supposed to enter.
7929 (set-buffer gnus-group-buffer
)
7930 (gnus-group-jump-to-group current-group
)
7933 (if (eq gnus-keep-same-level
'best
)
7934 (gnus-summary-best-group gnus-newsgroup-name
)
7935 (gnus-summary-search-group backward gnus-keep-same-level
))))
7936 (if (not target-group
)
7937 ;; There are no further groups, so we return to the group
7940 (gnus-message 5 "Returning to the group buffer")
7942 (set-buffer current-buffer
)
7943 (gnus-summary-exit))
7944 ;; We try to enter the target group.
7945 (gnus-group-jump-to-group target-group
)
7946 (let ((unreads (gnus-group-group-unread)))
7947 (if (and (or (eq t unreads
)
7948 (and unreads
(not (zerop unreads
))))
7949 (gnus-summary-read-group
7950 target-group nil no-article current-buffer
))
7952 (setq current-group target-group
7953 target-group nil
)))))))
7955 (defun gnus-summary-next-group-old (&optional no-article group backward
)
7956 "Exit current newsgroup and then select next unread newsgroup.
7957 If prefix argument NO-ARTICLE is non-nil, no article is selected initially.
7958 If BACKWARD, go to previous group instead."
7960 (gnus-set-global-variables)
7961 (let ((ingroup gnus-newsgroup-name
)
7962 (sumbuf (current-buffer))
7964 (set-buffer gnus-group-buffer
)
7966 (or (and (numberp (setq num
(car (gnus-gethash
7967 group gnus-newsrc-hashtb
))))
7971 (gnus-group-jump-to-group group
)
7973 (gnus-group-jump-to-group ingroup
))
7974 (gnus-summary-search-group backward
)
7975 (let ((group (or group
(gnus-summary-search-group backward
))))
7977 (gnus-summary-exit t
) ;Update all information.
7979 (gnus-summary-exit-no-update t
)
7980 (gnus-group-jump-to-group ingroup
)
7981 (setq group
(gnus-summary-search-group backward
))
7982 (gnus-message 5 "Selecting %s..." group
)
7983 (set-buffer gnus-group-buffer
)
7984 ;; We are now in group mode buffer.
7985 ;; Make sure group mode buffer point is on GROUP.
7986 (gnus-group-jump-to-group group
)
7987 (if (not (eq gnus-auto-select-next
'quietly
))
7989 (gnus-summary-read-group group nil no-article sumbuf
)
7990 (and (string= gnus-newsgroup-name ingroup
)
7991 (bufferp sumbuf
) (buffer-name sumbuf
)
7993 (set-buffer (setq gnus-summary-buffer sumbuf
))
7994 (gnus-summary-exit-no-update t
))))
7995 (let ((prevgroup group
))
7996 (gnus-group-jump-to-group ingroup
)
7997 (setq group
(gnus-summary-search-group backward
))
7998 (gnus-summary-read-group group nil no-article sumbuf
)
7999 (while (and (string= gnus-newsgroup-name ingroup
)
8001 (buffer-name sumbuf
)
8002 (not (string= prevgroup
(gnus-group-group-name))))
8003 (set-buffer gnus-group-buffer
)
8004 (gnus-summary-read-group
8005 (setq prevgroup
(gnus-group-group-name))
8006 nil no-article sumbuf
))
8007 (and (string= prevgroup
(gnus-group-group-name))
8008 ;; We have reached the final group in the group
8011 (if (buffer-name sumbuf
)
8014 (gnus-summary-exit)))))))))))
8016 (defun gnus-summary-prev-group (&optional no-article
)
8017 "Exit current newsgroup and then select previous unread newsgroup.
8018 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
8020 (gnus-summary-next-group no-article nil t
))
8022 ;; Walking around summary lines.
8024 (defun gnus-summary-first-subject (&optional unread
)
8025 "Go to the first unread subject.
8026 If UNREAD is non-nil, go to the first unread article.
8027 Returns nil if there are no unread articles."
8031 (goto-char (point-min)))
8034 (point-min) (point-max) 'gnus-mark gnus-unread-mark
))
8037 ;; There are no unread articles.
8038 (gnus-message 3 "No more unread articles")
8040 (gnus-summary-position-cursor)))
8042 (defun gnus-summary-next-subject (n &optional unread dont-display
)
8043 "Go to next N'th summary line.
8044 If N is negative, go to the previous N'th subject line.
8045 If UNREAD is non-nil, only unread articles are selected.
8046 The difference between N and the actual number of steps taken is
8049 (let ((backward (< n
0))
8052 (gnus-summary-search-forward unread nil backward
))
8054 (if (/= 0 n
) (gnus-message 7 "No more%s articles"
8055 (if unread
" unread" "")))
8058 (gnus-summary-recenter)
8059 (gnus-summary-position-cursor)))
8062 (defun gnus-summary-next-unread-subject (n)
8063 "Go to next N'th unread summary line."
8065 (gnus-summary-next-subject n t
))
8067 (defun gnus-summary-prev-subject (n &optional unread
)
8068 "Go to previous N'th summary line.
8069 If optional argument UNREAD is non-nil, only unread article is selected."
8071 (gnus-summary-next-subject (- n
) unread
))
8073 (defun gnus-summary-prev-unread-subject (n)
8074 "Go to previous N'th unread summary line."
8076 (gnus-summary-next-subject (- n
) t
))
8078 (defun gnus-summary-goto-subject (article)
8079 "Go the subject line of ARTICLE."
8083 (completing-read "Article number: "
8087 (int-to-string (mail-header-number headers
))))
8088 gnus-newsgroup-headers
)
8089 nil
'require-match
))))
8090 (or article
(error "No article number"))
8092 (if (not (gnus-goto-char (text-property-any (point-min) (point-max)
8093 'gnus-number article
)))
8095 (gnus-summary-show-thread)
8096 ;; Skip dummy articles.
8097 (if (eq (gnus-summary-article-mark) gnus-dummy-mark
)
8104 (gnus-summary-position-cursor)))))
8106 ;; Walking around summary lines with displaying articles.
8108 (defun gnus-summary-expand-window (&optional arg
)
8109 "Make the summary buffer take up the entire Emacs frame.
8110 Given a prefix, will force an `article' buffer configuration."
8112 (gnus-set-global-variables)
8114 (gnus-configure-windows 'article
'force
)
8115 (gnus-configure-windows 'summary
'force
)))
8117 (defun gnus-summary-display-article (article &optional all-header
)
8118 "Display ARTICLE in article buffer."
8119 (gnus-set-global-variables)
8123 (gnus-article-prepare article all-header
)
8124 (gnus-summary-show-thread)
8125 (if (eq (gnus-summary-article-mark) gnus-dummy-mark
)
8128 (gnus-summary-position-cursor)))
8129 (run-hooks 'gnus-select-article-hook
)
8130 (gnus-summary-recenter)
8131 (gnus-summary-goto-subject article
)
8132 ;; Successfully display article.
8133 (gnus-summary-update-line)
8134 (gnus-article-set-window-start
8135 (cdr (assq article gnus-newsgroup-bookmarks
)))
8138 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
8139 "Select the current article.
8140 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
8141 non-nil, the article will be re-fetched even if it already present in
8142 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
8144 (and (not pseudo
) (gnus-summary-pseudo-article)
8145 (error "This is a pseudo-article."))
8146 (let ((article (or article
(gnus-summary-article-number)))
8147 (all-headers (not (not all-headers
))) ;Must be T or NIL.
8151 (set-buffer gnus-summary-buffer
)
8152 (if (or (null gnus-current-article
)
8153 (null gnus-article-current
)
8154 (null (get-buffer gnus-article-buffer
))
8155 (not (eq article
(cdr gnus-article-current
)))
8156 (not (equal (car gnus-article-current
) gnus-newsgroup-name
))
8158 ;; The requested article is different from the current article.
8160 (gnus-summary-display-article article all-headers
)
8162 (if (or all-headers gnus-show-all-headers
)
8163 (gnus-article-show-all-headers))
8166 (gnus-article-set-window-start
8167 (cdr (assq article gnus-newsgroup-bookmarks
)))))))
8169 (defun gnus-summary-set-current-mark (&optional current-mark
)
8170 "Obsolete function."
8173 (defun gnus-summary-next-article (&optional unread subject backward
)
8174 "Select the next article.
8175 If UNREAD, only unread articles are selected.
8176 If SUBJECT, only articles with SUBJECT are selected.
8177 If BACKWARD, the previous article is selected instead of the next."
8179 (gnus-set-global-variables)
8182 ;; Is there such an article?
8183 ((and (gnus-summary-search-forward unread subject backward
)
8184 (or (gnus-summary-display-article (gnus-summary-article-number))
8185 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
8186 (gnus-summary-position-cursor))
8187 ;; If not, we try the first unread, if that is wanted.
8189 gnus-auto-select-same
8190 (or (gnus-summary-first-unread-article)
8191 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
8192 (gnus-summary-position-cursor)
8193 (gnus-message 6 "Wrapped"))
8194 ;; Try to get next/previous article not displayed in this group.
8195 ((and gnus-auto-extend-newsgroup
8196 (not unread
) (not subject
)
8197 (setq header
(gnus-more-header-forward backward
)))
8198 (gnus-extend-newsgroup header backward
)
8199 (let ((buffer-read-only nil
))
8200 (goto-char (if backward
(point-min) (point-max)))
8201 (gnus-summary-prepare-threads (list header
)))
8202 (gnus-summary-goto-article (if backward gnus-newsgroup-begin
8203 gnus-newsgroup-end
)))
8204 ;; Go to next/previous group.
8206 (or (gnus-ephemeral-group-p gnus-newsgroup-name
)
8207 (gnus-summary-jump-to-group gnus-newsgroup-name
))
8208 (let ((cmd last-command-char
)
8210 (if (eq gnus-keep-same-level
'best
)
8211 (gnus-summary-best-group gnus-newsgroup-name
)
8212 (gnus-summary-search-group backward gnus-keep-same-level
))))
8213 ;; For some reason, the group window gets selected. We change
8215 (select-window (get-buffer-window (current-buffer)))
8216 ;; Keep just the event type of CMD.
8217 ;(and (listp cmd) (setq cmd (car cmd)))
8218 ;; Select next unread newsgroup automagically.
8220 ((not gnus-auto-select-next
)
8221 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
8222 ((eq gnus-auto-select-next
'quietly
)
8224 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
8226 (gnus-message 7 "No more%s articles (%s)..."
8227 (if unread
" unread" "")
8228 (if group
(concat "selecting " group
)
8230 (gnus-summary-next-group nil group backward
)))
8232 (let ((keystrokes '(?\C-n ?\C-p
))
8234 (while (or (null key
) (memq key keystrokes
))
8236 7 "No more%s articles%s" (if unread
" unread" "")
8238 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
8239 (format " (Type %s for %s [%s])"
8240 (single-key-description cmd
) group
8241 (car (gnus-gethash group gnus-newsrc-hashtb
)))
8242 (format " (Type %s to exit %s)"
8243 (single-key-description cmd
)
8244 gnus-newsgroup-name
)))
8245 ;; Confirm auto selection.
8246 (let* ((event (read-char)))
8247 (setq key
(if (listp event
) (car event
) event
))
8248 (if (memq key keystrokes
)
8249 (let ((obuf (current-buffer)))
8250 (switch-to-buffer gnus-group-buffer
)
8252 (gnus-group-jump-to-group group
))
8254 (execute-kbd-macro (char-to-string key
))
8256 (setq group
(gnus-group-group-name))
8257 (switch-to-buffer obuf
)))))
8260 (gnus-ephemeral-group-p gnus-newsgroup-name
))
8262 (gnus-summary-next-group nil group backward
))
8263 (execute-kbd-macro (char-to-string key
)))))))))))
8265 (defun gnus-summary-next-unread-article ()
8266 "Select unread article after current one."
8268 (gnus-summary-next-article t
(and gnus-auto-select-same
8269 (gnus-summary-subject-string))))
8271 (defun gnus-summary-prev-article (&optional unread subject
)
8272 "Select the article after the current one.
8273 If UNREAD is non-nil, only unread articles are selected."
8275 (gnus-summary-next-article unread subject t
))
8277 (defun gnus-summary-prev-unread-article ()
8278 "Select unred article before current one."
8280 (gnus-summary-prev-article t
(and gnus-auto-select-same
8281 (gnus-summary-subject-string))))
8283 (defun gnus-summary-next-page (&optional lines circular
)
8284 "Show next page of selected article.
8285 If end of article, select next article.
8286 Argument LINES specifies lines to be scrolled up.
8287 If CIRCULAR is non-nil, go to the start of the article instead of
8288 instead of selecting the next article when reaching the end of the
8291 (setq gnus-summary-buffer
(current-buffer))
8292 (gnus-set-global-variables)
8293 (let ((article (gnus-summary-article-number))
8295 (gnus-configure-windows 'article
)
8296 (if (or (null gnus-current-article
)
8297 (null gnus-article-current
)
8298 (/= article
(cdr gnus-article-current
))
8299 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
8300 ;; Selected subject is different from current article's.
8301 (gnus-summary-display-article article
)
8302 (gnus-eval-in-buffer-window
8304 (setq endp
(gnus-article-next-page lines
)))
8307 (gnus-summary-beginning-of-article))
8309 (gnus-message 3 "End of message"))
8311 (gnus-summary-next-unread-article)))))
8312 (gnus-summary-recenter)
8313 (gnus-summary-position-cursor)))
8315 (defun gnus-summary-prev-page (&optional lines
)
8316 "Show previous page of selected article.
8317 Argument LINES specifies lines to be scrolled down."
8319 (gnus-set-global-variables)
8320 (let ((article (gnus-summary-article-number)))
8321 (gnus-configure-windows 'article
)
8322 (if (or (null gnus-current-article
)
8323 (null gnus-article-current
)
8324 (/= article
(cdr gnus-article-current
))
8325 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
8326 ;; Selected subject is different from current article's.
8327 (gnus-summary-display-article article
)
8328 (gnus-summary-recenter)
8329 (gnus-eval-in-buffer-window gnus-article-buffer
8330 (gnus-article-prev-page lines
))))
8331 (gnus-summary-position-cursor))
8333 (defun gnus-summary-scroll-up (lines)
8334 "Scroll up (or down) one line current article.
8335 Argument LINES specifies lines to be scrolled up (or down if negative)."
8337 (gnus-set-global-variables)
8338 (gnus-configure-windows 'article
)
8339 (or (gnus-summary-select-article nil nil
'pseudo
)
8340 (gnus-eval-in-buffer-window
8343 (if (gnus-article-next-page lines
)
8344 (gnus-message 3 "End of message")))
8346 (gnus-article-prev-page (- lines
))))))
8347 (gnus-summary-recenter)
8348 (gnus-summary-position-cursor))
8350 (defun gnus-summary-next-same-subject ()
8351 "Select next article which has the same subject as current one."
8353 (gnus-set-global-variables)
8354 (gnus-summary-next-article nil
(gnus-summary-subject-string)))
8356 (defun gnus-summary-prev-same-subject ()
8357 "Select previous article which has the same subject as current one."
8359 (gnus-set-global-variables)
8360 (gnus-summary-prev-article nil
(gnus-summary-subject-string)))
8362 (defun gnus-summary-next-unread-same-subject ()
8363 "Select next unread article which has the same subject as current one."
8365 (gnus-set-global-variables)
8366 (gnus-summary-next-article t
(gnus-summary-subject-string)))
8368 (defun gnus-summary-prev-unread-same-subject ()
8369 "Select previous unread article which has the same subject as current one."
8371 (gnus-set-global-variables)
8372 (gnus-summary-prev-article t
(gnus-summary-subject-string)))
8374 (defun gnus-summary-first-unread-article ()
8375 "Select the first unread article.
8376 Return nil if there are no unread articles."
8378 (gnus-set-global-variables)
8380 (if (gnus-summary-first-subject t
)
8382 (gnus-summary-show-thread)
8383 (gnus-summary-first-subject t
)
8384 (gnus-summary-display-article (gnus-summary-article-number))))
8385 (gnus-summary-position-cursor)))
8387 (defun gnus-summary-best-unread-article ()
8388 "Select the unread article with the highest score."
8390 (gnus-set-global-variables)
8391 (let ((best -
1000000)
8394 (or (gnus-summary-first-subject t
)
8395 (error "No unread articles"))
8399 (and (> (setq score
(gnus-summary-article-score)) best
)
8401 article
(gnus-summary-article-number)))
8403 (gnus-summary-search-subject nil t
))))
8405 (error "No unread articles")
8406 (gnus-summary-goto-article article
))
8407 (gnus-summary-position-cursor)))
8409 (defun gnus-summary-goto-article (article &optional all-headers
)
8410 "Fetch ARTICLE and display it if it exists.
8411 If ALL-HEADERS is non-nil, no header lines are hidden."
8417 (mapcar (lambda (headers)
8418 (list (int-to-string (mail-header-number headers
))))
8419 gnus-newsgroup-headers
)
8420 nil
'require-match
))))
8422 (and (gnus-summary-goto-subject article
)
8423 (gnus-summary-display-article article all-headers
))
8424 (gnus-summary-position-cursor)))
8426 (defun gnus-summary-goto-last-article ()
8427 "Go to the previously read article."
8430 (and gnus-last-article
8431 (gnus-summary-goto-article gnus-last-article
))
8432 (gnus-summary-position-cursor)))
8434 (defun gnus-summary-pop-article (number)
8435 "Pop one article off the history and go to the previous.
8436 NUMBER articles will be popped off."
8439 (setq gnus-newsgroup-history
8440 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
8442 (gnus-summary-goto-article (car to
))
8443 (error "Article history empty")))
8444 (gnus-summary-position-cursor))
8446 ;; Summary article oriented commands
8448 (defun gnus-summary-refer-parent-article (n)
8449 "Refer parent article N times.
8450 The difference between N and the number of articles fetched is returned."
8452 (gnus-set-global-variables)
8456 (let ((ref (mail-header-references (gnus-get-header-by-num
8457 (gnus-summary-article-number)))))
8458 (if (and ref
(not (equal ref
""))
8459 (string-match "<[^<>]*>[ \t]*$" ref
))
8460 (gnus-summary-refer-article
8461 (substring ref
(match-beginning 0) (match-end 0)))
8462 (gnus-message 1 "No references in article %d"
8463 (gnus-summary-article-number))
8466 (gnus-summary-position-cursor)
8469 (defun gnus-summary-refer-article (message-id)
8470 "Refer article specified by MESSAGE-ID.
8471 NOTE: This command only works with newsgroups that use real or simulated NNTP."
8472 (interactive "sMessage-ID: ")
8473 (if (or (not (stringp message-id
))
8474 (zerop (length message-id
)))
8476 ;; Construct the correct Message-ID if necessary.
8477 ;; Suggested by tale@pawl.rpi.edu.
8478 (or (string-match "^<" message-id
)
8479 (setq message-id
(concat "<" message-id
)))
8480 (or (string-match ">$" message-id
)
8481 (setq message-id
(concat message-id
">")))
8482 (let ((header (car (gnus-gethash (downcase message-id
)
8483 gnus-newsgroup-dependencies
))))
8485 (or (gnus-summary-goto-article (mail-header-number header
))
8486 ;; The header has been read, but the article had been
8487 ;; expunged, so we insert it again.
8489 (gnus-summary-insert-line
8490 nil header
0 nil gnus-read-mark nil nil
8491 (mail-header-subject header
))
8493 (mail-header-number header
)))
8494 (let ((gnus-override-method gnus-refer-article-method
)
8495 (gnus-ancient-mark gnus-read-mark
)
8496 (tmp-point (window-start
8497 (get-buffer-window gnus-article-buffer
)))
8499 (and gnus-refer-article-method
8500 (gnus-check-server gnus-refer-article-method
))
8501 ;; Save the old article buffer.
8503 (set-buffer (gnus-article-setup-buffer))
8504 (gnus-kill-buffer " *temp Article*")
8505 (setq tmp-buf
(rename-buffer " *temp Article*")))
8507 (if (gnus-article-prepare
8508 message-id nil
(gnus-read-header message-id
))
8510 (setq number
(mail-header-number gnus-current-headers
))
8511 (gnus-rebuild-thread message-id
)
8512 (gnus-summary-goto-subject number
)
8513 (if (null gnus-use-full-window
)
8515 (delete-windows-on tmp-buf
)
8516 (gnus-configure-windows 'article
'force
)))
8517 (gnus-summary-recenter)
8518 (gnus-article-set-window-start
8519 (cdr (assq number gnus-newsgroup-bookmarks
)))
8521 (run-hooks 'gnus-visual-mark-article-hook
))
8523 ;; We restore the old article buffer.
8525 (kill-buffer gnus-article-buffer
)
8526 (set-buffer tmp-buf
)
8527 (rename-buffer gnus-article-buffer
)
8528 (let ((buffer-read-only nil
))
8530 (set-window-start (get-buffer-window (current-buffer))
8531 tmp-point
)))))))))))
8533 (defun gnus-summary-enter-digest-group ()
8534 "Enter a digest group based on the current article."
8536 (gnus-set-global-variables)
8537 (gnus-summary-select-article)
8538 ;; We do not want a narrowed article.
8539 (gnus-summary-stop-page-breaking)
8540 (let ((name (format "%s-%d"
8541 (gnus-group-prefixed-name
8542 gnus-newsgroup-name
(list 'nndoc
""))
8543 gnus-current-article
))
8544 (ogroup gnus-newsgroup-name
)
8545 (buf (current-buffer)))
8546 (if (gnus-group-read-ephemeral-group
8547 name
(list 'nndoc name
8548 (list 'nndoc-address
(get-buffer gnus-article-buffer
))
8549 '(nndoc-article-type digest
))
8551 (setcdr (nthcdr 4 (nth 2 (gnus-gethash name gnus-newsrc-hashtb
)))
8552 (list (list (cons 'to-group ogroup
))))
8553 (switch-to-buffer buf
)
8554 (gnus-set-global-variables)
8555 (gnus-configure-windows 'summary
)
8556 (gnus-message 3 "Article not a digest?"))))
8558 (defun gnus-summary-isearch-article ()
8559 "Do incremental search forward on current article."
8561 (gnus-set-global-variables)
8562 (gnus-summary-select-article)
8563 (gnus-eval-in-buffer-window
8564 gnus-article-buffer
(isearch-forward)))
8566 (defun gnus-summary-search-article-forward (regexp &optional backward
)
8567 "Search for an article containing REGEXP forward.
8568 If BACKWARD, search backward instead."
8571 (format "Search article %s (regexp%s): "
8572 (if current-prefix-arg
"backward" "forward")
8573 (if gnus-last-search-regexp
8574 (concat ", default " gnus-last-search-regexp
)
8576 current-prefix-arg
))
8577 (gnus-set-global-variables)
8578 (if (string-equal regexp
"")
8579 (setq regexp
(or gnus-last-search-regexp
""))
8580 (setq gnus-last-search-regexp regexp
))
8581 (if (gnus-summary-search-article regexp backward
)
8582 (gnus-article-set-window-start
8583 (cdr (assq (gnus-summary-article-number) gnus-newsgroup-bookmarks
)))
8584 (error "Search failed: \"%s\"" regexp
)))
8586 (defun gnus-summary-search-article-backward (regexp)
8587 "Search for an article containing REGEXP backward."
8590 (format "Search article backward (regexp%s): "
8591 (if gnus-last-search-regexp
8592 (concat ", default " gnus-last-search-regexp
)
8594 (gnus-summary-search-article-forward regexp
'backward
))
8596 (defun gnus-summary-search-article (regexp &optional backward
)
8597 "Search for an article containing REGEXP.
8598 Optional argument BACKWARD means do search for backward.
8599 gnus-select-article-hook is not called during the search."
8600 (let ((gnus-select-article-hook nil
) ;Disable hook.
8601 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
8604 (function re-search-backward
) (function re-search-forward
)))
8607 ;; Hidden thread subtrees must be searched for ,too.
8608 (gnus-summary-show-all-threads)
8609 (if (eobp) (forward-line -
1))
8610 ;; First of all, search current article.
8611 ;; We don't want to read article again from NNTP server nor reset
8613 (gnus-summary-select-article)
8614 (gnus-message 9 "Searching article: %d..." gnus-current-article
)
8615 (setq last gnus-current-article
)
8616 (gnus-eval-in-buffer-window
8620 ;; Begin search from current point.
8621 (setq found
(funcall re-search regexp nil t
))))
8622 ;; Then search next articles.
8623 (while (and (not found
)
8624 (gnus-summary-display-article
8625 (gnus-summary-search-subject backward nil nil
)))
8626 (gnus-message 9 "Searching article: %d..." gnus-current-article
)
8627 (gnus-eval-in-buffer-window
8631 (goto-char (if backward
(point-max) (point-min)))
8632 (setq found
(funcall re-search regexp nil t
)))))
8634 ;; Adjust article pointer.
8635 (or (eq last gnus-current-article
)
8636 (setq gnus-last-article last
))
8637 ;; Return T if found such article.
8640 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
8641 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8642 If HEADER is an empty string (or nil), the match is done on the entire
8643 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8645 (list (let ((completion-ignore-case t
))
8648 (mapcar (lambda (string) (list string
))
8649 '("Number" "Subject" "From" "Lines" "Date"
8650 "Message-ID" "Xref" "References"))
8651 nil
'require-match
))
8652 (read-string "Regexp: ")
8653 (read-key-sequence "Command: ")
8654 current-prefix-arg
))
8655 (gnus-set-global-variables)
8656 ;; Hidden thread subtrees must be searched as well.
8657 (gnus-summary-show-all-threads)
8658 ;; We don't want to change current point nor window configuration.
8660 (save-window-excursion
8661 (gnus-message 6 "Executing %s..." (key-description command
))
8662 ;; We'd like to execute COMMAND interactively so as to give arguments.
8663 (gnus-execute header regexp
8665 (call-interactively '(, (key-binding command
)))))
8667 (gnus-message 6 "Executing %s...done" (key-description command
)))))
8669 (defun gnus-summary-beginning-of-article ()
8670 "Scroll the article back to the beginning."
8672 (gnus-set-global-variables)
8673 (gnus-summary-select-article)
8674 (gnus-configure-windows 'article
)
8675 (gnus-eval-in-buffer-window
8678 (goto-char (point-min))
8679 (and gnus-break-pages
(gnus-narrow-to-page))))
8681 (defun gnus-summary-end-of-article ()
8682 "Scroll to the end of the article."
8684 (gnus-set-global-variables)
8685 (gnus-summary-select-article)
8686 (gnus-configure-windows 'article
)
8687 (gnus-eval-in-buffer-window
8690 (goto-char (point-max))
8692 (and gnus-break-pages
(gnus-narrow-to-page))))
8694 (defun gnus-summary-show-article ()
8695 "Force re-fetching of the current article."
8697 (gnus-set-global-variables)
8698 (gnus-summary-select-article nil
'force
)
8699 (gnus-configure-windows 'article
)
8700 (gnus-summary-position-cursor))
8702 (defun gnus-summary-verbose-headers (&optional arg
)
8703 "Toggle permanent full header display.
8704 If ARG is a positive number, turn header display on.
8705 If ARG is a negative number, turn header display off."
8707 (gnus-set-global-variables)
8708 (gnus-summary-toggle-header arg
)
8709 (setq gnus-show-all-headers
8710 (cond ((or (not (numberp arg
))
8712 (not gnus-show-all-headers
))
8716 (defun gnus-summary-toggle-header (&optional arg
)
8717 "Show the headers if they are hidden, or hide them if they are shown.
8718 If ARG is a positive number, show the entire header.
8719 If ARG is a negative number, hide the unwanted header lines."
8721 (gnus-set-global-variables)
8723 (set-buffer gnus-article-buffer
)
8724 (let ((buffer-read-only nil
))
8726 (if (> arg
0) (remove-text-properties (point-min) (point-max)
8727 gnus-hidden-properties
)
8728 (if (< arg
0) (run-hooks 'gnus-article-display-hook
)))
8729 (if (text-property-any (point-min) (point-max) 'invisible t
)
8730 (remove-text-properties
8731 (point-min) (point-max) gnus-hidden-properties
)
8732 ;; We hide the headers. This song and dance act below is
8733 ;; done because `gnus-have-all-headers' is buffer-local to
8734 ;; the summary buffer, and we only want to temporarily
8735 ;; change it in that buffer. Ugh.
8736 (let ((have gnus-have-all-headers
))
8738 (set-buffer gnus-summary-buffer
)
8739 (setq gnus-have-all-headers nil
)
8741 (set-buffer gnus-article-buffer
)
8742 (run-hooks 'gnus-article-display-hook
))
8743 (setq gnus-have-all-headers have
)))))
8744 (set-window-point (get-buffer-window (current-buffer)) (point-min)))))
8746 (defun gnus-summary-show-all-headers ()
8747 "Make all header lines visible."
8749 (gnus-set-global-variables)
8750 (gnus-article-show-all-headers))
8752 (defun gnus-summary-toggle-mime (&optional arg
)
8753 "Toggle MIME processing.
8754 If ARG is a positive number, turn MIME processing on."
8756 (gnus-set-global-variables)
8757 (setq gnus-show-mime
8758 (if (null arg
) (not gnus-show-mime
)
8759 (> (prefix-numeric-value arg
) 0)))
8760 (gnus-summary-select-article t
'force
))
8762 (defun gnus-summary-caesar-message (&optional arg
)
8763 "Caesar rotate the current article by 13.
8764 The numerical prefix specifies how manu places to rotate each letter
8767 (gnus-set-global-variables)
8768 (gnus-summary-select-article)
8769 (let ((mail-header-separator ""))
8770 (gnus-eval-in-buffer-window
8774 (let ((start (window-start)))
8775 (news-caesar-buffer-body arg
)
8776 (set-window-start (get-buffer-window (current-buffer)) start
))))))
8778 (defun gnus-summary-stop-page-breaking ()
8779 "Stop page breaking in the current article."
8781 (gnus-set-global-variables)
8782 (gnus-summary-select-article)
8783 (gnus-eval-in-buffer-window gnus-article-buffer
(widen)))
8785 ;; Suggested by Brian Edmonds <bedmonds@prodigy.bc.ca>.
8787 (defun gnus-summary-move-article (&optional n to-newsgroup select-method
)
8788 "Move the current article to a different newsgroup.
8789 If N is a positive number, move the N next articles.
8790 If N is a negative number, move the N previous articles.
8791 If N is nil and any articles have been marked with the process mark,
8792 move those articles instead.
8793 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8794 If SELECT-METHOD is symbol, do not move to a specific newsgroup, but
8795 re-spool using this method.
8796 For this function to work, both the current newsgroup and the
8797 newsgroup that you want to move to have to support the `request-move'
8798 and `request-accept' functions. (Ie. mail newsgroups at present.)"
8800 (gnus-set-global-variables)
8801 (or (gnus-check-backend-function 'request-move-article gnus-newsgroup-name
)
8802 (error "The current newsgroup does not support article moving"))
8803 (let ((articles (gnus-summary-work-articles n
))
8804 (prefix (gnus-group-real-prefix gnus-newsgroup-name
))
8805 art-group to-method sel-met
)
8806 (if (and (not to-newsgroup
) (not select-method
))
8809 (format "Where do you want to move %s? %s"
8810 (if (> (length articles
) 1)
8811 (format "these %d articles" (length articles
))
8813 (if gnus-current-move-group
8814 (format "(%s default) " gnus-current-move-group
)
8816 gnus-active-hashtb nil nil prefix
)))
8819 (if (or (string= to-newsgroup
"") (string= to-newsgroup prefix
))
8820 (setq to-newsgroup
(or gnus-current-move-group
"")))
8821 (or (gnus-gethash to-newsgroup gnus-active-hashtb
)
8822 (gnus-activate-group to-newsgroup
)
8823 (error "No such group: %s" to-newsgroup
))
8824 (setq gnus-current-move-group to-newsgroup
)))
8825 (setq to-method
(if select-method
(list select-method
"")
8826 (gnus-find-method-for-group to-newsgroup
)))
8827 (or (gnus-check-backend-function 'request-accept-article
(car to-method
))
8828 (error "%s does not support article copying" (car to-method
)))
8829 (or (gnus-check-server to-method
)
8830 (error "Can't open server %s" (car to-method
)))
8831 (gnus-message 6 "Moving to %s: %s..."
8832 (or select-method to-newsgroup
) articles
)
8835 (gnus-request-move-article
8836 (car articles
) ; Article to move
8837 gnus-newsgroup-name
; From newsgroup
8838 (nth 1 (gnus-find-method-for-group
8839 gnus-newsgroup-name
)) ; Server
8840 (list 'gnus-request-accept-article
8842 (list 'quote select-method
)
8844 (not (cdr articles
))) ; Accept form
8845 (not (cdr articles
)))) ; Only save nov last time
8846 (let* ((buffer-read-only nil
)
8849 (gnus-gethash (car art-group
) gnus-newsrc-hashtb
)
8851 (gnus-group-prefixed-name
8853 (if select-method
(list select-method
"")
8854 (gnus-find-method-for-group to-newsgroup
)))
8855 gnus-newsrc-hashtb
)))
8856 (info (nth 2 entry
))
8857 (article (car articles
)))
8858 (gnus-summary-goto-subject article
)
8860 (delete-region (point) (progn (forward-line 1) (point)))
8861 ;; Update the group that has been moved to.
8863 () ; This group does not exist yet.
8864 (if (not (memq article gnus-newsgroup-unreads
))
8865 (setcar (cdr (cdr info
))
8866 (gnus-add-to-range (nth 2 info
)
8867 (list (cdr art-group
)))))
8868 ;; Copy any marks over to the new group.
8869 (let ((marks '((tick . gnus-newsgroup-marked
)
8870 (dormant . gnus-newsgroup-dormant
)
8871 (expire . gnus-newsgroup-expirable
)
8872 (bookmark . gnus-newsgroup-bookmarks
)
8873 (reply . gnus-newsgroup-replied
)))
8874 (to-article (cdr art-group
)))
8876 (if (memq article
(symbol-value (cdr (car marks
))))
8877 (gnus-add-marked-articles
8878 (car info
) (car (car marks
)) (list to-article
) info
))
8879 (setq marks
(cdr marks
)))))
8881 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
8882 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
8883 (setq gnus-newsgroup-dormant
8884 (delq article gnus-newsgroup-dormant
))
8885 (setq gnus-newsgroup-reads
8886 (cons (cons article gnus-canceled-mark
)
8887 gnus-newsgroup-reads
)))
8888 (gnus-message 1 "Couldn't move article %s" (car articles
)))
8889 (gnus-summary-remove-process-mark (car articles
))
8890 (setq articles
(cdr articles
)))
8891 (gnus-set-mode-line 'summary
)))
8893 (defun gnus-summary-respool-article (&optional n respool-method
)
8894 "Respool the current article.
8895 The article will be squeezed through the mail spooling process again,
8896 which means that it will be put in some mail newsgroup or other
8897 depending on `nnmail-split-methods'.
8898 If N is a positive number, respool the N next articles.
8899 If N is a negative number, respool the N previous articles.
8900 If N is nil and any articles have been marked with the process mark,
8901 respool those articles instead.
8903 Respooling can be done both from mail groups and \"real\" newsgroups.
8904 In the former case, the articles in question will be moved from the
8905 current group into whatever groups they are destined to. In the
8906 latter case, they will be copied into the relevant groups."
8908 (gnus-set-global-variables)
8909 (let ((respool-methods (gnus-methods-using 'respool
))
8911 (symbol-name (car (gnus-find-method-for-group gnus-newsgroup-name
)))))
8913 (setq respool-method
8915 "What method do you want to use when respooling? "
8916 respool-methods nil t methname
)))
8917 (or (string= respool-method
"")
8918 (if (assoc (symbol-name
8919 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
8921 (gnus-summary-move-article n nil
(intern respool-method
))
8922 (gnus-summary-copy-article n nil
(intern respool-method
))))))
8924 ;; Suggested by gregj@unidata.com (Gregory J. Grubbs).
8925 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
8926 "Move the current article to a different newsgroup.
8927 If N is a positive number, move the N next articles.
8928 If N is a negative number, move the N previous articles.
8929 If N is nil and any articles have been marked with the process mark,
8930 move those articles instead.
8931 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8932 If SELECT-METHOD is symbol, do not move to a specific newsgroup, but
8933 re-spool using this method.
8934 For this function to work, the newsgroup that you want to move to have
8935 to support the `request-move' and `request-accept'
8936 functions. (Ie. mail newsgroups at present.)"
8938 (gnus-set-global-variables)
8939 (let ((articles (gnus-summary-work-articles n
))
8940 (copy-buf (get-buffer-create "*copy work*"))
8941 (prefix (gnus-group-real-prefix gnus-newsgroup-name
))
8942 art-group to-method
)
8943 (buffer-disable-undo copy-buf
)
8944 (if (and (not to-newsgroup
) (not select-method
))
8947 (format "Where do you want to copy %s? %s"
8948 (if (> (length articles
) 1)
8949 (format "these %d articles" (length articles
))
8951 (if gnus-current-move-group
8952 (format "(%s default) " gnus-current-move-group
)
8954 gnus-active-hashtb nil nil prefix
)))
8957 (if (or (string= to-newsgroup
"") (string= to-newsgroup prefix
))
8958 (setq to-newsgroup
(or gnus-current-move-group
"")))
8959 (or (gnus-gethash to-newsgroup gnus-active-hashtb
)
8960 (gnus-activate-group to-newsgroup
)
8961 (error "No such group: %s" to-newsgroup
))
8962 (setq gnus-current-move-group to-newsgroup
)))
8963 (setq to-method
(if select-method
(list select-method
"")
8964 (gnus-find-method-for-group to-newsgroup
)))
8965 (or (gnus-check-backend-function 'request-accept-article
(car to-method
))
8966 (error "%s does not support article copying" (car to-method
)))
8967 (or (gnus-check-server to-method
)
8968 (error "Can't open server %s" (car to-method
)))
8970 (gnus-message 6 "Copying to %s: %s..."
8971 (or select-method to-newsgroup
) articles
)
8974 (set-buffer copy-buf
)
8975 (gnus-request-article-this-buffer
8976 (car articles
) gnus-newsgroup-name
)
8977 (gnus-request-accept-article
8978 (if select-method
(list 'quote select-method
) to-newsgroup
)
8979 (not (cdr articles
)))))
8982 (gnus-gethash (car art-group
) gnus-newsrc-hashtb
)
8984 (gnus-group-prefixed-name
8986 (if select-method
(list select-method
"")
8987 (gnus-find-method-for-group to-newsgroup
)))
8988 gnus-newsrc-hashtb
)))
8989 (info (nth 2 entry
))
8990 (article (car articles
)))
8991 ;; We copy the info over to the new group.
8993 () ; This group does not exist (yet).
8994 (if (not (memq article gnus-newsgroup-unreads
))
8995 (setcar (cdr (cdr info
))
8996 (gnus-add-to-range (nth 2 info
)
8997 (list (cdr art-group
)))))
8998 ;; Copy any marks over to the new group.
8999 (let ((marks '((tick . gnus-newsgroup-marked
)
9000 (dormant . gnus-newsgroup-dormant
)
9001 (expire . gnus-newsgroup-expirable
)
9002 (bookmark . gnus-newsgroup-bookmarks
)
9003 (reply . gnus-newsgroup-replied
)))
9004 (to-article (cdr art-group
)))
9006 (if (memq article
(symbol-value (cdr (car marks
))))
9007 (gnus-add-marked-articles
9008 (car info
) (car (car marks
)) (list to-article
) info
))
9009 (setq marks
(cdr marks
))))))
9010 (gnus-message 1 "Couldn't copy article %s" (car articles
)))
9011 (gnus-summary-remove-process-mark (car articles
))
9012 (setq articles
(cdr articles
)))
9013 (kill-buffer copy-buf
)))
9015 (defun gnus-summary-import-article (file)
9016 "Import a random file into a mail newsgroup."
9017 (interactive "fImport file: ")
9018 (let ((group gnus-newsgroup-name
)
9020 (or (gnus-check-backend-function 'request-accept-article group
)
9021 (error "%s does not support article importing" group
))
9022 (or (file-readable-p file
)
9023 (not (file-regular-p file
))
9024 (error "Can't read %s" file
))
9026 (set-buffer (get-buffer-create " *import file*"))
9027 (buffer-disable-undo (current-buffer))
9029 (insert-file-contents file
)
9030 (goto-char (point-min))
9031 (if (nnheader-article-p)
9033 (setq atts
(file-attributes file
))
9034 (insert "From: " (read-string "From: ") "\n"
9035 "Subject: " (read-string "Subject: ") "\n"
9036 "Date: " (current-time-string (nth 5 atts
)) "\n"
9037 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
9038 (gnus-request-accept-article group t
)
9039 (kill-buffer (current-buffer)))))
9041 (defun gnus-summary-expire-articles ()
9042 "Expire all articles that are marked as expirable in the current group."
9044 (if (not (gnus-check-backend-function
9045 'request-expire-articles gnus-newsgroup-name
))
9047 (let* ((info (nth 2 (gnus-gethash gnus-newsgroup-name
9048 gnus-newsrc-hashtb
)))
9049 (total (memq 'total-expire
(nth 5 info
)))
9050 (expirable (if total
9051 (gnus-list-of-read-articles gnus-newsgroup-name
)
9052 (setq gnus-newsgroup-expirable
9053 (sort gnus-newsgroup-expirable
'<))))
9057 (gnus-message 6 "Expiring articles...")
9058 ;; The list of articles that weren't expired is returned.
9059 (setq es
(gnus-request-expire-articles expirable gnus-newsgroup-name
))
9060 (or total
(setq gnus-newsgroup-expirable es
))
9061 ;; We go through the old list of expirable, and mark all
9062 ;; really expired articles as nonexistent.
9063 (or (eq es expirable
) ;If nothing was expired, we don't mark.
9064 (let ((gnus-use-cache nil
))
9066 (or (memq (car expirable
) es
)
9067 (gnus-summary-mark-article
9068 (car expirable
) gnus-canceled-mark
))
9069 (setq expirable
(cdr expirable
)))))
9070 (gnus-message 6 "Expiring articles...done")))))
9072 (defun gnus-summary-expire-articles-now ()
9073 "Expunge all expirable articles in the current group.
9074 This means that *all* articles that are marked as expirable will be
9075 deleted forever, right now."
9077 (or gnus-expert-user
9079 "Are you really, really, really sure you want to expunge? ")
9081 (let ((nnmail-expiry-wait -
1)
9082 (nnmail-expiry-wait-function nil
))
9083 (gnus-summary-expire-articles)))
9085 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9086 (defun gnus-summary-delete-article (&optional n
)
9087 "Delete the N next (mail) articles.
9088 This command actually deletes articles. This is not a marking
9089 command. The article will disappear forever from you life, never to
9091 If N is negative, delete backwards.
9092 If N is nil and articles have been marked with the process mark,
9093 delete these instead."
9095 (or (gnus-check-backend-function 'request-expire-articles
9096 gnus-newsgroup-name
)
9097 (error "The current newsgroup does not support article deletion."))
9098 ;; Compute the list of articles to delete.
9099 (let ((articles (gnus-summary-work-articles n
))
9101 (if (and gnus-novice-user
9103 (format "Do you really want to delete %s forever? "
9104 (if (> (length articles
) 1) "these articles"
9107 ;; Delete the articles.
9108 (setq not-deleted
(gnus-request-expire-articles
9109 articles gnus-newsgroup-name
'force
))
9111 (gnus-summary-remove-process-mark (car articles
))
9112 ;; The backend might not have been able to delete the article
9114 (or (memq (car articles
) not-deleted
)
9115 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
9116 (setq articles
(cdr articles
))))
9117 (gnus-summary-position-cursor)
9118 (gnus-set-mode-line 'summary
)
9121 (defun gnus-summary-edit-article (&optional force
)
9122 "Enter into a buffer and edit the current article.
9123 This will have permanent effect only in mail groups.
9124 If FORCE is non-nil, allow editing of articles even in read-only
9128 (not (gnus-group-read-only-p))
9129 (error "The current newsgroup does not support article editing."))
9130 (gnus-summary-select-article t
)
9131 (gnus-configure-windows 'article
)
9132 (select-window (get-buffer-window gnus-article-buffer
))
9133 (gnus-message 6 "C-c C-c to end edits")
9134 (setq buffer-read-only nil
)
9136 (use-local-map (copy-keymap (current-local-map)))
9137 (local-set-key "\C-c\C-c" 'gnus-summary-edit-article-done
)
9138 (buffer-enable-undo)
9140 (goto-char (point-min))
9141 (search-forward "\n\n" nil t
))
9143 (defun gnus-summary-edit-article-done ()
9144 "Make edits to the current article permanent."
9146 (if (gnus-group-read-only-p)
9148 (gnus-summary-edit-article-postpone)
9149 (message "The current newsgroup does not support article editing.")
9151 (let ((buf (buffer-substring-no-properties (point-min) (point-max))))
9154 (if (not (gnus-request-replace-article
9155 (cdr gnus-article-current
) (car gnus-article-current
)
9157 (error "Couldn't replace article.")
9159 (use-local-map gnus-article-mode-map
)
9160 (setq buffer-read-only t
)
9161 (buffer-disable-undo (current-buffer))
9162 (gnus-configure-windows 'summary
))
9163 (and gnus-visual
(run-hooks 'gnus-visual-mark-article-hook
)))))
9165 (defun gnus-summary-edit-article-postpone ()
9166 "Postpone changes to the current article."
9169 (use-local-map gnus-article-mode-map
)
9170 (setq buffer-read-only t
)
9171 (buffer-disable-undo (current-buffer))
9172 (gnus-configure-windows 'summary
)
9173 (and gnus-visual
(run-hooks 'gnus-visual-mark-article-hook
)))
9175 (defun gnus-summary-fancy-query ()
9176 "Query where the fancy respool algorithm would put this article."
9178 (gnus-summary-select-article)
9180 (set-buffer gnus-article-buffer
)
9182 (goto-char (point-min))
9183 (search-forward "\n\n")
9184 (narrow-to-region (point-min) (point))
9185 (pp-eval-expression (list 'quote
(nnmail-split-fancy))))))
9187 ;; Summary score commands.
9189 ;; Suggested by boubaker@cenatls.cena.dgac.fr.
9191 (defun gnus-summary-raise-score (n)
9192 "Raise the score of the current article by N."
9194 (gnus-summary-set-score (+ (gnus-summary-article-score) n
)))
9196 (defun gnus-summary-set-score (n)
9197 "Set the score of the current article to N."
9199 ;; Skip dummy header line.
9201 (gnus-summary-show-thread)
9202 (if (eq (gnus-summary-article-mark) gnus-dummy-mark
)
9204 (let ((buffer-read-only nil
))
9206 (gnus-summary-update-mark
9207 (if (= n
(or gnus-summary-default-score
0)) ?
9208 (if (< n
(or gnus-summary-default-score
0))
9209 gnus-score-below-mark gnus-score-over-mark
)) 'score
))
9210 (let* ((article (gnus-summary-article-number))
9211 (score (assq article gnus-newsgroup-scored
)))
9212 (if score
(setcdr score n
)
9213 (setq gnus-newsgroup-scored
9214 (cons (cons article n
) gnus-newsgroup-scored
))))
9215 (gnus-summary-update-line)))
9217 (defun gnus-summary-current-score ()
9218 "Return the score of the current article."
9220 (message "%s" (gnus-summary-article-score)))
9222 ;; Summary marking commands.
9224 (defun gnus-summary-raise-same-subject-and-select (score)
9225 "Raise articles which has the same subject with SCORE and select the next."
9227 (let ((subject (gnus-summary-subject-string)))
9228 (gnus-summary-raise-score score
)
9229 (while (gnus-summary-search-subject nil nil subject
)
9230 (gnus-summary-raise-score score
))
9231 (gnus-summary-next-article t
)))
9233 (defun gnus-summary-raise-same-subject (score)
9234 "Raise articles which has the same subject with SCORE."
9236 (let ((subject (gnus-summary-subject-string)))
9237 (gnus-summary-raise-score score
)
9238 (while (gnus-summary-search-subject nil nil subject
)
9239 (gnus-summary-raise-score score
))
9240 (gnus-summary-next-subject 1 t
)))
9242 (defun gnus-score-default (level)
9243 (if level
(prefix-numeric-value level
)
9244 gnus-score-interactive-default-score
))
9246 (defun gnus-summary-raise-thread (&optional score
)
9247 "Raise the score of the articles in the current thread with SCORE."
9249 (setq score
(gnus-score-default score
))
9252 (let ((level (gnus-summary-thread-level)))
9253 (gnus-summary-raise-score score
)
9254 (while (and (zerop (gnus-summary-next-subject 1 nil t
))
9255 (> (gnus-summary-thread-level) level
))
9256 (gnus-summary-raise-score score
))
9258 (let ((gnus-summary-check-current t
))
9259 (or (zerop (gnus-summary-next-subject 1 t
))
9261 (gnus-summary-recenter)
9262 (gnus-summary-position-cursor)
9263 (gnus-set-mode-line 'summary
))
9265 (defun gnus-summary-lower-same-subject-and-select (score)
9266 "Raise articles which has the same subject with SCORE and select the next."
9268 (gnus-summary-raise-same-subject-and-select (- score
)))
9270 (defun gnus-summary-lower-same-subject (score)
9271 "Raise articles which has the same subject with SCORE."
9273 (gnus-summary-raise-same-subject (- score
)))
9275 (defun gnus-summary-lower-thread (&optional score
)
9276 "Lower score of articles in the current thread with SCORE."
9278 (gnus-summary-raise-thread (- (1- (gnus-score-default score
)))))
9280 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
9281 "Mark articles which has the same subject as read, and then select the next.
9282 If UNMARK is positive, remove any kind of mark.
9283 If UNMARK is negative, tick articles."
9286 (setq unmark
(prefix-numeric-value unmark
)))
9288 (gnus-summary-mark-same-subject
9289 (gnus-summary-subject-string) unmark
)))
9290 ;; Select next unread article. If auto-select-same mode, should
9291 ;; select the first unread article.
9292 (gnus-summary-next-article t
(and gnus-auto-select-same
9293 (gnus-summary-subject-string)))
9294 (gnus-message 7 "%d article%s marked as %s"
9295 count
(if (= count
1) " is" "s are")
9296 (if unmark
"unread" "read"))))
9298 (defun gnus-summary-kill-same-subject (&optional unmark
)
9299 "Mark articles which has the same subject as read.
9300 If UNMARK is positive, remove any kind of mark.
9301 If UNMARK is negative, tick articles."
9304 (setq unmark
(prefix-numeric-value unmark
)))
9306 (gnus-summary-mark-same-subject
9307 (gnus-summary-subject-string) unmark
)))
9308 ;; If marked as read, go to next unread subject.
9310 ;; Go to next unread subject.
9311 (gnus-summary-next-subject 1 t
))
9312 (gnus-message 7 "%d articles are marked as %s"
9313 count
(if unmark
"unread" "read"))))
9315 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
9316 "Mark articles with same SUBJECT as read, and return marked number.
9317 If optional argument UNMARK is positive, remove any kinds of marks.
9318 If optional argument UNMARK is negative, mark articles as unread instead."
9322 ((null unmark
) ; Mark as read.
9325 (gnus-summary-mark-article-as-read gnus-killed-mark
)
9326 (gnus-summary-show-thread) t
)
9327 (gnus-summary-search-forward nil subject
))
9328 (setq count
(1+ count
))))
9329 ((> unmark
0) ; Tick.
9332 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
9333 (gnus-summary-show-thread) t
)
9334 (gnus-summary-search-forward nil subject
))
9335 (setq count
(1+ count
))))
9336 (t ; Mark as unread.
9339 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
9340 (gnus-summary-show-thread) t
)
9341 (gnus-summary-search-forward nil subject
))
9342 (setq count
(1+ count
)))))
9343 (gnus-set-mode-line 'summary
)
9344 ;; Return the number of marked articles.
9347 (defun gnus-summary-mark-as-processable (n &optional unmark
)
9348 "Set the process mark on the next N articles.
9349 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9350 the process mark instead. The difference between N and the actual
9351 number of articles marked is returned."
9353 (let ((backward (< n
0))
9358 (gnus-summary-remove-process-mark
9359 (gnus-summary-article-number))
9360 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9361 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
9363 (if (/= 0 n
) (gnus-message 7 "No more articles"))
9364 (gnus-summary-recenter)
9365 (gnus-summary-position-cursor)
9368 (defun gnus-summary-unmark-as-processable (n)
9369 "Remove the process mark from the next N articles.
9370 If N is negative, mark backward instead. The difference between N and
9371 the actual number of articles marked is returned."
9373 (gnus-summary-mark-as-processable n t
))
9375 (defun gnus-summary-unmark-all-processable ()
9376 "Remove the process mark from all articles."
9379 (while gnus-newsgroup-processable
9380 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
9381 (gnus-summary-position-cursor))
9383 (defun gnus-summary-mark-as-expirable (n)
9384 "Mark N articles forward as expirable.
9385 If N is negative, mark backward instead. The difference between N and
9386 the actual number of articles marked is returned."
9388 (gnus-summary-mark-forward n gnus-expirable-mark
))
9390 (defun gnus-summary-mark-article-as-replied (article)
9391 "Mark ARTICLE replied and update the summary line."
9392 (setq gnus-newsgroup-replied
(cons article gnus-newsgroup-replied
))
9393 (let ((buffer-read-only nil
))
9394 (if (gnus-summary-goto-subject article
)
9396 (gnus-summary-update-mark gnus-replied-mark
'replied
)
9399 (defun gnus-summary-set-bookmark (article)
9400 "Set a bookmark in current article."
9401 (interactive (list (gnus-summary-article-number)))
9402 (if (or (not (get-buffer gnus-article-buffer
))
9403 (not gnus-current-article
)
9404 (not gnus-article-current
)
9405 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
9406 (error "No current article selected"))
9407 ;; Remove old bookmark, if one exists.
9408 (let ((old (assq article gnus-newsgroup-bookmarks
)))
9409 (if old
(setq gnus-newsgroup-bookmarks
9410 (delq old gnus-newsgroup-bookmarks
))))
9411 ;; Set the new bookmark, which is on the form
9412 ;; (article-number . line-number-in-body).
9413 (setq gnus-newsgroup-bookmarks
9417 (set-buffer gnus-article-buffer
)
9421 (goto-char (point-min))
9422 (search-forward "\n\n" nil t
)
9425 gnus-newsgroup-bookmarks
))
9426 (gnus-message 6 "A bookmark has been added to the current article."))
9428 (defun gnus-summary-remove-bookmark (article)
9429 "Remove the bookmark from the current article."
9430 (interactive (list (gnus-summary-article-number)))
9431 ;; Remove old bookmark, if one exists.
9432 (let ((old (assq article gnus-newsgroup-bookmarks
)))
9435 (setq gnus-newsgroup-bookmarks
9436 (delq old gnus-newsgroup-bookmarks
))
9437 (gnus-message 6 "Removed bookmark."))
9438 (gnus-message 6 "No bookmark in current article."))))
9440 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9441 (defun gnus-summary-mark-as-dormant (n)
9442 "Mark N articles forward as dormant.
9443 If N is negative, mark backward instead. The difference between N and
9444 the actual number of articles marked is returned."
9446 (gnus-summary-mark-forward n gnus-dormant-mark
))
9448 (defun gnus-summary-set-process-mark (article)
9449 "Set the process mark on ARTICLE and update the summary line."
9450 (setq gnus-newsgroup-processable
9452 (delq article gnus-newsgroup-processable
)))
9453 (let ((buffer-read-only nil
))
9454 (if (gnus-summary-goto-subject article
)
9456 (gnus-summary-show-thread)
9457 (and (eq (gnus-summary-article-mark) gnus-dummy-mark
)
9459 (gnus-summary-update-mark gnus-process-mark
'replied
)
9462 (defun gnus-summary-remove-process-mark (article)
9463 "Remove the process mark from ARTICLE and update the summary line."
9464 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
9465 (let ((buffer-read-only nil
))
9466 (if (gnus-summary-goto-subject article
)
9468 (gnus-summary-show-thread)
9469 (and (eq (gnus-summary-article-mark) gnus-dummy-mark
)
9471 (gnus-summary-update-mark ?
'replied
)
9472 (if (memq article gnus-newsgroup-replied
)
9473 (gnus-summary-update-mark gnus-replied-mark
'replied
))
9476 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
9477 "Mark N articles as read forwards.
9478 If N is negative, mark backwards instead.
9479 Mark with MARK. If MARK is ? , ?! or ??, articles will be
9481 The difference between N and the actual number of articles marked is
9484 (gnus-set-global-variables)
9485 (let ((backward (< n
0))
9486 (gnus-summary-goto-unread
9487 (and gnus-summary-goto-unread
9488 (not (memq mark
(list gnus-unread-mark
9489 gnus-ticked-mark gnus-dormant-mark
)))))
9491 (mark (or mark gnus-del-mark
)))
9493 (gnus-summary-mark-article nil mark no-expire
)
9494 (zerop (gnus-summary-next-subject
9495 (if backward -
1 1) gnus-summary-goto-unread t
)))
9497 (if (/= 0 n
) (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
9498 (gnus-summary-recenter)
9499 (gnus-summary-position-cursor)
9500 (gnus-set-mode-line 'summary
)
9503 (defun gnus-summary-mark-article-as-read (mark)
9504 "Mark the current article quickly as read with MARK."
9505 (let ((article (gnus-summary-article-number)))
9506 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
9507 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
9508 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
9509 (setq gnus-newsgroup-reads
9510 (cons (cons article mark
) gnus-newsgroup-reads
))
9511 ;; Possibly remove from cache, if that is used.
9512 (and gnus-use-cache
(gnus-cache-enter-remove-article article
))
9513 (and gnus-newsgroup-auto-expire
9514 (or (= mark gnus-killed-mark
) (= mark gnus-del-mark
)
9515 (= mark gnus-catchup-mark
) (= mark gnus-low-score-mark
)
9516 (= mark gnus-read-mark
))
9518 (setq mark gnus-expirable-mark
)
9519 (setq gnus-newsgroup-expirable
9520 (cons article gnus-newsgroup-expirable
))))
9521 (while (eq (gnus-summary-article-mark) gnus-dummy-mark
)
9524 (gnus-summary-update-mark mark
'unread
)
9527 (defun gnus-summary-mark-article-as-unread (mark)
9528 "Mark the current article quickly as unread with MARK."
9529 (let ((article (gnus-summary-article-number)))
9530 (or (memq article gnus-newsgroup-unreads
)
9531 (setq gnus-newsgroup-unreads
(cons article gnus-newsgroup-unreads
)))
9532 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
9533 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
9534 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
9535 (setq gnus-newsgroup-reads
9536 (delq (assq article gnus-newsgroup-reads
)
9537 gnus-newsgroup-reads
))
9538 (if (= mark gnus-ticked-mark
)
9539 (setq gnus-newsgroup-marked
(cons article gnus-newsgroup-marked
)))
9540 (if (= mark gnus-dormant-mark
)
9541 (setq gnus-newsgroup-dormant
(cons article gnus-newsgroup-dormant
)))
9543 ;; See whether the article is to be put in the cache.
9545 (vectorp (gnus-get-header-by-num article
))
9547 (gnus-cache-possibly-enter-article
9548 gnus-newsgroup-name article
9549 (gnus-get-header-by-num article
)
9550 (= mark gnus-ticked-mark
)
9551 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
9553 (while (eq (gnus-summary-article-mark) gnus-dummy-mark
)
9556 (gnus-summary-update-mark mark
'unread
)
9559 (defun gnus-summary-mark-article (&optional article mark no-expire
)
9560 "Mark ARTICLE with MARK. MARK can be any character.
9561 Four MARK strings are reserved: `? ' (unread), `?!' (ticked), `??'
9562 (dormant) and `?E' (expirable).
9563 If MARK is nil, then the default character `?D' is used.
9564 If ARTICLE is nil, then the article on the current line will be
9567 (setq mark
(aref mark
0)))
9568 ;; If no mark is given, then we check auto-expiring.
9569 (and (not no-expire
)
9570 gnus-newsgroup-auto-expire
9573 (or (= mark gnus-killed-mark
) (= mark gnus-del-mark
)
9574 (= mark gnus-catchup-mark
) (= mark gnus-low-score-mark
)
9575 (= mark gnus-read-mark
))))
9576 (setq mark gnus-expirable-mark
))
9577 (let* ((mark (or mark gnus-del-mark
))
9578 (article (or article
(gnus-summary-article-number))))
9579 (or article
(error "No article on current line"))
9580 (if (or (= mark gnus-unread-mark
)
9581 (= mark gnus-ticked-mark
)
9582 (= mark gnus-dormant-mark
))
9583 (gnus-mark-article-as-unread article mark
)
9584 (gnus-mark-article-as-read article mark
))
9586 ;; See whether the article is to be put in the cache.
9588 (not (= mark gnus-canceled-mark
))
9589 (vectorp (gnus-get-header-by-num article
))
9591 (gnus-cache-possibly-enter-article
9592 gnus-newsgroup-name article
9593 (gnus-get-header-by-num article
)
9594 (= mark gnus-ticked-mark
)
9595 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
9597 (if (gnus-summary-goto-subject article
)
9598 (let ((buffer-read-only nil
))
9599 (gnus-summary-show-thread)
9600 (and (eq (gnus-summary-article-mark) gnus-dummy-mark
)
9603 (gnus-summary-update-mark mark
'unread
)
9606 (defun gnus-summary-update-mark (mark type
)
9608 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
9609 (buffer-read-only nil
)
9613 (forward-char forward
)
9614 (setq plist
(text-properties-at (point)))
9617 (and plist
(add-text-properties (1- (point)) (point) plist
))
9618 (and (eq type
'unread
)
9620 (add-text-properties (1- (point)) (point) (list 'gnus-mark mark
))
9621 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
9623 (defun gnus-mark-article-as-read (article &optional mark
)
9624 "Enter ARTICLE in the pertinent lists and remove it from others."
9625 ;; Make the article expirable.
9626 (let ((mark (or mark gnus-del-mark
)))
9627 (if (= mark gnus-expirable-mark
)
9628 (setq gnus-newsgroup-expirable
(cons article gnus-newsgroup-expirable
))
9629 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)))
9630 ;; Remove from unread and marked lists.
9631 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
9632 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
9633 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
9634 (setq gnus-newsgroup-reads
9635 (cons (cons article mark
) gnus-newsgroup-reads
))
9636 ;; Possibly remove from cache, if that is used.
9637 (and gnus-use-cache
(gnus-cache-enter-remove-article article
))))
9639 (defun gnus-mark-article-as-unread (article &optional mark
)
9640 "Enter ARTICLE in the pertinent lists and remove it from others."
9641 (let ((mark (or mark gnus-ticked-mark
)))
9642 ;; Add to unread list.
9643 (or (memq article gnus-newsgroup-unreads
)
9644 (setq gnus-newsgroup-unreads
(cons article gnus-newsgroup-unreads
)))
9645 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
9646 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
9647 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
9648 (setq gnus-newsgroup-reads
9649 (delq (assq article gnus-newsgroup-reads
)
9650 gnus-newsgroup-reads
))
9651 (if (= mark gnus-ticked-mark
)
9652 (setq gnus-newsgroup-marked
(cons article gnus-newsgroup-marked
)))
9653 (if (= mark gnus-dormant-mark
)
9654 (setq gnus-newsgroup-dormant
(cons article gnus-newsgroup-dormant
)))))
9656 (defalias 'gnus-summary-mark-as-unread-forward
9657 'gnus-summary-tick-article-forward
)
9658 (make-obsolete 'gnus-summary-mark-as-unread-forward
9659 'gnus-summary-tick-article-forward
)
9660 (defun gnus-summary-tick-article-forward (n)
9661 "Tick N articles forwards.
9662 If N is negative, tick backwards instead.
9663 The difference between N and the number of articles ticked is returned."
9665 (gnus-summary-mark-forward n gnus-ticked-mark
))
9667 (defalias 'gnus-summary-mark-as-unread-backward
9668 'gnus-summary-tick-article-backward
)
9669 (make-obsolete 'gnus-summary-mark-as-unread-backward
9670 'gnus-summary-tick-article-backward
)
9671 (defun gnus-summary-tick-article-backward (n)
9672 "Tick N articles backwards.
9673 The difference between N and the number of articles ticked is returned."
9675 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
9677 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
9678 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
9679 (defun gnus-summary-tick-article (&optional article clear-mark
)
9680 "Mark current article as unread.
9681 Optional 1st argument ARTICLE specifies article number to be marked as unread.
9682 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
9683 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
9686 (defun gnus-summary-mark-as-read-forward (n)
9687 "Mark N articles as read forwards.
9688 If N is negative, mark backwards instead.
9689 The difference between N and the actual number of articles marked is
9692 (gnus-summary-mark-forward n gnus-del-mark t
))
9694 (defun gnus-summary-mark-as-read-backward (n)
9695 "Mark the N articles as read backwards.
9696 The difference between N and the actual number of articles marked is
9699 (gnus-summary-mark-forward (- n
) gnus-del-mark t
))
9701 (defun gnus-summary-mark-as-read (&optional article mark
)
9702 "Mark current article as read.
9703 ARTICLE specifies the article to be marked as read.
9704 MARK specifies a string to be inserted at the beginning of the line."
9705 (gnus-summary-mark-article article mark
))
9707 (defun gnus-summary-clear-mark-forward (n)
9708 "Clear marks from N articles forward.
9709 If N is negative, clear backward instead.
9710 The difference between N and the number of marks cleared is returned."
9712 (gnus-summary-mark-forward n gnus-unread-mark
))
9714 (defun gnus-summary-clear-mark-backward (n)
9715 "Clear marks from N articles backward.
9716 The difference between N and the number of marks cleared is returned."
9718 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
9720 (defun gnus-summary-mark-unread-as-read ()
9721 "Intended to be used by `gnus-summary-mark-article-hook'."
9722 (or (memq gnus-current-article gnus-newsgroup-marked
)
9723 (memq gnus-current-article gnus-newsgroup-dormant
)
9724 (memq gnus-current-article gnus-newsgroup-expirable
)
9725 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
9727 (defun gnus-summary-mark-region-as-read (point mark all
)
9728 "Mark all unread articles between point and mark as read.
9729 If given a prefix, mark all articles between point and mark as read,
9730 even ticked and dormant ones."
9731 (interactive "r\nP")
9741 (not (memq (gnus-summary-article-number)
9742 gnus-newsgroup-marked
))
9743 (not (memq (gnus-summary-article-number)
9744 gnus-newsgroup-dormant
))))
9745 (gnus-summary-mark-article
9746 (gnus-summary-article-number) gnus-del-mark
))
9748 (zerop (forward-line 1))))))
9750 ;; Fix by Per Abrahamsen <amanda@iesd.auc.dk>.
9751 (defalias 'gnus-summary-delete-marked-as-read
9752 'gnus-summary-remove-lines-marked-as-read
)
9753 (make-obsolete 'gnus-summary-delete-marked-as-read
9754 'gnus-summary-remove-lines-marked-as-read
)
9755 (defun gnus-summary-remove-lines-marked-as-read ()
9756 "Remove lines that are marked as read."
9758 (gnus-summary-remove-lines-marked-with
9760 (lambda (char) (char-to-string (symbol-value char
)))
9761 '(gnus-del-mark gnus-read-mark gnus-ancient-mark
9762 gnus-killed-mark gnus-kill-file-mark
9763 gnus-low-score-mark gnus-expirable-mark
9764 gnus-canceled-mark gnus-catchup-mark
)
9767 (defalias 'gnus-summary-delete-marked-with
9768 'gnus-summary-remove-lines-marked-with
)
9769 (make-obsolete 'gnus-summary-delete-marked-with
9770 'gnus-summary-remove-lines-marked-with
)
9771 ;; Rewrite by Daniel Quinlan <quinlan@best.com>.
9772 (defun gnus-summary-remove-lines-marked-with (marks)
9773 "Remove lines that are marked with MARKS (e.g. \"DK\")."
9774 (interactive "sMarks: ")
9775 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>.
9776 (gnus-set-global-variables)
9777 (let ((buffer-read-only nil
)
9779 (let ((gnus-summary-check-current t
))
9780 (gnus-summary-search-forward t
)
9781 (gnus-summary-article-number)))
9782 (marks (concat "^[" marks
"]")))
9783 (goto-char (point-min))
9784 (if gnus-newsgroup-adaptive
9785 (gnus-score-remove-lines-adaptive marks
)
9786 (while (re-search-forward marks nil t
)
9787 (gnus-delete-line)))
9788 ;; If we use dummy roots, we have to do an additional sweep over
9790 (if (not (eq gnus-summary-make-false-root
'dummy
))
9792 (goto-char (point-min))
9793 (setq marks
(concat "^[" (char-to-string gnus-dummy-mark
) "]"))
9794 (while (re-search-forward marks nil t
)
9795 (if (gnus-subject-equal
9796 (gnus-summary-subject-string)
9799 (gnus-summary-subject-string)))
9802 (gnus-delete-line))))
9803 (or (zerop (buffer-size))
9804 (gnus-summary-goto-subject orig-article
)
9806 (gnus-summary-prev-subject 1)
9807 (gnus-summary-position-cursor)))))
9809 (defun gnus-summary-expunge-below (&optional score
)
9810 "Remove articles with score less than SCORE."
9812 (gnus-set-global-variables)
9813 (setq score
(if score
9814 (prefix-numeric-value score
)
9815 (or gnus-summary-default-score
0)))
9817 (set-buffer gnus-summary-buffer
)
9818 (goto-char (point-min))
9819 (let ((buffer-read-only nil
)
9822 (if (< (gnus-summary-article-score) score
)
9826 (delete-region beg
(point)))
9829 (or (zerop (buffer-size))
9831 (gnus-summary-prev-subject 1)
9832 (gnus-summary-position-cursor))))))
9834 (defun gnus-summary-mark-below (score mark
)
9835 "Mark articles with score less than SCORE with MARK."
9836 (interactive "P\ncMark: ")
9837 (gnus-set-global-variables)
9838 (setq score
(if score
9839 (prefix-numeric-value score
)
9840 (or gnus-summary-default-score
0)))
9842 (set-buffer gnus-summary-buffer
)
9843 (goto-char (point-min))
9845 (and (< (gnus-summary-article-score) score
)
9846 (gnus-summary-mark-article nil mark
))
9849 (defun gnus-summary-kill-below (&optional score
)
9850 "Mark articles with score below SCORE as read."
9852 (gnus-set-global-variables)
9853 (gnus-summary-mark-below score gnus-killed-mark
))
9855 (defun gnus-summary-clear-above (&optional score
)
9856 "Clear all marks from articles with score above SCORE."
9858 (gnus-set-global-variables)
9859 (gnus-summary-mark-above score gnus-unread-mark
))
9861 (defun gnus-summary-tick-above (&optional score
)
9862 "Tick all articles with score above SCORE."
9864 (gnus-set-global-variables)
9865 (gnus-summary-mark-above score gnus-ticked-mark
))
9867 (defun gnus-summary-mark-above (score mark
)
9868 "Mark articles with score over SCORE with MARK."
9869 (interactive "P\ncMark: ")
9870 (gnus-set-global-variables)
9871 (setq score
(if score
9872 (prefix-numeric-value score
)
9873 (or gnus-summary-default-score
0)))
9875 (set-buffer gnus-summary-buffer
)
9876 (goto-char (point-min))
9878 (if (> (gnus-summary-article-score) score
)
9880 (gnus-summary-mark-article nil mark
)
9882 (forward-line 1)))))
9884 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9885 (defun gnus-summary-show-all-expunged ()
9886 "Display all the hidden articles that were expunged for low scores."
9888 (gnus-set-global-variables)
9889 (let ((buffer-read-only nil
))
9890 (let ((scored gnus-newsgroup-scored
)
9893 (or (gnus-summary-goto-subject (car (car scored
)))
9894 (and (setq h
(gnus-get-header-by-num (car (car scored
))))
9895 (< (cdr (car scored
)) gnus-summary-expunge-below
)
9896 (setq headers
(cons h headers
))))
9897 (setq scored
(cdr scored
)))
9898 (or headers
(error "No expunged articles hidden."))
9899 (goto-char (point-min))
9901 (gnus-summary-update-lines
9904 (gnus-summary-prepare-unthreaded (nreverse headers
))
9906 (goto-char (point-min))
9907 (gnus-summary-position-cursor)))
9909 (defun gnus-summary-show-all-dormant ()
9910 "Display all the hidden articles that are marked as dormant."
9912 (gnus-set-global-variables)
9913 (let ((buffer-read-only nil
))
9914 (let ((dormant gnus-newsgroup-dormant
)
9917 (or (gnus-summary-goto-subject (car dormant
))
9918 (and (setq h
(gnus-get-header-by-num (car dormant
)))
9919 (setq headers
(cons h headers
))))
9920 (setq dormant
(cdr dormant
)))
9921 (or headers
(error "No dormant articles hidden."))
9922 (goto-char (point-min))
9924 (gnus-summary-update-lines
9927 (gnus-summary-prepare-unthreaded (nreverse headers
))
9929 (goto-char (point-min))
9930 (gnus-summary-position-cursor)))
9932 (defun gnus-summary-hide-all-dormant ()
9933 "Hide all dormant articles."
9935 (gnus-set-global-variables)
9936 (gnus-summary-remove-lines-marked-with (char-to-string gnus-dormant-mark
))
9937 (gnus-summary-position-cursor))
9939 (defun gnus-summary-catchup (&optional all quietly to-here not-mark
)
9940 "Mark all articles not marked as unread in this newsgroup as read.
9941 If prefix argument ALL is non-nil, all articles are marked as read.
9942 If QUIETLY is non-nil, no questions will be asked.
9943 If TO-HERE is non-nil, it should be a point in the buffer. All
9944 articles before this point will be marked as read.
9945 The number of articles marked as read is returned."
9947 (gnus-set-global-variables)
9950 (not gnus-interactive-catchup
) ;Without confirmation?
9954 "Mark absolutely all articles as read? "
9955 "Mark all unread articles as read? ")))
9957 (not gnus-newsgroup-adaptive
)
9958 (not gnus-newsgroup-auto-expire
))
9960 (and all
(setq gnus-newsgroup-marked nil
9961 gnus-newsgroup-dormant nil
))
9962 (setq gnus-newsgroup-unreads
9963 (append gnus-newsgroup-marked gnus-newsgroup-dormant
)))
9964 ;; We actually mark all articles as canceled, which we
9965 ;; have to do when using auto-expiry or adaptive scoring.
9966 (gnus-summary-show-all-threads)
9967 (if (gnus-summary-first-subject (not all
))
9969 (if to-here
(< (point) to-here
) t
)
9970 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
9971 (gnus-summary-search-subject nil
(not all
)))))
9973 (setq gnus-newsgroup-unreads
9974 (append gnus-newsgroup-marked
9975 gnus-newsgroup-dormant
)))))
9976 (let ((method (gnus-find-method-for-group gnus-newsgroup-name
)))
9977 (if (and (not to-here
) (eq 'nnvirtual
(car method
)))
9978 (nnvirtual-catchup-group
9979 (gnus-group-real-name gnus-newsgroup-name
) (nth 1 method
) all
)))
9980 (gnus-summary-position-cursor)))
9982 (defun gnus-summary-catchup-to-here (&optional all
)
9983 "Mark all unticked articles before the current one as read.
9984 If ALL is non-nil, also mark ticked and dormant articles as read."
9986 (gnus-set-global-variables)
9988 (and (zerop (forward-line -
1))
9991 (gnus-summary-catchup all t
(point))
9992 (gnus-set-mode-line 'summary
))))
9993 (gnus-summary-position-cursor))
9995 (defun gnus-summary-catchup-all (&optional quietly
)
9996 "Mark all articles in this newsgroup as read."
9998 (gnus-set-global-variables)
9999 (gnus-summary-catchup t quietly
))
10001 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
10002 "Mark all articles not marked as unread in this newsgroup as read, then exit.
10003 If prefix argument ALL is non-nil, all articles are marked as read."
10005 (gnus-set-global-variables)
10006 (gnus-summary-catchup all quietly nil
'fast
)
10007 ;; Select next newsgroup or exit.
10008 (if (and (eq gnus-auto-select-next
'quietly
)
10009 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
10010 (gnus-summary-next-group nil
)
10011 (gnus-summary-exit)))
10013 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
10014 "Mark all articles in this newsgroup as read, and then exit."
10016 (gnus-set-global-variables)
10017 (gnus-summary-catchup-and-exit t quietly
))
10019 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
10020 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
10021 "Mark all articles in this group as read and select the next group.
10022 If given a prefix, mark all articles, unread as well as ticked, as
10025 (gnus-set-global-variables)
10026 (gnus-summary-catchup all
)
10027 (gnus-summary-next-group))
10029 ;; Thread-based commands.
10031 (defun gnus-summary-toggle-threads (&optional arg
)
10032 "Toggle showing conversation threads.
10033 If ARG is positive number, turn showing conversation threads on."
10035 (gnus-set-global-variables)
10036 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
10037 (setq gnus-show-threads
10038 (if (null arg
) (not gnus-show-threads
)
10039 (> (prefix-numeric-value arg
) 0)))
10040 (gnus-summary-prepare)
10041 (gnus-summary-goto-subject current
)
10042 (gnus-summary-position-cursor)))
10044 (defun gnus-summary-show-all-threads ()
10045 "Show all threads."
10047 (gnus-set-global-variables)
10049 (let ((buffer-read-only nil
))
10050 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
10051 (gnus-summary-position-cursor))
10053 (defun gnus-summary-show-thread ()
10054 "Show thread subtrees.
10055 Returns nil if no thread was there to be shown."
10057 (gnus-set-global-variables)
10058 (let ((buffer-read-only nil
)
10059 (orig (prog1 (point) (gnus-summary-hide-thread)))
10060 ;; first goto end then to beg, to have point at beg after let
10061 (end (progn (end-of-line) (point)))
10062 (beg (progn (beginning-of-line) (point))))
10064 ;; Any hidden lines here?
10065 (search-forward "\r" end t
)
10066 (subst-char-in-region beg end ?\^M ?
\n t
)
10068 (gnus-summary-position-cursor))))
10070 (defun gnus-summary-hide-all-threads ()
10071 "Hide all thread subtrees."
10073 (gnus-set-global-variables)
10075 (goto-char (point-min))
10076 (gnus-summary-hide-thread)
10077 (while (and (not (eobp)) (zerop (forward-line 1)))
10078 (gnus-summary-hide-thread)))
10079 (gnus-summary-position-cursor))
10081 (defun gnus-summary-hide-thread ()
10082 "Hide thread subtrees.
10083 Returns nil if no threads were there to be hidden."
10085 (gnus-set-global-variables)
10086 (let ((buffer-read-only nil
)
10088 (level (gnus-summary-thread-level))
10090 ;; Go forward until either the buffer ends or the subthread
10094 (while (and (zerop (forward-line 1))
10095 (> (gnus-summary-thread-level) level
))
10096 (setq end
(point)))
10100 (search-backward "\n" start t
))
10101 (subst-char-in-region start end ?
\n ?\^M t
)
10103 (gnus-summary-position-cursor)))))
10105 (defun gnus-summary-go-to-next-thread (&optional previous
)
10106 "Go to the same level (or less) next thread.
10107 If PREVIOUS is non-nil, go to previous thread instead.
10108 Return the article number moved to, or nil if moving was impossible."
10109 (let ((level (gnus-summary-thread-level))
10110 (article (gnus-summary-article-number)))
10112 (while (and (zerop (forward-line -
1))
10113 (> (gnus-summary-thread-level) level
)))
10114 (while (and (save-excursion
10117 (zerop (forward-line 1))
10118 (> (gnus-summary-thread-level) level
))))
10119 (gnus-summary-recenter)
10120 (gnus-summary-position-cursor)
10121 (let ((oart (gnus-summary-article-number)))
10122 (and (/= oart article
) oart
))))
10124 (defun gnus-summary-next-thread (n)
10125 "Go to the same level next N'th thread.
10126 If N is negative, search backward instead.
10127 Returns the difference between N and the number of skips actually
10130 (gnus-set-global-variables)
10131 (let ((backward (< n
0))
10133 (while (and (> n
0)
10134 (gnus-summary-go-to-next-thread backward
))
10136 (gnus-summary-position-cursor)
10137 (if (/= 0 n
) (gnus-message 7 "No more threads"))
10140 (defun gnus-summary-prev-thread (n)
10141 "Go to the same level previous N'th thread.
10142 Returns the difference between N and the number of skips actually
10145 (gnus-set-global-variables)
10146 (gnus-summary-next-thread (- n
)))
10148 (defun gnus-summary-go-down-thread (&optional same
)
10149 "Go down one level in the current thread.
10150 If SAME is non-nil, also move to articles of the same level."
10151 (let ((level (gnus-summary-thread-level))
10153 (if (and (zerop (forward-line 1))
10154 (> (gnus-summary-thread-level) level
))
10159 (defun gnus-summary-go-up-thread ()
10160 "Go up one level in the current thread."
10161 (let ((level (gnus-summary-thread-level))
10163 (while (and (zerop (forward-line -
1))
10164 (>= (gnus-summary-thread-level) level
)))
10165 (if (>= (gnus-summary-thread-level) level
)
10171 (defun gnus-summary-down-thread (n)
10172 "Go down thread N steps.
10173 If N is negative, go up instead.
10174 Returns the difference between N and how many steps down that were
10177 (gnus-set-global-variables)
10180 (while (and (> n
0)
10181 (if up
(gnus-summary-go-up-thread)
10182 (gnus-summary-go-down-thread)))
10184 (gnus-summary-position-cursor)
10185 (if (/= 0 n
) (gnus-message 7 "Can't go further"))
10188 (defun gnus-summary-up-thread (n)
10189 "Go up thread N steps.
10190 If N is negative, go up instead.
10191 Returns the difference between N and how many steps down that were
10194 (gnus-set-global-variables)
10195 (gnus-summary-down-thread (- n
)))
10197 (defun gnus-summary-kill-thread (&optional unmark
)
10198 "Mark articles under current thread as read.
10199 If the prefix argument is positive, remove any kinds of marks.
10200 If the prefix argument is negative, tick articles instead."
10202 (gnus-set-global-variables)
10204 (setq unmark
(prefix-numeric-value unmark
)))
10206 (level (gnus-summary-thread-level)))
10208 ;; Expand the thread.
10209 (gnus-summary-show-thread)
10211 ;; Mark the article...
10212 (cond ((null unmark
) (gnus-summary-mark-article-as-read
10214 ((> unmark
0) (gnus-summary-mark-article-as-unread
10216 (t (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
10217 ;; ...and go forward until either the buffer ends or the subtree
10219 (if (not (and (zerop (forward-line 1))
10220 (> (gnus-summary-thread-level) level
)))
10221 (setq killing nil
))))
10222 ;; Hide killed subtrees.
10224 gnus-thread-hide-killed
10225 (gnus-summary-hide-thread))
10226 ;; If marked as read, go to next unread subject.
10228 ;; Go to next unread subject.
10229 (gnus-summary-next-subject 1 t
)))
10230 (gnus-set-mode-line 'summary
))
10232 ;; Summary sorting commands
10234 (defun gnus-summary-sort-by-number (&optional reverse
)
10235 "Sort summary buffer by article number.
10236 Argument REVERSE means reverse order."
10238 (gnus-set-global-variables)
10240 ;; `gnus-summary-article-number' is a macro, and `sort-subr' wants
10241 ;; a function, so we wrap it.
10242 (cons (lambda () (gnus-summary-article-number))
10243 'gnus-thread-sort-by-number
) reverse
))
10245 (defun gnus-summary-sort-by-author (&optional reverse
)
10246 "Sort summary buffer by author name alphabetically.
10247 If case-fold-search is non-nil, case of letters is ignored.
10248 Argument REVERSE means reverse order."
10250 (gnus-set-global-variables)
10254 (let* ((header (gnus-get-header-by-num (gnus-summary-article-number)))
10256 (if (not (vectorp header
))
10258 (setq extract
(funcall gnus-extract-address-components
10259 (mail-header-from header
)))
10260 (concat (or (car extract
) (cdr extract
))
10261 "\r" (int-to-string (mail-header-number header
))
10262 "\r" (mail-header-subject header
)))))
10263 'gnus-thread-sort-by-author
)
10266 (defun gnus-summary-sort-by-subject (&optional reverse
)
10267 "Sort summary buffer by subject alphabetically. `Re:'s are ignored.
10268 If case-fold-search is non-nil, case of letters is ignored.
10269 Argument REVERSE means reverse order."
10271 (gnus-set-global-variables)
10275 (let* ((header (gnus-get-header-by-num (gnus-summary-article-number)))
10277 (if (not (vectorp header
))
10279 (setq extract
(funcall gnus-extract-address-components
10280 (mail-header-from header
)))
10282 (downcase (gnus-simplify-subject (gnus-summary-subject-string) t
))
10283 "\r" (int-to-string (mail-header-number header
))
10284 "\r" (or (car extract
) (cdr extract
))))))
10285 'gnus-thread-sort-by-subject
)
10288 (defun gnus-summary-sort-by-date (&optional reverse
)
10289 "Sort summary buffer by date.
10290 Argument REVERSE means reverse order."
10292 (gnus-set-global-variables)
10296 (gnus-sortable-date
10298 (gnus-get-header-by-num (gnus-summary-article-number)))))
10299 'gnus-thread-sort-by-date
)
10302 (defun gnus-summary-sort-by-score (&optional reverse
)
10303 "Sort summary buffer by score.
10304 Argument REVERSE means reverse order."
10306 (gnus-set-global-variables)
10308 (cons (lambda () (gnus-summary-article-score))
10309 'gnus-thread-sort-by-score
)
10312 (defvar gnus-summary-already-sorted nil
)
10313 (defun gnus-summary-sort (predicate reverse
)
10314 ;; Sort summary buffer by PREDICATE. REVERSE means reverse order.
10315 (if gnus-summary-already-sorted
10317 (let (buffer-read-only)
10318 (if (not gnus-show-threads
)
10319 ;; We do untreaded sorting...
10321 (goto-char (point-min))
10322 (sort-subr reverse
'forward-line
'end-of-line
(car predicate
)))
10323 ;; ... or we do threaded sorting.
10324 (let ((gnus-thread-sort-functions (list (cdr predicate
)))
10325 (gnus-summary-prepare-hook nil
)
10326 (gnus-summary-already-sorted nil
))
10327 ;; We do that by simply regenerating the threads.
10328 (gnus-summary-prepare)
10329 (and gnus-show-threads
10330 gnus-thread-hide-subtree
10331 (gnus-summary-hide-all-threads))
10332 ;; If in async mode, we send some info to the backend.
10333 (and gnus-newsgroup-async
10334 (setq gnus-newsgroup-threads
(nreverse gnus-newsgroup-threads
))
10335 (gnus-request-asynchronous
10336 gnus-newsgroup-name
10337 (if (and gnus-asynchronous-article-function
10338 (fboundp gnus-asynchronous-article-function
))
10339 (funcall gnus-asynchronous-article-function
10340 gnus-newsgroup-threads
)
10341 gnus-newsgroup-threads
))))))))
10344 (defun gnus-sortable-date (date)
10345 "Make sortable string by string-lessp from DATE.
10346 Timezone package is used."
10347 (let* ((date (timezone-fix-time date nil nil
)) ;[Y M D H M S]
10348 (year (aref date
0))
10349 (month (aref date
1))
10350 (day (aref date
2)))
10351 (timezone-make-sortable-date
10353 (timezone-make-time-string
10354 (aref date
3) (aref date
4) (aref date
5)))))
10357 ;; Summary saving commands.
10359 (defun gnus-summary-save-article (&optional n
)
10360 "Save the current article using the default saver function.
10361 If N is a positive number, save the N next articles.
10362 If N is a negative number, save the N previous articles.
10363 If N is nil and any articles have been marked with the process mark,
10364 save those articles instead.
10365 The variable `gnus-default-article-saver' specifies the saver function."
10367 (gnus-set-global-variables)
10368 (let ((articles (gnus-summary-work-articles n
)))
10370 (let ((header (gnus-get-header-by-num (car articles
))))
10371 (if (vectorp header
)
10373 (save-window-excursion
10374 (gnus-summary-select-article t nil nil
(car articles
)))
10375 (or gnus-save-all-headers
10376 (gnus-article-hide-headers t
))
10377 ;; Remove any X-Gnus lines.
10380 (set-buffer gnus-article-buffer
)
10381 (let ((buffer-read-only nil
))
10382 (goto-char (point-min))
10383 (narrow-to-region (point) (or (search-forward "\n\n" nil t
)
10385 (while (re-search-forward "^X-Gnus" nil t
)
10386 (beginning-of-line)
10387 (delete-region (point)
10388 (progn (forward-line 1) (point))))
10390 (save-window-excursion
10391 (if gnus-default-article-saver
10392 (funcall gnus-default-article-saver
)
10393 (error "No default saver is defined."))))
10394 (if (assq 'name header
)
10395 (gnus-copy-file (cdr (assq 'name header
)))
10396 (gnus-message 1 "Article %d is unsavable" (car articles
)))))
10397 (gnus-summary-remove-process-mark (car articles
))
10398 (setq articles
(cdr articles
)))
10399 (gnus-summary-position-cursor)
10402 (defun gnus-summary-pipe-output (&optional arg
)
10403 "Pipe the current article to a subprocess.
10404 If N is a positive number, pipe the N next articles.
10405 If N is a negative number, pipe the N previous articles.
10406 If N is nil and any articles have been marked with the process mark,
10407 pipe those articles instead."
10409 (gnus-set-global-variables)
10410 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
))
10411 (gnus-summary-save-article arg
)))
10413 (defun gnus-summary-save-article-mail (&optional arg
)
10414 "Append the current article to an mail file.
10415 If N is a positive number, save the N next articles.
10416 If N is a negative number, save the N previous articles.
10417 If N is nil and any articles have been marked with the process mark,
10418 save those articles instead."
10420 (gnus-set-global-variables)
10421 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
10422 (gnus-summary-save-article arg
)))
10424 (defun gnus-summary-save-article-rmail (&optional arg
)
10425 "Append the current article to an rmail file.
10426 If N is a positive number, save the N next articles.
10427 If N is a negative number, save the N previous articles.
10428 If N is nil and any articles have been marked with the process mark,
10429 save those articles instead."
10431 (gnus-set-global-variables)
10432 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
10433 (gnus-summary-save-article arg
)))
10435 (defun gnus-summary-save-article-file (&optional arg
)
10436 "Append the current article to a file.
10437 If N is a positive number, save the N next articles.
10438 If N is a negative number, save the N previous articles.
10439 If N is nil and any articles have been marked with the process mark,
10440 save those articles instead."
10442 (gnus-set-global-variables)
10443 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
10444 (gnus-summary-save-article arg
)))
10446 (defun gnus-read-save-file-name (prompt default-name
)
10447 (let ((methods gnus-split-methods
)
10449 (if (not gnus-split-methods
)
10452 (set-buffer gnus-article-buffer
)
10453 (gnus-narrow-to-headers)
10455 (goto-char (point-min))
10456 (and (condition-case ()
10457 (re-search-forward (car (car methods
)) nil t
)
10459 (setq split-name
(cons (nth 1 (car methods
)) split-name
)))
10460 (setq methods
(cdr methods
)))
10462 (cond ((null split-name
)
10464 (concat prompt
" (default "
10465 (file-name-nondirectory default-name
) ") ")
10466 (file-name-directory default-name
)
10468 ((= 1 (length split-name
))
10470 (concat prompt
" (default " (car split-name
) ") ")
10471 gnus-article-save-directory
10472 (concat gnus-article-save-directory
(car split-name
))))
10474 (setq split-name
(mapcar (lambda (el) (list el
))
10475 (nreverse split-name
)))
10476 (let ((result (completing-read
10477 (concat prompt
" ")
10478 split-name nil nil
)))
10479 (concat gnus-article-save-directory
10480 (if (string= result
"")
10481 (car (car split-name
))
10484 (defun gnus-summary-save-in-rmail (&optional filename
)
10485 "Append this article to Rmail file.
10486 Optional argument FILENAME specifies file name.
10487 Directory to save to is default to `gnus-article-save-directory' which
10488 is initialized from the SAVEDIR environment variable."
10490 (gnus-set-global-variables)
10491 (let ((default-name
10492 (funcall gnus-rmail-save-name gnus-newsgroup-name
10493 gnus-current-headers gnus-newsgroup-last-rmail
)))
10495 (setq filename
(gnus-read-save-file-name
10496 "Save in rmail file:" default-name
)))
10497 (gnus-make-directory (file-name-directory filename
))
10498 (gnus-eval-in-buffer-window
10499 gnus-article-buffer
10503 (gnus-output-to-rmail filename
))))
10504 ;; Remember the directory name to save articles
10505 (setq gnus-newsgroup-last-rmail filename
)))
10507 (defun gnus-summary-save-in-mail (&optional filename
)
10508 "Append this article to Unix mail file.
10509 Optional argument FILENAME specifies file name.
10510 Directory to save to is default to `gnus-article-save-directory' which
10511 is initialized from the SAVEDIR environment variable."
10513 (gnus-set-global-variables)
10514 (let ((default-name
10515 (funcall gnus-mail-save-name gnus-newsgroup-name
10516 gnus-current-headers gnus-newsgroup-last-mail
)))
10518 (setq filename
(gnus-read-save-file-name
10519 "Save in Unix mail file:" default-name
)))
10521 (expand-file-name filename
10523 (file-name-directory default-name
))))
10524 (gnus-make-directory (file-name-directory filename
))
10525 (gnus-eval-in-buffer-window
10526 gnus-article-buffer
10530 (if (and (file-readable-p filename
) (mail-file-babyl-p filename
))
10531 (gnus-output-to-rmail filename
)
10532 (rmail-output filename
1 t t
)))))
10533 ;; Remember the directory name to save articles.
10534 (setq gnus-newsgroup-last-mail filename
)))
10536 (defun gnus-summary-save-in-file (&optional filename
)
10537 "Append this article to file.
10538 Optional argument FILENAME specifies file name.
10539 Directory to save to is default to `gnus-article-save-directory' which
10540 is initialized from the SAVEDIR environment variable."
10542 (gnus-set-global-variables)
10543 (let ((default-name
10544 (funcall gnus-file-save-name gnus-newsgroup-name
10545 gnus-current-headers gnus-newsgroup-last-file
)))
10547 (setq filename
(gnus-read-save-file-name
10548 "Save in file:" default-name
)))
10549 (gnus-make-directory (file-name-directory filename
))
10550 (gnus-eval-in-buffer-window
10551 gnus-article-buffer
10555 (gnus-output-to-file filename
))))
10556 ;; Remember the directory name to save articles.
10557 (setq gnus-newsgroup-last-file filename
)))
10559 (defun gnus-summary-save-in-pipe (&optional command
)
10560 "Pipe this article to subprocess."
10562 (gnus-set-global-variables)
10563 (let ((command (read-string "Shell command on article: "
10564 gnus-last-shell-command
)))
10565 (if (string-equal command
"")
10566 (setq command gnus-last-shell-command
))
10567 (gnus-eval-in-buffer-window
10568 gnus-article-buffer
10571 (shell-command-on-region (point-min) (point-max) command nil
)))
10572 (setq gnus-last-shell-command command
)))
10574 ;; Summary extract commands
10576 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
10577 (let ((buffer-read-only nil
)
10578 (article (gnus-summary-article-number))
10580 (or (gnus-summary-goto-subject article
)
10581 (error (format "No such article: %d" article
)))
10582 (gnus-summary-position-cursor)
10583 ;; If all commands are to be bunched up on one line, we collect
10585 (if gnus-view-pseudos-separately
10587 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
10590 (setq action
(cdr (assq 'action
(car ps
))))
10591 (setq files
(list (cdr (assq 'name
(car ps
)))))
10592 (while (and ps
(cdr ps
)
10593 (string= (or action
"1")
10594 (or (cdr (assq 'action
(car (cdr ps
)))) "2")))
10595 (setq files
(cons (cdr (assq 'name
(car (cdr ps
)))) files
))
10596 (setcdr ps
(cdr (cdr ps
))))
10599 (if (not (string-match "%s" action
))
10600 (setq files
(cons " " files
)))
10601 (setq files
(cons " " files
))
10602 (and (assq 'execute
(car ps
))
10603 (setcdr (assq 'execute
(car ps
))
10604 (funcall (if (string-match "%s" action
)
10607 (mapconcat (lambda (f) f
) files
" ")))))
10608 (setq ps
(cdr ps
)))))
10609 (if (and gnus-view-pseudos
(not not-view
))
10611 (and (assq 'execute
(car pslist
))
10612 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
10613 (eq gnus-view-pseudos
'not-confirm
)))
10614 (setq pslist
(cdr pslist
)))
10617 (gnus-summary-goto-subject (or (cdr (assq 'article
(car pslist
)))
10618 (gnus-summary-article-number)))
10621 (insert " " (file-name-nondirectory
10622 (cdr (assq 'name
(car pslist
))))
10623 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
10624 (add-text-properties
10625 b
(1+ b
) (list 'gnus-number gnus-reffed-article-number
10626 'gnus-mark gnus-unread-mark
10628 'gnus-pseudo
(car pslist
)))
10630 (gnus-sethash (int-to-string gnus-reffed-article-number
)
10631 (car pslist
) gnus-newsgroup-headers-hashtb-by-number
)
10632 (setq gnus-newsgroup-unreads
10633 (cons gnus-reffed-article-number gnus-newsgroup-unreads
))
10634 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
10635 (setq pslist
(cdr pslist
)))))))
10637 (defun gnus-pseudos< (p1 p2
)
10638 (let ((c1 (cdr (assq 'action p1
)))
10639 (c2 (cdr (assq 'action p2
))))
10640 (and c1 c2
(string< c1 c2
))))
10642 (defun gnus-request-pseudo-article (props)
10643 (cond ((assq 'execute props
)
10644 (gnus-execute-command (cdr (assq 'execute props
)))))
10645 (let ((gnus-current-article (gnus-summary-article-number)))
10646 (run-hooks 'gnus-mark-article-hook
)))
10648 (defun gnus-execute-command (command &optional automatic
)
10650 (gnus-article-setup-buffer)
10651 (set-buffer gnus-article-buffer
)
10652 (let ((command (if automatic command
(read-string "Command: " command
)))
10653 (buffer-read-only nil
))
10655 (insert "$ " command
"\n\n")
10656 (if gnus-view-pseudo-asynchronously
10657 (start-process "gnus-execute" nil
"sh" "-c" command
)
10658 (call-process "sh" nil t nil
"-c" command
)))))
10660 (defun gnus-copy-file (file &optional to
)
10663 (list (read-file-name "Copy file: " default-directory
)
10664 (read-file-name "Copy file to: " default-directory
)))
10665 (gnus-set-global-variables)
10666 (or to
(setq to
(read-file-name "Copy file to: " default-directory
)))
10667 (and (file-directory-p to
)
10668 (setq to
(concat (file-name-as-directory to
)
10669 (file-name-nondirectory file
))))
10670 (copy-file file to
))
10672 ;; Summary kill commands.
10674 (defun gnus-summary-edit-global-kill (article)
10675 "Edit the \"global\" kill file."
10676 (interactive (list (gnus-summary-article-number)))
10677 (gnus-set-global-variables)
10678 (gnus-group-edit-global-kill article
))
10680 (defun gnus-summary-edit-local-kill ()
10681 "Edit a local kill file applied to the current newsgroup."
10683 (gnus-set-global-variables)
10684 (setq gnus-current-headers
10686 (int-to-string (gnus-summary-article-number))
10687 gnus-newsgroup-headers-hashtb-by-number
))
10688 (gnus-set-global-variables)
10689 (gnus-group-edit-local-kill
10690 (gnus-summary-article-number) gnus-newsgroup-name
))
10694 ;;; Gnus article mode
10697 (put 'gnus-article-mode
'mode-class
'special
)
10699 (defvar gnus-bugaboo nil
)
10701 (if gnus-article-mode-map
10703 (setq gnus-article-mode-map
(make-keymap))
10704 (suppress-keymap gnus-article-mode-map
)
10705 (define-key gnus-article-mode-map
" " 'gnus-article-next-page
)
10706 (define-key gnus-article-mode-map
"\177" 'gnus-article-prev-page
)
10707 (define-key gnus-article-mode-map
"\C-c^" 'gnus-article-refer-article
)
10708 (define-key gnus-article-mode-map
"h" 'gnus-article-show-summary
)
10709 (define-key gnus-article-mode-map
"s" 'gnus-article-show-summary
)
10710 (define-key gnus-article-mode-map
"\C-c\C-m" 'gnus-article-mail
)
10711 (define-key gnus-article-mode-map
"?" 'gnus-article-describe-briefly
)
10712 (define-key gnus-article-mode-map gnus-mouse-2
'gnus-article-push-button
)
10713 (define-key gnus-article-mode-map
"\r" 'gnus-article-press-button
)
10714 (define-key gnus-article-mode-map
"\t" 'gnus-article-next-button
)
10715 (define-key gnus-article-mode-map
"\C-c\C-b" 'gnus-bug
)
10717 ;; Duplicate almost all summary keystrokes in the article mode map.
10720 "p" "N" "P" "\M-\C-n" "\M-\C-p"
10721 "\M-n" "\M-p" "." "," "\M-s" "\M-r" "<" ">" "j"
10722 "u" "!" "U" "d" "D" "E" "\M-u" "\M-U" "k" "\C-k" "\M-\C-k"
10723 "\M-\C-l" "e" "#" "\M-#" "\M-\C-t" "\M-\C-s" "\M-\C-h"
10724 "\M-\C-f" "\M-\C-b" "\M-\C-u" "\M-\C-d" "&" "\C-w"
10725 "\C-t" "?" "\C-c\M-\C-s" "\C-c\C-s\C-n" "\C-c\C-s\C-a"
10726 "\C-c\C-s\C-s" "\C-c\C-s\C-d" "\C-c\C-s\C-i" "\C-x\C-s"
10727 "\M-g" "w" "\C-c\C-r" "\M-t" "C"
10728 "o" "\C-o" "|" "\M-k" "\M-K" "V" "\C-c\C-d"
10729 "\C-c\C-i" "x" "X" "t" "g" "?" "l"
10730 "\C-c\C-v\C-v" "\C-d" "v"
10731 ;; "Mt" "M!" "Md" "Mr"
10732 ;; "Mc" "M " "Me" "Mx" "M?" "Mb" "MB" "M#" "M\M-#" "M\M-r"
10733 ;; "M\M-\C-r" "MD" "M\M-D" "MS" "MC" "MH" "M\C-c" "Mk" "MK"
10734 ;; "Ms" "Mc" "Mu" "Mm" "Mk" "Gn" "Gp" "GN" "GP" "G\C-n" "G\C-p"
10735 ;; "G\M-n" "G\M-p" "Gf" "Gb" "Gg" "Gl" "Gp" "Tk" "Tl" "Ti" "TT"
10736 ;; "Ts" "TS" "Th" "TH" "Tn" "Tp" "Tu" "Td" "T#" "A " "An" "A\177" "Ap"
10737 ;; "A\r" "A<" "A>" "Ab" "Ae" "A^" "Ar" "Aw" "Ac" "Ag" "At" "Am"
10738 ;; "As" "Wh" "Ws" "Wc" "Wo" "Ww" "Wd" "Wq" "Wf" "Wt" "W\C-t"
10739 ;; "WT" "WA" "Wa" "WH" "WC" "WS" "Wb" "Hv" "Hf" "Hd" "Hh" "Hi"
10740 ;; "Be" "B\177" "Bm" "Br" "Bw" "Bc" "Bq" "Bi" "Oo" "Om" "Or"
10741 ;; "Of" "Oh" "Ov" "Op" "Vu" "V\C-s" "V\C-r" "Vr" "V&" "VT" "Ve"
10742 ;; "VD" "Vk" "VK" "Vsn" "Vsa" "Vss" "Vsd" "Vsi"
10744 (while (and gnus-bugaboo commands
) ; disabled
10745 (define-key gnus-article-mode-map
(car commands
)
10746 'gnus-article-summary-command
)
10747 (setq commands
(cdr commands
))))
10749 (let ((commands (list "q" "Q" "c" "r" "R" "\C-c\C-f" "m" "a" "f" "F"
10750 ;; "Zc" "ZC" "ZE" "ZQ" "ZZ" "Zn" "ZR" "ZG" "ZN" "ZP"
10751 "=" "n" "^" "\M-^")))
10752 (while (and gnus-bugaboo commands
) ; disabled
10753 (define-key gnus-article-mode-map
(car commands
)
10754 'gnus-article-summary-command-nosave
)
10755 (setq commands
(cdr commands
)))))
10758 (defun gnus-article-mode ()
10759 "Major mode for displaying an article.
10761 All normal editing commands are switched off.
10763 The following commands are available:
10765 \\<gnus-article-mode-map>
10766 \\[gnus-article-next-page]\t Scroll the article one page forwards
10767 \\[gnus-article-prev-page]\t Scroll the article one page backwards
10768 \\[gnus-article-refer-article]\t Go to the article referred to by an article id near point
10769 \\[gnus-article-show-summary]\t Display the summary buffer
10770 \\[gnus-article-mail]\t Send a reply to the address near point
10771 \\[gnus-article-describe-briefly]\t Describe the current mode briefly
10772 \\[gnus-info-find-node]\t Go to the Gnus info node"
10774 (if gnus-visual
(gnus-article-make-menu-bar))
10775 (kill-all-local-variables)
10776 (gnus-simplify-mode-line)
10777 (setq mode-name
"Article")
10778 (setq major-mode
'gnus-article-mode
)
10779 (make-local-variable 'minor-mode-alist
)
10780 (or (assq 'gnus-show-mime minor-mode-alist
)
10781 (setq minor-mode-alist
10782 (cons (list 'gnus-show-mime
" MIME") minor-mode-alist
)))
10783 (use-local-map gnus-article-mode-map
)
10784 (make-local-variable 'page-delimiter
)
10785 (setq page-delimiter gnus-page-delimiter
)
10786 (buffer-disable-undo (current-buffer))
10787 (setq buffer-read-only t
) ;Disable modification
10788 (run-hooks 'gnus-article-mode-hook
))
10790 (defun gnus-article-setup-buffer ()
10791 "Initialize article mode buffer."
10792 ;; Returns the article buffer.
10793 (if (get-buffer gnus-article-buffer
)
10795 (set-buffer gnus-article-buffer
)
10796 (buffer-disable-undo (current-buffer))
10797 (setq buffer-read-only t
)
10798 (gnus-add-current-to-buffer-list)
10799 (or (eq major-mode
'gnus-article-mode
)
10800 (gnus-article-mode))
10803 (set-buffer (get-buffer-create gnus-article-buffer
))
10804 (gnus-add-current-to-buffer-list)
10805 (gnus-article-mode)
10806 (current-buffer))))
10808 ;; Set article window start at LINE, where LINE is the number of lines
10809 ;; from the head of the article.
10810 (defun gnus-article-set-window-start (&optional line
)
10812 (get-buffer-window gnus-article-buffer
)
10814 (set-buffer gnus-article-buffer
)
10815 (goto-char (point-min))
10818 (gnus-message 6 "Moved to bookmark")
10819 (search-forward "\n\n" nil t
)
10820 (forward-line line
)
10823 (defun gnus-request-article-this-buffer (article group
)
10824 "Get an article and insert it into this buffer."
10825 (setq group
(or group gnus-newsgroup-name
))
10827 ;; Open server if it has closed.
10828 (gnus-check-server (gnus-find-method-for-group group
))
10830 ;; Using `gnus-request-article' directly will insert the article into
10831 ;; `nntp-server-buffer' - so we'll save some time by not having to
10832 ;; copy it from the server buffer into the article buffer.
10834 ;; We only request an article by message-id when we do not have the
10835 ;; headers for it, so we'll have to get those.
10836 (and (stringp article
)
10837 (let ((gnus-override-method gnus-refer-article-method
))
10838 (gnus-read-header article
)))
10840 ;; If the article number is negative, that means that this article
10841 ;; doesn't belong in this newsgroup (possibly), so we find its
10842 ;; message-id and request it by id instead of number.
10843 (if (not (numberp article
))
10846 (set-buffer gnus-summary-buffer
)
10847 (let ((header (gnus-get-header-by-num article
)))
10849 (if (vectorp header
)
10850 ;; It's a real article.
10851 (setq article
(mail-header-id header
))
10852 ;; It is an extracted pseudo-article.
10853 (setq article
'pseudo
)
10854 (gnus-request-pseudo-article header
)))
10856 (let ((method (gnus-find-method-for-group gnus-newsgroup-name
)))
10857 (if (not (eq (car method
) 'nneething
))
10859 (let ((dir (concat (file-name-as-directory (nth 1 method
))
10860 (mail-header-subject header
))))
10861 (if (file-directory-p dir
)
10863 (setq article
'nneething
)
10864 (gnus-group-enter-directory dir
)))))))))
10866 ;; Check the cache.
10867 (if (and gnus-use-cache
10869 (gnus-cache-request-article article group
))
10871 ;; Get the article and put into the article buffer.
10872 (if (or (stringp article
) (numberp article
))
10875 ;; There may be some overlays that we have to kill...
10877 (let ((overlays (and (fboundp 'overlays-at
)
10878 (overlays-at (point-min)))))
10880 (delete-overlay (car overlays
))
10881 (setq overlays
(cdr overlays
))))
10883 (let ((gnus-override-method
10884 (and (stringp article
) gnus-refer-article-method
)))
10885 (and (gnus-request-article article group
(current-buffer))
10889 (defun gnus-read-header (id)
10890 "Read the headers of article ID and enter them into the Gnus system."
10892 (if (not (setq header
10893 (car (if (let ((gnus-nov-is-evil t
))
10894 (gnus-retrieve-headers
10895 (list id
) gnus-newsgroup-name
))
10896 (gnus-get-newsgroup-headers)))))
10899 (mail-header-set-number header gnus-reffed-article-number
))
10900 (setq gnus-newsgroup-headers
(cons header gnus-newsgroup-headers
))
10901 (gnus-sethash (int-to-string (mail-header-number header
)) header
10902 gnus-newsgroup-headers-hashtb-by-number
)
10904 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
)))
10905 (setq gnus-current-headers header
)
10908 (defun gnus-article-prepare (article &optional all-headers header
)
10909 "Prepare ARTICLE in article mode buffer.
10910 ARTICLE should either be an article number or a Message-ID.
10911 If ARTICLE is an id, HEADER should be the article headers.
10912 If ALL-HEADERS is non-nil, no headers are hidden."
10914 ;; Make sure we start in a summary buffer.
10915 (or (eq major-mode
'gnus-summary-mode
)
10916 (set-buffer gnus-summary-buffer
))
10917 (setq gnus-summary-buffer
(current-buffer))
10918 ;; Make sure the connection to the server is alive.
10919 (or (gnus-server-opened (gnus-find-method-for-group gnus-newsgroup-name
))
10922 (gnus-find-method-for-group gnus-newsgroup-name
))
10923 (gnus-request-group gnus-newsgroup-name t
)))
10924 (let* ((article (if header
(mail-header-number header
) article
))
10925 (summary-buffer (current-buffer))
10926 (internal-hook gnus-article-internal-prepare-hook
)
10927 (group gnus-newsgroup-name
)
10930 (gnus-article-setup-buffer)
10931 (set-buffer gnus-article-buffer
)
10932 (if (not (setq result
(let ((buffer-read-only nil
))
10933 (gnus-request-article-this-buffer
10935 ;; There is no such article.
10937 (if (not (numberp article
))
10939 (setq gnus-article-current
10940 (cons gnus-newsgroup-name article
))
10941 (set-buffer gnus-summary-buffer
)
10942 (setq gnus-current-article article
)
10943 (gnus-summary-mark-article article gnus-canceled-mark
))
10944 (gnus-message 1 "No such article (may be canceled)")
10947 (if (or (eq result
'pseudo
) (eq result
'nneething
))
10950 (set-buffer summary-buffer
)
10951 (setq gnus-last-article gnus-current-article
10952 gnus-newsgroup-history
(cons gnus-current-article
10953 gnus-newsgroup-history
)
10954 gnus-current-article
0
10955 gnus-current-headers nil
10956 gnus-article-current nil
)
10957 (if (eq result
'nneething
)
10958 (gnus-configure-windows 'summary
)
10959 (gnus-configure-windows 'article
))
10960 (gnus-set-global-variables))
10961 (gnus-set-mode-line 'article
))
10962 ;; The result from the `request' was an actual article -
10963 ;; or at least some text that is now displayed in the
10965 (if (and (numberp article
)
10966 (not (eq article gnus-current-article
)))
10967 ;; Seems like a new article has been selected.
10968 ;; `gnus-current-article' must be an article number.
10970 (set-buffer summary-buffer
)
10971 (setq gnus-last-article gnus-current-article
10972 gnus-newsgroup-history
(cons gnus-current-article
10973 gnus-newsgroup-history
)
10974 gnus-current-article article
10975 gnus-current-headers
10976 (gnus-get-header-by-num gnus-current-article
)
10977 gnus-article-current
10978 (cons gnus-newsgroup-name gnus-current-article
))
10979 (gnus-summary-show-thread)
10980 (run-hooks 'gnus-mark-article-hook
)
10981 (gnus-set-mode-line 'summary
)
10983 (run-hooks 'gnus-visual-mark-article-hook
))
10984 ;; Set the global newsgroup variables here.
10985 ;; Suggested by Jim Sisolak
10986 ;; <sisolak@trans4.neep.wisc.edu>.
10987 (gnus-set-global-variables)
10988 (setq gnus-have-all-headers
10989 (or all-headers gnus-show-all-headers
))
10990 (and gnus-use-cache
10991 (vectorp (gnus-get-header-by-number article
))
10992 (gnus-cache-possibly-enter-article
10994 (gnus-get-header-by-number article
)
10995 (memq article gnus-newsgroup-marked
)
10996 (memq article gnus-newsgroup-dormant
)
10997 (memq article gnus-newsgroup-unreads
)))))
10998 ;; Hooks for getting information from the article.
10999 ;; This hook must be called before being narrowed.
11000 (let (buffer-read-only)
11001 (run-hooks 'internal-hook
)
11002 (run-hooks 'gnus-article-prepare-hook
)
11003 ;; Decode MIME message.
11004 (if (and gnus-show-mime
11005 (or (not gnus-strict-mime
)
11006 (gnus-fetch-field "Mime-Version")))
11007 (funcall gnus-show-mime-method
))
11008 ;; Perform the article display hooks.
11009 (run-hooks 'gnus-article-display-hook
))
11011 (goto-char (point-min))
11012 (and gnus-break-pages
(gnus-narrow-to-page))
11013 (gnus-set-mode-line 'article
)
11014 (gnus-configure-windows 'article
)
11015 (goto-char (point-min))
11018 (defun gnus-article-show-all-headers ()
11019 "Show all article headers in article mode buffer."
11021 (gnus-article-setup-buffer)
11022 (set-buffer gnus-article-buffer
)
11023 (let ((buffer-read-only nil
))
11024 (remove-text-properties (point-min) (point-max)
11025 gnus-hidden-properties
))))
11027 (defun gnus-article-hide-headers-if-wanted ()
11028 "Hide unwanted headers if `gnus-have-all-headers' is nil.
11029 Provided for backwards compatibility."
11030 (or (save-excursion (set-buffer gnus-summary-buffer
) gnus-have-all-headers
)
11031 (gnus-article-hide-headers)))
11033 (defun gnus-article-hide-headers (&optional delete
)
11034 "Hide unwanted headers and possibly sort them as well."
11037 (set-buffer gnus-article-buffer
)
11039 (let ((sorted gnus-sorted-header-list
)
11040 (buffer-read-only nil
)
11041 want-list beg want-l
)
11042 ;; First we narrow to just the headers.
11044 (goto-char (point-min))
11045 ;; Hide any "From " lines at the beginning of (mail) articles.
11046 (while (looking-at "From ")
11049 (add-text-properties (point-min) (point) gnus-hidden-properties
))
11050 ;; Then treat the rest of the header lines.
11053 (progn (search-forward "\n\n" nil t
) (forward-line -
1) (point)))
11054 ;; Then we use the two regular expressions
11055 ;; `gnus-ignored-headers' and `gnus-visible-headers' to
11056 ;; select which header lines is to remain visible in the
11058 (goto-char (point-min))
11059 (while (re-search-forward "^[^ \t]*:" nil t
)
11060 (beginning-of-line)
11061 ;; We add the headers we want to keep to a list and delete
11062 ;; them from the buffer.
11063 (if (or (and (stringp gnus-visible-headers
)
11064 (looking-at gnus-visible-headers
))
11065 (and (not (stringp gnus-visible-headers
))
11066 (stringp gnus-ignored-headers
)
11067 (not (looking-at gnus-ignored-headers
))))
11071 ;; Be sure to get multi-line headers...
11072 (re-search-forward "^[^ \t]*:" nil t
)
11073 (beginning-of-line)
11075 (cons (buffer-substring beg
(point)) want-list
))
11076 (delete-region beg
(point))
11079 ;; Next we perform the sorting by looking at
11080 ;; `gnus-sorted-header-list'.
11081 (goto-char (point-min))
11082 (while (and sorted want-list
)
11083 (setq want-l want-list
)
11085 (not (string-match (car sorted
) (car want-l
))))
11086 (setq want-l
(cdr want-l
)))
11089 (insert (car want-l
))
11090 (setq want-list
(delq (car want-l
) want-list
))))
11091 (setq sorted
(cdr sorted
)))
11092 ;; Any headers that were not matched by the sorted list we
11093 ;; just tack on the end of the visible header list.
11095 (insert (car want-list
))
11096 (setq want-list
(cdr want-list
)))
11097 ;; And finally we make the unwanted headers invisible.
11099 (delete-region (point) (point-max))
11100 ;; Suggested by Sudish Joseph <joseph@cis.ohio-state.edu>.
11101 (add-text-properties (point) (point-max) gnus-hidden-properties
))))))
11103 ;; Written by Per Abrahamsen <amanda@iesd.auc.dk>.
11104 (defun gnus-article-treat-overstrike ()
11105 "Translate overstrikes into bold text."
11108 (set-buffer gnus-article-buffer
)
11109 (let ((buffer-read-only nil
))
11110 (while (search-forward "\b" nil t
)
11111 (let ((next (following-char))
11112 (previous (char-after (- (point) 2))))
11113 (cond ((eq next previous
)
11114 (put-text-property (- (point) 2) (point)
11116 (put-text-property (point) (1+ (point))
11119 (put-text-property (1- (point)) (1+ (point))
11121 (put-text-property (1- (point)) (point)
11124 (put-text-property (- (point) 2) (point)
11126 (put-text-property (point) (1+ (point))
11127 'face
'underline
))))))))
11129 (defun gnus-article-word-wrap ()
11130 "Format too long lines."
11133 (set-buffer gnus-article-buffer
)
11134 (let ((buffer-read-only nil
))
11135 (goto-char (point-min))
11136 (search-forward "\n\n" nil t
)
11138 (let ((paragraph-start "^[>|#:<;* ]*[ \t]*$")
11139 (adaptive-fill-regexp "[ \t]*\\([|#:<;>*]+ *\\)?")
11140 (adaptive-fill-mode t
))
11141 (while (not (eobp))
11142 (and (>= (current-column) (min fill-column
(window-width)))
11143 (/= (preceding-char) ?
:)
11144 (fill-paragraph nil
))
11145 (end-of-line 2))))))
11147 (defun gnus-article-remove-cr ()
11148 "Remove carriage returns from an article."
11151 (set-buffer gnus-article-buffer
)
11152 (let ((buffer-read-only nil
))
11153 (goto-char (point-min))
11154 (while (search-forward "\r" nil t
)
11155 (replace-match "" t t
)))))
11157 (defun gnus-article-display-x-face (&optional force
)
11158 "Look for an X-Face header and display it if present."
11159 (interactive (list 'force
))
11161 (set-buffer gnus-article-buffer
)
11162 (let ((inhibit-point-motion-hooks t
)
11163 (case-fold-search nil
)
11166 (goto-char (point-min))
11167 (search-forward "\n\n")
11168 (narrow-to-region (point-min) (point))
11169 (goto-char (point-min))
11170 (setq from
(mail-fetch-field "from"))
11171 (if (not (and gnus-article-x-face-command
11173 (not gnus-article-x-face-too-ugly
)
11174 (and gnus-article-x-face-too-ugly from
11175 (not (string-match gnus-article-x-face-too-ugly
11178 (goto-char (point-min))
11179 (re-search-forward "^X-Face: " nil t
))))
11181 (let ((beg (point))
11182 (end (1- (re-search-forward "^\\($\\|[^ \t]\\)" nil t
))))
11183 (if (symbolp gnus-article-x-face-command
)
11184 (and (or (fboundp gnus-article-x-face-command
)
11185 (error "%s is not a function"
11186 gnus-article-x-face-command
))
11187 (funcall gnus-article-x-face-command beg end
))
11188 (call-process-region beg end
"sh" nil
0 nil
11189 "-c" gnus-article-x-face-command
))))))))
11191 (defun gnus-article-de-quoted-unreadable (&optional force
)
11192 "Do a naive translation of a quoted-printable-encoded article.
11193 This is in no way, shape or form meant as a replacement for real MIME
11194 processing, but is simply a stop-gap measure until MIME support is
11196 If FORCE, decode the article whether it is marked as quoted-printable
11198 (interactive (list 'force
))
11200 (set-buffer gnus-article-buffer
)
11201 (let ((case-fold-search t
)
11202 (buffer-read-only nil
)
11203 (type (gnus-fetch-field "content-transfer-encoding")))
11204 (if (or force
(and type
(string-match "quoted-printable" type
)))
11206 (goto-char (point-min))
11207 (search-forward "\n\n" nil
'move
)
11208 (gnus-mime-decode-quoted-printable (point) (point-max)))))))
11210 (defun gnus-mime-decode-quoted-printable (from to
)
11211 ;; Decode quoted-printable from region between FROM and TO.
11214 (while (search-forward "=" to t
)
11215 (cond ((eq (following-char) ?
\n)
11218 ((looking-at "[0-9A-F][0-9A-F]")
11220 (insert (hexl-hex-string-to-integer
11221 (buffer-substring (point) (+ 2 (point)))))
11225 ((gnus-message 3 "Malformed MIME quoted-printable message"))))))
11227 (defvar gnus-article-time-units
11228 (list (cons 'year
(* 365.25 24 60 60))
11229 (cons 'week
(* 7 24 60 60))
11230 (cons 'day
(* 24 60 60))
11231 (cons 'hour
(* 60 60))
11235 (defun gnus-article-date-ut (&optional type
)
11236 "Convert DATE date to universal time in the current article.
11237 If TYPE is `local', convert to local time; if it is `lapsed', output
11238 how much time has lapsed since DATE."
11239 (interactive (list 'ut
))
11240 (let ((date (mail-header-date (or gnus-current-headers
11241 (gnus-get-header-by-number
11242 (gnus-summary-article-number))"")))
11243 (date-regexp "^Date: \\|^X-Sent: "))
11248 (set-buffer gnus-article-buffer
)
11249 (let ((buffer-read-only nil
))
11250 (goto-char (point-min))
11251 (if (and (re-search-forward date-regexp nil t
)
11253 (beginning-of-line)
11254 (looking-at date-regexp
)))
11255 (delete-region (gnus-point-at-bol)
11256 (progn (end-of-line) (1+ (point))))
11257 (goto-char (point-min))
11258 (goto-char (- (search-forward "\n\n") 2)))
11262 (concat "Date: " (condition-case ()
11263 (timezone-make-date-arpa-standard date
)
11269 (timezone-make-date-arpa-standard date nil
"UT")
11273 ;; If the date is seriously mangled, the timezone
11274 ;; functions are liable to bug out, so we condition-case
11275 ;; the entire thing.
11276 (let* ((real-sec (condition-case ()
11277 (- (gnus-seconds-since-epoch
11278 (timezone-make-date-arpa-standard
11279 (current-time-string)
11280 (current-time-zone) "UT"))
11281 (gnus-seconds-since-epoch
11282 (timezone-make-date-arpa-standard
11285 (sec (abs real-sec
))
11293 (if (zerop (setq num
(ffloor (/ sec
(cdr unit
)))))
11295 (setq sec
(- sec
(* num
(cdr unit
))))
11297 (concat (if prev
", " "") (int-to-string
11299 " " (symbol-name (car unit
))
11300 (if (> num
1) "s" ""))
11302 gnus-article-time-units
"")
11305 " in the future\n")))))
11307 (error "Unknown conversion type: %s" type
)))))))))
11309 (defun gnus-article-date-local ()
11310 "Convert the current article date to the local timezone."
11312 (gnus-article-date-ut 'local
))
11314 (defun gnus-article-date-lapsed ()
11315 "Convert the current article date to time lapsed since it was sent."
11317 (gnus-article-date-ut 'lapsed
))
11319 (defun gnus-article-maybe-highlight ()
11320 "Do some article highlighting if `gnus-visual' is non-nil."
11321 (if gnus-visual
(gnus-article-highlight-some)))
11325 (defun gnus-output-to-rmail (file-name)
11326 "Append the current article to an Rmail file named FILE-NAME."
11328 ;; Most of these codes are borrowed from rmailout.el.
11329 (setq file-name
(expand-file-name file-name
))
11330 (setq rmail-default-rmail-file file-name
)
11331 (let ((artbuf (current-buffer))
11332 (tmpbuf (get-buffer-create " *Gnus-output*")))
11334 (or (get-file-buffer file-name
)
11335 (file-exists-p file-name
)
11336 (if (gnus-yes-or-no-p
11337 (concat "\"" file-name
"\" does not exist, create it? "))
11338 (let ((file-buffer (create-file-buffer file-name
)))
11340 (set-buffer file-buffer
)
11341 (rmail-insert-rmail-file-header)
11342 (let ((require-final-newline nil
))
11343 (write-region (point-min) (point-max) file-name t
1)))
11344 (kill-buffer file-buffer
))
11345 (error "Output file does not exist")))
11346 (set-buffer tmpbuf
)
11347 (buffer-disable-undo (current-buffer))
11349 (insert-buffer-substring artbuf
)
11350 (gnus-convert-article-to-rmail)
11351 ;; Decide whether to append to a file or to an Emacs buffer.
11352 (let ((outbuf (get-file-buffer file-name
)))
11354 (append-to-file (point-min) (point-max) file-name
)
11355 ;; File has been visited, in buffer OUTBUF.
11356 (set-buffer outbuf
)
11357 (let ((buffer-read-only nil
)
11358 (msg (and (boundp 'rmail-current-message
)
11359 (symbol-value 'rmail-current-message
))))
11360 ;; If MSG is non-nil, buffer is in RMAIL mode.
11363 (narrow-to-region (point-max) (point-max))))
11364 (insert-buffer-substring tmpbuf
)
11367 (goto-char (point-min))
11369 (search-backward "\^_")
11370 (narrow-to-region (point) (point-max))
11371 (goto-char (1+ (point-min)))
11372 (rmail-count-new-messages t
)
11373 (rmail-show-message msg
)))))))
11374 (kill-buffer tmpbuf
)))
11376 (defun gnus-output-to-file (file-name)
11377 "Append the current article to a file named FILE-NAME."
11378 (setq file-name
(expand-file-name file-name
))
11379 (let ((artbuf (current-buffer))
11380 (tmpbuf (get-buffer-create " *Gnus-output*")))
11382 (set-buffer tmpbuf
)
11383 (buffer-disable-undo (current-buffer))
11385 (insert-buffer-substring artbuf
)
11386 ;; Append newline at end of the buffer as separator, and then
11387 ;; save it to file.
11388 (goto-char (point-max))
11390 (append-to-file (point-min) (point-max) file-name
))
11391 (kill-buffer tmpbuf
)))
11393 (defun gnus-convert-article-to-rmail ()
11394 "Convert article in current buffer to Rmail message format."
11395 (let ((buffer-read-only nil
))
11396 ;; Convert article directly into Babyl format.
11397 ;; Suggested by Rob Austein <sra@lcs.mit.edu>
11398 (goto-char (point-min))
11399 (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
11400 (while (search-forward "\n\^_" nil t
) ;single char
11401 (replace-match "\n^_" t t
)) ;2 chars: "^" and "_"
11402 (goto-char (point-max))
11405 (defun gnus-narrow-to-page (&optional arg
)
11406 "Make text outside current page invisible except for page delimiter.
11407 A numeric arg specifies to move forward or backward by that many pages,
11408 thus showing a page other than the one point was originally in."
11410 (setq arg
(if arg
(prefix-numeric-value arg
) 0))
11412 (forward-page -
1) ;Beginning of current page.
11417 (forward-page (1- arg
))))
11418 ;; Find the end of the page.
11420 ;; If we stopped due to end of buffer, stay there.
11421 ;; If we stopped after a page delimiter, put end of restriction
11422 ;; at the beginning of that line.
11423 ;; These are commented out.
11424 ;; (if (save-excursion (beginning-of-line)
11425 ;; (looking-at page-delimiter))
11426 ;; (beginning-of-line))
11427 (narrow-to-region (point)
11429 ;; Find the top of the page.
11431 ;; If we found beginning of buffer, stay there.
11432 ;; If extra text follows page delimiter on same line,
11434 ;; Otherwise, show text starting with following line.
11435 (if (and (eolp) (not (bobp)))
11439 (defun gnus-gmt-to-local ()
11440 "Rewrite Date header described in GMT to local in current buffer.
11441 Intended to be used with gnus-article-prepare-hook."
11445 (goto-char (point-min))
11446 (narrow-to-region (point-min)
11447 (progn (search-forward "\n\n" nil
'move
) (point)))
11448 (goto-char (point-min))
11449 (if (re-search-forward "^Date:[ \t]\\(.*\\)$" nil t
)
11450 (let ((buffer-read-only nil
)
11451 (date (buffer-substring-no-properties
11452 (match-beginning 1) (match-end 1))))
11453 (delete-region (match-beginning 1) (match-end 1))
11455 (timezone-make-date-arpa-standard
11456 date nil
(current-time-zone))))))))
11459 ;; Article mode commands
11461 (defun gnus-article-next-page (&optional lines
)
11462 "Show next page of current article.
11463 If end of article, return non-nil. Otherwise return nil.
11464 Argument LINES specifies lines to be scrolled up."
11466 (move-to-window-line -
1)
11467 ;; Fixed by enami@ptgd.sony.co.jp (enami tsugutomo)
11468 (if (save-excursion
11470 (and (pos-visible-in-window-p) ;Not continuation line.
11472 ;; Nothing in this page.
11473 (if (or (not gnus-break-pages
)
11476 (widen) (forward-line 1) (eobp)))) ;Real end-of-buffer?
11478 (gnus-narrow-to-page 1) ;Go to next page.
11480 ;; More in this page.
11484 ;; Long lines may cause an end-of-buffer error.
11485 (goto-char (point-max))))
11488 (defun gnus-article-prev-page (&optional lines
)
11489 "Show previous page of current article.
11490 Argument LINES specifies lines to be scrolled down."
11492 (move-to-window-line 0)
11493 (if (and gnus-break-pages
11495 (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer?
11497 (gnus-narrow-to-page -
1) ;Go to previous page.
11498 (goto-char (point-max))
11500 (scroll-down lines
)))
11502 (defun gnus-article-refer-article ()
11503 "Read article specified by message-id around point."
11505 (search-forward ">" nil t
) ;Move point to end of "<....>".
11506 (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t
)
11508 (buffer-substring (match-beginning 1) (match-end 1))))
11509 (set-buffer gnus-summary-buffer
)
11510 (gnus-summary-refer-article message-id
))
11511 (error "No references around point")))
11513 (defun gnus-article-show-summary ()
11514 "Reconfigure windows to show summary buffer."
11516 (gnus-configure-windows 'article
)
11517 (gnus-summary-goto-subject gnus-current-article
))
11519 (defun gnus-article-describe-briefly ()
11520 "Describe article mode commands briefly."
11523 (substitute-command-keys "\\<gnus-article-mode-map>\\[gnus-article-next-page]:Next page \\[gnus-article-prev-page]:Prev page \\[gnus-article-show-summary]:Show summary \\[gnus-info-find-node]:Run Info \\[gnus-article-describe-briefly]:This help")))
11525 (defun gnus-article-summary-command ()
11526 "Execute the last keystroke in the summary buffer."
11528 (let ((obuf (current-buffer))
11529 (owin (current-window-configuration))
11531 (switch-to-buffer gnus-summary-buffer
'norecord
)
11532 (setq func
(lookup-key (current-local-map) (this-command-keys)))
11533 (call-interactively func
)
11535 (set-window-configuration owin
)
11536 (set-window-point (get-buffer-window (current-buffer)) (point))))
11538 (defun gnus-article-summary-command-nosave ()
11539 "Execute the last keystroke in the summary buffer."
11542 (pop-to-buffer gnus-summary-buffer
'norecord
)
11543 (setq func
(lookup-key (current-local-map) (this-command-keys)))
11544 (call-interactively func
)))
11547 ;; Basic ideas by emv@math.lsa.umich.edu (Edward Vielmetti)
11550 (defalias 'gnus-batch-kill
'gnus-batch-score
)
11552 (defun gnus-batch-score ()
11553 "Run batched scoring.
11554 Usage: emacs -batch -l gnus -f gnus-batch-score <newsgroups> ...
11555 Newsgroups is a list of strings in Bnews format. If you want to score
11556 the comp hierarchy, you'd say \"comp.all\". If you would not like to
11557 score the alt hierarchy, you'd say \"!alt.all\"."
11560 (gnus-newsrc-parse-options
11561 (apply (function concat
)
11562 (mapcar (lambda (g) (concat g
" "))
11563 command-line-args-left
))))
11564 (gnus-expert-user t
)
11565 (nnmail-spool-file nil
)
11566 (gnus-use-dribble-file nil
)
11567 (yes (car yes-and-no
))
11568 (no (cdr yes-and-no
))
11570 ;; Disable verbose message.
11571 gnus-novice-user gnus-large-newsgroup
)
11572 ;; Eat all arguments.
11573 (setq command-line-args-left nil
)
11576 ;; Apply kills to specified newsgroups in command line arguments.
11577 (setq newsrc
(cdr gnus-newsrc-alist
))
11579 (setq group
(car (car newsrc
)))
11580 (setq entry
(gnus-gethash group gnus-newsrc-hashtb
))
11581 (if (and (<= (nth 1 (car newsrc
)) gnus-level-subscribed
)
11583 (or (eq (car entry
) t
)
11584 (not (zerop (car entry
)))))
11585 (if yes
(string-match yes group
) t
)
11586 (or (null no
) (not (string-match no group
))))
11588 (gnus-summary-read-group group nil t
)
11589 (and (eq (current-buffer) (get-buffer gnus-summary-buffer
))
11590 (gnus-summary-exit))))
11591 (setq newsrc
(cdr newsrc
)))
11593 (switch-to-buffer gnus-group-buffer
)
11594 (gnus-group-save-newsrc)))
11596 (defun gnus-apply-kill-file ()
11597 "Apply a kill file to the current newsgroup.
11598 Returns the number of articles marked as read."
11599 (if (or (file-exists-p (gnus-newsgroup-kill-file nil
))
11600 (file-exists-p (gnus-newsgroup-kill-file gnus-newsgroup-name
)))
11601 (gnus-apply-kill-file-internal)
11604 (defun gnus-kill-save-kill-buffer ()
11606 (let ((file (gnus-newsgroup-kill-file gnus-newsgroup-name
)))
11607 (if (get-file-buffer file
)
11609 (set-buffer (get-file-buffer file
))
11610 (and (buffer-modified-p) (save-buffer))
11611 (kill-buffer (current-buffer)))))))
11613 (defvar gnus-kill-file-name
"KILL"
11614 "Suffix of the kill files.")
11616 (defun gnus-newsgroup-kill-file (newsgroup)
11617 "Return the name of a kill file name for NEWSGROUP.
11618 If NEWSGROUP is nil, return the global kill file name instead."
11619 (cond ((or (null newsgroup
)
11620 (string-equal newsgroup
""))
11621 ;; The global KILL file is placed at top of the directory.
11622 (expand-file-name gnus-kill-file-name
11623 (or gnus-kill-files-directory
"~/News")))
11624 ((gnus-use-long-file-name 'not-kill
)
11625 ;; Append ".KILL" to newsgroup name.
11626 (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup
)
11627 "." gnus-kill-file-name
)
11628 (or gnus-kill-files-directory
"~/News")))
11630 ;; Place "KILL" under the hierarchical directory.
11631 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup
)
11632 "/" gnus-kill-file-name
)
11633 (or gnus-kill-files-directory
"~/News")))))
11640 (defvar gnus-dribble-ignore nil
)
11641 (defvar gnus-dribble-eval-file nil
)
11643 (defun gnus-dribble-file-name ()
11644 (concat gnus-current-startup-file
"-dribble"))
11646 (defun gnus-dribble-enter (string)
11647 (if (and (not gnus-dribble-ignore
)
11648 gnus-dribble-buffer
11649 (buffer-name gnus-dribble-buffer
))
11650 (let ((obuf (current-buffer)))
11651 (set-buffer gnus-dribble-buffer
)
11652 (insert string
"\n")
11653 (set-window-point (get-buffer-window (current-buffer)) (point-max))
11654 (set-buffer obuf
))))
11656 (defun gnus-dribble-read-file ()
11657 (let ((dribble-file (gnus-dribble-file-name)))
11659 (set-buffer (setq gnus-dribble-buffer
11661 (file-name-nondirectory dribble-file
))))
11662 (gnus-add-current-to-buffer-list)
11664 (set-visited-file-name dribble-file
)
11665 (buffer-disable-undo (current-buffer))
11666 (bury-buffer (current-buffer))
11667 (set-buffer-modified-p nil
)
11668 (let ((auto (make-auto-save-file-name))
11669 (gnus-dribble-ignore t
))
11670 (if (or (file-exists-p auto
) (file-exists-p dribble-file
))
11672 (if (file-newer-than-file-p auto dribble-file
)
11673 (setq dribble-file auto
))
11674 (insert-file-contents dribble-file
)
11675 (if (not (zerop (buffer-size)))
11676 (set-buffer-modified-p t
))
11678 "Auto-save file exists. Do you want to read it? ")
11679 (setq gnus-dribble-eval-file t
))))))))
11681 (defun gnus-dribble-eval-file ()
11682 (if (not gnus-dribble-eval-file
)
11684 (setq gnus-dribble-eval-file nil
)
11686 (let ((gnus-dribble-ignore t
))
11687 (set-buffer gnus-dribble-buffer
)
11688 (eval-buffer (current-buffer))))))
11690 (defun gnus-dribble-delete-file ()
11691 (if (file-exists-p (gnus-dribble-file-name))
11692 (delete-file (gnus-dribble-file-name)))
11693 (if gnus-dribble-buffer
11695 (set-buffer gnus-dribble-buffer
)
11696 (let ((auto (make-auto-save-file-name)))
11697 (if (file-exists-p auto
)
11698 (delete-file auto
))
11700 (set-buffer-modified-p nil
)))))
11702 (defun gnus-dribble-save ()
11703 (if (and gnus-dribble-buffer
11704 (buffer-name gnus-dribble-buffer
))
11706 (set-buffer gnus-dribble-buffer
)
11709 (defun gnus-dribble-clear ()
11711 (if (gnus-buffer-exists-p gnus-dribble-buffer
)
11713 (set-buffer gnus-dribble-buffer
)
11715 (set-buffer-modified-p nil
)
11716 (setq buffer-saved-size
(buffer-size))))))
11719 ;;; Server Communication
11722 (defun gnus-start-news-server (&optional confirm
)
11723 "Open a method for getting news.
11724 If CONFIRM is non-nil, the user will be asked for an NNTP server."
11726 (if gnus-current-select-method
11727 ;; Stream is already opened.
11729 ;; Open NNTP server.
11730 (if (null gnus-nntp-service
) (setq gnus-nntp-server nil
))
11733 ;; Read server name with completion.
11734 (setq gnus-nntp-server
11735 (completing-read "NNTP server: "
11736 (mapcar (lambda (server) (list server
))
11737 (cons (list gnus-nntp-server
)
11738 gnus-secondary-servers
))
11739 nil nil gnus-nntp-server
))))
11741 (if (and gnus-nntp-server
11742 (stringp gnus-nntp-server
)
11743 (not (string= gnus-nntp-server
"")))
11744 (setq gnus-select-method
11745 (cond ((or (string= gnus-nntp-server
"")
11746 (string= gnus-nntp-server
"::"))
11747 (list 'nnspool
(system-name)))
11748 ((string-match "^:" gnus-nntp-server
)
11749 (list 'nnmh gnus-nntp-server
11750 (list 'nnmh-directory
11751 (file-name-as-directory
11753 (concat "~/" (substring
11754 gnus-nntp-server
1)))))
11755 (list 'nnmh-get-new-mail nil
)))
11757 (list 'nntp gnus-nntp-server
)))))
11759 (setq how
(car gnus-select-method
))
11760 (cond ((eq how
'nnspool
)
11762 (gnus-message 5 "Looking up local news spool..."))
11765 (gnus-message 5 "Looking up mh spool..."))
11768 (setq gnus-current-select-method gnus-select-method
)
11769 (run-hooks 'gnus-open-server-hook
)
11771 ;; gnus-open-server-hook might have opened it
11772 (gnus-server-opened gnus-select-method
)
11773 (gnus-open-server gnus-select-method
)
11776 "%s open error: '%s'. Continue? "
11777 (nth 1 gnus-select-method
)
11778 (gnus-status-message gnus-select-method
)))
11780 (gnus-message 1 "Couldn't open server on %s"
11781 (nth 1 gnus-select-method
))
11785 (defun gnus-check-server (&optional method
)
11786 "If the news server is down, start it up again."
11787 (let ((method (if method method gnus-select-method
)))
11788 (and (stringp method
)
11789 (setq method
(gnus-server-to-method method
)))
11790 (if (gnus-server-opened method
)
11791 ;; Stream is already opened.
11794 (gnus-message 5 "Opening server %s on %s..." (car method
) (nth 1 method
))
11795 (run-hooks 'gnus-open-server-hook
)
11797 (gnus-open-server method
)
11800 (defun gnus-nntp-message (&optional message
)
11801 "Check the status of the NNTP server.
11802 If the status of the server is clear and MESSAGE is non-nil, MESSAGE
11803 is returned insted of the status string."
11804 (let ((status (gnus-status-message (gnus-find-method-for-group
11805 gnus-newsgroup-name
)))
11806 (message (or message
"")))
11807 (if (and (stringp status
) (> (length status
) 0))
11810 (defun gnus-get-function (method function
)
11811 (and (stringp method
)
11812 (setq method
(gnus-server-to-method method
)))
11813 (let ((func (intern (format "%s-%s" (car method
) function
))))
11814 (if (not (fboundp func
))
11816 (require (car method
))
11817 (if (not (fboundp func
))
11818 (error "No such function: %s" func
))))
11821 ;;; Interface functions to the backends.
11823 (defun gnus-open-server (method)
11824 (funcall (gnus-get-function method
'open-server
)
11825 (nth 1 method
) (nthcdr 2 method
)))
11827 (defun gnus-close-server (method)
11828 (funcall (gnus-get-function method
'close-server
) (nth 1 method
)))
11830 (defun gnus-request-list (method)
11831 (funcall (gnus-get-function method
'request-list
) (nth 1 method
)))
11833 (defun gnus-request-list-newsgroups (method)
11834 (funcall (gnus-get-function method
'request-list-newsgroups
) (nth 1 method
)))
11836 (defun gnus-request-newgroups (date method
)
11837 (funcall (gnus-get-function method
'request-newgroups
)
11838 date
(nth 1 method
)))
11840 (defun gnus-server-opened (method)
11841 (funcall (gnus-get-function method
'server-opened
) (nth 1 method
)))
11843 (defun gnus-status-message (method)
11844 (let ((method (if (stringp method
) (gnus-find-method-for-group method
)
11846 (funcall (gnus-get-function method
'status-message
) (nth 1 method
))))
11848 (defun gnus-request-group (group &optional dont-check
)
11849 (let ((method (gnus-find-method-for-group group
)))
11850 (funcall (gnus-get-function method
'request-group
)
11851 (gnus-group-real-name group
) (nth 1 method
) dont-check
)))
11853 (defun gnus-request-asynchronous (group &optional articles
)
11854 (let ((method (gnus-find-method-for-group group
)))
11855 (funcall (gnus-get-function method
'request-asynchronous
)
11856 (gnus-group-real-name group
) (nth 1 method
) articles
)))
11858 (defun gnus-list-active-group (group)
11859 (let ((method (gnus-find-method-for-group group
))
11860 (func 'list-active-group
))
11861 (and (gnus-check-backend-function func group
)
11862 (funcall (gnus-get-function method func
)
11863 (gnus-group-real-name group
) (nth 1 method
)))))
11865 (defun gnus-request-group-description (group)
11866 (let ((method (gnus-find-method-for-group group
))
11867 (func 'request-group-description
))
11868 (and (gnus-check-backend-function func group
)
11869 (funcall (gnus-get-function method func
)
11870 (gnus-group-real-name group
) (nth 1 method
)))))
11872 (defun gnus-close-group (group)
11873 (let ((method (gnus-find-method-for-group group
)))
11874 (funcall (gnus-get-function method
'close-group
)
11875 (gnus-group-real-name group
) (nth 1 method
))))
11877 (defun gnus-retrieve-headers (articles group
)
11878 (let ((method (gnus-find-method-for-group group
)))
11879 (if (and gnus-use-cache
(numberp (car articles
)))
11880 (gnus-cache-retrieve-headers articles group
)
11881 (funcall (gnus-get-function method
'retrieve-headers
)
11882 articles
(gnus-group-real-name group
) (nth 1 method
)))))
11884 (defun gnus-retrieve-groups (groups method
)
11885 (funcall (gnus-get-function method
'retrieve-groups
) groups
(nth 1 method
)))
11887 (defun gnus-request-article (article group
&optional buffer
)
11888 (let ((method (gnus-find-method-for-group group
)))
11889 (funcall (gnus-get-function method
'request-article
)
11890 article
(gnus-group-real-name group
) (nth 1 method
) buffer
)))
11892 (defun gnus-request-head (article group
)
11893 (let ((method (gnus-find-method-for-group group
)))
11894 (funcall (gnus-get-function method
'request-head
)
11895 article
(gnus-group-real-name group
) (nth 1 method
))))
11897 (defun gnus-request-body (article group
)
11898 (let ((method (gnus-find-method-for-group group
)))
11899 (funcall (gnus-get-function method
'request-body
)
11900 article
(gnus-group-real-name group
) (nth 1 method
))))
11902 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>.
11903 (defun gnus-request-post-buffer (post group subject header artbuf
11904 info follow-to respect-poster
)
11905 (let* ((info (or info
(and group
(nth 2 (gnus-gethash
11906 group gnus-newsrc-hashtb
)))))
11908 (if (and gnus-post-method
11909 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>.
11911 (format "%s" (car (gnus-find-method-for-group
11912 gnus-newsgroup-name
)))
11913 gnus-valid-select-methods
)))
11915 (gnus-find-method-for-group gnus-newsgroup-name
))))
11916 (or (gnus-check-server method
)
11917 (error "Can't open server %s:%s" (car method
) (nth 1 method
)))
11918 (let ((mail-self-blind nil
)
11919 (mail-archive-file-name nil
))
11920 (funcall (gnus-get-function method
'request-post-buffer
)
11921 post group subject header artbuf info follow-to
11924 (defun gnus-request-post (method &optional force
)
11925 (and (stringp method
)
11926 (setq method
(gnus-server-to-method method
)))
11927 (and (not force
) gnus-post-method
11928 (memq 'post
(assoc (format "%s" (car method
))
11929 gnus-valid-select-methods
))
11930 (setq method gnus-post-method
))
11931 (funcall (gnus-get-function method
'request-post
)
11934 (defun gnus-request-expire-articles (articles group
&optional force
)
11935 (let ((method (gnus-find-method-for-group group
)))
11936 (funcall (gnus-get-function method
'request-expire-articles
)
11937 articles
(gnus-group-real-name group
) (nth 1 method
)
11940 (defun gnus-request-move-article
11941 (article group server accept-function
&optional last
)
11942 (let ((method (gnus-find-method-for-group group
)))
11943 (funcall (gnus-get-function method
'request-move-article
)
11944 article
(gnus-group-real-name group
)
11945 (nth 1 method
) accept-function last
)))
11947 (defun gnus-request-accept-article (group &optional last
)
11948 (let ((func (if (symbolp group
) group
11949 (car (gnus-find-method-for-group group
)))))
11950 (funcall (intern (format "%s-request-accept-article" func
))
11951 (if (stringp group
) (gnus-group-real-name group
) group
)
11954 (defun gnus-request-replace-article (article group buffer
)
11955 (let ((func (car (gnus-find-method-for-group group
))))
11956 (funcall (intern (format "%s-request-replace-article" func
))
11957 article
(gnus-group-real-name group
) buffer
)))
11959 (defun gnus-request-create-group (group)
11960 (let ((method (gnus-find-method-for-group group
)))
11961 (funcall (gnus-get-function method
'request-create-group
)
11962 (gnus-group-real-name group
) (nth 1 method
))))
11964 (defun gnus-member-of-valid (symbol group
)
11965 (memq symbol
(assoc
11966 (format "%s" (car (gnus-find-method-for-group group
)))
11967 gnus-valid-select-methods
)))
11969 (defun gnus-secondary-method-p (method)
11970 (let ((methods gnus-secondary-select-methods
)
11971 (gmethod (gnus-server-get-method nil method
)))
11972 (while (and methods
11973 (not (equal (gnus-server-get-method nil
(car methods
))
11975 (setq methods
(cdr methods
)))
11978 (defun gnus-find-method-for-group (group &optional info
)
11979 (or gnus-override-method
11981 gnus-select-method
)
11982 (let ((info (or info
(nth 2 (gnus-gethash group gnus-newsrc-hashtb
))))
11985 (not (setq method
(nth 4 info
))))
11986 (setq method gnus-select-method
)
11988 (cond ((stringp method
)
11989 (gnus-server-to-method method
))
11990 ((stringp (car method
))
11991 (gnus-server-extend-method group method
))
11994 (gnus-server-add-address method
))))
11996 (defun gnus-check-backend-function (func group
)
11997 (let ((method (if (stringp group
) (car (gnus-find-method-for-group group
))
11999 (fboundp (intern (format "%s-%s" method func
)))))
12001 (defun gnus-methods-using (method)
12002 (let ((valids gnus-valid-select-methods
)
12005 (if (memq method
(car valids
))
12006 (setq outs
(cons (car valids
) outs
)))
12007 (setq valids
(cdr valids
)))
12011 ;;; Active & Newsrc File Handling
12014 ;; Newsrc related functions.
12015 ;; Gnus internal format of gnus-newsrc-alist:
12016 ;; (("alt.general" 3 (1 . 1))
12017 ;; ("alt.misc" 3 ((1 . 10) (12 . 15)))
12018 ;; ("alt.test" 7 (1 . 99) (45 57 93)) ...)
12019 ;; The first item is the group name; the second is the subscription
12020 ;; level; the third is either a range of a list of ranges of read
12021 ;; articles, the optional fourth element is a list of marked articles,
12022 ;; the optional fifth element is the select method.
12024 ;; Gnus internal format of gnus-newsrc-hashtb:
12025 ;; (95 ("alt.general" 3 (1 . 1)) ("alt.misc" 3 ((1 . 10) (12 . 15))) ...)
12026 ;; This is the entry for "alt.misc". The first element is the number
12027 ;; of unread articles in "alt.misc". The cdr of this entry is the
12028 ;; element *before* "alt.misc" in gnus-newsrc-alist, which makes is
12029 ;; trivial to remove or add new elements into gnus-newsrc-alist
12030 ;; without scanning the entire list. So, to get the actual information
12031 ;; of "alt.misc", you'd say something like
12032 ;; (nth 2 (gnus-gethash "alt.misc" gnus-newsrc-hashtb))
12034 ;; Gnus internal format of gnus-active-hashtb:
12038 ;; The only element in each entry in this hash table is a range of
12039 ;; (possibly) available articles. (Articles in this range may have
12040 ;; been expired or canceled.)
12042 ;; Gnus internal format of gnus-killed-list and gnus-zombie-list:
12043 ;; ("alt.misc" "alt.test" "alt.general" ...)
12045 (defun gnus-setup-news (&optional rawfile level
)
12046 "Setup news information.
12047 If RAWFILE is non-nil, the .newsrc file will also be read.
12048 If LEVEL is non-nil, the news will be set up at level LEVEL."
12049 (let ((init (not (and gnus-newsrc-alist gnus-active-hashtb
(not rawfile
)))))
12050 ;; Clear some variables to re-initialize news information.
12051 (if init
(setq gnus-newsrc-alist nil
12052 gnus-active-hashtb nil
))
12054 ;; Read the newsrc file and create `gnus-newsrc-hashtb'.
12055 (if init
(gnus-read-newsrc-file rawfile
))
12057 ;; If we don't read the complete active file, we fill in the
12059 (if (or (null gnus-read-active-file
)
12060 (eq gnus-read-active-file
'some
))
12061 (gnus-update-active-hashtb-from-killed))
12063 ;; Read the active file and create `gnus-active-hashtb'.
12064 ;; If `gnus-read-active-file' is nil, then we just create an empty
12065 ;; hash table. The partial filling out of the hash table will be
12066 ;; done in `gnus-get-unread-articles'.
12067 (and gnus-read-active-file
12069 (gnus-read-active-file))
12071 (or gnus-active-hashtb
12072 (setq gnus-active-hashtb
(make-vector 4095 0)))
12074 ;; Possibly eval the dribble file.
12075 (and init gnus-use-dribble-file
(gnus-dribble-eval-file))
12077 (gnus-update-format-specifications)
12079 ;; Find new newsgroups and treat them.
12080 (if (and init gnus-check-new-newsgroups gnus-read-active-file
(not level
)
12081 (gnus-check-server gnus-select-method
))
12082 (gnus-find-new-newsgroups))
12084 ;; Find the number of unread articles in each non-dead group.
12085 (let ((gnus-read-active-file (and (not level
) gnus-read-active-file
)))
12086 (gnus-get-unread-articles (or level
(1+ gnus-level-subscribed
))))
12088 (if (and init gnus-check-bogus-newsgroups
12089 gnus-read-active-file
(not level
)
12090 (gnus-server-opened gnus-select-method
))
12091 (gnus-check-bogus-newsgroups))))
12093 (defun gnus-find-new-newsgroups ()
12094 "Search for new newsgroups and add them.
12095 Each new newsgroup will be treated with `gnus-subscribe-newsgroup-method.'
12096 The `-n' option line from .newsrc is respected."
12098 (or (gnus-check-first-time-used)
12099 (if (or (consp gnus-check-new-newsgroups
)
12100 (eq gnus-check-new-newsgroups
'ask-server
))
12101 (gnus-ask-server-for-new-groups)
12103 group new-newsgroups
)
12104 (gnus-message 5 "Looking for new newsgroups...")
12105 (or gnus-have-read-active-file
(gnus-read-active-file))
12106 (setq gnus-newsrc-last-checked-date
(current-time-string))
12107 (if (not gnus-killed-hashtb
) (gnus-make-hashtable-from-killed))
12108 ;; Go though every newsgroup in `gnus-active-hashtb' and compare
12109 ;; with `gnus-newsrc-hashtb' and `gnus-killed-hashtb'.
12112 (if (or (null (setq group
(symbol-name sym
)))
12113 (null (symbol-value sym
))
12114 (gnus-gethash group gnus-killed-hashtb
)
12115 (gnus-gethash group gnus-newsrc-hashtb
))
12117 (let ((do-sub (gnus-matches-options-n group
)))
12119 ((eq do-sub
'subscribe
)
12120 (setq groups
(1+ groups
))
12121 (gnus-sethash group group gnus-killed-hashtb
)
12122 (funcall gnus-subscribe-options-newsgroup-method group
))
12123 ((eq do-sub
'ignore
)
12126 (setq groups
(1+ groups
))
12127 (gnus-sethash group group gnus-killed-hashtb
)
12128 (if gnus-subscribe-hierarchical-interactive
12129 (setq new-newsgroups
(cons group new-newsgroups
))
12130 (funcall gnus-subscribe-newsgroup-method group
)))))))
12131 gnus-active-hashtb
)
12133 (gnus-subscribe-hierarchical-interactive new-newsgroups
))
12134 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
12136 (gnus-message 6 "%d new newsgroup%s arrived."
12137 groups
(if (> groups
1) "s have" " has"))
12138 (gnus-message 6 "No new newsgroups."))))))
12140 (defun gnus-matches-options-n (group)
12141 ;; Returns `subscribe' if the group is to be unconditionally
12142 ;; subscribed, `ignore' if it is to be ignored, and nil if there is
12143 ;; no match for the group.
12145 ;; First we check the two user variables.
12147 ((and gnus-options-subscribe
12148 (string-match gnus-options-subscribe group
))
12150 ((and gnus-options-not-subscribe
12151 (string-match gnus-options-not-subscribe group
))
12153 ;; Then we go through the list that was retrieved from the .newsrc
12154 ;; file. This list has elements on the form
12155 ;; `(REGEXP . {ignore,subscribe})'. The first match found (the list
12156 ;; is in the reverse order of the options line) is returned.
12158 (let ((regs gnus-newsrc-options-n
))
12160 (not (string-match (car (car regs
)) group
)))
12161 (setq regs
(cdr regs
)))
12162 (and regs
(cdr (car regs
)))))))
12164 (defun gnus-ask-server-for-new-groups ()
12165 (let* ((date (or gnus-newsrc-last-checked-date
(current-time-string)))
12166 (methods (cons gnus-select-method
12168 (and (consp gnus-check-new-newsgroups
)
12169 gnus-check-new-newsgroups
)
12170 gnus-secondary-select-methods
)))
12172 (new-date (current-time-string))
12173 (hashtb (gnus-make-hashtable 100))
12174 group new-newsgroups got-new method
)
12175 ;; Go through both primary and secondary select methods and
12176 ;; request new newsgroups.
12178 (setq method
(gnus-server-get-method nil
(car methods
)))
12179 (and (gnus-check-server method
)
12180 (gnus-request-newgroups date method
)
12183 (set-buffer nntp-server-buffer
)
12184 ;; Enter all the new groups in a hashtable.
12185 (gnus-active-to-gnus-format method hashtb
'ignore
)))
12186 (setq methods
(cdr methods
)))
12187 (and got-new
(setq gnus-newsrc-last-checked-date new-date
))
12188 ;; Now all new groups from all select methods are in `hashtb'.
12190 (lambda (group-sym)
12191 (setq group
(symbol-name group-sym
))
12192 (if (or (null group
)
12193 (null (symbol-value group-sym
))
12194 (gnus-gethash group gnus-newsrc-hashtb
)
12195 (member group gnus-zombie-list
)
12196 (member group gnus-killed-list
))
12197 ;; The group is already known.
12199 (and (symbol-value group-sym
)
12200 (gnus-sethash group
(symbol-value group-sym
) gnus-active-hashtb
))
12201 (let ((do-sub (gnus-matches-options-n group
)))
12202 (cond ((eq do-sub
'subscribe
)
12203 (setq groups
(1+ groups
))
12204 (gnus-sethash group group gnus-killed-hashtb
)
12206 gnus-subscribe-options-newsgroup-method group
))
12207 ((eq do-sub
'ignore
)
12210 (setq groups
(1+ groups
))
12211 (gnus-sethash group group gnus-killed-hashtb
)
12212 (if gnus-subscribe-hierarchical-interactive
12213 (setq new-newsgroups
(cons group new-newsgroups
))
12214 (funcall gnus-subscribe-newsgroup-method group
)))))))
12217 (gnus-subscribe-hierarchical-interactive new-newsgroups
))
12218 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
12220 (gnus-message 6 "%d new newsgroup%s arrived."
12221 groups
(if (> groups
1) "s have" " has")))
12224 (defun gnus-check-first-time-used ()
12225 (if (or (> (length gnus-newsrc-alist
) 1)
12226 (file-exists-p gnus-startup-file
)
12227 (file-exists-p (concat gnus-startup-file
".el"))
12228 (file-exists-p (concat gnus-startup-file
".eld")))
12230 (gnus-message 6 "First time user; subscribing you to default groups")
12231 (or gnus-have-read-active-file
(gnus-read-active-file))
12232 (setq gnus-newsrc-last-checked-date
(current-time-string))
12233 (let ((groups gnus-default-subscribed-newsgroups
)
12237 (setq groups
(or groups gnus-backup-default-subscribed-newsgroups
))
12240 (if (null (setq group
(symbol-name sym
)))
12242 (let ((do-sub (gnus-matches-options-n group
)))
12244 ((eq do-sub
'subscribe
)
12245 (gnus-sethash group group gnus-killed-hashtb
)
12246 (funcall gnus-subscribe-options-newsgroup-method group
))
12247 ((eq do-sub
'ignore
)
12250 (setq gnus-killed-list
(cons group gnus-killed-list
)))))))
12251 gnus-active-hashtb
)
12253 (if (gnus-gethash (car groups
) gnus-active-hashtb
)
12254 (gnus-group-change-level
12255 (car groups
) gnus-level-default-subscribed gnus-level-killed
))
12256 (setq groups
(cdr groups
)))
12257 (gnus-group-make-help-group)
12258 (and gnus-novice-user
12259 (gnus-message 7 "`A k' to list killed groups"))))))
12261 (defun gnus-subscribe-group (group previous
&optional method
)
12262 (gnus-group-change-level
12264 (list t group gnus-level-default-subscribed nil nil method
)
12266 gnus-level-default-subscribed gnus-level-killed previous t
))
12268 ;; `gnus-group-change-level' is the fundamental function for changing
12269 ;; subscription levels of newsgroups. This might mean just changing
12270 ;; from level 1 to 2, which is pretty trivial, from 2 to 6 or back
12271 ;; again, which subscribes/unsubscribes a group, which is equally
12272 ;; trivial. Changing from 1-7 to 8-9 means that you kill a group, and
12273 ;; from 8-9 to 1-7 means that you remove the group from the list of
12274 ;; killed (or zombie) groups and add them to the (kinda) subscribed
12275 ;; groups. And last but not least, moving from 8 to 9 and 9 to 8,
12276 ;; which is trivial.
12277 ;; ENTRY can either be a string (newsgroup name) or a list (if
12278 ;; FROMKILLED is t, it's a list on the format (NUM INFO-LIST),
12279 ;; otherwise it's a list in the format of the `gnus-newsrc-hashtb'
12281 ;; LEVEL is the new level of the group, OLDLEVEL is the old level and
12282 ;; PREVIOUS is the group (in hashtb entry format) to insert this group
12284 (defun gnus-group-change-level (entry level
&optional oldlevel
12285 previous fromkilled
)
12286 (let (group info active num
)
12287 ;; Glean what info we can from the arguments
12289 (if fromkilled
(setq group
(nth 1 entry
))
12290 (setq group
(car (nth 2 entry
))))
12291 (setq group entry
))
12292 (if (and (stringp entry
)
12294 (< oldlevel gnus-level-zombie
))
12295 (setq entry
(gnus-gethash entry gnus-newsrc-hashtb
)))
12296 (if (and (not oldlevel
)
12298 (setq oldlevel
(car (cdr (nth 2 entry
)))))
12299 (if (stringp previous
)
12300 (setq previous
(gnus-gethash previous gnus-newsrc-hashtb
)))
12302 (if (and (>= oldlevel gnus-level-zombie
)
12303 (gnus-gethash group gnus-newsrc-hashtb
))
12304 ;; We are trying to subscribe a group that is already
12308 (or (gnus-ephemeral-group-p group
)
12309 (gnus-dribble-enter
12310 (format "(gnus-group-change-level %S %S %S %S %S)"
12311 group level oldlevel
(car (nth 2 previous
)) fromkilled
)))
12313 ;; Then we remove the newgroup from any old structures, if needed.
12314 ;; If the group was killed, we remove it from the killed or zombie
12315 ;; list. If not, and it is in fact going to be killed, we remove
12316 ;; it from the newsrc hash table and assoc.
12317 (cond ((>= oldlevel gnus-level-zombie
)
12318 (if (= oldlevel gnus-level-zombie
)
12319 (setq gnus-zombie-list
(delete group gnus-zombie-list
))
12320 (setq gnus-killed-list
(delete group gnus-killed-list
))))
12322 (if (and (>= level gnus-level-zombie
)
12325 (gnus-sethash (car (nth 2 entry
)) nil gnus-newsrc-hashtb
)
12327 (setcdr (gnus-gethash (car (nth 3 entry
))
12328 gnus-newsrc-hashtb
)
12330 (setcdr (cdr entry
) (cdr (cdr (cdr entry
))))))))
12332 ;; Finally we enter (if needed) the list where it is supposed to
12333 ;; go, and change the subscription level. If it is to be killed,
12334 ;; we enter it into the killed or zombie list.
12335 (cond ((>= level gnus-level-zombie
)
12336 ;; Remove from the hash table.
12337 (gnus-sethash group nil gnus-newsrc-hashtb
)
12338 (or (gnus-group-foreign-p group
)
12339 ;; We do not enter foreign groups into the list of dead
12341 (if (= level gnus-level-zombie
)
12342 (setq gnus-zombie-list
(cons group gnus-zombie-list
))
12343 (setq gnus-killed-list
(cons group gnus-killed-list
)))))
12345 ;; If the list is to be entered into the newsrc assoc, and
12346 ;; it was killed, we have to create an entry in the newsrc
12347 ;; hashtb format and fix the pointers in the newsrc assoc.
12348 (if (>= oldlevel gnus-level-zombie
)
12352 (setq info
(cdr entry
))
12353 (setq num
(car entry
)))
12354 (setq active
(gnus-gethash group gnus-active-hashtb
))
12356 (if active
(- (1+ (cdr active
)) (car active
)) t
))
12357 ;; Check whether the group is foreign. If so, the
12358 ;; foreign select method has to be entered into the
12360 (let ((method (gnus-group-method-name group
)))
12361 (if (eq method gnus-select-method
)
12362 (setq info
(list group level nil
))
12363 (setq info
(list group level nil nil method
)))))
12366 (let ((p gnus-newsrc-alist
))
12367 (while (cdr (cdr p
))
12370 (setq entry
(cons info
(cdr (cdr previous
))))
12373 (setcdr (cdr previous
) entry
)
12374 (gnus-sethash group
(cons num
(cdr previous
))
12375 gnus-newsrc-hashtb
))
12376 (setcdr previous entry
)
12377 (gnus-sethash group
(cons num previous
)
12378 gnus-newsrc-hashtb
))
12380 (setcdr (gnus-gethash (car (car (cdr entry
)))
12381 gnus-newsrc-hashtb
)
12383 ;; It was alive, and it is going to stay alive, so we
12384 ;; just change the level and don't change any pointers or
12385 ;; hash table entries.
12386 (setcar (cdr (car (cdr (cdr entry
)))) level
)))))))
12388 (defun gnus-kill-newsgroup (newsgroup)
12389 "Obsolete function. Kills a newsgroup."
12390 (gnus-group-change-level
12391 (gnus-gethash newsgroup gnus-newsrc-hashtb
) gnus-level-killed
))
12393 (defun gnus-check-bogus-newsgroups (&optional confirm
)
12394 "Remove bogus newsgroups.
12395 If CONFIRM is non-nil, the user has to confirm the deletion of every
12397 (let ((newsrc (cdr gnus-newsrc-alist
))
12399 (gnus-message 5 "Checking bogus newsgroups...")
12400 (or gnus-have-read-active-file
(gnus-read-active-file))
12401 ;; Find all bogus newsgroup that are subscribed.
12403 (setq group
(car (car newsrc
)))
12404 (if (or (gnus-gethash group gnus-active-hashtb
) ; Active
12405 (nth 4 (car newsrc
)) ; Foreign
12407 (not (gnus-y-or-n-p
12408 (format "Remove bogus newsgroup: %s " group
)))))
12411 ;; Found a bogus newsgroup.
12412 (setq bogus
(cons group bogus
)))
12413 (setq newsrc
(cdr newsrc
)))
12414 ;; Remove all bogus subscribed groups by first killing them, and
12415 ;; then removing them from the list of killed groups.
12417 (and (setq entry
(gnus-gethash (car bogus
) gnus-newsrc-hashtb
))
12419 (gnus-group-change-level entry gnus-level-killed
)
12420 (setq gnus-killed-list
(delete (car bogus
) gnus-killed-list
))))
12421 (setq bogus
(cdr bogus
)))
12422 ;; Then we remove all bogus groups from the list of killed and
12423 ;; zombie groups. They are are removed without confirmation.
12424 (let ((dead-lists '(gnus-killed-list gnus-zombie-list
))
12427 (setq killed
(symbol-value (car dead-lists
)))
12429 (setq group
(car killed
))
12430 (or (gnus-gethash group gnus-active-hashtb
)
12431 ;; The group is bogus.
12432 (set (car dead-lists
)
12433 (delete group
(symbol-value (car dead-lists
)))))
12434 (setq killed
(cdr killed
)))
12435 (setq dead-lists
(cdr dead-lists
))))
12436 (gnus-message 5 "Checking bogus newsgroups...done")))
12438 (defun gnus-check-duplicate-killed-groups ()
12439 "Remove duplicates from the list of killed groups."
12441 (let ((killed gnus-killed-list
))
12443 (gnus-message 9 "%d" (length killed
))
12444 (setcdr killed
(delete (car killed
) (cdr killed
)))
12445 (setq killed
(cdr killed
)))))
12447 ;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
12448 ;; and compute how many unread articles there are in each group.
12449 (defun gnus-get-unread-articles (&optional level
)
12450 (let* ((newsrc (cdr gnus-newsrc-alist
))
12451 (level (or level
(1+ gnus-level-subscribed
)))
12454 (cond ((and gnus-activate-foreign-newsgroups
12455 (not (numberp gnus-activate-foreign-newsgroups
)))
12456 (1+ gnus-level-subscribed
))
12457 ((numberp gnus-activate-foreign-newsgroups
)
12458 gnus-activate-foreign-newsgroups
)
12461 info group active virtuals method
)
12462 (gnus-message 5 "Checking new news...")
12465 (setq info
(car newsrc
)
12467 active
(gnus-gethash group gnus-active-hashtb
))
12469 ;; Check newsgroups. If the user doesn't want to check them, or
12470 ;; they can't be checked (for instance, if the news server can't
12471 ;; be reached) we just set the number of unread articles in this
12472 ;; newsgroup to t. This means that Gnus thinks that there are
12473 ;; unread articles, but it has no idea how many.
12474 (if (and (setq method
(nth 4 info
))
12475 (not (gnus-server-equal gnus-select-method
12476 (gnus-server-get-method nil method
)))
12477 (not (gnus-secondary-method-p method
)))
12478 ;; These groups are foreign. Check the level.
12479 (if (<= (nth 1 info
) foreign-level
)
12480 (if (eq (car (if (stringp method
)
12481 (gnus-server-to-method method
)
12482 (nth 4 info
))) 'nnvirtual
)
12483 ;; We have to activate the virtual groups after all
12484 ;; the others, so we just pop them on a list for
12486 (setq virtuals
(cons info virtuals
))
12487 (and (setq active
(gnus-activate-group (car info
)))
12488 ;; Close the groups as we look at them!
12489 (gnus-close-group group
))))
12491 ;; These groups are native or secondary.
12492 (if (and (not gnus-read-active-file
)
12493 (<= (nth 1 info
) level
))
12495 (or gnus-read-active-file
(gnus-check-server method
))
12496 (setq active
(gnus-activate-group (car info
))))))
12499 (gnus-get-unread-articles-in-group info active
)
12500 ;; The group couldn't be reached, so we nix out the number of
12501 ;; unread articles and stuff.
12502 (gnus-sethash group nil gnus-active-hashtb
)
12503 (setcar (gnus-gethash group gnus-newsrc-hashtb
) t
))
12505 (setq newsrc
(cdr newsrc
)))
12507 ;; Activate the virtual groups. This has to be done after all the
12509 ;; !!! If one virtual group contains another virtual group, even
12510 ;; doing it this way might cause problems.
12512 (and (setq active
(gnus-activate-group (car (car virtuals
))))
12513 (gnus-get-unread-articles-in-group (car virtuals
) active
))
12514 (setq virtuals
(cdr virtuals
)))
12516 (gnus-message 5 "Checking new news...done")))
12518 ;; Create a hash table out of the newsrc alist. The `car's of the
12519 ;; alist elements are used as keys.
12520 (defun gnus-make-hashtable-from-newsrc-alist ()
12521 (let ((alist gnus-newsrc-alist
)
12522 (ohashtb gnus-newsrc-hashtb
)
12524 (setq gnus-newsrc-hashtb
(gnus-make-hashtable (length alist
)))
12526 (setq prev
(setq gnus-newsrc-alist
12527 (if (equal (car (car gnus-newsrc-alist
))
12530 (cons (list "dummy.group" 0 nil
) alist
)))))
12532 (gnus-sethash (car (car alist
))
12533 (cons (and ohashtb
(car (gnus-gethash
12534 (car (car alist
)) ohashtb
)))
12535 prev
) gnus-newsrc-hashtb
)
12537 alist
(cdr alist
)))))
12539 (defun gnus-make-hashtable-from-killed ()
12540 "Create a hash table from the killed and zombie lists."
12541 (let ((lists '(gnus-killed-list gnus-zombie-list
))
12543 (setq gnus-killed-hashtb
12544 (gnus-make-hashtable
12545 (+ (length gnus-killed-list
) (length gnus-zombie-list
))))
12547 (setq list
(symbol-value (car lists
)))
12548 (setq lists
(cdr lists
))
12550 (gnus-sethash (car list
) (car list
) gnus-killed-hashtb
)
12551 (setq list
(cdr list
))))))
12553 (defun gnus-get-unread-articles-in-group (info active
)
12554 (let* ((range (nth 2 info
))
12556 (marked (nth 3 info
)))
12557 ;; If a cache is present, we may have to alter the active info.
12558 (and gnus-use-cache
12559 (gnus-cache-possibly-alter-active (car info
) active
))
12560 ;; Modify the list of read articles according to what articles
12561 ;; are available; then tally the unread articles and add the
12562 ;; number to the group hash table entry.
12564 ((zerop (cdr active
))
12567 (setq num
(- (1+ (cdr active
)) (car active
))))
12568 ((not (listp (cdr range
)))
12569 ;; Fix a single (num . num) range according to the
12570 ;; active hash table.
12571 ;; Fix by Carsten Bormann <cabo@Informatik.Uni-Bremen.DE>.
12572 (and (< (cdr range
) (car active
)) (setcdr range
(1- (car active
))))
12573 (and (> (cdr range
) (cdr active
)) (setcdr range
(cdr active
)))
12574 ;; Compute number of unread articles.
12575 (setq num
(max 0 (- (cdr active
) (- (1+ (cdr range
)) (car range
))))))
12577 ;; The read list is a list of ranges. Fix them according to
12578 ;; the active hash table.
12579 ;; First peel off any elements that are below the lower
12581 (while (and (cdr range
)
12583 (or (and (atom (car (cdr range
))) (car (cdr range
)))
12584 (car (car (cdr range
))))))
12585 (if (numberp (car range
))
12588 (or (and (numberp (car (cdr range
)))
12590 (cdr (car (cdr range
))))))
12591 (setcdr (car range
)
12592 (or (and (numberp (nth 1 range
)) (nth 1 range
))
12593 (cdr (car (cdr range
))))))
12594 (setcdr range
(cdr (cdr range
))))
12595 ;; Adjust the first element to be the same as the lower limit.
12596 (if (and (not (atom (car range
)))
12597 (< (cdr (car range
)) (car active
)))
12598 (setcdr (car range
) (1- (car active
))))
12599 ;; Then we want to peel off any elements that are higher
12600 ;; than the upper active limit.
12601 (let ((srange range
))
12602 ;; Go past all legal elements.
12603 (while (and (cdr srange
)
12604 (<= (or (and (atom (car (cdr srange
)))
12605 (car (cdr srange
)))
12606 (car (car (cdr srange
)))) (cdr active
)))
12607 (setq srange
(cdr srange
)))
12609 ;; Nuke all remaining illegal elements.
12610 (setcdr srange nil
))
12612 ;; Adjust the final element.
12613 (if (and (not (atom (car srange
)))
12614 (> (cdr (car srange
)) (cdr active
)))
12615 (setcdr (car srange
) (cdr active
))))
12616 ;; Compute the number of unread articles.
12618 (setq num
(+ num
(- (1+ (or (and (atom (car range
)) (car range
))
12619 (cdr (car range
))))
12620 (or (and (atom (car range
)) (car range
))
12621 (car (car range
))))))
12622 (setq range
(cdr range
)))
12623 (setq num
(max 0 (- (cdr active
) num
)))))
12626 (and (assq 'tick marked
)
12627 (inline (gnus-remove-illegal-marked-articles
12628 (assq 'tick marked
) (nth 2 info
))))
12629 (and (assq 'dormant marked
)
12630 (inline (gnus-remove-illegal-marked-articles
12631 (assq 'dormant marked
) (nth 2 info
))))
12633 (gnus-gethash (car info
) gnus-newsrc-hashtb
)
12634 (setq num
(max 0 (- num
(length (cdr (assq 'tick marked
)))
12635 (length (cdr (assq 'dormant marked
)))))))))
12638 (defun gnus-remove-illegal-marked-articles (marked ranges
)
12639 (let ((m (cdr marked
)))
12640 ;; Make sure that all ticked articles are a subset of the unread
12643 (if (gnus-member-of-range (car m
) ranges
)
12644 (setcdr marked
(cdr m
))
12646 (setq m
(cdr m
)))))
12648 (defun gnus-activate-group (group)
12649 ;; Check whether a group has been activated or not.
12650 (let ((method (gnus-find-method-for-group group
))
12652 (and (gnus-check-server method
)
12653 ;; We escape all bugs and quit here to make it possible to
12654 ;; continue if a group is so out-there that it reports bugs
12657 (gnus-request-group group
)
12661 (set-buffer nntp-server-buffer
)
12662 (goto-char (point-min))
12663 ;; Parse the result we got from `gnus-request-group'.
12664 (and (looking-at "[0-9]+ [0-9]+ \\([0-9]+\\) [0-9]+")
12666 (goto-char (match-beginning 1))
12668 group
(setq active
(cons (read (current-buffer))
12669 (read (current-buffer))))
12670 gnus-active-hashtb
))
12671 ;; Return the new active info.
12674 (defun gnus-update-read-articles
12675 (group unread unselected ticked
&optional domarks replied expirable killed
12676 dormant bookmark score
)
12677 "Update the list of read and ticked articles in GROUP using the
12678 UNREAD and TICKED lists.
12679 Note: UNSELECTED has to be sorted over `<'.
12680 Returns whether the updating was successful."
12681 (let* ((active (or gnus-newsgroup-active
12682 (gnus-gethash group gnus-active-hashtb
)))
12683 (entry (gnus-gethash group gnus-newsrc-hashtb
))
12684 (info (nth 2 entry
))
12685 (marked (nth 3 info
))
12687 (unread (sort (copy-sequence unread
) (function <)))
12689 (if (or (not info
) (not active
))
12690 ;; There is no info on this group if it was, in fact,
12691 ;; killed. Gnus stores no information on killed groups, so
12692 ;; there's nothing to be done.
12693 ;; One could store the information somewhere temporarily,
12694 ;; perhaps... Hmmm...
12696 ;; Remove any negative articles numbers.
12697 (while (and unread
(< (car unread
) 0))
12698 (setq unread
(cdr unread
)))
12699 ;; Remove any expired article numbers
12700 (while (and unread
(< (car unread
) (car active
)))
12701 (setq unread
(cdr unread
)))
12702 (while (and ticked
(< (car ticked
) (car active
)))
12703 (setq ticked
(cdr ticked
)))
12704 (while (and dormant
(< (car dormant
) (car active
)))
12705 (setq dormant
(cdr dormant
)))
12706 (setq unread
(sort (append unselected unread
) '<))
12707 ;; Compute the ranges of read articles by looking at the list of
12708 ;; unread articles.
12710 (if (/= (car unread
) prev
)
12711 (setq read
(cons (if (= prev
(1- (car unread
))) prev
12712 (cons prev
(1- (car unread
)))) read
)))
12713 (setq prev
(1+ (car unread
)))
12714 (setq unread
(cdr unread
)))
12715 (if (<= prev
(cdr active
))
12716 (setq read
(cons (cons prev
(cdr active
)) read
)))
12717 ;; Enter this list into the group info.
12718 (setcar (cdr (cdr info
))
12719 (if (> (length read
) 1) (nreverse read
) read
))
12720 ;; Enter the list of ticked articles.
12721 (gnus-set-marked-articles
12723 (if domarks replied
(cdr (assq 'reply marked
)))
12724 (if domarks expirable
(cdr (assq 'expire marked
)))
12725 (if domarks killed
(cdr (assq 'killed marked
)))
12726 (if domarks dormant
(cdr (assq 'dormant marked
)))
12727 (if domarks bookmark
(cdr (assq 'bookmark marked
)))
12728 (if domarks score
(cdr (assq 'score marked
))))
12729 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12730 (gnus-get-unread-articles-in-group
12731 info
(gnus-gethash group gnus-active-hashtb
))
12734 (defun gnus-make-articles-unread (group articles
)
12735 "Mark ARTICLES in GROUP as unread."
12736 (let* ((info (nth 2 (or (gnus-gethash group gnus-newsrc-hashtb
)
12737 (gnus-gethash (gnus-group-real-name group
)
12738 gnus-newsrc-hashtb
))))
12739 (ranges (nth 2 info
))
12742 (and (gnus-member-of-range (car articles
) ranges
)
12743 (setq news
(cons (car articles
) news
)))
12744 (setq articles
(cdr articles
)))
12747 (setcar (nthcdr 2 info
)
12748 (gnus-remove-from-range (nth 2 info
) (nreverse news
)))
12749 (gnus-group-update-group group t
))))
12751 ;; Enter all dead groups into the hashtb.
12752 (defun gnus-update-active-hashtb-from-killed ()
12753 (let ((hashtb (setq gnus-active-hashtb
(make-vector 4095 0)))
12754 (lists (list gnus-killed-list gnus-zombie-list
))
12757 (setq killed
(car lists
))
12759 (gnus-sethash (car killed
) nil hashtb
)
12760 (setq killed
(cdr killed
)))
12761 (setq lists
(cdr lists
)))))
12763 ;; Get the active file(s) from the backend(s).
12764 (defun gnus-read-active-file ()
12765 (gnus-group-set-mode-line)
12766 (let ((methods (if (gnus-check-server gnus-select-method
)
12767 ;; The native server is available.
12768 (cons gnus-select-method gnus-secondary-select-methods
)
12769 ;; The native server is down, so we just do the
12771 gnus-secondary-select-methods
))
12773 (setq gnus-have-read-active-file nil
)
12775 (set-buffer nntp-server-buffer
)
12777 (let* ((method (gnus-server-get-method nil
(car methods
)))
12778 (where (nth 1 method
))
12779 (mesg (format "Reading active file%s via %s..."
12780 (if (and where
(not (zerop (length where
))))
12781 (concat " from " where
) "")
12783 (gnus-message 5 mesg
)
12784 (if (not (gnus-check-server method
))
12787 ((and (eq gnus-read-active-file
'some
)
12788 (gnus-check-backend-function 'retrieve-groups
(car method
)))
12789 (let ((newsrc (cdr gnus-newsrc-alist
))
12790 (gmethod (gnus-server-get-method nil method
))
12793 (and (gnus-server-equal
12794 (gnus-find-method-for-group
12795 (car (car newsrc
)) (car newsrc
))
12797 (setq groups
(cons (gnus-group-real-name
12798 (car (car newsrc
))) groups
)))
12799 (setq newsrc
(cdr newsrc
)))
12800 (gnus-check-server method
)
12801 (setq list-type
(gnus-retrieve-groups groups method
))
12805 1 "Cannot read partial active file from %s server."
12809 ((eq list-type
'active
)
12810 (gnus-active-to-gnus-format method gnus-active-hashtb
))
12812 (gnus-groups-to-gnus-format method gnus-active-hashtb
)))))
12814 (if (not (gnus-request-list method
))
12816 (gnus-message 1 "Cannot read active file from %s server."
12819 (gnus-active-to-gnus-format method
)
12820 ;; We mark this active file as read.
12821 (setq gnus-have-read-active-file
12822 (cons method gnus-have-read-active-file
))
12823 (gnus-message 5 "%sdone" mesg
))))))
12824 (setq methods
(cdr methods
))))))
12826 ;; Read an active file and place the results in `gnus-active-hashtb'.
12827 (defun gnus-active-to-gnus-format (method &optional hashtb ignore-errors
)
12828 (let ((cur (current-buffer))
12830 (if (and gnus-active-hashtb
12831 (not (equal method gnus-select-method
)))
12833 (setq gnus-active-hashtb
12834 (if (equal method gnus-select-method
)
12835 (gnus-make-hashtable
12836 (count-lines (point-min) (point-max)))
12837 (gnus-make-hashtable 4096))))))
12838 (flag-hashtb (gnus-make-hashtable 60)))
12839 ;; Delete unnecessary lines.
12840 (goto-char (point-min))
12841 (while (search-forward "\nto." nil t
)
12842 (delete-region (1+ (match-beginning 0))
12843 (progn (forward-line 1) (point))))
12844 (or (string= gnus-ignored-newsgroups
"")
12846 (goto-char (point-min))
12847 (delete-matching-lines gnus-ignored-newsgroups
)))
12848 ;; Make the group names readable as a lisp expression even if they
12849 ;; contain special characters.
12850 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
12851 (goto-char (point-max))
12852 (while (re-search-backward "[][';?()#]" nil t
)
12854 ;; If these are groups from a foreign select method, we insert the
12855 ;; group prefix in front of the group names.
12856 (and method
(not (gnus-server-equal
12857 (gnus-server-get-method nil method
)
12858 (gnus-server-get-method nil gnus-select-method
)))
12859 (let ((prefix (gnus-group-prefixed-name "" method
)))
12860 (goto-char (point-min))
12861 (while (and (not (eobp))
12862 (progn (insert prefix
)
12863 (zerop (forward-line 1)))))))
12864 ;; Store the active file in a hash table.
12865 (goto-char (point-min))
12866 (if (string-match "%[oO]" gnus-group-line-format
)
12867 ;; Suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
12868 ;; If we want information on moderated groups, we use this
12870 (let* ((mod-hashtb (make-vector 7 0))
12871 (m (intern "m" mod-hashtb
))
12873 (while (not (eobp))
12874 (condition-case nil
12876 (narrow-to-region (point) (gnus-point-at-eol))
12877 (setq group
(let ((obarray hashtb
)) (read cur
)))
12878 (if (and (numberp (setq max
(read cur
)))
12879 (numberp (setq min
(read cur
)))
12881 (skip-chars-forward " \t")
12883 (or (= (following-char) ?
=)
12884 (= (following-char) ?x
)
12885 (= (following-char) ?j
)))))
12886 (set group
(cons min max
))
12888 ;; Enter moderated groups into a list.
12889 (if (eq (let ((obarray mod-hashtb
)) (read cur
)) m
)
12890 (setq gnus-moderated-list
12891 (cons (symbol-name group
) gnus-moderated-list
))))
12898 ;; And if we do not care about moderation, we use this loop,
12899 ;; which is faster.
12900 (let (group max min
)
12901 (while (not (eobp))
12904 (narrow-to-region (point) (gnus-point-at-eol))
12905 ;; group gets set to a symbol interned in the hash table
12906 ;; (what a hack!!) - jwz
12907 (setq group
(let ((obarray hashtb
)) (read cur
)))
12908 (if (and (numberp (setq max
(read cur
)))
12909 (numberp (setq min
(read cur
)))
12911 (skip-chars-forward " \t")
12913 (or (= (following-char) ?
=)
12914 (= (following-char) ?x
)
12915 (= (following-char) ?j
)))))
12916 (set group
(cons min max
))
12924 (gnus-message 3 "Warning - illegal active: %s"
12926 (gnus-point-at-bol) (gnus-point-at-eol)))))))
12928 (forward-line 1))))))
12930 (defun gnus-groups-to-gnus-format (method &optional hashtb
)
12931 ;; Parse a "groups" active file.
12932 (let ((cur (current-buffer))
12934 (if (and method gnus-active-hashtb
)
12936 (setq gnus-active-hashtb
12937 (gnus-make-hashtable
12938 (count-lines (point-min) (point-max)))))))
12939 (prefix (and method
12940 (not (gnus-server-equal
12941 (gnus-server-get-method nil method
)
12942 (gnus-server-get-method nil gnus-select-method
)))
12943 (gnus-group-prefixed-name "" method
))))
12945 (goto-char (point-min))
12946 ;; We split this into to separate loops, one with the prefix
12947 ;; and one without to speed the reading up somewhat.
12949 (let (min max opoint group
)
12950 (while (not (eobp))
12953 (read cur
) (read cur
)
12954 (setq min
(read cur
)
12957 (skip-chars-forward " \t")
12960 (set (let ((obarray hashtb
)) (read cur
))
12962 (error (and group
(symbolp group
) (set group nil
))))
12964 (let (min max group
)
12965 (while (not (eobp))
12967 (if (= (following-char) ?
2)
12969 (read cur
) (read cur
)
12970 (setq min
(read cur
)
12972 (set (setq group
(let ((obarray hashtb
)) (read cur
)))
12974 (error (and group
(symbolp group
) (set group nil
))))
12975 (forward-line 1))))))
12977 (defun gnus-read-newsrc-file (&optional force
)
12978 "Read startup file.
12979 If FORCE is non-nil, the .newsrc file is read."
12980 ;; Reset variables that might be defined in the .newsrc.eld file.
12981 (let ((variables gnus-variable-list
))
12983 (set (car variables
) nil
)
12984 (setq variables
(cdr variables
))))
12985 (let* ((newsrc-file gnus-current-startup-file
)
12986 (quick-file (concat newsrc-file
".el")))
12988 ;; We always load the .newsrc.eld file. If always contains
12989 ;; much information that can not be gotten from the .newsrc
12990 ;; file (ticked articles, killed groups, foreign methods, etc.)
12991 (gnus-read-newsrc-el-file quick-file
)
12994 (and (file-newer-than-file-p newsrc-file quick-file
)
12995 (file-newer-than-file-p newsrc-file
12996 (concat quick-file
"d")))
12997 (not gnus-newsrc-alist
))
12998 ;; We read the .newsrc file. Note that if there if a
12999 ;; .newsrc.eld file exists, it has already been read, and
13000 ;; the `gnus-newsrc-hashtb' has been created. While reading
13001 ;; the .newsrc file, Gnus will only use the information it
13002 ;; can find there for changing the data already read -
13003 ;; ie. reading the .newsrc file will not trash the data
13004 ;; already read (except for read articles).
13006 (gnus-message 5 "Reading %s..." newsrc-file
)
13007 (set-buffer (find-file-noselect newsrc-file
))
13008 (buffer-disable-undo (current-buffer))
13009 (gnus-newsrc-to-gnus-format)
13010 (kill-buffer (current-buffer))
13011 (gnus-message 5 "Reading %s...done" newsrc-file
))))))
13013 (defun gnus-read-newsrc-el-file (file)
13014 (let ((ding-file (concat file
"d")))
13015 ;; We always, always read the .eld file.
13016 (gnus-message 5 "Reading %s..." ding-file
)
13017 (let (gnus-newsrc-assoc)
13018 (condition-case nil
13019 (load ding-file t t t
)
13021 (and gnus-newsrc-assoc
(setq gnus-newsrc-alist gnus-newsrc-assoc
)))
13022 (let ((inhibit-quit t
))
13023 (gnus-uncompress-newsrc-alist))
13024 (gnus-make-hashtable-from-newsrc-alist)
13025 (if (not (file-newer-than-file-p file ding-file
))
13027 ;; Old format quick file
13028 (gnus-message 5 "Reading %s..." file
)
13029 ;; The .el file is newer than the .eld file, so we read that one
13031 (gnus-read-old-newsrc-el-file file
))))
13033 ;; Parse the old-style quick startup file
13034 (defun gnus-read-old-newsrc-el-file (file)
13035 (let (newsrc killed marked group m
)
13037 (let ((gnus-killed-assoc nil
)
13038 gnus-marked-assoc gnus-newsrc-alist gnus-newsrc-assoc
)
13040 (condition-case nil
13043 (setq newsrc gnus-newsrc-assoc
13044 killed gnus-killed-assoc
13045 marked gnus-marked-assoc
)))
13046 (setq gnus-newsrc-alist nil
)
13048 (setq group
(car newsrc
))
13049 (let ((info (nth 2 (gnus-gethash (car group
) gnus-newsrc-hashtb
))))
13052 (setcar (nthcdr 2 info
) (cdr (cdr group
)))
13054 (if (nth 1 group
) gnus-level-default-subscribed
13055 gnus-level-default-unsubscribed
))
13056 (setq gnus-newsrc-alist
(cons info gnus-newsrc-alist
)))
13057 (setq gnus-newsrc-alist
13061 (if (nth 1 group
) gnus-level-default-subscribed
13062 gnus-level-default-unsubscribed
)
13063 (cdr (cdr group
))))
13064 gnus-newsrc-alist
)))
13065 (if (setq m
(assoc (car group
) marked
))
13066 (setcdr (cdr (cdr info
))
13067 (cons (list (cons 'tick
(cdr m
))) nil
))))
13068 (setq newsrc
(cdr newsrc
)))
13069 (setq newsrc killed
)
13071 (setcar newsrc
(car (car newsrc
)))
13072 (setq newsrc
(cdr newsrc
)))
13073 (setq gnus-killed-list killed
))
13074 ;; The .el file version of this variable does not begin with
13075 ;; "options", while the .eld version does, so we just add it if it
13078 gnus-newsrc-options
13080 (and (not (string-match "^ *options" gnus-newsrc-options
))
13081 (setq gnus-newsrc-options
(concat "options " gnus-newsrc-options
)))
13082 (and (not (string-match "\n$" gnus-newsrc-options
))
13083 (setq gnus-newsrc-options
(concat gnus-newsrc-options
"\n")))
13084 ;; Finally, if we read some options lines, we parse them.
13085 (or (string= gnus-newsrc-options
"")
13086 (gnus-newsrc-parse-options gnus-newsrc-options
))))
13088 (setq gnus-newsrc-alist
(nreverse gnus-newsrc-alist
))
13089 (gnus-make-hashtable-from-newsrc-alist)))
13091 (defun gnus-make-newsrc-file (file)
13092 "Make server dependent file name by catenating FILE and server host name."
13093 (let* ((file (expand-file-name file nil
))
13094 (real-file (concat file
"-" (nth 1 gnus-select-method
))))
13095 (if (or (file-exists-p real-file
)
13096 (file-exists-p (concat real-file
".el"))
13097 (file-exists-p (concat real-file
".eld")))
13100 (defun gnus-uncompress-newsrc-alist ()
13101 ;; Uncompress all lists of marked articles in the newsrc assoc.
13102 (let ((newsrc gnus-newsrc-alist
)
13105 (if (not (setq marked
(nth 3 (car newsrc
))))
13108 (or (eq 'score
(car (car marked
)))
13109 (eq 'bookmark
(car (car marked
)))
13110 (eq 'killed
(car (car marked
)))
13111 (setcdr (car marked
) (gnus-uncompress-range (cdr (car marked
)))))
13112 (setq marked
(cdr marked
))))
13113 (setq newsrc
(cdr newsrc
)))))
13115 (defun gnus-compress-newsrc-alist ()
13116 ;; Compress all lists of marked articles in the newsrc assoc.
13117 (let ((newsrc gnus-newsrc-alist
)
13120 (if (not (setq marked
(nth 3 (car newsrc
))))
13123 (or (eq 'score
(car (car marked
)))
13124 (eq 'bookmark
(car (car marked
)))
13125 (eq 'killed
(car (car marked
)))
13126 (setcdr (car marked
)
13128 (gnus-compress-sequence
13129 (sort (cdr (car marked
)) '<) t
)
13130 (error (cdr (car marked
))))))
13131 (setq marked
(cdr marked
))))
13132 (setq newsrc
(cdr newsrc
)))))
13134 (defun gnus-newsrc-to-gnus-format ()
13135 (setq gnus-newsrc-options
"")
13136 (setq gnus-newsrc-options-n nil
)
13138 (or gnus-active-hashtb
13139 (setq gnus-active-hashtb
(make-vector 4095 0)))
13140 (let ((buf (current-buffer))
13141 (already-read (> (length gnus-newsrc-alist
) 1))
13142 group subscribed options-symbol newsrc Options-symbol
13144 (goto-char (point-min))
13145 ;; We intern the symbol `options' in the active hashtb so that we
13146 ;; can `eq' against it later.
13147 (set (setq options-symbol
(intern "options" gnus-active-hashtb
)) nil
)
13148 (set (setq Options-symbol
(intern "Options" gnus-active-hashtb
)) nil
)
13150 (while (not (eobp))
13151 ;; We first read the first word on the line by narrowing and
13152 ;; then reading into `gnus-active-hashtb'. Most groups will
13153 ;; already exist in that hashtb, so this will save some string
13157 (progn (skip-chars-forward "^ \t!:\n") (point)))
13158 (goto-char (point-min))
13160 (and (/= (point-min) (point-max))
13161 (let ((obarray gnus-active-hashtb
)) (read buf
))))
13163 ;; Now, the symbol we have read is either `options' or a group
13164 ;; name. If it is an options line, we just add it to a string.
13166 ((or (eq symbol options-symbol
)
13167 (eq symbol Options-symbol
))
13168 (setq gnus-newsrc-options
13169 ;; This concating is quite inefficient, but since our
13170 ;; thorough studies show that approx 99.37% of all
13171 ;; .newsrc files only contain a single options line, we
13172 ;; don't give a damn, frankly, my dear.
13173 (concat gnus-newsrc-options
13175 (gnus-point-at-bol)
13176 ;; Options may continue on the next line.
13177 (or (and (re-search-forward "^[^ \t]" nil
'move
)
13178 (progn (beginning-of-line) (point)))
13182 (or (boundp symbol
) (set symbol nil
))
13183 ;; It was a group name.
13184 (setq subscribed
(= (following-char) ?
:)
13185 group
(symbol-name symbol
)
13188 ;; If the line ends here, this is clearly a buggy line, so
13189 ;; we put point a the beginning of line and let the cond
13190 ;; below do the error handling.
13191 (beginning-of-line)
13192 ;; We skip to the beginning of the ranges.
13193 (skip-chars-forward "!: \t"))
13194 ;; We are now at the beginning of the list of read articles.
13195 ;; We read them range by range.
13198 ((looking-at "[0-9]+")
13199 ;; We narrow and read a number instead of buffer-substring/
13200 ;; string-to-int because it's faster. narrow/widen is
13201 ;; faster than save-restriction/narrow, and save-restriction
13202 ;; produces a garbage object.
13204 (narrow-to-region (match-beginning 0) (match-end 0))
13207 ;; If the next character is a dash, then this is a range.
13208 (if (= (following-char) ?-
)
13210 ;; We read the upper bound of the range.
13212 (if (not (looking-at "[0-9]+"))
13213 ;; This is a buggy line, by we pretend that
13214 ;; it's kinda OK. Perhaps the user should be
13216 (setq reads
(cons num1 reads
))
13221 (narrow-to-region (match-beginning 0)
13226 ;; It was just a simple number, so we add it to the
13228 (setq reads
(cons num1 reads
)))
13229 ;; If the next char in ?\n, then we have reached the end
13230 ;; of the line and return nil.
13231 (/= (following-char) ?
\n))
13232 ((= (following-char) ?
\n)
13233 ;; End of line, so we end.
13236 ;; Not numbers and not eol, so this might be a buggy
13239 ;; If it was eob instead of ?\n, we allow it.
13241 ;; The line was buggy.
13243 (gnus-message 3 "Mangled line: %s"
13244 (buffer-substring (gnus-point-at-bol)
13245 (gnus-point-at-eol)))
13249 ;; Skip past ", ". Spaces are illegal in these ranges, but
13250 ;; we allow them, because it's a common mistake to put a
13251 ;; space after the comma.
13252 (skip-chars-forward ", "))
13254 ;; We have already read .newsrc.eld, so we gently update the
13255 ;; data in the hash table with the information we have just
13259 (let ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb
)))
13262 ;; There is an entry for this file in the alist.
13264 (setcar (nthcdr 2 info
) (nreverse reads
))
13265 ;; We update the level very gently. In fact, we
13266 ;; only change it if there's been a status change
13267 ;; from subscribed to unsubscribed, or vice versa.
13268 (setq level
(nth 1 info
))
13269 (cond ((and (<= level gnus-level-subscribed
)
13271 (setq level
(if reads
13272 gnus-level-default-unsubscribed
13273 (1+ gnus-level-default-unsubscribed
))))
13274 ((and (> level gnus-level-subscribed
) subscribed
)
13275 (setq level gnus-level-default-subscribed
)))
13276 (setcar (cdr info
) level
))
13277 ;; This is a new group.
13278 (setq info
(list group
13280 gnus-level-default-subscribed
13282 (1+ gnus-level-subscribed
)
13283 gnus-level-default-unsubscribed
))
13284 (nreverse reads
))))
13285 (setq newsrc
(cons info newsrc
))))))
13288 (setq newsrc
(nreverse newsrc
))
13290 (if (not already-read
)
13292 ;; We now have two newsrc lists - `newsrc', which is what we
13293 ;; have read from .newsrc, and `gnus-newsrc-alist', which is
13294 ;; what we've read from .newsrc.eld. We have to merge these
13295 ;; lists. We do this by "attaching" any (foreign) groups in the
13296 ;; gnus-newsrc-alist to the (native) group that precedes them.
13297 (let ((rc (cdr gnus-newsrc-alist
))
13298 (prev gnus-newsrc-alist
)
13301 (or (null (nth 4 (car rc
))) ; It's a native group.
13302 (assoc (car (car rc
)) newsrc
) ; It's already in the alist.
13303 (if (setq entry
(assoc (car (car prev
)) newsrc
))
13304 (setcdr (setq mentry
(memq entry newsrc
))
13305 (cons (car rc
) (cdr mentry
)))
13306 (setq newsrc
(cons (car rc
) newsrc
))))
13310 (setq gnus-newsrc-alist newsrc
)
13311 ;; We make the newsrc hashtb.
13312 (gnus-make-hashtable-from-newsrc-alist)
13314 ;; Finally, if we read some options lines, we parse them.
13315 (or (string= gnus-newsrc-options
"")
13316 (gnus-newsrc-parse-options gnus-newsrc-options
))))
13318 ;; Parse options lines to find "options -n !all rec.all" and stuff.
13319 ;; The return value will be a list on the form
13320 ;; ((regexp1 . ignore)
13321 ;; (regexp2 . subscribe)...)
13322 ;; When handling new newsgroups, groups that match a `ignore' regexp
13323 ;; will be ignored, and groups that match a `subscribe' regexp will be
13324 ;; subscribed. A line like
13325 ;; options -n !all rec.all
13326 ;; will lead to a list that looks like
13327 ;; (("^rec\\..+" . subscribe)
13328 ;; ("^.+" . ignore))
13329 ;; So all "rec.*" groups will be subscribed, while all the other
13330 ;; groups will be ignored. Note that "options -n !all rec.all" is very
13331 ;; different from "options -n rec.all !all".
13332 (defun gnus-newsrc-parse-options (options)
13335 (gnus-set-work-buffer)
13336 (insert (regexp-quote options
))
13337 ;; First we treat all continuation lines.
13338 (goto-char (point-min))
13339 (while (re-search-forward "\n[ \t]+" nil t
)
13340 (replace-match " " t t
))
13341 ;; Then we transform all "all"s into ".+"s.
13342 (goto-char (point-min))
13343 (while (re-search-forward "\\ball\\b" nil t
)
13344 (replace-match ".+" t t
))
13345 (goto-char (point-min))
13346 ;; We remove all other options than the "-n" ones.
13347 (while (re-search-forward "[ \t]-[^n][^-]*" nil t
)
13348 (replace-match " ")
13350 (goto-char (point-min))
13352 ;; We are only interested in "options -n" lines - we
13353 ;; ignore the other option lines.
13354 (while (re-search-forward "[ \t]-n" nil t
)
13356 (or (save-excursion
13357 (and (re-search-forward "[ \t]-n" (gnus-point-at-eol) t
)
13359 (gnus-point-at-eol)))
13360 ;; Search for all "words"...
13361 (while (re-search-forward "[^ \t,\n]+" eol t
)
13362 (if (= (char-after (match-beginning 0)) ?
!)
13363 ;; If the word begins with a bang (!), this is a "not"
13364 ;; spec. We put this spec (minus the bang) and the
13365 ;; symbol `ignore' into the list.
13366 (setq out
(cons (cons (concat
13367 "^" (buffer-substring
13368 (1+ (match-beginning 0))
13371 ;; There was no bang, so this is a "yes" spec.
13372 (setq out
(cons (cons (concat
13373 "^" (buffer-substring (match-beginning 0)
13375 'subscribe
) out
)))))
13377 (setq gnus-newsrc-options-n out
))))
13380 (defun gnus-save-newsrc-file ()
13381 "Save .newsrc file."
13382 ;; Note: We cannot save .newsrc file if all newsgroups are removed
13383 ;; from the variable gnus-newsrc-alist.
13384 (and (or gnus-newsrc-alist gnus-killed-list
)
13385 gnus-current-startup-file
13387 (run-hooks 'gnus-save-newsrc-hook
)
13389 (if (and gnus-use-dribble-file
13390 (or (not gnus-dribble-buffer
)
13391 (not (buffer-name gnus-dribble-buffer
))
13392 (zerop (save-excursion
13393 (set-buffer gnus-dribble-buffer
)
13395 (gnus-message 4 "(No changes need to be saved)")
13396 (if gnus-save-newsrc-file
13398 (gnus-message 5 "Saving %s..." gnus-current-startup-file
)
13399 ;; Make backup file of master newsrc.
13400 (gnus-gnus-to-newsrc-format)
13401 (gnus-message 5 "Saving %s...done"
13402 gnus-current-startup-file
)))
13403 ;; Quickly loadable .newsrc.
13404 (set-buffer (get-buffer-create " *Gnus-newsrc*"))
13405 (setq buffer-file-name
(concat gnus-current-startup-file
".eld"))
13406 (gnus-add-current-to-buffer-list)
13407 (buffer-disable-undo (current-buffer))
13409 (gnus-message 5 "Saving %s.eld..." gnus-current-startup-file
)
13410 (gnus-gnus-to-quick-newsrc-format)
13412 (kill-buffer (current-buffer))
13413 (gnus-message 5 "Saving %s.eld...done" gnus-current-startup-file
)
13414 (gnus-dribble-delete-file))))))
13416 (defun gnus-gnus-to-quick-newsrc-format ()
13417 "Insert Gnus variables such as gnus-newsrc-alist in lisp format."
13418 (insert ";; Gnus startup file.\n")
13419 (insert ";; Never delete this file - touch .newsrc instead to force Gnus\n")
13420 (insert ";; to read .newsrc.\n")
13421 (insert "(setq gnus-newsrc-file-version "
13422 (prin1-to-string gnus-version
) ")\n")
13423 (let ((variables gnus-variable-list
)
13425 (gnus-newsrc-alist (cdr gnus-newsrc-alist
))
13427 ;; insert lisp expressions.
13428 (gnus-compress-newsrc-alist)
13430 (setq variable
(car variables
))
13431 (and (boundp variable
)
13432 (symbol-value variable
)
13433 (or gnus-save-killed-list
(not (eq variable
'gnus-killed-list
)))
13434 (insert "(setq " (symbol-name variable
) " '"
13435 (prin1-to-string (symbol-value variable
))
13437 (setq variables
(cdr variables
)))
13438 (gnus-uncompress-newsrc-alist)))
13441 (defun gnus-gnus-to-newsrc-format ()
13442 ;; Generate and save the .newsrc file.
13443 (let ((newsrc (cdr gnus-newsrc-alist
))
13446 (set-buffer (create-file-buffer gnus-current-startup-file
))
13447 (setq buffer-file-name gnus-current-startup-file
)
13448 (buffer-disable-undo (current-buffer))
13451 (if gnus-newsrc-options
(insert gnus-newsrc-options
))
13452 ;; Write subscribed and unsubscribed.
13454 (setq info
(car newsrc
))
13455 (if (not (nth 4 info
)) ;Don't write foreign groups to .newsrc.
13457 (insert (car info
) (if (> (nth 1 info
) gnus-level-subscribed
)
13459 (if (setq ranges
(nth 2 info
))
13462 (if (not (listp (cdr ranges
)))
13463 (if (= (car ranges
) (cdr ranges
))
13464 (insert (int-to-string (car ranges
)))
13465 (insert (int-to-string (car ranges
)) "-"
13466 (int-to-string (cdr ranges
))))
13468 (setq range
(car ranges
)
13469 ranges
(cdr ranges
))
13470 (if (or (atom range
) (= (car range
) (cdr range
)))
13471 (insert (int-to-string
13472 (or (and (atom range
) range
)
13474 (insert (int-to-string (car range
)) "-"
13475 (int-to-string (cdr range
))))
13476 (if ranges
(insert ","))))))
13478 (setq newsrc
(cdr newsrc
)))
13479 ;; It has been reported that sometime the modtime on the .newsrc
13480 ;; file seems to be off. We really do want to overwrite it, so
13481 ;; we clear the modtime here before saving. It's a bit odd,
13483 ;; sometimes the modtime clear isn't sufficient. most brute force:
13484 ;; delete the silly thing entirely first. but this fails to provide
13485 ;; such niceties as .newsrc~ creation.
13486 (if gnus-modtime-botch
13487 (delete-file gnus-startup-file
)
13488 (clear-visited-file-modtime))
13490 (kill-buffer (current-buffer)))))
13492 (defun gnus-read-all-descriptions-files ()
13493 (let ((methods (cons gnus-select-method gnus-secondary-select-methods
)))
13495 (gnus-read-descriptions-file (car methods
))
13496 (setq methods
(cdr methods
)))
13499 (defun gnus-read-descriptions-file (&optional method
)
13500 (let ((method (or method gnus-select-method
)))
13501 ;; We create the hashtable whether we manage to read the desc file
13502 ;; to avoid trying to re-read after a failed read.
13503 (or gnus-description-hashtb
13504 (setq gnus-description-hashtb
13505 (gnus-make-hashtable (length gnus-active-hashtb
))))
13506 ;; Mark this method's desc file as read.
13507 (gnus-sethash (gnus-group-prefixed-name "" method
) "Has read"
13508 gnus-description-hashtb
)
13510 (gnus-message 5 "Reading descriptions file via %s..." (car method
))
13512 ((not (gnus-check-server method
))
13513 (gnus-message 1 "Couldn't open server")
13515 ((not (gnus-request-list-newsgroups method
))
13516 (gnus-message 1 "Couldn't read newsgroups descriptions")
13522 (set-buffer nntp-server-buffer
)
13523 (goto-char (point-min))
13524 (if (or (search-forward "\n.\n" nil t
)
13525 (goto-char (point-max)))
13527 (beginning-of-line)
13528 (narrow-to-region (point-min) (point))))
13529 (goto-char (point-min))
13530 (while (not (eobp))
13531 ;; If we get an error, we set group to 0, which is not a
13535 (let ((obarray gnus-description-hashtb
))
13536 ;; Group is set to a symbol interned in this
13538 (read nntp-server-buffer
))
13540 (skip-chars-forward " \t")
13541 ;; ... which leads to this line being effectively ignored.
13542 (and (symbolp group
)
13543 (set group
(buffer-substring
13544 (point) (progn (end-of-line) (point)))))
13545 (forward-line 1))))
13546 (gnus-message 5 "Reading descriptions file...done")
13549 (defun gnus-group-get-description (group)
13550 ;; Get the description of a group by sending XGTITLE to the server.
13551 (and (gnus-request-group-description group
)
13553 (set-buffer nntp-server-buffer
)
13554 (goto-char (point-min))
13555 (and (looking-at "[^ \t]+[ \t]+\\(.*\\)")
13556 (buffer-substring (match-beginning 1) (match-end 1))))))
13562 (defvar gnus-server-mode-hook nil
13563 "Hook run in `gnus-server-mode' buffers.")
13565 (defconst gnus-server-line-format
" {%(%h:%w%)}\n"
13566 "Format of server lines.
13567 It works along the same lines as a normal formatting string,
13568 with some simple extensions.")
13570 (defvar gnus-server-mode-line-format
"Gnus List of servers"
13571 "The format specification for the server mode line.")
13573 (defconst gnus-server-line-format-alist
13574 (list (list ?h
'how ?s
)
13576 (list ?w
'where ?s
)
13579 (defconst gnus-server-mode-line-format-alist
13580 (list (list ?S
'news-server ?s
)
13581 (list ?M
'news-method ?s
)
13582 (list ?u
'user-defined ?s
)))
13584 (defvar gnus-server-line-format-spec nil
)
13585 (defvar gnus-server-mode-line-format-spec nil
)
13586 (defvar gnus-server-killed-servers nil
)
13588 (defvar gnus-server-mode-map nil
)
13589 (put 'gnus-server-mode
'mode-class
'special
)
13591 (if gnus-server-mode-map
13593 (setq gnus-server-mode-map
(make-sparse-keymap))
13594 (suppress-keymap gnus-server-mode-map
)
13595 (define-key gnus-server-mode-map
" " 'gnus-server-read-server
)
13596 (define-key gnus-server-mode-map
"\r" 'gnus-server-read-server
)
13597 (define-key gnus-server-mode-map gnus-mouse-2
'gnus-server-pick-server
)
13598 (define-key gnus-server-mode-map
"q" 'gnus-server-exit
)
13599 (define-key gnus-server-mode-map
"l" 'gnus-server-list-servers
)
13600 (define-key gnus-server-mode-map
"k" 'gnus-server-kill-server
)
13601 (define-key gnus-server-mode-map
"y" 'gnus-server-yank-server
)
13602 (define-key gnus-server-mode-map
"c" 'gnus-server-copy-server
)
13603 (define-key gnus-server-mode-map
"a" 'gnus-server-add-server
)
13604 (define-key gnus-server-mode-map
"e" 'gnus-server-edit-server
))
13606 (defun gnus-server-mode ()
13607 "Major mode for listing and editing servers.
13609 All normal editing commands are switched off.
13610 \\<gnus-server-mode-map>
13612 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
13614 The following commands are available:
13616 \\{gnus-server-mode-map}"
13618 (if gnus-visual
(gnus-server-make-menu-bar))
13619 (kill-all-local-variables)
13620 (gnus-simplify-mode-line)
13621 (setq major-mode
'gnus-server-mode
)
13622 (setq mode-name
"Server")
13623 ; (gnus-group-set-mode-line)
13624 (setq mode-line-process nil
)
13625 (use-local-map gnus-server-mode-map
)
13626 (buffer-disable-undo (current-buffer))
13627 (setq truncate-lines t
)
13628 (setq buffer-read-only t
)
13629 (run-hooks 'gnus-server-mode-hook
))
13631 (defun gnus-server-insert-server-line (sformat name method
)
13632 (let* ((sformat (or sformat gnus-server-line-format-spec
))
13634 (where (nth 1 method
))
13636 (beginning-of-line)
13638 ;; Insert the text.
13639 (insert (eval sformat
))
13640 (add-text-properties b
(1+ b
) (list 'gnus-server
(intern name
)))))
13642 (defun gnus-server-setup-buffer ()
13643 (if (get-buffer gnus-server-buffer
)
13646 (set-buffer (get-buffer-create gnus-server-buffer
))
13648 (and gnus-carpal
(gnus-carpal-setup-buffer 'server
)))))
13650 (defun gnus-server-prepare ()
13651 (setq gnus-server-mode-line-format-spec
13652 (gnus-parse-format gnus-server-mode-line-format
13653 gnus-server-mode-line-format-alist
))
13654 (setq gnus-server-line-format-spec
13655 (gnus-parse-format gnus-server-line-format
13656 gnus-server-line-format-alist
))
13657 (let ((alist gnus-server-alist
)
13658 (buffer-read-only nil
))
13661 (gnus-server-insert-server-line nil
(car (car alist
)) (cdr (car alist
)))
13662 (setq alist
(cdr alist
))))
13663 (goto-char (point-min))
13664 (gnus-server-position-cursor))
13666 (defun gnus-server-server-name ()
13667 (let ((server (get-text-property (gnus-point-at-bol) 'gnus-server
)))
13668 (and server
(symbol-name server
))))
13670 (defalias 'gnus-server-position-cursor
'gnus-goto-colon
)
13672 (defconst gnus-server-edit-buffer
"*Gnus edit server*")
13674 (defun gnus-server-update-server (server)
13676 (set-buffer gnus-server-buffer
)
13677 (let ((buffer-read-only nil
)
13678 (info (cdr (assoc server gnus-server-alist
))))
13679 (gnus-dribble-enter
13680 (concat "(gnus-server-set-info \"" server
"\" '"
13681 (prin1-to-string info
) ")"))
13682 ;; Buffer may be narrowed.
13685 (if (gnus-server-goto-server server
)
13686 (delete-region (progn (beginning-of-line) (point))
13687 (progn (forward-line 1) (point))))
13688 (let ((entry (assoc server gnus-server-alist
)))
13689 (gnus-server-insert-server-line nil
(car entry
) (cdr entry
))
13690 (gnus-server-position-cursor))))))
13692 (defun gnus-server-set-info (server info
)
13693 ;; Enter a select method into the virtual server alist.
13694 (gnus-dribble-enter
13695 (concat "(gnus-server-set-info \"" server
"\" '"
13696 (prin1-to-string info
) ")"))
13697 (let* ((server (nth 1 info
))
13698 (entry (assoc server gnus-server-alist
)))
13699 (if entry
(setcdr entry info
)
13700 (setq gnus-server-alist
13701 (nconc gnus-server-alist
(list (cons server info
)))))))
13703 (defun gnus-server-to-method (server)
13704 ;; Map virtual server names to select methods.
13705 (or (and (equal server
"native") gnus-select-method
)
13706 (cdr (assoc server gnus-server-alist
))))
13708 (defun gnus-server-extend-method (group method
)
13709 ;; This function "extends" a virtual server. If the server is
13710 ;; "hello", and the select method is ("hello" (my-var "something"))
13711 ;; in the group "alt.alt", this will result in a new virtual server
13712 ;; called "helly+alt.alt".
13714 (gnus-copy-sequence
13715 (if (equal (car method
) "native") gnus-select-method
13716 (cdr (assoc (car method
) gnus-server-alist
))))))
13717 (setcar (cdr entry
) (concat (nth 1 entry
) "+" group
))
13718 (nconc entry
(cdr method
))))
13720 (defun gnus-server-get-method (group method
)
13721 ;; Input either a server name, and extended server name, or a
13722 ;; select method, and return a select method.
13723 (cond ((stringp method
)
13724 (gnus-server-to-method method
))
13725 ((and (stringp (car method
)) group
)
13726 (gnus-server-extend-method group method
))
13728 (gnus-server-add-address method
))))
13730 (defun gnus-server-add-address (method)
13731 (let ((method-name (symbol-name (car method
))))
13732 (if (and (memq 'address
(assoc method-name gnus-valid-select-methods
))
13733 (not (assq (intern (concat method-name
"-address")) method
)))
13734 (append method
(list (list (intern (concat method-name
"-address"))
13738 (defun gnus-server-equal (s1 s2
)
13740 (and (= (length s1
) (length s2
))
13742 (while (and s1
(member (car s1
) s2
))
13743 (setq s1
(cdr s1
)))
13746 ;;; Interactive server functions.
13748 (defun gnus-server-kill-server (server)
13749 "Kill the server on the current line."
13750 (interactive (list (gnus-server-server-name)))
13751 (or (gnus-server-goto-server server
)
13752 (if server
(error "No such server: %s" server
)
13753 (error "No server on the current line")))
13754 (gnus-dribble-enter "")
13755 (let ((buffer-read-only nil
))
13756 (delete-region (progn (beginning-of-line) (point))
13757 (progn (forward-line 1) (point))))
13758 (setq gnus-server-killed-servers
13759 (cons (assoc server gnus-server-alist
) gnus-server-killed-servers
))
13760 (setq gnus-server-alist
(delq (car gnus-server-killed-servers
)
13761 gnus-server-alist
))
13762 (gnus-server-position-cursor))
13764 (defun gnus-server-yank-server ()
13765 "Yank the previously killed server."
13767 (or gnus-server-killed-servers
13768 (error "No killed servers to be yanked"))
13769 (let ((alist gnus-server-alist
)
13770 (server (gnus-server-server-name))
13771 (killed (car gnus-server-killed-servers
)))
13773 (setq gnus-server-alist
(nconc gnus-server-alist
(list killed
)))
13774 (if (string= server
(car (car gnus-server-alist
)))
13775 (setq gnus-server-alist
(cons killed gnus-server-alist
))
13776 (while (and (cdr alist
)
13777 (not (string= server
(car (car (cdr alist
))))))
13778 (setq alist
(cdr alist
)))
13779 (setcdr alist
(cons killed
(cdr alist
)))))
13780 (gnus-server-update-server (car killed
))
13781 (setq gnus-server-killed-servers
(cdr gnus-server-killed-servers
))
13782 (gnus-server-position-cursor)))
13784 (defun gnus-server-exit ()
13785 "Return to the group buffer."
13787 (kill-buffer (current-buffer))
13788 (switch-to-buffer gnus-group-buffer
))
13790 (defun gnus-server-list-servers ()
13791 "List all available servers."
13793 (let ((cur (gnus-server-server-name)))
13794 (gnus-server-prepare)
13795 (if cur
(gnus-server-goto-server cur
)
13796 (goto-char (point-max))
13798 (gnus-server-position-cursor)))
13800 (defun gnus-server-copy-server (from to
)
13803 (or (gnus-server-server-name)
13804 (error "No server on the current line"))
13805 (read-string "Copy to: ")))
13806 (or from
(error "No server on current line"))
13807 (or (and to
(not (string= to
""))) (error "No name to copy to"))
13808 (and (assoc to gnus-server-alist
) (error "%s already exists" to
))
13809 (or (assoc from gnus-server-alist
)
13810 (error "%s: no such server" from
))
13811 (let ((to-entry (gnus-copy-sequence (assoc from gnus-server-alist
))))
13812 (setcar to-entry to
)
13813 (setcar (nthcdr 2 to-entry
) to
)
13814 (setq gnus-server-killed-servers
13815 (cons to-entry gnus-server-killed-servers
))
13816 (gnus-server-yank-server)))
13818 (defun gnus-server-add-server (how where
)
13820 (list (intern (completing-read "Server method: "
13821 gnus-valid-select-methods nil t
))
13822 (read-string "Server name: ")))
13823 (setq gnus-server-killed-servers
13824 (cons (list where how where
) gnus-server-killed-servers
))
13825 (gnus-server-yank-server))
13827 (defun gnus-server-goto-server (server)
13828 "Jump to a server line."
13830 (list (completing-read "Goto server: " gnus-server-alist nil t
)))
13831 (let ((to (text-property-any (point-min) (point-max)
13832 'gnus-server
(intern server
))))
13836 (gnus-server-position-cursor)))))
13838 (defun gnus-server-edit-server (server)
13839 "Edit the server on the current line."
13840 (interactive (list (gnus-server-server-name)))
13842 (error "No server on current line"))
13843 (let ((winconf (current-window-configuration)))
13844 (get-buffer-create gnus-server-edit-buffer
)
13845 (gnus-configure-windows 'edit-server
)
13846 (gnus-add-current-to-buffer-list)
13848 (make-local-variable 'gnus-prev-winconf
)
13849 (setq gnus-prev-winconf winconf
)
13850 (use-local-map (copy-keymap (current-local-map)))
13851 (let ((done-func '(lambda ()
13852 "Exit editing mode and update the information."
13854 (gnus-server-edit-server-done 'group
))))
13855 (setcar (cdr (nth 4 done-func
)) server
)
13856 (local-set-key "\C-c\C-c" done-func
))
13858 (insert ";; Type `C-c C-c' after you have edited the server.\n\n")
13859 (insert (pp-to-string (cdr (assoc server gnus-server-alist
))))))
13861 (defun gnus-server-edit-server-done (server)
13863 (set-buffer (get-buffer-create gnus-server-edit-buffer
))
13864 (goto-char (point-min))
13865 (let ((form (read (current-buffer)))
13866 (winconf gnus-prev-winconf
))
13867 (gnus-server-set-info server form
)
13868 (kill-buffer (current-buffer))
13869 (and winconf
(set-window-configuration winconf
))
13870 (set-buffer gnus-server-buffer
)
13871 (gnus-server-update-server (gnus-server-server-name))
13872 (gnus-server-list-servers)
13873 (gnus-server-position-cursor)))
13875 (defun gnus-server-read-server (server)
13877 (interactive (list (gnus-server-server-name)))
13878 (gnus-browse-foreign-server (gnus-server-to-method server
) (current-buffer)))
13880 (defun gnus-mouse-pick-server (e)
13882 (mouse-set-point e
)
13883 (gnus-server-read-server (gnus-server-server-name)))
13886 ;;; entry points into gnus-score.el
13889 ;;; Finding score files.
13891 (defvar gnus-global-score-files nil
13892 "*List of global score files and directories.
13893 Set this variable if you want to use people's score files. One entry
13894 for each score file or each score file directory. Gnus will decide
13895 by itself what score files are applicable to which group.
13897 Say you want to use the single score file
13898 \"/ftp.ifi.uio.no@ftp:/pub/larsi/ding/score/soc.motss.SCORE\" and all
13899 score files in the \"/ftp.some-where:/pub/score\" directory.
13901 (setq gnus-global-score-files
13902 '(\"/ftp.ifi.uio.no:/pub/larsi/ding/score/soc.motss.SCORE\"
13903 \"/ftp.some-where:/pub/score\"))")
13905 (defun gnus-score-score-files (group)
13906 "Return a list of all possible score files."
13907 ;; Search and set any global score files.
13908 (and gnus-global-score-files
13909 (or gnus-internal-global-score-files
13910 (gnus-score-search-global-directories gnus-global-score-files
)))
13911 ;; Fix the kill-file dir variable.
13912 (setq gnus-kill-files-directory
13913 (file-name-as-directory
13914 (or gnus-kill-files-directory
"~/News/")))
13915 ;; If we can't read it, there are no score files.
13916 (if (not (file-exists-p (expand-file-name gnus-kill-files-directory
)))
13917 (setq gnus-score-file-list nil
)
13918 (if (gnus-use-long-file-name 'not-score
)
13919 ;; We want long file names.
13920 (if (or (not gnus-score-file-list
)
13921 (not (car gnus-score-file-list
))
13922 (gnus-file-newer-than gnus-kill-files-directory
13923 (car gnus-score-file-list
)))
13924 (setq gnus-score-file-list
13925 (cons (nth 5 (file-attributes gnus-kill-files-directory
))
13928 gnus-kill-files-directory t
13929 (gnus-score-file-regexp))))))
13930 ;; We do not use long file names, so we have to do some
13931 ;; directory traversing.
13932 (let ((mdir (length (expand-file-name gnus-kill-files-directory
)))
13933 (suffixes (list gnus-score-file-suffix gnus-adaptive-file-suffix
))
13936 (setq dir
(expand-file-name
13937 (concat gnus-kill-files-directory
13938 (gnus-replace-chars-in-string group ?. ?
/))))
13939 (setq dir
(gnus-replace-chars-in-string dir ?
: ?
/))
13940 (setq suffix
(car suffixes
)
13941 suffixes
(cdr suffixes
))
13942 (if (file-exists-p (concat dir
"/" suffix
))
13943 (setq files
(cons (concat dir
"/" suffix
) files
)))
13944 (while (>= (1+ (length dir
)) mdir
)
13945 (and (file-exists-p (concat dir
"/all/" suffix
))
13946 (setq files
(cons (concat dir
"/all/" suffix
) files
)))
13947 (string-match "/[^/]*$" dir
)
13948 (setq dir
(substring dir
0 (match-beginning 0)))))
13949 (setq gnus-score-file-list
13950 (cons nil
(nreverse files
)))))
13951 (cdr gnus-score-file-list
)))
13953 (defun gnus-score-file-regexp ()
13954 (concat "\\(" gnus-score-file-suffix
13955 "\\|" gnus-adaptive-file-suffix
"\\)$"))
13957 (defun gnus-score-find-bnews (group)
13958 "Return a list of score files for GROUP.
13959 The score files are those files in the ~/News directory which matches
13960 GROUP using BNews sys file syntax."
13961 (let* ((sfiles (append (gnus-score-score-files group
)
13962 gnus-internal-global-score-files
))
13963 (kill-dir (file-name-as-directory
13964 (expand-file-name gnus-kill-files-directory
)))
13965 (klen (length kill-dir
))
13966 ofiles not-match regexp
)
13968 (set-buffer (get-buffer-create "*gnus score files*"))
13969 (buffer-disable-undo (current-buffer))
13970 ;; Go through all score file names and create regexp with them
13974 (insert (car sfiles
))
13975 (goto-char (point-min))
13976 ;; First remove the suffix itself.
13977 (re-search-forward (concat "." (gnus-score-file-regexp)))
13978 (replace-match "" t t
)
13979 (goto-char (point-min))
13980 (if (looking-at (regexp-quote kill-dir
))
13981 ;; If the file name was just "SCORE", `klen' is one character
13983 (delete-char (min (1- (point-max)) klen
))
13984 (goto-char (point-max))
13985 (search-backward "/")
13986 (delete-region (1+ (point)) (point-min)))
13987 ;; If short file names were used, we have to translate slashes.
13988 (goto-char (point-min))
13989 (while (re-search-forward "[/:]" nil t
)
13990 (replace-match "." t t
))
13991 ;; Kludge to get rid of "nntp+" problems.
13992 (goto-char (point-min))
13993 (and (looking-at "nn[a-z]+\\+")
13995 (search-forward "+")
13998 ;; Translate ".all" to "[./].*";
13999 (while (search-forward ".all" nil t
)
14000 (replace-match "[./:].*" t t
))
14001 (goto-char (point-min))
14002 ;; Translate "all" to ".*".
14003 (while (search-forward "all" nil t
)
14004 (replace-match ".*" t t
))
14005 (goto-char (point-min))
14006 ;; Deal with "not."s.
14007 (if (looking-at "not.")
14010 (setq regexp
(buffer-substring 5 (point-max))))
14011 (setq regexp
(buffer-substring 1 (point-max)))
14012 (setq not-match nil
))
14013 ;; Finally - if this resulting regexp matches the group name,
14014 ;; we add this score file to the list of score files
14015 ;; applicable to this group.
14016 (if (or (and not-match
14017 (not (string-match regexp group
)))
14018 (and (not not-match
)
14019 (string-match regexp group
)))
14020 (setq ofiles
(cons (car sfiles
) ofiles
)))
14021 (setq sfiles
(cdr sfiles
)))
14022 (kill-buffer (current-buffer))
14023 ;; Slight kludge here - the last score file returned should be
14024 ;; the local score file, whether it exists or not. This is so
14025 ;; that any score commands the user enters will go to the right
14026 ;; file, and not end up in some global score file.
14029 (if (gnus-use-long-file-name 'not-score
)
14030 (concat gnus-kill-files-directory group
"."
14031 gnus-score-file-suffix
)
14032 (concat gnus-kill-files-directory
14033 (gnus-replace-chars-in-string group ?. ?
/ ?
: ?
/)
14034 "/" gnus-score-file-suffix
)))))
14035 ;; The local score file might already be there, but it's
14036 ;; supposed to be the very last file, so we delete it from the
14037 ;; list if it's already there, and add it to the head of the
14039 (setq ofiles
(cons localscore
(delete localscore ofiles
))))
14040 (nreverse ofiles
))))
14042 (defun gnus-score-find-single (group)
14043 "Return list containing the score file for GROUP."
14044 (list (gnus-score-file-name group gnus-adaptive-file-suffix
)
14045 (gnus-score-file-name group
)))
14047 (defun gnus-score-find-hierarchical (group)
14048 "Return list of score files for GROUP.
14049 This includes the score file for the group and all its parents."
14050 (let ((all (copy-sequence '(nil)))
14052 (while (string-match "\\." group
(1+ start
))
14053 (setq start
(match-beginning 0))
14054 (setq all
(cons (substring group
0 start
) all
)))
14055 (setq all
(cons group all
))
14057 (mapcar (lambda (newsgroup)
14058 (gnus-score-file-name newsgroup gnus-adaptive-file-suffix
))
14059 (setq all
(nreverse all
)))
14060 (mapcar 'gnus-score-file-name all
))))
14062 (defvar gnus-score-file-alist-cache nil
)
14064 (defun gnus-score-find-alist (group)
14065 "Return list of score files for GROUP.
14066 The list is determined from the variable gnus-score-file-alist."
14067 (let ((alist gnus-score-file-multiple-match-alist
)
14069 ;; if this group has been seen before, return the cached entry
14070 (if (setq score-files
(assoc group gnus-score-file-alist-cache
))
14071 (cdr score-files
) ;ensures caching groups with no matches
14072 ;; handle the multiple match alist
14074 (and (string-match (car (car alist
)) group
)
14076 (nconc score-files
(copy-sequence (cdr (car alist
))))))
14077 (setq alist
(cdr alist
)))
14078 (setq alist gnus-score-file-single-match-alist
)
14079 ;; handle the single match alist
14081 (and (string-match (car (car alist
)) group
)
14082 ;; progn used just in case ("regexp") has no files
14083 ;; and score-files is still nil. -sj
14084 ;; this can be construed as a "stop searching here" feature :>
14085 ;; and used to simplify regexps in the single-alist
14088 (nconc score-files
(copy-sequence (cdr (car alist
)))))
14090 (setq alist
(cdr alist
)))
14091 ;; cache the score files
14092 (setq gnus-score-file-alist-cache
14093 (cons (cons group score-files
) gnus-score-file-alist-cache
))
14097 (defun gnus-possibly-score-headers (&optional trace
)
14098 (let ((func gnus-score-find-score-files-function
)
14100 (and func
(not (listp func
))
14101 (setq func
(list func
)))
14102 ;; Go through all the functions for finding score files (or actual
14103 ;; scores) and add them to a list.
14104 (setq score-files
(gnus-score-find-alist gnus-newsgroup-name
))
14106 (and (symbolp (car func
))
14107 (fboundp (car func
))
14109 (nconc score-files
(funcall (car func
) gnus-newsgroup-name
))))
14110 (setq func
(cdr func
)))
14111 (if score-files
(gnus-score-headers score-files trace
))))
14113 (defun gnus-score-file-name (newsgroup &optional suffix
)
14114 "Return the name of a score file for NEWSGROUP."
14115 (let ((suffix (or suffix gnus-score-file-suffix
)))
14117 ((or (null newsgroup
)
14118 (string-equal newsgroup
""))
14119 ;; The global score file is placed at top of the directory.
14121 suffix
(or gnus-kill-files-directory
"~/News")))
14122 ((gnus-use-long-file-name 'not-score
)
14123 ;; Append ".SCORE" to newsgroup name.
14124 (expand-file-name (concat (gnus-newsgroup-savable-name newsgroup
)
14126 (or gnus-kill-files-directory
"~/News")))
14128 ;; Place "SCORE" under the hierarchical directory.
14129 (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup
)
14131 (or gnus-kill-files-directory
"~/News"))))))
14133 (defun gnus-score-search-global-directories (files)
14134 "Scan all global score directories for score files."
14135 ;; Set the variable `gnus-internal-global-score-files' to all
14136 ;; available global score files.
14137 (interactive (list gnus-global-score-files
))
14140 (if (string-match "/$" (car files
))
14141 (setq out
(nconc (directory-files
14143 (concat (gnus-score-file-regexp) "$"))))
14144 (setq out
(cons (car files
) out
)))
14145 (setq files
(cdr files
)))
14146 (setq gnus-internal-global-score-files out
)))
14148 ;; Allow redefinition of Gnus functions.
14150 (gnus-ems-redefine)
14154 ;;; gnus.el ends here