/[emacs]/emacs/lisp/gnus/gnus-sum.el
ViewVC logotype

Diff of /emacs/lisp/gnus/gnus-sum.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.38.6.2 by handa, Fri Mar 12 00:02:58 2004 UTC revision 1.38.6.3 by miles, Thu Sep 9 09:36:26 2004 UTC
# Line 26  Line 26 
26    
27  ;;; Code:  ;;; Code:
28    
29  (eval-when-compile (require 'cl))  (eval-when-compile
30      (require 'cl)
31      (defvar tool-bar-map))
32    
33  (require 'gnus)  (require 'gnus)
34  (require 'gnus-group)  (require 'gnus-group)
# Line 36  Line 38 
38  (require 'gnus-undo)  (require 'gnus-undo)
39  (require 'gnus-util)  (require 'gnus-util)
40  (require 'mm-decode)  (require 'mm-decode)
 ;; Recursive :-(.  
 ;; (require 'gnus-art)  
41  (require 'nnoo)  (require 'nnoo)
42    
43  (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)  (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
44  (autoload 'gnus-cache-write-active "gnus-cache")  (autoload 'gnus-cache-write-active "gnus-cache")
45    (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
46    (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
47  (autoload 'mm-uu-dissect "mm-uu")  (autoload 'mm-uu-dissect "mm-uu")
48    (autoload 'gnus-article-outlook-deuglify-article "deuglify"
49      "Deuglify broken Outlook (Express) articles and redisplay."
50      t)
51    (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
52    (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
53    (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
54    
55  (defcustom gnus-kill-summary-on-exit t  (defcustom gnus-kill-summary-on-exit t
56    "*If non-nil, kill the summary buffer when you exit from it.    "*If non-nil, kill the summary buffer when you exit from it.
# Line 105  given by the `gnus-summary-same-subject' Line 114  given by the `gnus-summary-same-subject'
114                   (const adopt)                   (const adopt)
115                   (const empty)))                   (const empty)))
116    
117    (defcustom gnus-summary-make-false-root-always nil
118      "Always make a false dummy root."
119      :group 'gnus-thread
120      :type 'boolean)
121    
122  (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"  (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
123    "*A regexp to match subjects to be excluded from loose thread gathering.    "*A regexp to match subjects to be excluded from loose thread gathering.
124  As loose thread gathering is done on subjects only, that means that  As loose thread gathering is done on subjects only, that means that
# Line 132  comparing subjects." Line 146  comparing subjects."
146    "List of functions taking a string argument that simplify subjects.    "List of functions taking a string argument that simplify subjects.
147  The functions are applied recursively.  The functions are applied recursively.
148    
149  Useful functions to put in this list include: `gnus-simplify-subject-re',  Useful functions to put in this list include:
150  `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."  `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
151    `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
152    :group 'gnus-thread    :group 'gnus-thread
153    :type '(repeat function))    :type '(repeat function))
154    
155  (defcustom gnus-simplify-ignored-prefixes nil  (defcustom gnus-simplify-ignored-prefixes nil
156    "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."    "*Remove matches for this regexp from subject lines when simplifying fuzzily."
157    :group 'gnus-thread    :group 'gnus-thread
158    :type '(choice (const :tag "off" nil)    :type '(choice (const :tag "off" nil)
159                   regexp))                   regexp))
# Line 197  If this variable is nil, scoring will be Line 212  If this variable is nil, scoring will be
212    :type '(choice (const :tag "disable")    :type '(choice (const :tag "disable")
213                   integer))                   integer))
214    
215    (defcustom gnus-summary-default-high-score 0
216      "*Default threshold for a high scored article.
217    An article will be highlighted as high scored if its score is greater
218    than this score."
219      :group 'gnus-score-default
220      :type 'integer)
221    
222    (defcustom gnus-summary-default-low-score 0
223      "*Default threshold for a low scored article.
224    An article will be highlighted as low scored if its score is smaller
225    than this score."
226      :group 'gnus-score-default
227      :type 'integer)
228    
229  (defcustom gnus-summary-zcore-fuzz 0  (defcustom gnus-summary-zcore-fuzz 0
230    "*Fuzziness factor for the zcore in the summary buffer.    "*Fuzziness factor for the zcore in the summary buffer.
231  Articles with scores closer than this to `gnus-summary-default-score'  Articles with scores closer than this to `gnus-summary-default-score'
# Line 219  simplification is selected." Line 248  simplification is selected."
248    
249  (defcustom gnus-thread-hide-subtree nil  (defcustom gnus-thread-hide-subtree nil
250    "*If non-nil, hide all threads initially.    "*If non-nil, hide all threads initially.
251    This can be a predicate specifier which says which threads to hide.
252  If threads are hidden, you have to run the command  If threads are hidden, you have to run the command
253  `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'  `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
254  to expose hidden threads."  to expose hidden threads."
255    :group 'gnus-thread    :group 'gnus-thread
256    :type 'boolean)    :type '(radio (sexp :format "Non-nil\n"
257                          :match (lambda (widget value)
258                                   (not (or (consp value) (functionp value))))
259                          :value t)
260                    (const nil)
261                    (sexp :tag "Predicate specifier" :size 0)))
262    
263  (defcustom gnus-thread-hide-killed t  (defcustom gnus-thread-hide-killed t
264    "*If non-nil, hide killed threads automatically."    "*If non-nil, hide killed threads automatically."
# Line 262  equal will be included." Line 297  equal will be included."
297    :type 'boolean)    :type 'boolean)
298    
299  (defcustom gnus-auto-select-first t  (defcustom gnus-auto-select-first t
300    "*If nil, don't select the first unread article when entering a group.    "*If non-nil, select the article under point.
301  If this variable is `best', select the highest-scored unread article  Which article this is is controlled by the `gnus-auto-select-subject'
302  in the group.  If t, select the first unread article.  variable.
303    
304  This variable can also be a function to place point on a likely  If you want to prevent automatic selection of articles in some
305  subject line.  Useful values include `gnus-summary-first-unread-subject',  newsgroups, set the variable to nil in `gnus-select-group-hook'."
 `gnus-summary-first-unread-article' and  
 `gnus-summary-best-unread-article'.  
   
 If you want to prevent automatic selection of the first unread article  
 in some newsgroups, set the variable to nil in  
 `gnus-select-group-hook'."  
306    :group 'gnus-group-select    :group 'gnus-group-select
307    :type '(choice (const :tag "none" nil)    :type '(choice (const :tag "none" nil)
308                   (const best)                   (sexp :menu-tag "first" t)))
309                   (sexp :menu-tag "first" t)  
310                   (function-item gnus-summary-first-unread-subject)  (defcustom gnus-auto-select-subject 'unread
311                   (function-item gnus-summary-first-unread-article)    "*Says what subject to place under point when entering a group.
312                   (function-item gnus-summary-best-unread-article)))  
313    This variable can either be the symbols `first' (place point on the
314    first subject), `unread' (place point on the subject line of the first
315    unread article), `best' (place point on the subject line of the
316    higest-scored article), `unseen' (place point on the subject line of
317    the first unseen article), 'unseen-or-unread' (place point on the subject
318    line of the first unseen article or, if all article have been seen, on the
319    subject line of the first unread article), or a function to be called to
320    place point on some subject line."
321      :group 'gnus-group-select
322      :type '(choice (const best)
323                     (const unread)
324                     (const first)
325                     (const unseen)
326                     (const unseen-or-unread)))
327    
328  (defcustom gnus-auto-select-next t  (defcustom gnus-auto-select-next t
329    "*If non-nil, offer to go to the next group from the end of the previous.    "*If non-nil, offer to go to the next group from the end of the previous.
330  If the value is t and the next newsgroup is empty, Gnus will exit  If the value is t and the next newsgroup is empty, Gnus will exit
331  summary mode and go back to group mode.  If the value is neither nil  summary mode and go back to group mode.  If the value is neither nil
332  nor t, Gnus will select the following unread newsgroup.  In  nor t, Gnus will select the following unread newsgroup.  In
333  particular, if the value is the symbol `quietly', the next unread  particular, if the value is the symbol `quietly', the next unread
334  newsgroup will be selected without any confirmation, and if it is  newsgroup will be selected without any confirmation, and if it is
335  `almost-quietly', the next group will be selected without any  `almost-quietly', the next group will be selected without any
336  confirmation if you are located on the last article in the group.  confirmation if you are located on the last article in the group.
337  Finally, if this variable is `slightly-quietly', the `Z n' command  Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
338  will go to the next group without confirmation."  will go to the next group without confirmation."
339    :group 'gnus-summary-maneuvering    :group 'gnus-summary-maneuvering
340    :type '(choice (const :tag "off" nil)    :type '(choice (const :tag "off" nil)
# Line 307  the first unread article." Line 350  the first unread article."
350    :group 'gnus-summary-maneuvering    :group 'gnus-summary-maneuvering
351    :type 'boolean)    :type 'boolean)
352    
353    (defcustom gnus-auto-goto-ignores 'unfetched
354      "*Says how to handle unfetched articles when maneuvering.
355    
356    This variable can either be the symbols nil (maneuver to any
357    article), `undownloaded' (maneuvering while unplugged ignores articles
358    that have not been fetched), `always-undownloaded' (maneuvering always
359    ignores articles that have not been fetched), `unfetched' (maneuvering
360    ignores articles whose headers have not been fetched).
361    
362    NOTE: The list of unfetched articles will always be nil when plugged
363    and, when unplugged, a subset of the undownloaded article list."
364      :group 'gnus-summary-maneuvering
365      :type '(choice (const :tag "None" nil)
366                     (const :tag "Undownloaded when unplugged" undownloaded)
367                     (const :tag "Undownloaded" always-undownloaded)
368                     (const :tag "Unfetched" unfetched)))
369    
370  (defcustom gnus-summary-check-current nil  (defcustom gnus-summary-check-current nil
371    "*If non-nil, consider the current article when moving.    "*If non-nil, consider the current article when moving.
372  The \"unread\" movement commands will stay on the same line if the  The \"unread\" movement commands will stay on the same line if the
# Line 324  and non-`vertical', do both horizontal a Line 384  and non-`vertical', do both horizontal a
384                   (integer :tag "height")                   (integer :tag "height")
385                   (sexp :menu-tag "both" t)))                   (sexp :menu-tag "both" t)))
386    
387    (defvar gnus-auto-center-group t
388      "*If non-nil, always center the group buffer.")
389    
390  (defcustom gnus-show-all-headers nil  (defcustom gnus-show-all-headers nil
391    "*If non-nil, don't hide any headers."    "*If non-nil, don't hide any headers."
392    :group 'gnus-article-hiding    :group 'gnus-article-hiding
# Line 350  variable." Line 413  variable."
413    
414  (defcustom gnus-move-split-methods nil  (defcustom gnus-move-split-methods nil
415    "*Variable used to suggest where articles are to be moved to.    "*Variable used to suggest where articles are to be moved to.
416  It uses the same syntax as the `gnus-split-methods' variable."  It uses the same syntax as the `gnus-split-methods' variable.
417    However, whereas `gnus-split-methods' specifies file names as targets,
418    this variable specifies group names."
419    :group 'gnus-summary-mail    :group 'gnus-summary-mail
420    :type '(repeat (choice (list :value (fun) function)    :type '(repeat (choice (list :value (fun) function)
421                           (cons :value ("" "") regexp (repeat string))                           (cons :value ("" "") regexp (repeat string))
422                           (sexp :value nil))))                           (sexp :value nil))))
423    
424  (defcustom gnus-unread-mark ?  ;Whitespace  (defcustom gnus-unread-mark ?           ;Whitespace
425    "*Mark used for unread articles."    "*Mark used for unread articles."
426    :group 'gnus-summary-marks    :group 'gnus-summary-marks
427    :type 'character)    :type 'character)
# Line 391  It uses the same syntax as the `gnus-spl Line 456  It uses the same syntax as the `gnus-spl
456    :group 'gnus-summary-marks    :group 'gnus-summary-marks
457    :type 'character)    :type 'character)
458    
459    (defcustom gnus-spam-mark ?$
460      "*Mark used for spam articles."
461      :group 'gnus-summary-marks
462      :type 'character)
463    
464  (defcustom gnus-souped-mark ?F  (defcustom gnus-souped-mark ?F
465    "*Mark used for killed articles."    "*Mark used for souped articles."
466    :group 'gnus-summary-marks    :group 'gnus-summary-marks
467    :type 'character)    :type 'character)
468    
# Line 416  It uses the same syntax as the `gnus-spl Line 486  It uses the same syntax as the `gnus-spl
486    :group 'gnus-summary-marks    :group 'gnus-summary-marks
487    :type 'character)    :type 'character)
488    
489    (defcustom gnus-forwarded-mark ?F
490      "*Mark used for articles that have been forwarded."
491      :group 'gnus-summary-marks
492      :type 'character)
493    
494    (defcustom gnus-recent-mark ?N
495      "*Mark used for articles that are recent."
496      :group 'gnus-summary-marks
497      :type 'character)
498    
499  (defcustom gnus-cached-mark ?*  (defcustom gnus-cached-mark ?*
500    "*Mark used for articles that are in the cache."    "*Mark used for articles that are in the cache."
501    :group 'gnus-summary-marks    :group 'gnus-summary-marks
502    :type 'character)    :type 'character)
503    
504  (defcustom gnus-saved-mark ?S  (defcustom gnus-saved-mark ?S
505    "*Mark used for articles that have been saved to."    "*Mark used for articles that have been saved."
506      :group 'gnus-summary-marks
507      :type 'character)
508    
509    (defcustom gnus-unseen-mark ?.
510      "*Mark used for articles that haven't been seen."
511      :group 'gnus-summary-marks
512      :type 'character)
513    
514    (defcustom gnus-no-mark ?               ;Whitespace
515      "*Mark used for articles that have no other secondary mark."
516    :group 'gnus-summary-marks    :group 'gnus-summary-marks
517    :type 'character)    :type 'character)
518    
# Line 446  It uses the same syntax as the `gnus-spl Line 536  It uses the same syntax as the `gnus-spl
536    :group 'gnus-summary-marks    :group 'gnus-summary-marks
537    :type 'character)    :type 'character)
538    
539  (defcustom gnus-undownloaded-mark ?@  (defcustom gnus-undownloaded-mark ?-
540    "*Mark used for articles that weren't downloaded."    "*Mark used for articles that weren't downloaded."
541    :group 'gnus-summary-marks    :group 'gnus-summary-marks
542    :type 'character)    :type 'character)
543    
544    (defcustom gnus-downloaded-mark ?+
545      "*Mark used for articles that were downloaded."
546      :group 'gnus-summary-marks
547      :type 'character)
548    
549  (defcustom gnus-downloadable-mark ?%  (defcustom gnus-downloadable-mark ?%
550    "*Mark used for articles that are to be downloaded."    "*Mark used for articles that are to be downloaded."
551    :group 'gnus-summary-marks    :group 'gnus-summary-marks
# Line 471  It uses the same syntax as the `gnus-spl Line 566  It uses the same syntax as the `gnus-spl
566    :group 'gnus-summary-marks    :group 'gnus-summary-marks
567    :type 'character)    :type 'character)
568    
569  (defcustom gnus-empty-thread-mark ?  ;Whitespace  (defcustom gnus-empty-thread-mark ?     ;Whitespace
570    "*There is no thread under the article."    "*There is no thread under the article."
571    :group 'gnus-summary-marks    :group 'gnus-summary-marks
572    :type 'character)    :type 'character)
# Line 523  list of parameters to that command." Line 618  list of parameters to that command."
618    :type 'boolean)    :type 'boolean)
619    
620  (defcustom gnus-summary-dummy-line-format  (defcustom gnus-summary-dummy-line-format
621    "  %(:                          :%) %S\n"    "   %(:                             :%) %S\n"
622    "*The format specification for the dummy roots in the summary buffer.    "*The format specification for the dummy roots in the summary buffer.
623  It works along the same lines as a normal formatting string,  It works along the same lines as a normal formatting string,
624  with some simple extensions.  with some simple extensions.
625    
626  %S  The subject"  %S  The subject
627    
628    General format specifiers can also be used.
629    See `(gnus)Formatting Variables'."
630      :link '(custom-manual "(gnus)Formatting Variables")
631    :group 'gnus-threading    :group 'gnus-threading
632    :type 'string)    :type 'string)
633    
# Line 574  score file." Line 673  score file."
673    
674  (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)  (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
675    "*List of functions used for sorting articles in the summary buffer.    "*List of functions used for sorting articles in the summary buffer.
676  This variable is only used when not using a threaded display."  
677    Each function takes two articles and returns non-nil if the first
678    article should be sorted before the other.  If you use more than one
679    function, the primary sort function should be the last.  You should
680    probably always include `gnus-article-sort-by-number' in the list of
681    sorting functions -- preferably first.  Also note that sorting by date
682    is often much slower than sorting by number, and the sorting order is
683    very similar.  (Sorting by date means sorting by the time the message
684    was sent, sorting by number means sorting by arrival time.)
685    
686    Ready-made functions include `gnus-article-sort-by-number',
687    `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
688    `gnus-article-sort-by-date', `gnus-article-sort-by-random'
689    and `gnus-article-sort-by-score'.
690    
691    When threading is turned on, the variable `gnus-thread-sort-functions'
692    controls how articles are sorted."
693    :group 'gnus-summary-sort    :group 'gnus-summary-sort
694    :type '(repeat (choice (function-item gnus-article-sort-by-number)    :type '(repeat (choice (function-item gnus-article-sort-by-number)
695                           (function-item gnus-article-sort-by-author)                           (function-item gnus-article-sort-by-author)
696                           (function-item gnus-article-sort-by-subject)                           (function-item gnus-article-sort-by-subject)
697                           (function-item gnus-article-sort-by-date)                           (function-item gnus-article-sort-by-date)
698                           (function-item gnus-article-sort-by-score)                           (function-item gnus-article-sort-by-score)
699                             (function-item gnus-article-sort-by-random)
700                           (function :tag "other"))))                           (function :tag "other"))))
701    
702  (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)  (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
703    "*List of functions used for sorting threads in the summary buffer.    "*List of functions used for sorting threads in the summary buffer.
704  By default, threads are sorted by article number.  By default, threads are sorted by article number.
705    
706  Each function takes two threads and return non-nil if the first thread  Each function takes two threads and returns non-nil if the first
707  should be sorted before the other.  If you use more than one function,  thread should be sorted before the other.  If you use more than one
708  the primary sort function should be the last.  You should probably  function, the primary sort function should be the last.  You should
709  always include `gnus-thread-sort-by-number' in the list of sorting  probably always include `gnus-thread-sort-by-number' in the list of
710  functions -- preferably first.  sorting functions -- preferably first.  Also note that sorting by date
711    is often much slower than sorting by number, and the sorting order is
712    very similar.  (Sorting by date means sorting by the time the message
713    was sent, sorting by number means sorting by arrival time.)
714    
715  Ready-made functions include `gnus-thread-sort-by-number',  Ready-made functions include `gnus-thread-sort-by-number',
716  `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',  `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
717  `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and  `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
718  `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."  `gnus-thread-sort-by-most-recent-number',
719    `gnus-thread-sort-by-most-recent-date',
720    `gnus-thread-sort-by-random', and
721    `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
722    
723    When threading is turned off, the variable
724    `gnus-article-sort-functions' controls how articles are sorted."
725    :group 'gnus-summary-sort    :group 'gnus-summary-sort
726    :type '(repeat (choice (function-item gnus-thread-sort-by-number)    :type '(repeat (choice (function-item gnus-thread-sort-by-number)
727                           (function-item gnus-thread-sort-by-author)                           (function-item gnus-thread-sort-by-author)
# Line 604  Ready-made functions include `gnus-threa Line 729  Ready-made functions include `gnus-threa
729                           (function-item gnus-thread-sort-by-date)                           (function-item gnus-thread-sort-by-date)
730                           (function-item gnus-thread-sort-by-score)                           (function-item gnus-thread-sort-by-score)
731                           (function-item gnus-thread-sort-by-total-score)                           (function-item gnus-thread-sort-by-total-score)
732                             (function-item gnus-thread-sort-by-random)
733                           (function :tag "other"))))                           (function :tag "other"))))
734    
735  (defcustom gnus-thread-score-function '+  (defcustom gnus-thread-score-function '+
# Line 637  This variable is local to the summary bu Line 763  This variable is local to the summary bu
763  (defcustom gnus-summary-mode-hook nil  (defcustom gnus-summary-mode-hook nil
764    "*A hook for Gnus summary mode.    "*A hook for Gnus summary mode.
765  This hook is run before any variables are set in the summary buffer."  This hook is run before any variables are set in the summary buffer."
766    :options '(turn-on-gnus-mailing-list-mode)    :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
767    :group 'gnus-summary-various    :group 'gnus-summary-various
768    :type 'hook)    :type 'hook)
769    
770    ;; Extracted from gnus-xmas-redefine in order to preserve user settings
771    (when (featurep 'xemacs)
772      (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
773      (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
774      (add-hook 'gnus-summary-mode-hook
775                'gnus-xmas-switch-horizontal-scrollbar-off))
776    
777  (defcustom gnus-summary-menu-hook nil  (defcustom gnus-summary-menu-hook nil
778    "*Hook run after the creation of the summary mode menu."    "*Hook run after the creation of the summary mode menu."
779    :group 'gnus-summary-visual    :group 'gnus-summary-visual
# Line 677  If you'd like to simplify subjects like Line 810  If you'd like to simplify subjects like
810  `gnus-summary-next-same-subject' command does, you can use the  `gnus-summary-next-same-subject' command does, you can use the
811  following hook:  following hook:
812    
813   (setq gnus-select-group-hook   (add-hook gnus-select-group-hook
814        (list             (lambda ()
815          (lambda ()               (mapcar (lambda (header)
816            (mapcar (lambda (header)                         (mail-header-set-subject
817                       (mail-header-set-subject                          header
818                        header                          (gnus-simplify-subject
819                        (gnus-simplify-subject                           (mail-header-subject header) 're-only)))
820                         (mail-header-subject header) 're-only)))                       gnus-newsgroup-headers)))"
                   gnus-newsgroup-headers))))"  
821    :group 'gnus-group-select    :group 'gnus-group-select
822    :type 'hook)    :type 'hook)
823    
824  (defcustom gnus-select-article-hook nil  (defcustom gnus-select-article-hook nil
825    "*A hook called when an article is selected."    "*A hook called when an article is selected."
826    :group 'gnus-summary-choose    :group 'gnus-summary-choose
827      :options '(gnus-agent-fetch-selected-article)
828    :type 'hook)    :type 'hook)
829    
830  (defcustom gnus-visual-mark-article-hook  (defcustom gnus-visual-mark-article-hook
# Line 741  automatically when it is selected." Line 874  automatically when it is selected."
874    :group 'gnus-summary    :group 'gnus-summary
875    :type 'hook)    :type 'hook)
876    
877    (defcustom gnus-summary-article-move-hook nil
878      "*A hook called after an article is moved, copied, respooled, or crossposted."
879      :group 'gnus-summary
880      :type 'hook)
881    
882    (defcustom gnus-summary-article-delete-hook nil
883      "*A hook called after an article is deleted."
884      :group 'gnus-summary
885      :type 'hook)
886    
887    (defcustom gnus-summary-article-expire-hook nil
888      "*A hook called after an article is expired."
889      :group 'gnus-summary
890      :type 'hook)
891    
892    (defcustom gnus-summary-display-arrow
893      (and (fboundp 'display-graphic-p)
894           (display-graphic-p))
895      "*If non-nil, display an arrow highlighting the current article."
896      :version "21.1"
897      :group 'gnus-summary
898      :type 'boolean)
899    
900  (defcustom gnus-summary-selected-face 'gnus-summary-selected-face  (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
901    "Face used for highlighting the current article in the summary buffer."    "Face used for highlighting the current article in the summary buffer."
902    :group 'gnus-summary-visual    :group 'gnus-summary-visual
903    :type 'face)    :type 'face)
904    
905    (defvar gnus-tmp-downloaded nil)
906    
907  (defcustom gnus-summary-highlight  (defcustom gnus-summary-highlight
908    '(((= mark gnus-canceled-mark)    '(((eq mark gnus-canceled-mark)
909       . gnus-summary-cancelled-face)       . gnus-summary-cancelled-face)
910      ((and (> score default)      ((and uncached (> score default-high))
911            (or (= mark gnus-dormant-mark)       . gnus-summary-high-undownloaded-face)
912                (= mark gnus-ticked-mark)))      ((and uncached (< score default-low))
913         . gnus-summary-low-undownloaded-face)
914        (uncached
915         . gnus-summary-normal-undownloaded-face)
916        ((and (> score default-high)
917              (or (eq mark gnus-dormant-mark)
918                  (eq mark gnus-ticked-mark)))
919       . gnus-summary-high-ticked-face)       . gnus-summary-high-ticked-face)
920      ((and (< score default)      ((and (< score default-low)
921            (or (= mark gnus-dormant-mark)            (or (eq mark gnus-dormant-mark)
922                (= mark gnus-ticked-mark)))                (eq mark gnus-ticked-mark)))
923       . gnus-summary-low-ticked-face)       . gnus-summary-low-ticked-face)
924      ((or (= mark gnus-dormant-mark)      ((or (eq mark gnus-dormant-mark)
925           (= mark gnus-ticked-mark))           (eq mark gnus-ticked-mark))
926       . gnus-summary-normal-ticked-face)       . gnus-summary-normal-ticked-face)
927      ((and (> score default) (= mark gnus-ancient-mark))      ((and (> score default-high) (eq mark gnus-ancient-mark))
928       . gnus-summary-high-ancient-face)       . gnus-summary-high-ancient-face)
929      ((and (< score default) (= mark gnus-ancient-mark))      ((and (< score default-low) (eq mark gnus-ancient-mark))
930       . gnus-summary-low-ancient-face)       . gnus-summary-low-ancient-face)
931      ((= mark gnus-ancient-mark)      ((eq mark gnus-ancient-mark)
932       . gnus-summary-normal-ancient-face)       . gnus-summary-normal-ancient-face)
933      ((and (> score default) (= mark gnus-unread-mark))      ((and (> score default-high) (eq mark gnus-unread-mark))
      . gnus-summary-high-unread-face)  
     ((and (< score default) (= mark gnus-unread-mark))  
      . gnus-summary-low-unread-face)  
     ((= mark gnus-unread-mark)  
      . gnus-summary-normal-unread-face)  
     ((and (> score default) (memq mark (list gnus-downloadable-mark  
                                              gnus-undownloaded-mark)))  
934       . gnus-summary-high-unread-face)       . gnus-summary-high-unread-face)
935      ((and (< score default) (memq mark (list gnus-downloadable-mark      ((and (< score default-low) (eq mark gnus-unread-mark))
                                              gnus-undownloaded-mark)))  
936       . gnus-summary-low-unread-face)       . gnus-summary-low-unread-face)
937      ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))      ((eq mark gnus-unread-mark)
938       . gnus-summary-normal-unread-face)       . gnus-summary-normal-unread-face)
939      ((> score default)      ((> score default-high)
940       . gnus-summary-high-read-face)       . gnus-summary-high-read-face)
941      ((< score default)      ((< score default-low)
942       . gnus-summary-low-read-face)       . gnus-summary-low-read-face)
943      (t      (t
944       . gnus-summary-normal-read-face))       . gnus-summary-normal-read-face))
945    "*Controls the highlighting of summary buffer lines.    "*Controls the highlighting of summary buffer lines.
946    
947  A list of (FORM . FACE) pairs.  When deciding how a particular summary  A list of (FORM . FACE) pairs.  When deciding how a a particular
948  line should be displayed, each form is evaluated.  The content of the  summary line should be displayed, each form is evaluated.  The content
949  face field after the first true form is used.  You can change how those  of the face field after the first true form is used.  You can change
950  summary lines are displayed, by editing the face field.  how those summary lines are displayed, by editing the face field.
951    
952  You can use the following variables in the FORM field.  You can use the following variables in the FORM field.
953    
954  score:   The articles score  score:        The article's score
955  default: The default article score.  default:      The default article score.
956  below:   The score below which articles are automatically marked as read.  default-high: The default score for high scored articles.
957  mark:    The articles mark."  default-low:  The default score for low scored articles.
958    below:        The score below which articles are automatically marked as read.
959    mark:         The article's mark.
960    uncached:     Non-nil if the article is uncached."
961    :group 'gnus-summary-visual    :group 'gnus-summary-visual
962    :type '(repeat (cons (sexp :tag "Form" nil)    :type '(repeat (cons (sexp :tag "Form" nil)
963                         face)))                         face)))
# Line 814  which it may alter in any way." Line 973  which it may alter in any way."
973  (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string  (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
974    "Variable that says which function should be used to decode a string with encoded words.")    "Variable that says which function should be used to decode a string with encoded words.")
975    
976  (defcustom gnus-extra-headers nil  (defcustom gnus-extra-headers '(To Newsgroups)
977    "*Extra headers to parse."    "*Extra headers to parse."
978    :version "21.1"    :version "21.1"
979    :group 'gnus-summary    :group 'gnus-summary
# Line 827  which it may alter in any way." Line 986  which it may alter in any way."
986    :group 'gnus-summary    :group 'gnus-summary
987    :type 'regexp)    :type 'regexp)
988    
 (defcustom gnus-group-charset-alist  
   '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5)  
     ("^cn\\>\\|\\<chinese\\>" cn-gb-2312)  
     ("^fj\\>\\|^japan\\>" iso-2022-jp-2)  
     ("^tnn\\>\\|^pin\\>\\|^sci.lang.japan" iso-2022-7bit)  
     ("^relcom\\>" koi8-r)  
     ("^fido7\\>" koi8-r)  
     ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)  
     ("^israel\\>" iso-8859-1)  
     ("^han\\>" euc-kr)  
     ("^alt.chinese.text.big5\\>" chinese-big5)  
     ("^soc.culture.vietnamese\\>" vietnamese-viqr)  
     ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)  
     (".*" iso-8859-1))  
   "Alist of regexps (to match group names) and default charsets to be used when reading."  
   :type '(repeat (list (regexp :tag "Group")  
                        (symbol :tag "Charset")))  
   :group 'gnus-charset)  
   
989  (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)  (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
990    "List of charsets that should be ignored.    "List of charsets that should be ignored.
991  When these charsets are used in the \"charset\" parameter, the  When these charsets are used in the \"charset\" parameter, the
# Line 854  default charset will be used instead." Line 994  default charset will be used instead."
994    :type '(repeat symbol)    :type '(repeat symbol)
995    :group 'gnus-charset)    :group 'gnus-charset)
996    
997  (defcustom gnus-group-ignored-charsets-alist  (gnus-define-group-parameter
998    '(("alt\\.chinese\\.text" iso-8859-1))   ignored-charsets
999    "Alist of regexps (to match group names) and charsets that should be ignored.   :type list
1000     :function-document
1001     "Return the ignored charsets of GROUP."
1002     :variable gnus-group-ignored-charsets-alist
1003     :variable-default
1004     '(("alt\\.chinese\\.text" iso-8859-1))
1005     :variable-document
1006     "Alist of regexps (to match group names) and charsets that should be ignored.
1007  When these charsets are used in the \"charset\" parameter, the  When these charsets are used in the \"charset\" parameter, the
1008  default charset will be used instead."  default charset will be used instead."
1009    :type '(repeat (cons (regexp :tag "Group")   :variable-group gnus-charset
1010                         (repeat symbol)))   :variable-type '(repeat (cons (regexp :tag "Group")
1011    :group 'gnus-charset)                                 (repeat symbol)))
1012     :parameter-type '(choice :tag "Ignored charsets"
1013                              :value nil
1014                              (repeat (symbol)))
1015     :parameter-document       "\
1016    List of charsets that should be ignored.
1017    
1018    When these charsets are used in the \"charset\" parameter, the
1019    default charset will be used instead.")
1020    
1021  (defcustom gnus-group-highlight-words-alist nil  (defcustom gnus-group-highlight-words-alist nil
1022    "Alist of group regexps and highlight regexps.    "Alist of group regexps and highlight regexps.
# Line 904  For example: ((1 . cn-gb-2312) (2 . big5 Line 1059  For example: ((1 . cn-gb-2312) (2 . big5
1059                   integer))                   integer))
1060    
1061  (defcustom gnus-summary-save-parts-default-mime "image/.*"  (defcustom gnus-summary-save-parts-default-mime "image/.*"
1062    "*A regexp to match MIME parts when saving multiple parts of a message    "*A regexp to match MIME parts when saving multiple parts of a
1063  with gnus-summary-save-parts (X m). This regexp will be used by default  message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1064  when prompting the user for which type of files to save."  This regexp will be used by default when prompting the user for which
1065    type of files to save."
1066    :group 'gnus-summary    :group 'gnus-summary
1067    :type 'regexp)    :type 'regexp)
1068    
1069    (defcustom gnus-read-all-available-headers nil
1070      "Whether Gnus should parse all headers made available to it.
1071    This is mostly relevant for slow back ends where the user may
1072    wish to widen the summary buffer to include all headers
1073    that were fetched.  Say, for nnultimate groups."
1074      :group 'gnus-summary
1075      :type '(choice boolean regexp))
1076    
1077    (defcustom gnus-summary-muttprint-program "muttprint"
1078      "Command (and optional arguments) used to run Muttprint."
1079      :version "21.3"
1080      :group 'gnus-summary
1081      :type 'string)
1082    
1083    (defcustom gnus-article-loose-mime nil
1084      "If non-nil, don't require MIME-Version header.
1085    Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1086    supply the MIME-Version header or deliberately strip it From the mail.
1087    Set it to non-nil, Gnus will treat some articles as MIME even if
1088    the MIME-Version header is missed."
1089      :version "21.3"
1090      :type 'boolean
1091      :group 'gnus-article-mime)
1092    
1093    (defcustom gnus-article-emulate-mime t
1094      "If non-nil, use MIME emulation for uuencode and the like.
1095    This means that Gnus will search message bodies for text that look
1096    like uuencoded bits, yEncoded bits, and so on, and present that using
1097    the normal Gnus MIME machinery."
1098      :type 'boolean
1099      :group 'gnus-article-mime)
1100    
1101  ;;; Internal variables  ;;; Internal variables
1102    
1103    (defvar gnus-summary-display-cache nil)
1104  (defvar gnus-article-mime-handles nil)  (defvar gnus-article-mime-handles nil)
1105  (defvar gnus-article-decoded-p nil)  (defvar gnus-article-decoded-p nil)
1106    (defvar gnus-article-charset nil)
1107    (defvar gnus-article-ignored-charsets nil)
1108  (defvar gnus-scores-exclude-files nil)  (defvar gnus-scores-exclude-files nil)
1109  (defvar gnus-page-broken nil)  (defvar gnus-page-broken nil)
 (defvar gnus-inhibit-mime-unbuttonizing nil)  
1110    
1111  (defvar gnus-original-article nil)  (defvar gnus-original-article nil)
1112  (defvar gnus-article-internal-prepare-hook nil)  (defvar gnus-article-internal-prepare-hook nil)
# Line 929  when prompting the user for which type o Line 1118  when prompting the user for which type o
1118    "Function called to sort the articles within a thread after it has been gathered together.")    "Function called to sort the articles within a thread after it has been gathered together.")
1119    
1120  (defvar gnus-summary-save-parts-type-history nil)  (defvar gnus-summary-save-parts-type-history nil)
1121  (defvar gnus-summary-save-parts-last-directory nil)  (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1122    
1123  ;; Avoid highlighting in kill files.  ;; Avoid highlighting in kill files.
1124  (defvar gnus-summary-inhibit-highlight nil)  (defvar gnus-summary-inhibit-highlight nil)
# Line 940  when prompting the user for which type o Line 1129  when prompting the user for which type o
1129  (defvar gnus-current-move-group nil)  (defvar gnus-current-move-group nil)
1130  (defvar gnus-current-copy-group nil)  (defvar gnus-current-copy-group nil)
1131  (defvar gnus-current-crosspost-group nil)  (defvar gnus-current-crosspost-group nil)
1132    (defvar gnus-newsgroup-display nil)
1133    
1134  (defvar gnus-newsgroup-dependencies nil)  (defvar gnus-newsgroup-dependencies nil)
1135  (defvar gnus-newsgroup-adaptive nil)  (defvar gnus-newsgroup-adaptive nil)
# Line 964  when prompting the user for which type o Line 1154  when prompting the user for which type o
1154      (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)      (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1155      (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)      (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1156      (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)      (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1157      (?L gnus-tmp-lines ?d)      (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1158        (?L gnus-tmp-lines ?s)
1159        (?O gnus-tmp-downloaded ?c)
1160      (?I gnus-tmp-indentation ?s)      (?I gnus-tmp-indentation ?s)
1161      (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)      (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1162      (?R gnus-tmp-replied ?c)      (?R gnus-tmp-replied ?c)
# Line 977  when prompting the user for which type o Line 1169  when prompting the user for which type o
1169      (?l (bbb-grouplens-score gnus-tmp-header) ?s)      (?l (bbb-grouplens-score gnus-tmp-header) ?s)
1170      (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)      (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1171      (?U gnus-tmp-unread ?c)      (?U gnus-tmp-unread ?c)
1172      (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)      (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1173            ?s)
1174      (?t (gnus-summary-number-of-articles-in-thread      (?t (gnus-summary-number-of-articles-in-thread
1175           (and (boundp 'thread) (car thread)) gnus-tmp-level)           (and (boundp 'thread) (car thread)) gnus-tmp-level)
1176          ?d)          ?d)
# Line 985  when prompting the user for which type o Line 1178  when prompting the user for which type o
1178           (and (boundp 'thread) (car thread)) gnus-tmp-level t)           (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1179          ?c)          ?c)
1180      (?u gnus-tmp-user-defined ?s)      (?u gnus-tmp-user-defined ?s)
1181      (?P (gnus-pick-line-number) ?d))      (?P (gnus-pick-line-number) ?d)
1182        (?B gnus-tmp-thread-tree-header-string ?s)
1183        (user-date (gnus-user-date
1184                    ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1185    "An alist of format specifications that can appear in summary lines.    "An alist of format specifications that can appear in summary lines.
1186  These are paired with what variables they correspond with, along with  These are paired with what variables they correspond with, along with
1187  the type of the variable (string, integer, character, etc).")  the type of the variable (string, integer, character, etc).")
# Line 1008  the type of the variable (string, intege Line 1204  the type of the variable (string, intege
1204      (?u gnus-tmp-user-defined ?s)      (?u gnus-tmp-user-defined ?s)
1205      (?d (length gnus-newsgroup-dormant) ?d)      (?d (length gnus-newsgroup-dormant) ?d)
1206      (?t (length gnus-newsgroup-marked) ?d)      (?t (length gnus-newsgroup-marked) ?d)
1207        (?h (length gnus-newsgroup-spam-marked) ?d)
1208      (?r (length gnus-newsgroup-reads) ?d)      (?r (length gnus-newsgroup-reads) ?d)
1209      (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)      (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1210      (?E gnus-newsgroup-expunged-tally ?d)      (?E gnus-newsgroup-expunged-tally ?d)
# Line 1019  the type of the variable (string, intege Line 1216  the type of the variable (string, intege
1216  (defvar gnus-last-shell-command nil  (defvar gnus-last-shell-command nil
1217    "Default shell command on article.")    "Default shell command on article.")
1218    
1219    (defvar gnus-newsgroup-agentized nil
1220      "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1221  (defvar gnus-newsgroup-begin nil)  (defvar gnus-newsgroup-begin nil)
1222  (defvar gnus-newsgroup-end nil)  (defvar gnus-newsgroup-end nil)
1223  (defvar gnus-newsgroup-last-rmail nil)  (defvar gnus-newsgroup-last-rmail nil)
# Line 1032  the type of the variable (string, intege Line 1231  the type of the variable (string, intege
1231  (defvar gnus-newsgroup-data-reverse nil)  (defvar gnus-newsgroup-data-reverse nil)
1232  (defvar gnus-newsgroup-limit nil)  (defvar gnus-newsgroup-limit nil)
1233  (defvar gnus-newsgroup-limits nil)  (defvar gnus-newsgroup-limits nil)
1234    (defvar gnus-summary-use-undownloaded-faces nil)
1235    
1236  (defvar gnus-newsgroup-unreads nil  (defvar gnus-newsgroup-unreads nil
1237    "List of unread articles in the current newsgroup.")    "Sorted list of unread articles in the current newsgroup.")
1238    
1239  (defvar gnus-newsgroup-unselected nil  (defvar gnus-newsgroup-unselected nil
1240    "List of unselected unread articles in the current newsgroup.")    "Sorted list of unselected unread articles in the current newsgroup.")
1241    
1242  (defvar gnus-newsgroup-reads nil  (defvar gnus-newsgroup-reads nil
1243    "Alist of read articles and article marks in the current newsgroup.")    "Alist of read articles and article marks in the current newsgroup.")
# Line 1045  the type of the variable (string, intege Line 1245  the type of the variable (string, intege
1245  (defvar gnus-newsgroup-expunged-tally nil)  (defvar gnus-newsgroup-expunged-tally nil)
1246    
1247  (defvar gnus-newsgroup-marked nil  (defvar gnus-newsgroup-marked nil
1248    "List of ticked articles in the current newsgroup (a subset of unread art).")    "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1249    
1250    (defvar gnus-newsgroup-spam-marked nil
1251      "List of ranges of articles that have been marked as spam.")
1252    
1253  (defvar gnus-newsgroup-killed nil  (defvar gnus-newsgroup-killed nil
1254    "List of ranges of articles that have been through the scoring process.")    "List of ranges of articles that have been through the scoring process.")
1255    
1256  (defvar gnus-newsgroup-cached nil  (defvar gnus-newsgroup-cached nil
1257    "List of articles that come from the article cache.")    "Sorted list of articles that come from the article cache.")
1258    
1259  (defvar gnus-newsgroup-saved nil  (defvar gnus-newsgroup-saved nil
1260    "List of articles that have been saved.")    "List of articles that have been saved.")
# Line 1061  the type of the variable (string, intege Line 1264  the type of the variable (string, intege
1264  (defvar gnus-newsgroup-replied nil  (defvar gnus-newsgroup-replied nil
1265    "List of articles that have been replied to in the current newsgroup.")    "List of articles that have been replied to in the current newsgroup.")
1266    
1267    (defvar gnus-newsgroup-forwarded nil
1268      "List of articles that have been forwarded in the current newsgroup.")
1269    
1270    (defvar gnus-newsgroup-recent nil
1271      "List of articles that have are recent in the current newsgroup.")
1272    
1273  (defvar gnus-newsgroup-expirable nil  (defvar gnus-newsgroup-expirable nil
1274    "List of articles in the current newsgroup that can be expired.")    "Sorted list of articles in the current newsgroup that can be expired.")
1275    
1276  (defvar gnus-newsgroup-processable nil  (defvar gnus-newsgroup-processable nil
1277    "List of articles in the current newsgroup that can be processed.")    "List of articles in the current newsgroup that can be processed.")
1278    
1279  (defvar gnus-newsgroup-downloadable nil  (defvar gnus-newsgroup-downloadable nil
1280    "List of articles in the current newsgroup that can be processed.")    "Sorted list of articles in the current newsgroup that can be processed.")
1281    
1282    (defvar gnus-newsgroup-unfetched nil
1283      "Sorted list of articles in the current newsgroup whose headers have
1284    not been fetched into the agent.
1285    
1286    This list will always be a subset of gnus-newsgroup-undownloaded.")
1287    
1288  (defvar gnus-newsgroup-undownloaded nil  (defvar gnus-newsgroup-undownloaded nil
1289    "List of articles in the current newsgroup that haven't been downloaded..")    "List of articles in the current newsgroup that haven't been downloaded.")
1290    
1291  (defvar gnus-newsgroup-unsendable nil  (defvar gnus-newsgroup-unsendable nil
1292    "List of articles in the current newsgroup that won't be sent.")    "List of articles in the current newsgroup that won't be sent.")
# Line 1080  the type of the variable (string, intege Line 1295  the type of the variable (string, intege
1295    "List of articles in the current newsgroup that have bookmarks.")    "List of articles in the current newsgroup that have bookmarks.")
1296    
1297  (defvar gnus-newsgroup-dormant nil  (defvar gnus-newsgroup-dormant nil
1298    "List of dormant articles in the current newsgroup.")    "Sorted list of dormant articles in the current newsgroup.")
1299    
1300    (defvar gnus-newsgroup-unseen nil
1301      "List of unseen articles in the current newsgroup.")
1302    
1303    (defvar gnus-newsgroup-seen nil
1304      "Range of seen articles in the current newsgroup.")
1305    
1306    (defvar gnus-newsgroup-articles nil
1307      "List of articles in the current newsgroup.")
1308    
1309  (defvar gnus-newsgroup-scored nil  (defvar gnus-newsgroup-scored nil
1310    "List of scored articles in the current newsgroup.")    "List of scored articles in the current newsgroup.")
# Line 1108  the type of the variable (string, intege Line 1332  the type of the variable (string, intege
1332  (defvar gnus-newsgroup-ephemeral-charset nil)  (defvar gnus-newsgroup-ephemeral-charset nil)
1333  (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)  (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1334    
1335  (defconst gnus-summary-local-variables  (defvar gnus-article-before-search nil)
1336    
1337    (defvar gnus-summary-local-variables
1338    '(gnus-newsgroup-name    '(gnus-newsgroup-name
1339      gnus-newsgroup-begin gnus-newsgroup-end      gnus-newsgroup-begin gnus-newsgroup-end
1340      gnus-newsgroup-last-rmail gnus-newsgroup-last-mail      gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1341      gnus-newsgroup-last-folder gnus-newsgroup-last-file      gnus-newsgroup-last-folder gnus-newsgroup-last-file
1342      gnus-newsgroup-auto-expire gnus-newsgroup-unreads      gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1343      gnus-newsgroup-unselected gnus-newsgroup-marked      gnus-newsgroup-unselected gnus-newsgroup-marked
1344        gnus-newsgroup-spam-marked
1345      gnus-newsgroup-reads gnus-newsgroup-saved      gnus-newsgroup-reads gnus-newsgroup-saved
1346      gnus-newsgroup-replied gnus-newsgroup-expirable      gnus-newsgroup-replied gnus-newsgroup-forwarded
1347        gnus-newsgroup-recent
1348        gnus-newsgroup-expirable
1349      gnus-newsgroup-processable gnus-newsgroup-killed      gnus-newsgroup-processable gnus-newsgroup-killed
1350      gnus-newsgroup-downloadable gnus-newsgroup-undownloaded      gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1351      gnus-newsgroup-unsendable      gnus-newsgroup-unfetched
1352        gnus-newsgroup-unsendable gnus-newsgroup-unseen
1353        gnus-newsgroup-seen gnus-newsgroup-articles
1354      gnus-newsgroup-bookmarks gnus-newsgroup-dormant      gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1355      gnus-newsgroup-headers gnus-newsgroup-threads      gnus-newsgroup-headers gnus-newsgroup-threads
1356      gnus-newsgroup-prepared gnus-summary-highlight-line-function      gnus-newsgroup-prepared gnus-summary-highlight-line-function
# Line 1141  the type of the variable (string, intege Line 1372  the type of the variable (string, intege
1372      gnus-cache-removable-articles gnus-newsgroup-cached      gnus-cache-removable-articles gnus-newsgroup-cached
1373      gnus-newsgroup-data gnus-newsgroup-data-reverse      gnus-newsgroup-data gnus-newsgroup-data-reverse
1374      gnus-newsgroup-limit gnus-newsgroup-limits      gnus-newsgroup-limit gnus-newsgroup-limits
1375      gnus-newsgroup-charset)      gnus-newsgroup-charset gnus-newsgroup-display
1376        gnus-summary-use-undownloaded-faces)
1377    "Variables that are buffer-local to the summary buffers.")    "Variables that are buffer-local to the summary buffers.")
1378    
1379    (defvar gnus-newsgroup-variables nil
1380      "A list of variables that have separate values in different newsgroups.
1381    A list of newsgroup (summary buffer) local variables, or cons of
1382    variables and their default expressions to be evalled (when the default
1383    values are not nil), that should be made global while the summary buffer
1384    is active.
1385    
1386    Note: The default expressions will be evaluated (using function `eval')
1387    before assignment to the local variable rather than just assigned to it.
1388    If the default expression is the symbol `global', that symbol will not
1389    be evaluated but the global value of the local variable will be used
1390    instead.
1391    
1392    These variables can be used to set variables in the group parameters
1393    while still allowing them to affect operations done in other buffers.
1394    For example:
1395    
1396    \(setq gnus-newsgroup-variables
1397         '(message-use-followup-to
1398           (gnus-visible-headers .
1399             \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1400    ")
1401    
1402  ;; Byte-compiler warning.  ;; Byte-compiler warning.
1403  (eval-when-compile (defvar gnus-article-mode-map))  (eval-when-compile
1404      ;; Bind features so that require will believe that gnus-sum has
1405      ;; already been loaded (avoids infinite recursion)
1406      (let ((features (cons 'gnus-sum features)))
1407        ;; Several of the declarations in gnus-sum are needed to load the
1408        ;; following files. Right now, these definitions have been
1409        ;; compiled but not defined (evaluated).  We could either do a
1410        ;; eval-and-compile about all of the declarations or evaluate the
1411        ;; source file.
1412        (if (boundp 'gnus-newsgroup-variables)
1413            nil
1414          (load "gnus-sum.el" t t t))
1415        (require 'gnus)
1416        (require 'gnus-agent)
1417        (require 'gnus-art)))
1418    
1419  ;; MIME stuff.  ;; MIME stuff.
1420    
# Line 1153  the type of the variable (string, intege Line 1422  the type of the variable (string, intege
1422    '(mail-decode-encoded-word-string)    '(mail-decode-encoded-word-string)
1423    "List of methods used to decode encoded words.    "List of methods used to decode encoded words.
1424    
1425  This variable is a list of FUNCTION or (REGEXP . FUNCTION).  If item is  This variable is a list of FUNCTION or (REGEXP . FUNCTION).  If item
1426  FUNCTION, FUNCTION will be apply to all newsgroups.  If item is a  is FUNCTION, FUNCTION will be apply to all newsgroups.  If item is a
1427  (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups  \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1428  whose names match REGEXP.  whose names match REGEXP.
1429    
1430  For example:  For example:
1431  ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)  \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1432   mail-decode-encoded-word-string   mail-decode-encoded-word-string
1433   (\"chinese\" . rfc1843-decode-string))")   (\"chinese\" . rfc1843-decode-string))")
1434    
# Line 1178  For example: Line 1447  For example:
1447                           (string-match (car x) gnus-newsgroup-name))                           (string-match (car x) gnus-newsgroup-name))
1448                      (nconc gnus-decode-encoded-word-methods-cache                      (nconc gnus-decode-encoded-word-methods-cache
1449                             (list (cdr x))))))                             (list (cdr x))))))
1450            gnus-decode-encoded-word-methods))              gnus-decode-encoded-word-methods))
1451    (let ((xlist gnus-decode-encoded-word-methods-cache))    (let ((xlist gnus-decode-encoded-word-methods-cache))
1452      (pop xlist)      (pop xlist)
1453      (while xlist      (while xlist
# Line 1189  For example: Line 1458  For example:
1458    
1459  (defun gnus-simplify-whitespace (str)  (defun gnus-simplify-whitespace (str)
1460    "Remove excessive whitespace from STR."    "Remove excessive whitespace from STR."
1461    (let ((mystr str))    ;; Multiple spaces.
1462      ;; Multiple spaces.    (while (string-match "[ \t][ \t]+" str)
1463      (while (string-match "[ \t][ \t]+" mystr)      (setq str (concat (substring str 0 (match-beginning 0))
1464        (setq mystr (concat (substring mystr 0 (match-beginning 0))                          " "
1465                            " "                          (substring str (match-end 0)))))
1466                            (substring mystr (match-end 0)))))    ;; Leading spaces.
1467      ;; Leading spaces.    (when (string-match "^[ \t]+" str)
1468      (when (string-match "^[ \t]+" mystr)      (setq str (substring str (match-end 0))))
1469        (setq mystr (substring mystr (match-end 0))))    ;; Trailing spaces.
1470      ;; Trailing spaces.    (when (string-match "[ \t]+$" str)
1471      (when (string-match "[ \t]+$" mystr)      (setq str (substring str 0 (match-beginning 0))))
1472        (setq mystr (substring mystr 0 (match-beginning 0))))    str)
1473      mystr))  
1474    (defun gnus-simplify-all-whitespace (str)
1475      "Remove all whitespace from STR."
1476      (while (string-match "[ \t\n]+" str)
1477        (setq str (replace-match "" nil nil str)))
1478      str)
1479    
1480  (defsubst gnus-simplify-subject-re (subject)  (defsubst gnus-simplify-subject-re (subject)
1481    "Remove \"Re:\" from subject lines."    "Remove \"Re:\" from subject lines."
1482    (if (string-match "^[Rr][Ee]: *" subject)    (if (string-match message-subject-re-regexp subject)
1483        (substring subject (match-end 0))        (substring subject (match-end 0))
1484      subject))      subject))
1485    
# Line 1279  See `gnus-simplify-buffer-fuzzy' for det Line 1553  See `gnus-simplify-buffer-fuzzy' for det
1553        (buffer-string))))        (buffer-string))))
1554    
1555  (defsubst gnus-simplify-subject-fully (subject)  (defsubst gnus-simplify-subject-fully (subject)
1556    "Simplify a subject string according to gnus-summary-gather-subject-limit."    "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1557    (cond    (cond
1558     (gnus-simplify-subject-functions     (gnus-simplify-subject-functions
1559      (gnus-map-function gnus-simplify-subject-functions subject))      (gnus-map-function gnus-simplify-subject-functions subject))
# Line 1295  See `gnus-simplify-buffer-fuzzy' for det Line 1569  See `gnus-simplify-buffer-fuzzy' for det
1569    
1570  (defsubst gnus-subject-equal (s1 s2 &optional simple-first)  (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1571    "Check whether two subjects are equal.    "Check whether two subjects are equal.
1572  If optional argument simple-first is t, first argument is already  If optional argument SIMPLE-FIRST is t, first argument is already
1573  simplified."  simplified."
1574    (cond    (cond
1575     ((null simple-first)     ((null simple-first)
# Line 1320  increase the score of each group you rea Line 1594  increase the score of each group you rea
1594    
1595  (defvar gnus-article-commands-menu)  (defvar gnus-article-commands-menu)
1596    
1597  (when t  ;; Non-orthogonal keys
   ;; Non-orthogonal keys  
1598    
1599    (gnus-define-keys gnus-summary-mode-map  (gnus-define-keys gnus-summary-mode-map
1600      " " gnus-summary-next-page    " " gnus-summary-next-page
1601      "\177" gnus-summary-prev-page    "\177" gnus-summary-prev-page
1602      [delete] gnus-summary-prev-page    [delete] gnus-summary-prev-page
1603      [backspace] gnus-summary-prev-page    [backspace] gnus-summary-prev-page
1604      "\r" gnus-summary-scroll-up    "\r" gnus-summary-scroll-up
1605      "\M-\r" gnus-summary-scroll-down    "\M-\r" gnus-summary-scroll-down
1606      "n" gnus-summary-next-unread-article    "n" gnus-summary-next-unread-article
1607      "p" gnus-summary-prev-unread-article    "p" gnus-summary-prev-unread-article
1608      "N" gnus-summary-next-article    "N" gnus-summary-next-article
1609      "P" gnus-summary-prev-article    "P" gnus-summary-prev-article
1610      "\M-\C-n" gnus-summary-next-same-subject    "\M-\C-n" gnus-summary-next-same-subject
1611      "\M-\C-p" gnus-summary-prev-same-subject    "\M-\C-p" gnus-summary-prev-same-subject
1612      "\M-n" gnus-summary-next-unread-subject    "\M-n" gnus-summary-next-unread-subject
1613      "\M-p" gnus-summary-prev-unread-subject    "\M-p" gnus-summary-prev-unread-subject
1614      "." gnus-summary-first-unread-article    "." gnus-summary-first-unread-article
1615      "," gnus-summary-best-unread-article    "," gnus-summary-best-unread-article
1616      "\M-s" gnus-summary-search-article-forward    "\M-s" gnus-summary-search-article-forward
1617      "\M-r" gnus-summary-search-article-backward    "\M-r" gnus-summary-search-article-backward
1618      "<" gnus-summary-beginning-of-article    "<" gnus-summary-beginning-of-article
1619      ">" gnus-summary-end-of-article    ">" gnus-summary-end-of-article
1620      "j" gnus-summary-goto-article    "j" gnus-summary-goto-article
1621      "^" gnus-summary-refer-parent-article    "^" gnus-summary-refer-parent-article
1622      "\M-^" gnus-summary-refer-article    "\M-^" gnus-summary-refer-article
1623      "u" gnus-summary-tick-article-forward    "u" gnus-summary-tick-article-forward
1624      "!" gnus-summary-tick-article-forward    "!" gnus-summary-tick-article-forward
1625      "U" gnus-summary-tick-article-backward    "U" gnus-summary-tick-article-backward
1626      "d" gnus-summary-mark-as-read-forward    "d" gnus-summary-mark-as-read-forward
1627      "D" gnus-summary-mark-as-read-backward    "D" gnus-summary-mark-as-read-backward
1628      "E" gnus-summary-mark-as-expirable    "E" gnus-summary-mark-as-expirable
1629      "\M-u" gnus-summary-clear-mark-forward    "\M-u" gnus-summary-clear-mark-forward
1630      "\M-U" gnus-summary-clear-mark-backward    "\M-U" gnus-summary-clear-mark-backward
1631      "k" gnus-summary-kill-same-subject-and-select    "k" gnus-summary-kill-same-subject-and-select
1632      "\C-k" gnus-summary-kill-same-subject    "\C-k" gnus-summary-kill-same-subject
1633      "\M-\C-k" gnus-summary-kill-thread    "\M-\C-k" gnus-summary-kill-thread
1634      "\M-\C-l" gnus-summary-lower-thread    "\M-\C-l" gnus-summary-lower-thread
1635      "e" gnus-summary-edit-article    "e" gnus-summary-edit-article
1636      "#" gnus-summary-mark-as-processable    "#" gnus-summary-mark-as-processable
1637      "\M-#" gnus-summary-unmark-as-processable    "\M-#" gnus-summary-unmark-as-processable
1638      "\M-\C-t" gnus-summary-toggle-threads    "\M-\C-t" gnus-summary-toggle-threads
1639      "\M-\C-s" gnus-summary-show-thread    "\M-\C-s" gnus-summary-show-thread
1640      "\M-\C-h" gnus-summary-hide-thread    "\M-\C-h" gnus-summary-hide-thread
1641      "\M-\C-f" gnus-summary-next-thread    "\M-\C-f" gnus-summary-next-thread
1642      "\M-\C-b" gnus-summary-prev-thread    "\M-\C-b" gnus-summary-prev-thread
1643      [(meta down)] gnus-summary-next-thread    [(meta down)] gnus-summary-next-thread
1644      [(meta up)] gnus-summary-prev-thread    [(meta up)] gnus-summary-prev-thread
1645      "\M-\C-u" gnus-summary-up-thread    "\M-\C-u" gnus-summary-up-thread
1646      "\M-\C-d" gnus-summary-down-thread    "\M-\C-d" gnus-summary-down-thread
1647      "&" gnus-summary-execute-command    "&" gnus-summary-execute-command
1648      "c" gnus-summary-catchup-and-exit    "c" gnus-summary-catchup-and-exit
1649      "\C-w" gnus-summary-mark-region-as-read    "\C-w" gnus-summary-mark-region-as-read
1650      "\C-t" gnus-summary-toggle-truncation    "\C-t" gnus-summary-toggle-truncation
1651      "?" gnus-summary-mark-as-dormant    "?" gnus-summary-mark-as-dormant
1652      "\C-c\M-\C-s" gnus-summary-limit-include-expunged    "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1653      "\C-c\C-s\C-n" gnus-summary-sort-by-number    "\C-c\C-s\C-n" gnus-summary-sort-by-number
1654      "\C-c\C-s\C-l" gnus-summary-sort-by-lines    "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1655      "\C-c\C-s\C-c" gnus-summary-sort-by-chars    "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1656      "\C-c\C-s\C-a" gnus-summary-sort-by-author    "\C-c\C-s\C-a" gnus-summary-sort-by-author
1657      "\C-c\C-s\C-s" gnus-summary-sort-by-subject    "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1658      "\C-c\C-s\C-d" gnus-summary-sort-by-date    "\C-c\C-s\C-d" gnus-summary-sort-by-date
1659      "\C-c\C-s\C-i" gnus-summary-sort-by-score    "\C-c\C-s\C-i" gnus-summary-sort-by-score
1660      "=" gnus-summary-expand-window    "\C-c\C-s\C-o" gnus-summary-sort-by-original
1661      "\C-x\C-s" gnus-summary-reselect-current-group    "\C-c\C-s\C-r" gnus-summary-sort-by-random
1662      "\M-g" gnus-summary-rescan-group    "=" gnus-summary-expand-window
1663      "w" gnus-summary-stop-page-breaking    "\C-x\C-s" gnus-summary-reselect-current-group
1664      "\C-c\C-r" gnus-summary-caesar-message    "\M-g" gnus-summary-rescan-group
1665      "f" gnus-summary-followup    "w" gnus-summary-stop-page-breaking
1666      "F" gnus-summary-followup-with-original    "\C-c\C-r" gnus-summary-caesar-message
1667      "C" gnus-summary-cancel-article    "f" gnus-summary-followup
1668      "r" gnus-summary-reply    "F" gnus-summary-followup-with-original
1669      "R" gnus-summary-reply-with-original    "C" gnus-summary-cancel-article
1670      "\C-c\C-f" gnus-summary-mail-forward    "r" gnus-summary-reply
1671      "o" gnus-summary-save-article    "R" gnus-summary-reply-with-original
1672      "\C-o" gnus-summary-save-article-mail    "\C-c\C-f" gnus-summary-mail-forward
1673      "|" gnus-summary-pipe-output    "o" gnus-summary-save-article
1674      "\M-k" gnus-summary-edit-local-kill    "\C-o" gnus-summary-save-article-mail
1675      "\M-K" gnus-summary-edit-global-kill    "|" gnus-summary-pipe-output
1676      ;; "V" gnus-version    "\M-k" gnus-summary-edit-local-kill
1677      "\C-c\C-d" gnus-summary-describe-group    "\M-K" gnus-summary-edit-global-kill
1678      "q" gnus-summary-exit    ;; "V" gnus-version
1679      "Q" gnus-summary-exit-no-update    "\C-c\C-d" gnus-summary-describe-group
1680      "\C-c\C-i" gnus-info-find-node    "q" gnus-summary-exit
1681      gnus-mouse-2 gnus-mouse-pick-article    "Q" gnus-summary-exit-no-update
1682      "m" gnus-summary-mail-other-window    "\C-c\C-i" gnus-info-find-node
1683      "a" gnus-summary-post-news    gnus-mouse-2 gnus-mouse-pick-article
1684      "x" gnus-summary-limit-to-unread    "m" gnus-summary-mail-other-window
1685      "s" gnus-summary-isearch-article    "a" gnus-summary-post-news
1686      "t" gnus-summary-toggle-header    "i" gnus-summary-news-other-window
1687      "g" gnus-summary-show-article    "x" gnus-summary-limit-to-unread
1688      "l" gnus-summary-goto-last-article    "s" gnus-summary-isearch-article
1689      "\C-c\C-v\C-v" gnus-uu-decode-uu-view    "t" gnus-summary-toggle-header
1690      "\C-d" gnus-summary-enter-digest-group    "g" gnus-summary-show-article
1691      "\M-\C-d" gnus-summary-read-document    "l" gnus-summary-goto-last-article
1692      "\M-\C-e" gnus-summary-edit-parameters    "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1693      "\M-\C-a" gnus-summary-customize-parameters    "\C-d" gnus-summary-enter-digest-group
1694      "\C-c\C-b" gnus-bug    "\M-\C-d" gnus-summary-read-document
1695      "*" gnus-cache-enter-article    "\M-\C-e" gnus-summary-edit-parameters
1696      "\M-*" gnus-cache-remove-article    "\M-\C-a" gnus-summary-customize-parameters
1697      "\M-&" gnus-summary-universal-argument    "\C-c\C-b" gnus-bug
1698      "\C-l" gnus-recenter    "*" gnus-cache-enter-article
1699      "I" gnus-summary-increase-score    "\M-*" gnus-cache-remove-article
1700      "L" gnus-summary-lower-score    "\M-&" gnus-summary-universal-argument
1701      "\M-i" gnus-symbolic-argument    "\C-l" gnus-recenter
1702      "h" gnus-summary-select-article-buffer    "I" gnus-summary-increase-score
1703      "L" gnus-summary-lower-score
1704      "b" gnus-article-view-part    "\M-i" gnus-symbolic-argument
1705      "\M-t" gnus-summary-toggle-display-buttonized    "h" gnus-summary-select-article-buffer
1706    
1707      "V" gnus-summary-score-map    "b" gnus-article-view-part
1708      "X" gnus-uu-extract-map    "\M-t" gnus-summary-toggle-display-buttonized
1709      "S" gnus-summary-send-map)  
1710      "V" gnus-summary-score-map
1711    ;; Sort of orthogonal keymap    "X" gnus-uu-extract-map
1712    (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)    "S" gnus-summary-send-map)
1713      "t" gnus-summary-tick-article-forward  
1714      "!" gnus-summary-tick-article-forward  ;; Sort of orthogonal keymap
1715      "d" gnus-summary-mark-as-read-forward  (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1716      "r" gnus-summary-mark-as-read-forward    "t" gnus-summary-tick-article-forward
1717      "c" gnus-summary-clear-mark-forward    "!" gnus-summary-tick-article-forward
1718      " " gnus-summary-clear-mark-forward    "d" gnus-summary-mark-as-read-forward
1719      "e" gnus-summary-mark-as-expirable    "r" gnus-summary-mark-as-read-forward
1720      "x" gnus-summary-mark-as-expirable    "c" gnus-summary-clear-mark-forward
1721      "?" gnus-summary-mark-as-dormant    " " gnus-summary-clear-mark-forward
1722      "b" gnus-summary-set-bookmark    "e" gnus-summary-mark-as-expirable
1723      "B" gnus-summary-remove-bookmark    "x" gnus-summary-mark-as-expirable
1724      "#" gnus-summary-mark-as-processable    "?" gnus-summary-mark-as-dormant
1725      "\M-#" gnus-summary-unmark-as-processable    "b" gnus-summary-set-bookmark
1726      "S" gnus-summary-limit-include-expunged    "B" gnus-summary-remove-bookmark
1727      "C" gnus-summary-catchup    "#" gnus-summary-mark-as-processable
1728      "H" gnus-summary-catchup-to-here    "\M-#" gnus-summary-unmark-as-processable
1729      "\C-c" gnus-summary-catchup-all    "S" gnus-summary-limit-include-expunged
1730      "k" gnus-summary-kill-same-subject-and-select    "C" gnus-summary-catchup
1731      "K" gnus-summary-kill-same-subject    "H" gnus-summary-catchup-to-here
1732      "P" gnus-uu-mark-map)    "h" gnus-summary-catchup-from-here
1733      "\C-c" gnus-summary-catchup-all
1734    (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)    "k" gnus-summary-kill-same-subject-and-select
1735      "c" gnus-summary-clear-above    "K" gnus-summary-kill-same-subject
1736      "u" gnus-summary-tick-above    "P" gnus-uu-mark-map)
1737      "m" gnus-summary-mark-above  
1738      "k" gnus-summary-kill-below)  (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1739      "c" gnus-summary-clear-above
1740    (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)    "u" gnus-summary-tick-above
1741      "/" gnus-summary-limit-to-subject    "m" gnus-summary-mark-above
1742      "n" gnus-summary-limit-to-articles    "k" gnus-summary-kill-below)
1743      "w" gnus-summary-pop-limit  
1744      "s" gnus-summary-limit-to-subject  (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1745      "a" gnus-summary-limit-to-author    "/" gnus-summary-limit-to-subject
1746      "u" gnus-summary-limit-to-unread    "n" gnus-summary-limit-to-articles
1747      "m" gnus-summary-limit-to-marks    "w" gnus-summary-pop-limit
1748      "M" gnus-summary-limit-exclude-marks    "s" gnus-summary-limit-to-subject
1749      "v" gnus-summary-limit-to-score    "a" gnus-summary-limit-to-author
1750      "*" gnus-summary-limit-include-cached    "u" gnus-summary-limit-to-unread
1751      "D" gnus-summary-limit-include-dormant    "m" gnus-summary-limit-to-marks
1752      "T" gnus-summary-limit-include-thread    "M" gnus-summary-limit-exclude-marks
1753      "d" gnus-summary-limit-exclude-dormant    "v" gnus-summary-limit-to-score
1754      "t" gnus-summary-limit-to-age    "*" gnus-summary-limit-include-cached
1755      "x" gnus-summary-limit-to-extra    "D" gnus-summary-limit-include-dormant
1756      "E" gnus-summary-limit-include-expunged    "T" gnus-summary-limit-include-thread
1757      "c" gnus-summary-limit-exclude-childless-dormant    "d" gnus-summary-limit-exclude-dormant
1758      "C" gnus-summary-limit-mark-excluded-as-read)    "t" gnus-summary-limit-to-age
1759      "." gnus-summary-limit-to-unseen
1760    (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)    "x" gnus-summary-limit-to-extra
1761      "n" gnus-summary-next-unread-article    "p" gnus-summary-limit-to-display-predicate
1762      "p" gnus-summary-prev-unread-article    "E" gnus-summary-limit-include-expunged
1763      "N" gnus-summary-next-article    "c" gnus-summary-limit-exclude-childless-dormant
1764      "P" gnus-summary-prev-article    "C" gnus-summary-limit-mark-excluded-as-read
1765      "\C-n" gnus-summary-next-same-subject    "o" gnus-summary-insert-old-articles
1766      "\C-p" gnus-summary-prev-same-subject    "N" gnus-summary-insert-new-articles)
1767      "\M-n" gnus-summary-next-unread-subject  
1768      "\M-p" gnus-summary-prev-unread-subject  (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1769      "f" gnus-summary-first-unread-article    "n" gnus-summary-next-unread-article
1770      "b" gnus-summary-best-unread-article    "p" gnus-summary-prev-unread-article
1771      "j" gnus-summary-goto-article    "N" gnus-summary-next-article
1772      "g" gnus-summary-goto-subject    "P" gnus-summary-prev-article
1773      "l" gnus-summary-goto-last-article    "\C-n" gnus-summary-next-same-subject
1774      "o" gnus-summary-pop-article)    "\C-p" gnus-summary-prev-same-subject
1775      "\M-n" gnus-summary-next-unread-subject
1776    (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)    "\M-p" gnus-summary-prev-unread-subject
1777      "k" gnus-summary-kill-thread    "f" gnus-summary-first-unread-article
1778      "l" gnus-summary-lower-thread    "b" gnus-summary-best-unread-article
1779      "i" gnus-summary-raise-thread    "j" gnus-summary-goto-article
1780      "T" gnus-summary-toggle-threads    "g" gnus-summary-goto-subject
1781      "t" gnus-summary-rethread-current    "l" gnus-summary-goto-last-article
1782      "^" gnus-summary-reparent-thread    "o" gnus-summary-pop-article)
1783      "s" gnus-summary-show-thread  
1784      "S" gnus-summary-show-all-threads  (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1785      "h" gnus-summary-hide-thread    "k" gnus-summary-kill-thread
1786      "H" gnus-summary-hide-all-threads    "l" gnus-summary-lower-thread
1787      "n" gnus-summary-next-thread    "i" gnus-summary-raise-thread
1788      "p" gnus-summary-prev-thread    "T" gnus-summary-toggle-threads
1789      "u" gnus-summary-up-thread    "t" gnus-summary-rethread-current
1790      "o" gnus-summary-top-thread    "^" gnus-summary-reparent-thread
1791      "d" gnus-summary-down-thread    "s" gnus-summary-show-thread
1792      "#" gnus-uu-mark-thread    "S" gnus-summary-show-all-threads
1793      "\M-#" gnus-uu-unmark-thread)    "h" gnus-summary-hide-thread
1794      "H" gnus-summary-hide-all-threads
1795    (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)    "n" gnus-summary-next-thread
1796      "g" gnus-summary-prepare    "p" gnus-summary-prev-thread
1797      "c" gnus-summary-insert-cached-articles)    "u" gnus-summary-up-thread
1798      "o" gnus-summary-top-thread
1799    (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)    "d" gnus-summary-down-thread
1800      "c" gnus-summary-catchup-and-exit    "#" gnus-uu-mark-thread
1801      "C" gnus-summary-catchup-all-and-exit    "\M-#" gnus-uu-unmark-thread)
1802      "E" gnus-summary-exit-no-update  
1803      "Q" gnus-summary-exit  (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1804      "Z" gnus-summary-exit    "g" gnus-summary-prepare
1805      "n" gnus-summary-catchup-and-goto-next-group    "c" gnus-summary-insert-cached-articles
1806      "R" gnus-summary-reselect-current-group    "d" gnus-summary-insert-dormant-articles)
1807      "G" gnus-summary-rescan-group  
1808      "N" gnus-summary-next-group  (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1809      "s" gnus-summary-save-newsrc    "c" gnus-summary-catchup-and-exit
1810      "P" gnus-summary-prev-group)    "C" gnus-summary-catchup-all-and-exit
1811      "E" gnus-summary-exit-no-update
1812    (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)    "Q" gnus-summary-exit
1813      " " gnus-summary-next-page    "Z" gnus-summary-exit
1814      "n" gnus-summary-next-page    "n" gnus-summary-catchup-and-goto-next-group
1815      "\177" gnus-summary-prev-page    "R" gnus-summary-reselect-current-group
1816      [delete] gnus-summary-prev-page    "G" gnus-summary-rescan-group
1817      "p" gnus-summary-prev-page    "N" gnus-summary-next-group
1818      "\r" gnus-summary-scroll-up    "s" gnus-summary-save-newsrc
1819      "\M-\r" gnus-summary-scroll-down    "P" gnus-summary-prev-group)
1820      "<" gnus-summary-beginning-of-article  
1821      ">" gnus-summary-end-of-article  (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1822      "b" gnus-summary-beginning-of-article    " " gnus-summary-next-page
1823      "e" gnus-summary-end-of-article    "n" gnus-summary-next-page
1824      "^" gnus-summary-refer-parent-article    "\177" gnus-summary-prev-page
1825      "r" gnus-summary-refer-parent-article    [delete] gnus-summary-prev-page
1826      "D" gnus-summary-enter-digest-group    "p" gnus-summary-prev-page
1827      "R" gnus-summary-refer-references    "\r" gnus-summary-scroll-up
1828      "T" gnus-summary-refer-thread    "\M-\r" gnus-summary-scroll-down
1829      "g" gnus-summary-show-article    "<" gnus-summary-beginning-of-article
1830      "s" gnus-summary-isearch-article    ">" gnus-summary-end-of-article
1831      "P" gnus-summary-print-article    "b" gnus-summary-beginning-of-article
1832      "t" gnus-article-babel)    "e" gnus-summary-end-of-article
1833      "^" gnus-summary-refer-parent-article
1834    (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)    "r" gnus-summary-refer-parent-article
1835      "b" gnus-article-add-buttons    "D" gnus-summary-enter-digest-group
1836      "B" gnus-article-add-buttons-to-head    "R" gnus-summary-refer-references
1837      "o" gnus-article-treat-overstrike    "T" gnus-summary-refer-thread
1838      "e" gnus-article-emphasize    "g" gnus-summary-show-article
1839      "w" gnus-article-fill-cited-article    "s" gnus-summary-isearch-article
1840      "Q" gnus-article-fill-long-lines    "P" gnus-summary-print-article
1841      "C" gnus-article-capitalize-sentences    "M" gnus-mailing-list-insinuate
1842      "c" gnus-article-remove-cr    "t" gnus-article-babel)
1843      "q" gnus-article-de-quoted-unreadable  
1844      "6" gnus-article-de-base64-unreadable  (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1845      "Z" gnus-article-decode-HZ    "b" gnus-article-add-buttons
1846      "h" gnus-article-wash-html    "B" gnus-article-add-buttons-to-head
1847      "f" gnus-article-display-x-face    "o" gnus-article-treat-overstrike
1848      "l" gnus-summary-stop-page-breaking    "e" gnus-article-emphasize
1849      "r" gnus-summary-caesar-message    "w" gnus-article-fill-cited-article
1850      "t" gnus-summary-toggle-header    "Q" gnus-article-fill-long-lines
1851      "v" gnus-summary-verbose-headers    "C" gnus-article-capitalize-sentences
1852      "H" gnus-article-strip-headers-in-body    "c" gnus-article-remove-cr
1853      "d" gnus-article-treat-dumbquotes)    "q" gnus-article-de-quoted-unreadable
1854      "6" gnus-article-de-base64-unreadable
1855    (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)    "Z" gnus-article-decode-HZ
1856      "a" gnus-article-hide    "h" gnus-article-wash-html
1857      "h" gnus-article-hide-headers    "u" gnus-article-unsplit-urls
1858      "b" gnus-article-hide-boring-headers    "s" gnus-summary-force-verify-and-decrypt
1859      "s" gnus-article-hide-signature    "f" gnus-article-display-x-face
1860      "c" gnus-article-hide-citation    "l" gnus-summary-stop-page-breaking
1861      "C" gnus-article-hide-citation-in-followups    "r" gnus-summary-caesar-message
1862      "l" gnus-article-hide-list-identifiers    "m" gnus-summary-morse-message
1863      "p" gnus-article-hide-pgp    "t" gnus-summary-toggle-header
1864      "B" gnus-article-strip-banner    "g" gnus-treat-smiley
1865      "P" gnus-article-hide-pem    "v" gnus-summary-verbose-headers
1866      "\C-c" gnus-article-hide-citation-maybe)    "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1867      "p" gnus-article-verify-x-pgp-sig
1868    (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)    "d" gnus-article-treat-dumbquotes)
1869      "a" gnus-article-highlight  
1870      "h" gnus-article-highlight-headers  (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1871      "c" gnus-article-highlight-citation    ;; mnemonic: deuglif*Y*
1872      "s" gnus-article-highlight-signature)    "u" gnus-article-outlook-unwrap-lines
1873      "a" gnus-article-outlook-repair-attribution
1874    (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)    "c" gnus-article-outlook-rearrange-citation
1875      "w" gnus-article-decode-mime-words    "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1876      "c" gnus-article-decode-charset  
1877      "v" gnus-mime-view-all-parts  (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1878      "b" gnus-article-view-part)    "a" gnus-article-hide
1879      "h" gnus-article-hide-headers
1880    (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)    "b" gnus-article-hide-boring-headers
1881      "z" gnus-article-date-ut    "s" gnus-article-hide-signature
1882      "u" gnus-article-date-ut    "c" gnus-article-hide-citation
1883      "l" gnus-article-date-local    "C" gnus-article-hide-citation-in-followups
1884      "e" gnus-article-date-lapsed    "l" gnus-article-hide-list-identifiers
1885      "o" gnus-article-date-original    "B" gnus-article-strip-banner
1886      "i" gnus-article-date-iso8601    "P" gnus-article-hide-pem
1887      "s" gnus-article-date-user)    "\C-c" gnus-article-hide-citation-maybe)
1888    
1889    (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)  (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1890      "t" gnus-article-remove-trailing-blank-lines    "a" gnus-article-highlight
1891      "l" gnus-article-strip-leading-blank-lines    "h" gnus-article-highlight-headers
1892      "m" gnus-article-strip-multiple-blank-lines    "c" gnus-article-highlight-citation
1893      "a" gnus-article-strip-blank-lines    "s" gnus-article-highlight-signature)
1894      "A" gnus-article-strip-all-blank-lines  
1895      "s" gnus-article-strip-leading-space  (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1896      "e" gnus-article-strip-trailing-space)    "f" gnus-article-treat-fold-headers
1897      "u" gnus-article-treat-unfold-headers
1898    (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)    "n" gnus-article-treat-fold-newsgroups)
1899      "v" gnus-version  
1900      "f" gnus-summary-fetch-faq  (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1901      "d" gnus-summary-describe-group    "x" gnus-article-display-x-face
1902      "h" gnus-summary-describe-briefly    "d" gnus-article-display-face
1903      "i" gnus-info-find-node)    "s" gnus-treat-smiley
1904      "D" gnus-article-remove-images
1905    (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)    "f" gnus-treat-from-picon
1906      "e" gnus-summary-expire-articles    "m" gnus-treat-mail-picon
1907      "\M-\C-e" gnus-summary-expire-articles-now    "n" gnus-treat-newsgroups-picon)
1908      "\177" gnus-summary-delete-article  
1909      [delete] gnus-summary-delete-article  (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1910      [backspace] gnus-summary-delete-article    "w" gnus-article-decode-mime-words
1911      "m" gnus-summary-move-article    "c" gnus-article-decode-charset
1912      "r" gnus-summary-respool-article    "v" gnus-mime-view-all-parts
1913      "w" gnus-summary-edit-article    "b" gnus-article-view-part)
1914      "c" gnus-summary-copy-article  
1915      "B" gnus-summary-crosspost-article  (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1916      "q" gnus-summary-respool-query    "z" gnus-article-date-ut
1917      "t" gnus-summary-respool-trace    "u" gnus-article-date-ut
1918      "i" gnus-summary-import-article    "l" gnus-article-date-local
1919      "p" gnus-summary-article-posted-p)    "p" gnus-article-date-english
1920      "e" gnus-article-date-lapsed
1921    (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)    "o" gnus-article-date-original
1922      "o" gnus-summary-save-article    "i" gnus-article-date-iso8601
1923      "m" gnus-summary-save-article-mail    "s" gnus-article-date-user)
1924      "F" gnus-summary-write-article-file  
1925      "r" gnus-summary-save-article-rmail  (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1926      "f" gnus-summary-save-article-file    "t" gnus-article-remove-trailing-blank-lines
1927      "b" gnus-summary-save-article-body-file    "l" gnus-article-strip-leading-blank-lines
1928      "h" gnus-summary-save-article-folder    "m" gnus-article-strip-multiple-blank-lines
1929      "v" gnus-summary-save-article-vm    "a" gnus-article-strip-blank-lines
1930      "p" gnus-summary-pipe-output    "A" gnus-article-strip-all-blank-lines
1931      "s" gnus-soup-add-article)    "s" gnus-article-strip-leading-space
1932      "e" gnus-article-strip-trailing-space
1933    (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)    "w" gnus-article-remove-leading-whitespace)
1934      "b" gnus-summary-display-buttonized  
1935      "m" gnus-summary-repair-multipart  (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1936      "v" gnus-article-view-part    "v" gnus-version
1937      "o" gnus-article-save-part    "f" gnus-summary-fetch-faq
1938      "c" gnus-article-copy-part    "d" gnus-summary-describe-group
1939      "e" gnus-article-externalize-part    "h" gnus-summary-describe-briefly
1940      "i" gnus-article-inline-part    "i" gnus-info-find-node
1941      "|" gnus-article-pipe-part))    "c" gnus-group-fetch-charter
1942      "C" gnus-group-fetch-control)
1943    
1944    (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1945      "e" gnus-summary-expire-articles
1946      "\M-\C-e" gnus-summary-expire-articles-now
1947      "\177" gnus-summary-delete-article
1948      [delete] gnus-summary-delete-article
1949      [backspace] gnus-summary-delete-article
1950      "m" gnus-summary-move-article
1951      "r" gnus-summary-respool-article
1952      "w" gnus-summary-edit-article
1953      "c" gnus-summary-copy-article
1954      "B" gnus-summary-crosspost-article
1955      "q" gnus-summary-respool-query
1956      "t" gnus-summary-respool-trace
1957      "i" gnus-summary-import-article
1958      "I" gnus-summary-create-article
1959      "p" gnus-summary-article-posted-p)
1960    
1961    (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1962      "o" gnus-summary-save-article
1963      "m" gnus-summary-save-article-mail
1964      "F" gnus-summary-write-article-file
1965      "r" gnus-summary-save-article-rmail
1966      "f" gnus-summary-save-article-file
1967      "b" gnus-summary-save-article-body-file
1968      "h" gnus-summary-save-article-folder
1969      "v" gnus-summary-save-article-vm
1970      "p" gnus-summary-pipe-output
1971      "P" gnus-summary-muttprint
1972      "s" gnus-soup-add-article)
1973    
1974    (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1975      "b" gnus-summary-display-buttonized
1976      "m" gnus-summary-repair-multipart
1977      "v" gnus-article-view-part
1978      "o" gnus-article-save-part
1979      "c" gnus-article-copy-part
1980      "C" gnus-article-view-part-as-charset
1981      "e" gnus-article-view-part-externally
1982      "E" gnus-article-encrypt-body
1983      "i" gnus-article-inline-part
1984      "|" gnus-article-pipe-part)
1985    
1986    (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
1987      "p" gnus-summary-mark-as-processable
1988      "u" gnus-summary-unmark-as-processable
1989      "U" gnus-summary-unmark-all-processable
1990      "v" gnus-uu-mark-over
1991      "s" gnus-uu-mark-series
1992      "r" gnus-uu-mark-region
1993      "g" gnus-uu-unmark-region
1994      "R" gnus-uu-mark-by-regexp
1995      "G" gnus-uu-unmark-by-regexp
1996      "t" gnus-uu-mark-thread
1997      "T" gnus-uu-unmark-thread
1998      "a" gnus-uu-mark-all
1999      "b" gnus-uu-mark-buffer
2000      "S" gnus-uu-mark-sparse
2001      "k" gnus-summary-kill-process-mark
2002      "y" gnus-summary-yank-process-mark
2003      "w" gnus-summary-save-process-mark
2004      "i" gnus-uu-invert-processable)
2005    
2006    (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2007      ;;"x" gnus-uu-extract-any
2008      "m" gnus-summary-save-parts
2009      "u" gnus-uu-decode-uu
2010      "U" gnus-uu-decode-uu-and-save
2011      "s" gnus-uu-decode-unshar
2012      "S" gnus-uu-decode-unshar-and-save
2013      "o" gnus-uu-decode-save
2014      "O" gnus-uu-decode-save
2015      "b" gnus-uu-decode-binhex
2016      "B" gnus-uu-decode-binhex
2017      "p" gnus-uu-decode-postscript
2018      "P" gnus-uu-decode-postscript-and-save)
2019    
2020    (gnus-define-keys
2021        (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2022      "u" gnus-uu-decode-uu-view
2023      "U" gnus-uu-decode-uu-and-save-view
2024      "s" gnus-uu-decode-unshar-view
2025      "S" gnus-uu-decode-unshar-and-save-view
2026      "o" gnus-uu-decode-save-view
2027      "O" gnus-uu-decode-save-view
2028      "b" gnus-uu-decode-binhex-view
2029      "B" gnus-uu-decode-binhex-view
2030      "p" gnus-uu-decode-postscript-view
2031      "P" gnus-uu-decode-postscript-and-save-view)
2032    
2033    (defvar gnus-article-post-menu nil)
2034    
2035    (defconst gnus-summary-menu-maxlen 20)
2036    
2037    (defun gnus-summary-menu-split (menu)
2038      ;; If we have lots of elements, divide them into groups of 20
2039      ;; and make a pane (or submenu) for each one.
2040      (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2041          (let ((menu menu) sublists next
2042                (i 1))
2043            (while menu
2044              ;; Pull off the next gnus-summary-menu-maxlen elements
2045              ;; and make them the next element of sublist.
2046              (setq next (nthcdr gnus-summary-menu-maxlen menu))
2047              (if next
2048                  (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2049                          nil))
2050              (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2051                                                 (aref (car (last menu)) 0)) menu)
2052                                   sublists))
2053              (setq i (1+ i))
2054              (setq menu next))
2055            (nreverse sublists))
2056        ;; Few elements--put them all in one pane.
2057        menu))
2058    
2059  (defun gnus-summary-make-menu-bar ()  (defun gnus-summary-make-menu-bar ()
2060    (gnus-turn-off-edit-menu 'summary)    (gnus-turn-off-edit-menu 'summary)
# Line 1673  increase the score of each group you rea Line 2062  increase the score of each group you rea
2062    (unless (boundp 'gnus-summary-misc-menu)    (unless (boundp 'gnus-summary-misc-menu)
2063    
2064      (easy-menu-define      (easy-menu-define
2065       gnus-summary-kill-menu gnus-summary-mode-map ""        gnus-summary-kill-menu gnus-summary-mode-map ""
2066       (cons        (cons
2067        "Score"         "Score"
2068        (nconc         (nconc
2069         (list          (list
2070          ["Enter score..." gnus-summary-score-entry t]           ["Customize" gnus-score-customize t])
2071          ["Customize" gnus-score-customize t])          (gnus-make-score-map 'increase)
2072         (gnus-make-score-map 'increase)          (gnus-make-score-map 'lower)
2073         (gnus-make-score-map 'lower)          '(("Mark"
2074         '(("Mark"             ["Kill below" gnus-summary-kill-below t]
2075            ["Kill below" gnus-summary-kill-below t]             ["Mark above" gnus-summary-mark-above t]
2076            ["Mark above" gnus-summary-mark-above t]             ["Tick above" gnus-summary-tick-above t]
2077            ["Tick above" gnus-summary-tick-above t]             ["Clear above" gnus-summary-clear-above t])
2078            ["Clear above" gnus-summary-clear-above t])            ["Current score" gnus-summary-current-score t]
2079           ["Current score" gnus-summary-current-score t]            ["Set score" gnus-summary-set-score t]
2080           ["Set score" gnus-summary-set-score t]            ["Switch current score file..." gnus-score-change-score-file t]
2081           ["Switch current score file..." gnus-score-change-score-file t]            ["Set mark below..." gnus-score-set-mark-below t]
2082           ["Set mark below..." gnus-score-set-mark-below t]            ["Set expunge below..." gnus-score-set-expunge-below t]
2083           ["Set expunge below..." gnus-score-set-expunge-below t]            ["Edit current score file" gnus-score-edit-current-scores t]
2084           ["Edit current score file" gnus-score-edit-current-scores t]            ["Edit score file" gnus-score-edit-file t]
2085           ["Edit score file" gnus-score-edit-file t]            ["Trace score" gnus-score-find-trace t]
2086           ["Trace score" gnus-score-find-trace t]            ["Find words" gnus-score-find-favourite-words t]
2087           ["Find words" gnus-score-find-favourite-words t]            ["Rescore buffer" gnus-summary-rescore t]
2088           ["Rescore buffer" gnus-summary-rescore t]            ["Increase score..." gnus-summary-increase-score t]
2089           ["Increase score..." gnus-summary-increase-score t]            ["Lower score..." gnus-summary-lower-score t]))))
2090           ["Lower score..." gnus-summary-lower-score t]))))  
2091        ;; Define both the Article menu in the summary buffer and the
2092      ;; Define both the Article menu in the summary buffer and the equivalent      ;; equivalent Commands menu in the article buffer here for
2093      ;; Commands menu in the article buffer here for consistency.      ;; consistency.
2094      (let ((innards      (let ((innards
2095             '(("Hide"             `(("Hide"
2096                ["All" gnus-article-hide t]                ["All" gnus-article-hide t]
2097                ["Headers" gnus-article-hide-headers t]                ["Headers" gnus-article-hide-headers t]
2098                ["Signature" gnus-article-hide-signature t]                ["Signature" gnus-article-hide-signature t]
2099                ["Citation" gnus-article-hide-citation t]                ["Citation" gnus-article-hide-citation t]
2100                ["List identifiers" gnus-article-hide-list-identifiers t]                ["List identifiers" gnus-article-hide-list-identifiers t]
               ["PGP" gnus-article-hide-pgp t]  
2101                ["Banner" gnus-article-strip-banner t]                ["Banner" gnus-article-strip-banner t]
2102                ["Boring headers" gnus-article-hide-boring-headers t])                ["Boring headers" gnus-article-hide-boring-headers t])
2103               ("Highlight"               ("Highlight"
2104                ["All" gnus-article-highlight t]                ["All" gnus-article-highlight t]
2105                ["Headers" gnus-article-highlight-headers t]                ["Headers" gnus-article-highlight-headers t]
2106                ["Signature" gnus-article-highlight-signature t]                ["Signature" gnus-article-highlight-signature t]
2107                ["Citation" gnus-article-highlight-citation t])                ["Citation" gnus-article-highlight-citation t])
2108               ("MIME"               ("MIME"
2109                ["Words" gnus-article-decode-mime-words t]                ["Words" gnus-article-decode-mime-words t]
2110                ["Charset" gnus-article-decode-charset t]                ["Charset" gnus-article-decode-charset t]
2111                ["QP" gnus-article-de-quoted-unreadable t]                ["QP" gnus-article-de-quoted-unreadable t]
2112                ["Base64" gnus-article-de-base64-unreadable t]                ["Base64" gnus-article-de-base64-unreadable t]
2113                ["View all" gnus-mime-view-all-parts t])                ["View MIME buttons" gnus-summary-display-buttonized t]
2114               ("Date"                ["View all" gnus-mime-view-all-parts t]
2115                ["Local" gnus-article-date-local t]                ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2116                ["ISO8601" gnus-article-date-iso8601 t]                ["Encrypt body" gnus-article-encrypt-body
2117                ["UT" gnus-article-date-ut t]                 :active (not (gnus-group-read-only-p))
2118                ["Original" gnus-article-date-original t]                 ,@(if (featurep 'xemacs) nil
2119                ["Lapsed" gnus-article-date-lapsed t]                     '(:help "Encrypt the message body on disk"))]
2120                ["User-defined" gnus-article-date-user t])                ["Extract all parts..." gnus-summary-save-parts t]
2121               ("Washing"                ("Multipart"
2122                ("Remove Blanks"                 ["Repair multipart" gnus-summary-repair-multipart t]
2123                 ["Leading" gnus-article-strip-leading-blank-lines t]                 ["Pipe part..." gnus-article-pipe-part t]
2124                 ["Multiple" gnus-article-strip-multiple-blank-lines t]                 ["Inline part" gnus-article-inline-part t]
2125                 ["Trailing" gnus-article-remove-trailing-blank-lines t]                 ["Encrypt body" gnus-article-encrypt-body
2126                 ["All of the above" gnus-article-strip-blank-lines t]                  :active (not (gnus-group-read-only-p))
2127                 ["All" gnus-article-strip-all-blank-lines t]                 ,@(if (featurep 'xemacs) nil
2128                 ["Leading space" gnus-article-strip-leading-space t]                     '(:help "Encrypt the message body on disk"))]
2129                 ["Trailing space" gnus-article-strip-trailing-space t])                 ["View part externally" gnus-article-view-part-externally t]
2130                ["Overstrike" gnus-article-treat-overstrike t]                 ["View part with charset..." gnus-article-view-part-as-charset t]
2131                ["Dumb quotes" gnus-article-treat-dumbquotes t]                 ["Copy part" gnus-article-copy-part t]
2132                ["Emphasis" gnus-article-emphasize t]                 ["Save part..." gnus-article-save-part t]
2133                ["Word wrap" gnus-article-fill-cited-article t]                 ["View part" gnus-article-view-part t]))
2134                 ("Date"
2135                  ["Local" gnus-article-date-local t]
2136                  ["ISO8601" gnus-article-date-iso8601 t]
2137                  ["UT" gnus-article-date-ut t]
2138                  ["Original" gnus-article-date-original t]
2139                  ["Lapsed" gnus-article-date-lapsed t]
2140                  ["User-defined" gnus-article-date-user t])
2141                 ("Display"
2142                  ["Remove images" gnus-article-remove-images t]
2143                  ["Toggle smiley" gnus-treat-smiley t]
2144                  ["Show X-Face" gnus-article-display-x-face t]
2145                  ["Show picons in From" gnus-treat-from-picon t]
2146                  ["Show picons in mail headers" gnus-treat-mail-picon t]
2147                  ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2148                  ("View as different encoding"
2149                   ,@(gnus-summary-menu-split
2150                      (mapcar
2151                       (lambda (cs)
2152                         ;; Since easymenu under Emacs doesn't allow
2153                         ;; lambda forms for menu commands, we should
2154                         ;; provide intern'ed function symbols.
2155                         (let ((command (intern (format "\
2156    gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2157                           (fset command
2158                                 `(lambda ()
2159                                    (interactive)
2160                                    (let ((gnus-summary-show-article-charset-alist
2161                                           '((1 . ,cs))))
2162                                      (gnus-summary-show-article 1))))
2163                           `[,(symbol-name cs) ,command t]))
2164                       (sort (if (fboundp 'coding-system-list)
2165                                 (coding-system-list)
2166                               (mapcar 'car mm-mime-mule-charset-alist))
2167                             'string<)))))
2168                 ("Washing"
2169                  ("Remove Blanks"
2170                   ["Leading" gnus-article-strip-leading-blank-lines t]
2171                   ["Multiple" gnus-article-strip-multiple-blank-lines t]
2172                   ["Trailing" gnus-article-remove-trailing-blank-lines t]
2173                   ["All of the above" gnus-article-strip-blank-lines t]
2174                   ["All" gnus-article-strip-all-blank-lines t]
2175                   ["Leading space" gnus-article-strip-leading-space t]
2176                   ["Trailing space" gnus-article-strip-trailing-space t]
2177                   ["Leading space in headers"
2178                    gnus-article-remove-leading-whitespace t])
2179                  ["Overstrike" gnus-article-treat-overstrike t]
2180                  ["Dumb quotes" gnus-article-treat-dumbquotes t]
2181                  ["Emphasis" gnus-article-emphasize t]
2182                  ["Word wrap" gnus-article-fill-cited-article t]
2183                ["Fill long lines" gnus-article-fill-long-lines t]                ["Fill long lines" gnus-article-fill-long-lines t]
2184                ["Capitalize sentences" gnus-article-capitalize-sentences t]                ["Capitalize sentences" gnus-article-capitalize-sentences t]
2185                ["CR" gnus-article-remove-cr t]                ["Remove CR" gnus-article-remove-cr t]
2186                ["Show X-Face" gnus-article-display-x-face t]                ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2187                ["Quoted-Printable" gnus-article-de-quoted-unreadable t]                ["Base64" gnus-article-de-base64-unreadable t]
2188                ["Base64" gnus-article-de-base64-unreadable t]                ["Rot 13" gnus-summary-caesar-message
2189                ["Rot 13" gnus-summary-caesar-message                 ,@(if (featurep 'xemacs) '(t)
2190                 :help "\"Caesar rotate\" article by 13"]                     '(:help "\"Caesar rotate\" article by 13"))]
2191                ["Unix pipe" gnus-summary-pipe-message t]                ["Morse decode" gnus-summary-morse-message t]
2192                ["Add buttons" gnus-article-add-buttons t]                ["Unix pipe..." gnus-summary-pipe-message t]
2193                ["Add buttons to head" gnus-article-add-buttons-to-head t]                ["Add buttons" gnus-article-add-buttons t]
2194                ["Stop page breaking" gnus-summary-stop-page-breaking t]                ["Add buttons to head" gnus-article-add-buttons-to-head t]
2195                ["Verbose header" gnus-summary-verbose-headers t]                ["Stop page breaking" gnus-summary-stop-page-breaking t]
2196                ["Toggle header" gnus-summary-toggle-header t]                ["Verbose header" gnus-summary-verbose-headers t]
2197                  ["Toggle header" gnus-summary-toggle-header t]
2198                  ["Unfold headers" gnus-article-treat-unfold-headers t]
2199                  ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2200                ["Html" gnus-article-wash-html t]                ["Html" gnus-article-wash-html t]
2201                ["HZ" gnus-article-decode-HZ t])                ["Unsplit URLs" gnus-article-unsplit-urls t]
2202               ("Output"                ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2203                ["Save in default format" gnus-summary-save-article                ["Decode HZ" gnus-article-decode-HZ t]
2204                 :help "Save article using default method"]                ("(Outlook) Deuglify"
2205                ["Save in file" gnus-summary-save-article-file                 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2206                 :help "Save article in file"]                 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2207                ["Save in Unix mail format" gnus-summary-save-article-mail t]                 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2208                ["Save in MH folder" gnus-summary-save-article-folder t]                 ["Full (Outlook) deuglify"
2209                ["Save in VM folder" gnus-summary-save-article-vm t]                  gnus-article-outlook-deuglify-article t])
2210                ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]                )
2211                ["Save body in file" gnus-summary-save-article-body-file t]               ("Output"
2212                ["Pipe through a filter" gnus-summary-pipe-output t]                ["Save in default format..." gnus-summary-save-article
2213                ["Add to SOUP packet" gnus-soup-add-article t]                 ,@(if (featurep 'xemacs) '(t)
2214                ["Print" gnus-summary-print-article t])                     '(:help "Save article using default method"))]
2215               ("Backend"                ["Save in file..." gnus-summary-save-article-file
2216                ["Respool article..." gnus-summary-respool-article t]                 ,@(if (featurep 'xemacs) '(t)
2217                ["Move article..." gnus-summary-move-article                     '(:help "Save article in file"))]
2218                 (gnus-check-backend-function                ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2219                  'request-move-article gnus-newsgroup-name)]                ["Save in MH folder..." gnus-summary-save-article-folder t]
2220                ["Copy article..." gnus-summary-copy-article t]                ["Save in VM folder..." gnus-summary-save-article-vm t]
2221                ["Crosspost article..." gnus-summary-crosspost-article                ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2222                 (gnus-check-backend-function                ["Save body in file..." gnus-summary-save-article-body-file t]
2223                  'request-replace-article gnus-newsgroup-name)]                ["Pipe through a filter..." gnus-summary-pipe-output t]
2224                ["Import file..." gnus-summary-import-article t]                ["Add to SOUP packet" gnus-soup-add-article t]
2225                ["Check if posted" gnus-summary-article-posted-p t]                ["Print with Muttprint..." gnus-summary-muttprint t]
2226                ["Edit article" gnus-summary-edit-article                ["Print" gnus-summary-print-article t])
2227                 (not (gnus-group-read-only-p))]               ("Backend"
2228                ["Delete article" gnus-summary-delete-article                ["Respool article..." gnus-summary-respool-article t]
2229                 (gnus-check-backend-function                ["Move article..." gnus-summary-move-article
2230                  'request-expire-articles gnus-newsgroup-name)]                 (gnus-check-backend-function
2231                ["Query respool" gnus-summary-respool-query t]                  'request-move-article gnus-newsgroup-name)]
2232                  ["Copy article..." gnus-summary-copy-article t]
2233                  ["Crosspost article..." gnus-summary-crosspost-article
2234                   (gnus-check-backend-function
2235                    'request-replace-article gnus-newsgroup-name)]
2236                  ["Import file..." gnus-summary-import-article
2237                   (gnus-check-backend-function
2238                    'request-accept-article gnus-newsgroup-name)]
2239                  ["Create article..." gnus-summary-create-article
2240                   (gnus-check-backend-function
2241                    'request-accept-article gnus-newsgroup-name)]
2242                  ["Check if posted" gnus-summary-article-posted-p t]
2243                  ["Edit article" gnus-summary-edit-article
2244                   (not (gnus-group-read-only-p))]
2245                  ["Delete article" gnus-summary-delete-article
2246                   (gnus-check-backend-function
2247                    'request-expire-articles gnus-newsgroup-name)]
2248                  ["Query respool" gnus-summary-respool-query t]
2249                ["Trace respool" gnus-summary-respool-trace t]                ["Trace respool" gnus-summary-respool-trace t]
2250                ["Delete expirable articles" gnus-summary-expire-articles-now                ["Delete expirable articles" gnus-summary-expire-articles-now
2251                 (gnus-check-backend-function                 (gnus-check-backend-function
2252                  'request-expire-articles gnus-newsgroup-name)])                  'request-expire-articles gnus-newsgroup-name)])
2253               ("Extract"               ("Extract"
2254                ["Uudecode" gnus-uu-decode-uu                ["Uudecode" gnus-uu-decode-uu
2255                 :help "Decode uuencoded article(s)"]                 ,@(if (featurep 'xemacs) '(t)
2256                ["Uudecode and save" gnus-uu-decode-uu-and-save t]                     '(:help "Decode uuencoded article(s)"))]
2257                ["Unshar" gnus-uu-decode-unshar t]                ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2258                ["Unshar and save" gnus-uu-decode-unshar-and-save t]                ["Unshar" gnus-uu-decode-unshar t]
2259                ["Save" gnus-uu-decode-save t]                ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2260                ["Binhex" gnus-uu-decode-binhex t]                ["Save" gnus-uu-decode-save t]
2261                ["Postscript" gnus-uu-decode-postscript t])                ["Binhex" gnus-uu-decode-binhex t]
2262               ("Cache"                ["Postscript" gnus-uu-decode-postscript t]
2263                ["Enter article" gnus-cache-enter-article t]                ["All MIME parts" gnus-summary-save-parts t])
2264                ["Remove article" gnus-cache-remove-article t])               ("Cache"
2265                  ["Enter article" gnus-cache-enter-article t]
2266                  ["Remove article" gnus-cache-remove-article t])
2267               ["Translate" gnus-article-babel t]               ["Translate" gnus-article-babel t]
2268               ["Select article buffer" gnus-summary-select-article-buffer t]               ["Select article buffer" gnus-summary-select-article-buffer t]
2269               ["Enter digest buffer" gnus-summary-enter-digest-group t]               ["Enter digest buffer" gnus-summary-enter-digest-group t]
2270               ["Isearch article..." gnus-summary-isearch-article t]               ["Isearch article..." gnus-summary-isearch-article t]
2271               ["Beginning of the article" gnus-summary-beginning-of-article t]               ["Beginning of the article" gnus-summary-beginning-of-article t]
2272               ["End of the article" gnus-summary-end-of-article t]               ["End of the article" gnus-summary-end-of-article t]
2273               ["Fetch parent of article" gnus-summary-refer-parent-article t]               ["Fetch parent of article" gnus-summary-refer-parent-article t]
2274               ["Fetch referenced articles" gnus-summary-refer-references t]               ["Fetch referenced articles" gnus-summary-refer-references t]
2275               ["Fetch current thread" gnus-summary-refer-thread t]               ["Fetch current thread" gnus-summary-refer-thread t]
2276               ["Fetch article with id..." gnus-summary-refer-article t]               ["Fetch article with id..." gnus-summary-refer-article t]
2277               ["Redisplay" gnus-summary-show-article t])))               ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2278                 ["Redisplay" gnus-summary-show-article t]
2279                 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2280        (easy-menu-define        (easy-menu-define
2281         gnus-summary-article-menu gnus-summary-mode-map ""          gnus-summary-article-menu gnus-summary-mode-map ""
2282         (cons "Article" innards))          (cons "Article" innards))
2283    
2284        (if (not (keymapp gnus-summary-article-menu))        (if (not (keymapp gnus-summary-article-menu))
2285            (easy-menu-define            (easy-menu-define
# Line 1831  increase the score of each group you rea Line 2292  increase the score of each group you rea
2292            (cons "Commands" gnus-article-commands-menu))))            (cons "Commands" gnus-article-commands-menu))))
2293    
2294      (easy-menu-define      (easy-menu-define
2295       gnus-summary-thread-menu gnus-summary-mode-map ""        gnus-summary-thread-menu gnus-summary-mode-map ""
2296       '("Threads"        '("Threads"
2297         ["Toggle threading" gnus-summary-toggle-threads t]          ["Find all messages in thread" gnus-summary-refer-thread t]
2298         ["Hide threads" gnus-summary-hide-all-threads t]          ["Toggle threading" gnus-summary-toggle-threads t]
2299         ["Show threads" gnus-summary-show-all-threads t]          ["Hide threads" gnus-summary-hide-all-threads t]
2300         ["Hide thread" gnus-summary-hide-thread t]          ["Show threads" gnus-summary-show-all-threads t]
2301         ["Show thread" gnus-summary-show-thread t]          ["Hide thread" gnus-summary-hide-thread t]
2302         ["Go to next thread" gnus-summary-next-thread t]          ["Show thread" gnus-summary-show-thread t]
2303         ["Go to previous thread" gnus-summary-prev-thread t]          ["Go to next thread" gnus-summary-next-thread t]
2304         ["Go down thread" gnus-summary-down-thread t]          ["Go to previous thread" gnus-summary-prev-thread t]
2305         ["Go up thread" gnus-summary-up-thread t]          ["Go down thread" gnus-summary-down-thread t]
2306         ["Top of thread" gnus-summary-top-thread t]          ["Go up thread" gnus-summary-up-thread t]
2307         ["Mark thread as read" gnus-summary-kill-thread t]          ["Top of thread" gnus-summary-top-thread t]
2308         ["Lower thread score" gnus-summary-lower-thread t]          ["Mark thread as read" gnus-summary-kill-thread t]
2309         ["Raise thread score" gnus-summary-raise-thread t]          ["Lower thread score" gnus-summary-lower-thread t]
2310         ["Rethread current" gnus-summary-rethread-current t]))          ["Raise thread score" gnus-summary-raise-thread t]
2311            ["Rethread current" gnus-summary-rethread-current t]))
2312    
2313      (easy-menu-define      (easy-menu-define
2314       gnus-summary-post-menu gnus-summary-mode-map ""        gnus-summary-post-menu gnus-summary-mode-map ""
2315       '("Post"        `("Post"
2316         ["Post an article" gnus-summary-post-news          ["Send a message (mail or news)" gnus-summary-post-news
2317          :help "Post an article"]           ,@(if (featurep 'xemacs) '(t)
2318         ["Followup" gnus-summary-followup               '(:help "Post an article"))]
2319          :help "Post followup to this article"]          ["Followup" gnus-summary-followup
2320         ["Followup and yank" gnus-summary-followup-with-original           ,@(if (featurep 'xemacs) '(t)
2321          :help "Post followup to this article, quoting its contents"]               '(:help "Post followup to this article"))]
2322         ["Supersede article" gnus-summary-supersede-article t]          ["Followup and yank" gnus-summary-followup-with-original
2323         ["Cancel article" gnus-summary-cancel-article           ,@(if (featurep 'xemacs) '(t)
2324          :help "Cancel an article you posted"]               '(:help "Post followup to this article, quoting its contents"))]
2325         ["Reply" gnus-summary-reply t]          ["Supersede article" gnus-summary-supersede-article t]
2326         ["Reply and yank" gnus-summary-reply-with-original t]          ["Cancel article" gnus-summary-cancel-article
2327         ["Wide reply" gnus-summary-wide-reply t]           ,@(if (featurep 'xemacs) '(t)
2328         ["Wide reply and yank" gnus-summary-wide-reply-with-original               '(:help "Cancel an article you posted"))]
2329          :help "Mail a reply, quoting this article"]          ["Reply" gnus-summary-reply t]
2330         ["Mail forward" gnus-summary-mail-forward t]          ["Reply and yank" gnus-summary-reply-with-original t]
2331         ["Post forward" gnus-summary-post-forward t]          ["Wide reply" gnus-summary-wide-reply t]
2332         ["Digest and mail" gnus-uu-digest-mail-forward t]          ["Wide reply and yank" gnus-summary-wide-reply-with-original
2333         ["Digest and post" gnus-uu-digest-post-forward t]           ,@(if (featurep 'xemacs) '(t)
2334         ["Resend message" gnus-summary-resend-message t]               '(:help "Mail a reply, quoting this article"))]
2335         ["Send bounced mail" gnus-summary-resend-bounced-mail t]          ["Very wide reply" gnus-summary-very-wide-reply t]
2336         ["Send a mail" gnus-summary-mail-other-window t]          ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2337         ["Uuencode and post" gnus-uu-post-news           ,@(if (featurep 'xemacs) '(t)
2338          :help "Post a uuencoded article"]               '(:help "Mail a very wide reply, quoting this article"))]
2339         ["Followup via news" gnus-summary-followup-to-mail t]          ["Mail forward" gnus-summary-mail-forward t]
2340         ["Followup via news and yank"          ["Post forward" gnus-summary-post-forward t]
2341          gnus-summary-followup-to-mail-with-original t]          ["Digest and mail" gnus-uu-digest-mail-forward t]
2342         ;;("Draft"          ["Digest and post" gnus-uu-digest-post-forward t]
2343         ;;["Send" gnus-summary-send-draft t]          ["Resend message" gnus-summary-resend-message t]
2344         ;;["Send bounced" gnus-resend-bounced-mail t])          ["Resend message edit" gnus-summary-resend-message-edit t]
2345         ))          ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2346            ["Send a mail" gnus-summary-mail-other-window t]
2347            ["Create a local message" gnus-summary-news-other-window t]
2348            ["Uuencode and post" gnus-uu-post-news
2349             ,@(if (featurep 'xemacs) '(t)
2350                 '(:help "Post a uuencoded article"))]
2351            ["Followup via news" gnus-summary-followup-to-mail t]
2352            ["Followup via news and yank"
2353             gnus-summary-followup-to-mail-with-original t]
2354            ;;("Draft"
2355            ;;["Send" gnus-summary-send-draft t]
2356            ;;["Send bounced" gnus-resend-bounced-mail t])
2357            ))
2358    
2359        (cond
2360         ((not (keymapp gnus-summary-post-menu))
2361          (setq gnus-article-post-menu gnus-summary-post-menu))
2362         ((not gnus-article-post-menu)
2363          ;; Don't share post menu.
2364          (setq gnus-article-post-menu
2365                (copy-keymap gnus-summary-post-menu))))
2366        (define-key gnus-article-mode-map [menu-bar post]
2367          (cons "Post" gnus-article-post-menu))
2368    
2369      (easy-menu-define      (easy-menu-define
2370       gnus-summary-misc-menu gnus-summary-mode-map ""        gnus-summary-misc-menu gnus-summary-mode-map ""
2371       '("Misc"        `("Gnus"
2372         ("Mark Read"          ("Mark Read"
2373          ["Mark as read" gnus-summary-mark-as-read-forward t]           ["Mark as read" gnus-summary-mark-as-read-forward t]
2374          ["Mark same subject and select"           ["Mark same subject and select"
2375           gnus-summary-kill-same-subject-and-select t]            gnus-summary-kill-same-subject-and-select t]
2376          ["Mark same subject" gnus-summary-kill-same-subject t]           ["Mark same subject" gnus-summary-kill-same-subject t]
2377          ["Catchup" gnus-summary-catchup           ["Catchup" gnus-summary-catchup
2378           :help "Mark unread articles in this group as read"]            ,@(if (featurep 'xemacs) '(t)
2379          ["Catchup all" gnus-summary-catchup-all t]                '(:help "Mark unread articles in this group as read"))]
2380          ["Catchup to here" gnus-summary-catchup-to-here t]           ["Catchup all" gnus-summary-catchup-all t]
2381          ["Catchup region" gnus-summary-mark-region-as-read t]           ["Catchup to here" gnus-summary-catchup-to-here t]
2382          ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])           ["Catchup from here" gnus-summary-catchup-from-here t]
2383         ("Mark Various"           ["Catchup region" gnus-summary-mark-region-as-read
2384          ["Tick" gnus-summary-tick-article-forward t]            (gnus-mark-active-p)]
2385          ["Mark as dormant" gnus-summary-mark-as-dormant t]           ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2386          ["Remove marks" gnus-summary-clear-mark-forward t]          ("Mark Various"
2387          ["Set expirable mark" gnus-summary-mark-as-expirable t]           ["Tick" gnus-summary-tick-article-forward t]
2388          ["Set bookmark" gnus-summary-set-bookmark t]           ["Mark as dormant" gnus-summary-mark-as-dormant t]
2389          ["Remove bookmark" gnus-summary-remove-bookmark t])           ["Remove marks" gnus-summary-clear-mark-forward t]
2390         ("Mark Limit"           ["Set expirable mark" gnus-summary-mark-as-expirable t]
2391          ["Marks..." gnus-summary-limit-to-marks t]           ["Set bookmark" gnus-summary-set-bookmark t]
2392          ["Subject..." gnus-summary-limit-to-subject t]           ["Remove bookmark" gnus-summary-remove-bookmark t])
2393          ["Author..." gnus-summary-limit-to-author t]          ("Limit to"
2394          ["Age..." gnus-summary-limit-to-age t]           ["Marks..." gnus-summary-limit-to-marks t]
2395          ["Extra..." gnus-summary-limit-to-extra t]           ["Subject..." gnus-summary-limit-to-subject t]
2396          ["Score" gnus-summary-limit-to-score t]           ["Author..." gnus-summary-limit-to-author t]
2397          ["Unread" gnus-summary-limit-to-unread t]           ["Age..." gnus-summary-limit-to-age t]
2398          ["Non-dormant" gnus-summary-limit-exclude-dormant t]           ["Extra..." gnus-summary-limit-to-extra t]
2399          ["Articles" gnus-summary-limit-to-articles t]           ["Score..." gnus-summary-limit-to-score t]
2400          ["Pop limit" gnus-summary-pop-limit t]           ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2401          ["Show dormant" gnus-summary-limit-include-dormant t]           ["Unread" gnus-summary-limit-to-unread t]
2402          ["Hide childless dormant"           ["Unseen" gnus-summary-limit-to-unseen t]
2403           gnus-summary-limit-exclude-childless-dormant t]           ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2404          ;;["Hide thread" gnus-summary-limit-exclude-thread t]           ["Next articles" gnus-summary-limit-to-articles t]
2405          ["Hide marked" gnus-summary-limit-exclude-marks t]           ["Pop limit" gnus-summary-pop-limit t]
2406          ["Show expunged" gnus-summary-show-all-expunged t])           ["Show dormant" gnus-summary-limit-include-dormant t]
2407         ("Process Mark"           ["Hide childless dormant"
2408          ["Set mark" gnus-summary-mark-as-processable t]            gnus-summary-limit-exclude-childless-dormant t]
2409          ["Remove mark" gnus-summary-unmark-as-processable t]           ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2410          ["Remove all marks" gnus-summary-unmark-all-processable t]           ["Hide marked" gnus-summary-limit-exclude-marks t]
2411          ["Mark above" gnus-uu-mark-over t]           ["Show expunged" gnus-summary-limit-include-expunged t])
2412          ["Mark series" gnus-uu-mark-series t]          ("Process Mark"
2413          ["Mark region" gnus-uu-mark-region t]           ["Set mark" gnus-summary-mark-as-processable t]
2414          ["Unmark region" gnus-uu-unmark-region t]           ["Remove mark" gnus-summary-unmark-as-processable t]
2415          ["Mark by regexp..." gnus-uu-mark-by-regexp t]           ["Remove all marks" gnus-summary-unmark-all-processable t]
2416          ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]           ["Mark above" gnus-uu-mark-over t]
2417          ["Mark all" gnus-uu-mark-all t]           ["Mark series" gnus-uu-mark-series t]
2418          ["Mark buffer" gnus-uu-mark-buffer t]           ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2419          ["Mark sparse" gnus-uu-mark-sparse t]           ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2420          ["Mark thread" gnus-uu-mark-thread t]           ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2421          ["Unmark thread" gnus-uu-unmark-thread t]           ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2422          ("Process Mark Sets"           ["Mark all" gnus-uu-mark-all t]
2423           ["Kill" gnus-summary-kill-process-mark t]           ["Mark buffer" gnus-uu-mark-buffer t]
2424           ["Yank" gnus-summary-yank-process-mark           ["Mark sparse" gnus-uu-mark-sparse t]
2425            gnus-newsgroup-process-stack]           ["Mark thread" gnus-uu-mark-thread t]
2426           ["Save" gnus-summary-save-process-mark t]))           ["Unmark thread" gnus-uu-unmark-thread t]
2427         ("Scroll article"           ("Process Mark Sets"
2428          ["Page forward" gnus-summary-next-page            ["Kill" gnus-summary-kill-process-mark t]
2429           :help "Show next page of article"]            ["Yank" gnus-summary-yank-process-mark
2430          ["Page backward" gnus-summary-prev-page             gnus-newsgroup-process-stack]
2431           :help "Show previous page of article"]            ["Save" gnus-summary-save-process-mark t]
2432          ["Line forward" gnus-summary-scroll-up t])            ["Run command on marked..." gnus-summary-universal-argument t]))
2433         ("Move"          ("Scroll article"
2434          ["Next unread article" gnus-summary-next-unread-article t]           ["Page forward" gnus-summary-next-page
2435          ["Previous unread article" gnus-summary-prev-unread-article t]            ,@(if (featurep 'xemacs) '(t)
2436          ["Next article" gnus-summary-next-article t]                '(:help "Show next page of article"))]
2437          ["Previous article" gnus-summary-prev-article t]           ["Page backward" gnus-summary-prev-page
2438          ["Next unread subject" gnus-summary-next-unread-subject t]            ,@(if (featurep 'xemacs) '(t)
2439          ["Previous unread subject" gnus-summary-prev-unread-subject t]                '(:help "Show previous page of article"))]
2440          ["Next article same subject" gnus-summary-next-same-subject t]           ["Line forward" gnus-summary-scroll-up t])
2441          ["Previous article same subject" gnus-summary-prev-same-subject t]          ("Move"
2442          ["First unread article" gnus-summary-first-unread-article t]           ["Next unread article" gnus-summary-next-unread-article t]
2443          ["Best unread article" gnus-summary-best-unread-article t]           ["Previous unread article" gnus-summary-prev-unread-article t]
2444          ["Go to subject number..." gnus-summary-goto-subject t]           ["Next article" gnus-summary-next-article t]
2445          ["Go to article number..." gnus-summary-goto-article t]           ["Previous article" gnus-summary-prev-article t]
2446          ["Go to the last article" gnus-summary-goto-last-article t]           ["Next unread subject" gnus-summary-next-unread-subject t]
2447          ["Pop article off history" gnus-summary-pop-article t])           ["Previous unread subject" gnus-summary-prev-unread-subject t]
2448         ("Sort"           ["Next article same subject" gnus-summary-next-same-subject t]
2449          ["Sort by number" gnus-summary-sort-by-number t]           ["Previous article same subject" gnus-summary-prev-same-subject t]
2450          ["Sort by author" gnus-summary-sort-by-author t]           ["First unread article" gnus-summary-first-unread-article t]
2451          ["Sort by subject" gnus-summary-sort-by-subject t]           ["Best unread article" gnus-summary-best-unread-article t]
2452          ["Sort by date" gnus-summary-sort-by-date t]           ["Go to subject number..." gnus-summary-goto-subject t]
2453          ["Sort by score" gnus-summary-sort-by-score t]           ["Go to article number..." gnus-summary-goto-article t]
2454          ["Sort by lines" gnus-summary-sort-by-lines t]           ["Go to the last article" gnus-summary-goto-last-article t]
2455          ["Sort by characters" gnus-summary-sort-by-chars t])           ["Pop article off history" gnus-summary-pop-article t])
2456         ("Help"          ("Sort"
2457          ["Fetch group FAQ" gnus-summary-fetch-faq t]           ["Sort by number" gnus-summary-sort-by-number t]
2458          ["Describe group" gnus-summary-describe-group t]           ["Sort by author" gnus-summary-sort-by-author t]
2459          ["Read manual" gnus-info-find-node t])           ["Sort by subject" gnus-summary-sort-by-subject t]
2460         ("Modes"           ["Sort by date" gnus-summary-sort-by-date t]
2461          ["Pick and read" gnus-pick-mode t]           ["Sort by score" gnus-summary-sort-by-score t]
2462          ["Binary" gnus-binary-mode t])           ["Sort by lines" gnus-summary-sort-by-lines t]
2463         ("Regeneration"           ["Sort by characters" gnus-summary-sort-by-chars t]
2464          ["Regenerate" gnus-summary-prepare t]           ["Randomize" gnus-summary-sort-by-random t]
2465          ["Insert cached articles" gnus-summary-insert-cached-articles t]           ["Original sort" gnus-summary-sort-by-original t])
2466          ["Toggle threading" gnus-summary-toggle-threads t])          ("Help"
2467         ["Filter articles..." gnus-summary-execute-command t]           ["Fetch group FAQ" gnus-summary-fetch-faq t]
2468         ["Run command on subjects..." gnus-summary-universal-argument t]           ["Describe group" gnus-summary-describe-group t]
2469         ["Search articles forward..." gnus-summary-search-article-forward t]           ["Fetch charter" gnus-group-fetch-charter
2470         ["Search articles backward..." gnus-summary-search-article-backward t]            ,@(if (featurep 'xemacs) nil
2471         ["Toggle line truncation" gnus-summary-toggle-truncation t]                '(:help "Display the charter of the current group"))]
2472         ["Expand window" gnus-summary-expand-window t]           ["Fetch control message" gnus-group-fetch-control
2473         ["Expire expirable articles" gnus-summary-expire-articles            ,@(if (featurep 'xemacs) nil
2474          (gnus-check-backend-function                '(:help "Display the archived control message for the current group"))]
2475           'request-expire-articles gnus-newsgroup-name)]           ["Read manual" gnus-info-find-node t])
2476         ["Edit local kill file" gnus-summary-edit-local-kill t]          ("Modes"
2477         ["Edit main kill file" gnus-summary-edit-global-kill t]           ["Pick and read" gnus-pick-mode t]
2478         ["Edit group parameters" gnus-summary-edit-parameters t]           ["Binary" gnus-binary-mode t])
2479         ["Customize group parameters" gnus-summary-customize-parameters t]          ("Regeneration"
2480         ["Send a bug report" gnus-bug t]           ["Regenerate" gnus-summary-prepare t]
2481         ("Exit"           ["Insert cached articles" gnus-summary-insert-cached-articles t]
2482          ["Catchup and exit" gnus-summary-catchup-and-exit           ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2483           :help "Mark unread articles in this group as read, then exit"]           ["Toggle threading" gnus-summary-toggle-threads t])
2484          ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]          ["See old articles" gnus-summary-insert-old-articles t]
2485          ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]          ["See new articles" gnus-summary-insert-new-articles t]
2486          ["Exit group" gnus-summary-exit          ["Filter articles..." gnus-summary-execute-command t]
2487           :help "Exit current group, return to group selection mode"]          ["Run command on articles..." gnus-summary-universal-argument t]
2488          ["Exit group without updating" gnus-summary-exit-no-update t]          ["Search articles forward..." gnus-summary-search-article-forward t]
2489          ["Exit and goto next group" gnus-summary-next-group t]          ["Search articles backward..." gnus-summary-search-article-backward t]
2490          ["Exit and goto prev group" gnus-summary-prev-group t]          ["Toggle line truncation" gnus-summary-toggle-truncation t]
2491          ["Reselect group" gnus-summary-reselect-current-group t]          ["Expand window" gnus-summary-expand-window t]
2492          ["Rescan group" gnus-summary-rescan-group t]          ["Expire expirable articles" gnus-summary-expire-articles
2493          ["Update dribble" gnus-summary-save-newsrc t])))           (gnus-check-backend-function
2494              'request-expire-articles gnus-newsgroup-name)]
2495            ["Edit local kill file" gnus-summary-edit-local-kill t]
2496            ["Edit main kill file" gnus-summary-edit-global-kill t]
2497            ["Edit group parameters" gnus-summary-edit-parameters t]
2498            ["Customize group parameters" gnus-summary-customize-parameters t]
2499            ["Send a bug report" gnus-bug t]
2500            ("Exit"
2501             ["Catchup and exit" gnus-summary-catchup-and-exit
2502              ,@(if (featurep 'xemacs) '(t)
2503                  '(:help "Mark unread articles in this group as read, then exit"))]
2504             ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2505             ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2506             ["Exit group" gnus-summary-exit
2507              ,@(if (featurep 'xemacs) '(t)
2508                  '(:help "Exit current group, return to group selection mode"))]
2509             ["Exit group without updating" gnus-summary-exit-no-update t]
2510             ["Exit and goto next group" gnus-summary-next-group t]
2511             ["Exit and goto prev group" gnus-summary-prev-group t]
2512             ["Reselect group" gnus-summary-reselect-current-group t]
2513             ["Rescan group" gnus-summary-rescan-group t]
2514             ["Update dribble" gnus-summary-save-newsrc t])))
2515    
2516      (gnus-run-hooks 'gnus-summary-menu-hook)))      (gnus-run-hooks 'gnus-summary-menu-hook)))
2517    
2518  (defvar gnus-summary-tool-bar-map nil)  (defvar gnus-summary-tool-bar-map nil)
2519    
2520  ;; Emacs 21 tool bar.  Should be no-op otherwise.  ;; Emacs 21 tool bar.  Should be no-op otherwise.
 ;; NB: A new function tool-bar-local-item-from-menu is added in Emacs  
 ;; 21.2.50+.  Considering many users use Emacs 21, use  
 ;; tool-bar-add-item-from-menu here.  
2521  (defun gnus-summary-make-tool-bar ()  (defun gnus-summary-make-tool-bar ()
2522    (if (and    (if (and (fboundp 'tool-bar-add-item-from-menu)
2523         (condition-case nil (require 'tool-bar) (error nil))             (default-value 'tool-bar-mode)
2524         (fboundp 'tool-bar-add-item-from-menu)             (not gnus-summary-tool-bar-map))
        (default-value 'tool-bar-mode)  
        (not gnus-summary-tool-bar-map))  
2525        (setq gnus-summary-tool-bar-map        (setq gnus-summary-tool-bar-map
2526              (let ((tool-bar-map (make-sparse-keymap)))              (let ((tool-bar-map (make-sparse-keymap))
2527                      (load-path (mm-image-load-path)))
2528                (tool-bar-add-item-from-menu                (tool-bar-add-item-from-menu
2529                 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)                 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2530                (tool-bar-add-item-from-menu                (tool-bar-add-item-from-menu
# Line 2156  and backwards while displaying articles, Line 2657  and backwards while displaying articles,
2657  respectively.  respectively.
2658    
2659  You can also post articles and send mail from this buffer.  To  You can also post articles and send mail from this buffer.  To
2660  follow up an article, type `\\[gnus-summary-followup]'.  To mail a reply to the author  follow up an article, type `\\[gnus-summary-followup]'.  To mail a reply to the author
2661  of an article, type `\\[gnus-summary-reply]'.  of an article, type `\\[gnus-summary-reply]'.
2662    
2663  There are approx. one gazillion commands you can execute in this  There are approx. one gazillion commands you can execute in this
# Line 2171  The following commands are available: Line 2672  The following commands are available:
2672      (gnus-summary-make-menu-bar)      (gnus-summary-make-menu-bar)
2673      (gnus-summary-make-tool-bar))      (gnus-summary-make-tool-bar))
2674    (gnus-summary-make-local-variables)    (gnus-summary-make-local-variables)
2675      (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2676        (gnus-summary-make-local-variables))
2677    (gnus-make-thread-indent-array)    (gnus-make-thread-indent-array)
2678    (gnus-simplify-mode-line)    (gnus-simplify-mode-line)
2679    (setq major-mode 'gnus-summary-mode)    (setq major-mode 'gnus-summary-mode)
# Line 2190  The following commands are available: Line 2693  The following commands are available:
2693    (make-local-variable 'gnus-summary-dummy-line-format)    (make-local-variable 'gnus-summary-dummy-line-format)
2694    (make-local-variable 'gnus-summary-dummy-line-format-spec)    (make-local-variable 'gnus-summary-dummy-line-format-spec)
2695    (make-local-variable 'gnus-summary-mark-positions)    (make-local-variable 'gnus-summary-mark-positions)
2696    (make-local-hook 'pre-command-hook)    (gnus-make-local-hook 'pre-command-hook)
2697    (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)    (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2698    (gnus-run-hooks 'gnus-summary-mode-hook)    (gnus-run-hooks 'gnus-summary-mode-hook)
2699      (turn-on-gnus-mailing-list-mode)
2700    (mm-enable-multibyte)    (mm-enable-multibyte)
2701    (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)    (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2702    (gnus-update-summary-mark-positions))    (gnus-update-summary-mark-positions))
# Line 2290  The following commands are available: Line 2794  The following commands are available:
2794              (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))              (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2795              (when offset              (when offset
2796                (gnus-data-update-list odata offset)))                (gnus-data-update-list odata offset)))
2797          ;; Find the last element in the list to be spliced into the main        ;; Find the last element in the list to be spliced into the main
2798          ;; list.          ;; list.
2799          (while (cdr list)          (while (cdr list)
2800            (setq list (cdr list)))            (setq list (cdr list)))
# Line 2352  The following commands are available: Line 2856  The following commands are available:
2856  (defun gnus-article-parent-p (number)  (defun gnus-article-parent-p (number)
2857    "Say whether this article is a parent or not."    "Say whether this article is a parent or not."
2858    (let ((data (gnus-data-find-list number)))    (let ((data (gnus-data-find-list number)))
2859      (and (cdr data)                     ; There has to be an article after...      (and (cdr data)              ; There has to be an article after...
2860           (< (gnus-data-level (car data)) ; And it has to have a higher level.           (< (gnus-data-level (car data)) ; And it has to have a higher level.
2861              (gnus-data-level (nth 1 data))))))              (gnus-data-level (nth 1 data))))))
2862    
# Line 2380  The following commands are available: Line 2884  The following commands are available:
2884  (defun gnus-article-read-p (article)  (defun gnus-article-read-p (article)
2885    "Say whether ARTICLE is read or not."    "Say whether ARTICLE is read or not."
2886    (not (or (memq article gnus-newsgroup-marked)    (not (or (memq article gnus-newsgroup-marked)
2887               (memq article gnus-newsgroup-spam-marked)
2888             (memq article gnus-newsgroup-unreads)             (memq article gnus-newsgroup-unreads)
2889             (memq article gnus-newsgroup-unselected)             (memq article gnus-newsgroup-unselected)
2890             (memq article gnus-newsgroup-dormant))))             (memq article gnus-newsgroup-dormant))))
# Line 2470  article number." Line 2975  article number."
2975  This is all marks except unread, ticked, dormant, and expirable."  This is all marks except unread, ticked, dormant, and expirable."
2976    (not (or (= mark gnus-unread-mark)    (not (or (= mark gnus-unread-mark)
2977             (= mark gnus-ticked-mark)             (= mark gnus-ticked-mark)
2978               (= mark gnus-spam-mark)
2979             (= mark gnus-dormant-mark)             (= mark gnus-dormant-mark)
2980             (= mark gnus-expirable-mark))))             (= mark gnus-expirable-mark))))
2981    
# Line 2481  time; i.e., when generating the summary Line 2987  time; i.e., when generating the summary
2987  marks of articles."  marks of articles."
2988    `(cond    `(cond
2989      ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)      ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
     ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)  
2990      ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)      ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2991      ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)      ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2992      ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)      ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2993        ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
2994      ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)      ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2995      ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)      ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2996      (t (or (cdr (assq ,number gnus-newsgroup-reads))      (t (or (cdr (assq ,number gnus-newsgroup-reads))
# Line 2492  marks of articles." Line 2998  marks of articles."
2998    
2999  ;; Saving hidden threads.  ;; Saving hidden threads.
3000    
 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)  
 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))  
   
3001  (defmacro gnus-save-hidden-threads (&rest forms)  (defmacro gnus-save-hidden-threads (&rest forms)
3002    "Save hidden threads, eval FORMS, and restore the hidden threads."    "Save hidden threads, eval FORMS, and restore the hidden threads."
3003    (let ((config (make-symbol "config")))    (let ((config (make-symbol "config")))
# Line 2503  marks of articles." Line 3006  marks of articles."
3006             (save-excursion             (save-excursion
3007               ,@forms)               ,@forms)
3008           (gnus-restore-hidden-threads-configuration ,config)))))           (gnus-restore-hidden-threads-configuration ,config)))))
3009    (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3010    (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3011    
3012  (defun gnus-data-compute-positions ()  (defun gnus-data-compute-positions ()
3013    "Compute the positions of all articles."    "Compute the positions of all articles."
# Line 2558  display only a single character." Line 3063  display only a single character."
3063      ;; Nix out all the control chars...      ;; Nix out all the control chars...
3064      (while (>= (setq i (1- i)) 0)      (while (>= (setq i (1- i)) 0)
3065        (aset table i [??]))        (aset table i [??]))
3066      ;; ... but not newline and cr, of course.  (cr is necessary for the     ;; ... but not newline and cr, of course.  (cr is necessary for the
3067      ;; selective display).      ;; selective display).
3068      (aset table ?\n nil)      (aset table ?\n nil)
3069      (aset table ?\r nil)      (aset table ?\r nil)
# Line 2572  display only a single character." Line 3077  display only a single character."
3077            (aset table i [??]))))            (aset table i [??]))))
3078      (setq buffer-display-table table)))      (setq buffer-display-table table)))
3079    
3080    (defun gnus-summary-set-article-display-arrow (pos)
3081      "Update the overlay arrow to point to line at position POS."
3082      (when (and gnus-summary-display-arrow
3083                 (boundp 'overlay-arrow-position)
3084                 (boundp 'overlay-arrow-string))
3085        (save-excursion
3086          (goto-char pos)
3087          (beginning-of-line)
3088          (unless overlay-arrow-position
3089            (setq overlay-arrow-position (make-marker)))
3090          (setq overlay-arrow-string "=>"
3091                overlay-arrow-position (set-marker overlay-arrow-position
3092                                                   (point)
3093                                                   (current-buffer))))))
3094    
3095  (defun gnus-summary-setup-buffer (group)  (defun gnus-summary-setup-buffer (group)
3096    "Initialize summary buffer."    "Initialize summary buffer."
3097    (let ((buffer (concat "*Summary " group "*")))    (let ((buffer (gnus-summary-buffer-name group))
3098            (dead-name (concat "*Dead Summary "
3099                               (gnus-group-decoded-name group) "*")))
3100        ;; If a dead summary buffer exists, we kill it.
3101        (when (gnus-buffer-live-p dead-name)
3102          (gnus-kill-buffer dead-name))
3103      (if (get-buffer buffer)      (if (get-buffer buffer)
3104          (progn          (progn
3105            (set-buffer buffer)            (set-buffer buffer)
# Line 2590  display only a single character." Line 3115  display only a single character."
3115          (make-local-variable 'gnus-article-current)          (make-local-variable 'gnus-article-current)
3116          (make-local-variable 'gnus-original-article-buffer))          (make-local-variable 'gnus-original-article-buffer))
3117        (setq gnus-newsgroup-name group)        (setq gnus-newsgroup-name group)
3118          ;; Set any local variables in the group parameters.
3119          (gnus-summary-set-local-parameters gnus-newsgroup-name)
3120        t)))        t)))
3121    
3122  (defun gnus-set-global-variables ()  (defun gnus-set-global-variables ()
# Line 2600  buffer that was in action when the last Line 3127  buffer that was in action when the last
3127      (setq gnus-summary-buffer (current-buffer))      (setq gnus-summary-buffer (current-buffer))
3128      (let ((name gnus-newsgroup-name)      (let ((name gnus-newsgroup-name)
3129            (marked gnus-newsgroup-marked)            (marked gnus-newsgroup-marked)
3130              (spam gnus-newsgroup-spam-marked)
3131            (unread gnus-newsgroup-unreads)            (unread gnus-newsgroup-unreads)
3132            (headers gnus-current-headers)            (headers gnus-current-headers)
3133            (data gnus-newsgroup-data)            (data gnus-newsgroup-data)
# Line 2609  buffer that was in action when the last Line 3137  buffer that was in action when the last
3137            (gac gnus-article-current)            (gac gnus-article-current)
3138            (reffed gnus-reffed-article-number)            (reffed gnus-reffed-article-number)
3139            (score-file gnus-current-score-file)            (score-file gnus-current-score-file)
3140            (default-charset gnus-newsgroup-charset))            (default-charset gnus-newsgroup-charset)
3141              vlist)
3142          (let ((locals gnus-newsgroup-variables))
3143            (while locals
3144              (if (consp (car locals))
3145                  (push (eval (caar locals)) vlist)
3146                (push (eval (car locals)) vlist))
3147              (setq locals (cdr locals)))
3148            (setq vlist (nreverse vlist)))
3149        (save-excursion        (save-excursion
3150          (set-buffer gnus-group-buffer)          (set-buffer gnus-group-buffer)
3151          (setq gnus-newsgroup-name name          (setq gnus-newsgroup-name name
3152                gnus-newsgroup-marked marked                gnus-newsgroup-marked marked
3153                  gnus-newsgroup-spam-marked spam
3154                gnus-newsgroup-unreads unread                gnus-newsgroup-unreads unread
3155                gnus-current-headers headers                gnus-current-headers headers
3156                gnus-newsgroup-data data                gnus-newsgroup-data data
# Line 2624  buffer that was in action when the last Line 3161  buffer that was in action when the last
3161                gnus-reffed-article-number reffed                gnus-reffed-article-number reffed
3162                gnus-current-score-file score-file                gnus-current-score-file score-file
3163                gnus-newsgroup-charset default-charset)                gnus-newsgroup-charset default-charset)
3164            (let ((locals gnus-newsgroup-variables))
3165              (while locals
3166                (if (consp (car locals))
3167                    (set (caar locals) (pop vlist))
3168                  (set (car locals) (pop vlist)))
3169                (setq locals (cdr locals))))
3170          ;; The article buffer also has local variables.          ;; The article buffer also has local variables.
3171          (when (gnus-buffer-live-p gnus-article-buffer)          (when (gnus-buffer-live-p gnus-article-buffer)
3172            (set-buffer gnus-article-buffer)            (set-buffer gnus-article-buffer)
# Line 2665  buffer that was in action when the last Line 3208  buffer that was in action when the last
3208      (let ((gnus-replied-mark 129)      (let ((gnus-replied-mark 129)
3209            (gnus-score-below-mark 130)            (gnus-score-below-mark 130)
3210            (gnus-score-over-mark 130)            (gnus-score-over-mark 130)
3211            (gnus-download-mark 131)            (gnus-undownloaded-mark 131)
3212            (spec gnus-summary-line-format-spec)            (spec gnus-summary-line-format-spec)
3213            gnus-visual pos)            gnus-visual pos)
3214        (save-excursion        (save-excursion
3215          (gnus-set-work-buffer)          (gnus-set-work-buffer)
3216          (let ((gnus-summary-line-format-spec spec)          (let ((gnus-summary-line-format-spec spec)
3217                (gnus-newsgroup-downloadable '((0 . t))))                (gnus-newsgroup-downloadable '(0)))
3218            (gnus-summary-insert-line            (gnus-summary-insert-line
3219             [0 "" "" "" "" "" 0 0 "" nil]  0 nil 128 t nil "" nil 1)             [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil]
3220               0 nil t 128 t nil "" nil 1)
3221            (goto-char (point-min))            (goto-char (point-min))
3222            (setq pos (list (cons 'unread (and (search-forward "\200" nil t)            (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3223                                               (- (point) (point-min) 1)))))                                               (- (point) (point-min) 1)))))
# Line 2699  buffer that was in action when the last Line 3243  buffer that was in action when the last
3243     (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))     (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3244     (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))     (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3245    
3246  (defun gnus-summary-from-or-to-or-newsgroups (header)  (defun gnus-summary-extract-address-component (from)
3247    (let ((to (cdr (assq 'To (mail-header-extra header))))    (or (car (funcall gnus-extract-address-components from))
3248          (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))        from))
3249          (mail-parse-charset gnus-newsgroup-charset)  
3250    (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3251      (let ((mail-parse-charset gnus-newsgroup-charset)
3252            ; Is it really necessary to do this next part for each summary line?
3253            ; Luckily, doesn't seem to slow things down much.
3254          (mail-parse-ignored-charsets          (mail-parse-ignored-charsets
3255           (save-excursion (set-buffer gnus-summary-buffer)           (save-excursion (set-buffer gnus-summary-buffer)
3256                           gnus-newsgroup-ignored-charsets)))                           gnus-newsgroup-ignored-charsets)))
3257      (cond      (or
3258       ((and to       (and gnus-ignored-from-addresses
3259             gnus-ignored-from-addresses            (string-match gnus-ignored-from-addresses gnus-tmp-from)
3260             (string-match gnus-ignored-from-addresses            (let ((extra-headers (mail-header-extra header))
3261                           (mail-header-from header)))                  to
3262        (concat "-> "                  newsgroups)
3263                (or (car (funcall gnus-extract-address-components              (cond
3264                                  (funcall               ((setq to (cdr (assq 'To extra-headers)))
3265                                   gnus-decode-encoded-word-function to)))                (concat "-> "
3266                    (funcall gnus-decode-encoded-word-function to))))                        (inline
3267       ((and newsgroups                          (gnus-summary-extract-address-component
3268             gnus-ignored-from-addresses                           (funcall gnus-decode-encoded-word-function to)))))
3269             (string-match gnus-ignored-from-addresses               ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3270                           (mail-header-from header)))                (concat "=> " newsgroups)))))
3271        (concat "=> " newsgroups))       (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
      (t  
       (or (car (funcall gnus-extract-address-components  
                         (mail-header-from header)))  
           (mail-header-from header))))))  
3272    
3273  (defun gnus-summary-insert-line (gnus-tmp-header  (defun gnus-summary-insert-line (gnus-tmp-header
3274                                   gnus-tmp-level gnus-tmp-current                                   gnus-tmp-level gnus-tmp-current
3275                                   gnus-tmp-unread gnus-tmp-replied                                   undownloaded gnus-tmp-unread gnus-tmp-replied
3276                                   gnus-tmp-expirable gnus-tmp-subject-or-nil                                   gnus-tmp-expirable gnus-tmp-subject-or-nil
3277                                   &optional gnus-tmp-dummy gnus-tmp-score                                   &optional gnus-tmp-dummy gnus-tmp-score
3278                                   gnus-tmp-process)                                   gnus-tmp-process)
# Line 2739  buffer that was in action when the last Line 3283  buffer that was in action when the last
3283            (if (or (null gnus-summary-default-score)            (if (or (null gnus-summary-default-score)
3284                    (<= (abs (- gnus-tmp-score gnus-summary-default-score))                    (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3285                        gnus-summary-zcore-fuzz))                        gnus-summary-zcore-fuzz))
3286                ?  ;Whitespace                ?                         ;Whitespace
3287              (if (< gnus-tmp-score gnus-summary-default-score)              (if (< gnus-tmp-score gnus-summary-default-score)
3288                  gnus-score-below-mark gnus-score-over-mark)))                  gnus-score-below-mark gnus-score-over-mark)))
3289             (gnus-tmp-number (mail-header-number gnus-tmp-header))
3290           (gnus-tmp-replied           (gnus-tmp-replied
3291            (cond (gnus-tmp-process gnus-process-mark)            (cond (gnus-tmp-process gnus-process-mark)
3292                  ((memq gnus-tmp-current gnus-newsgroup-cached)                  ((memq gnus-tmp-current gnus-newsgroup-cached)
3293                   gnus-cached-mark)                   gnus-cached-mark)
3294                  (gnus-tmp-replied gnus-replied-mark)                  (gnus-tmp-replied gnus-replied-mark)
3295                    ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3296                     gnus-forwarded-mark)
3297                  ((memq gnus-tmp-current gnus-newsgroup-saved)                  ((memq gnus-tmp-current gnus-newsgroup-saved)
3298                   gnus-saved-mark)                   gnus-saved-mark)
3299                  (t gnus-unread-mark)))                  ((memq gnus-tmp-number gnus-newsgroup-recent)
3300                     gnus-recent-mark)
3301                    ((memq gnus-tmp-number gnus-newsgroup-unseen)
3302                     gnus-unseen-mark)
3303                    (t gnus-no-mark)))
3304             (gnus-tmp-downloaded
3305              (cond (undownloaded
3306                     gnus-undownloaded-mark)
3307                    (gnus-newsgroup-agentized
3308                     gnus-downloaded-mark)
3309                    (t
3310                     gnus-no-mark)))
3311           (gnus-tmp-from (mail-header-from gnus-tmp-header))           (gnus-tmp-from (mail-header-from gnus-tmp-header))
3312           (gnus-tmp-name           (gnus-tmp-name
3313            (cond            (cond
3314             ((string-match "<[^>]+> *$" gnus-tmp-from)             ((string-match "<[^>]+> *$" gnus-tmp-from)
3315              (let ((beg (match-beginning 0)))              (let ((beg (match-beginning 0)))
3316                (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)                (or (and (string-match "^\".+\"" gnus-tmp-from)
3317                         (substring gnus-tmp-from (1+ (match-beginning 0))                         (substring gnus-tmp-from 1 (1- (match-end 0))))
                                   (1- (match-end 0))))  
3318                    (substring gnus-tmp-from 0 beg))))                    (substring gnus-tmp-from 0 beg))))
3319             ((string-match "(.+)" gnus-tmp-from)             ((string-match "(.+)" gnus-tmp-from)
3320              (substring gnus-tmp-from              (substring gnus-tmp-from
3321                         (1+ (match-beginning 0)) (1- (match-end 0))))                         (1+ (match-beginning 0)) (1- (match-end 0))))
3322             (t gnus-tmp-from)))             (t gnus-tmp-from)))
3323           (gnus-tmp-subject (mail-header-subject gnus-tmp-header))           (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
          (gnus-tmp-number (mail-header-number gnus-tmp-header))  
3324           (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))           (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3325           (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))           (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3326           (buffer-read-only nil))           (buffer-read-only nil))
3327      (when (string= gnus-tmp-name "")      (when (string= gnus-tmp-name "")
3328        (setq gnus-tmp-name gnus-tmp-from))        (setq gnus-tmp-name gnus-tmp-from))
3329      (unless (numberp gnus-tmp-lines)      (unless (numberp gnus-tmp-lines)
3330        (setq gnus-tmp-lines 0))        (setq gnus-tmp-lines -1))
3331      (gnus-put-text-property      (if (= gnus-tmp-lines -1)
3332            (setq gnus-tmp-lines "?")
3333          (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3334          (gnus-put-text-property
3335       (point)       (point)
3336       (progn (eval gnus-summary-line-format-spec) (point))       (progn (eval gnus-summary-line-format-spec) (point))
3337       'gnus-number gnus-tmp-number)         'gnus-number gnus-tmp-number)
3338      (when (gnus-visual-p 'summary-highlight 'highlight)      (when (gnus-visual-p 'summary-highlight 'highlight)
3339        (forward-line -1)        (forward-line -1)
3340        (gnus-run-hooks 'gnus-summary-update-hook)        (gnus-run-hooks 'gnus-summary-update-hook)
# Line 2804  buffer that was in action when the last Line 3363  buffer that was in action when the last
3363           (if (or (null gnus-summary-default-score)           (if (or (null gnus-summary-default-score)
3364                   (<= (abs (- score gnus-summary-default-score))                   (<= (abs (- score gnus-summary-default-score))
3365                       gnus-summary-zcore-fuzz))                       gnus-summary-zcore-fuzz))
3366               ?  ;Whitespace               ?                          ;Whitespace
3367             (if (< score gnus-summary-default-score)             (if (< score gnus-summary-default-score)
3368                 gnus-score-below-mark gnus-score-over-mark))                 gnus-score-below-mark gnus-score-over-mark))
3369           'score))           'score))
# Line 2819  buffer that was in action when the last Line 3378  buffer that was in action when the last
3378  This may be 0 in some cases -- if none of the articles in  This may be 0 in some cases -- if none of the articles in
3379  the thread are to be displayed."  the thread are to be displayed."
3380    (let* ((number    (let* ((number
3381            ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.           ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3382            (cond            (cond
3383             ((not (listp thread))             ((not (listp thread))
3384              1)              1)
# Line 2842  the thread are to be displayed." Line 3401  the thread are to be displayed."
3401            gnus-empty-thread-mark)            gnus-empty-thread-mark)
3402        number)))        number)))
3403    
3404    (defsubst gnus-summary-line-message-size (head)
3405      "Return pretty-printed version of message size.
3406    This function is intended to be used in
3407    `gnus-summary-line-format-alist'."
3408      (let ((c (or (mail-header-chars head) -1)))
3409        (cond ((< c 0) "n/a")               ; chars not available
3410              ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3411              ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3412              ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3413              (t (format "%dM" (/ c (* 1024.0 1024)))))))
3414    
3415    
3416  (defun gnus-summary-set-local-parameters (group)  (defun gnus-summary-set-local-parameters (group)
3417    "Go through the local params of GROUP and set all variable specs in that list."    "Go through the local params of GROUP and set all variable specs in that list."
3418    (let ((params (gnus-group-find-parameter group))    (let ((params (gnus-group-find-parameter group))
3419            (vars '(quit-config))           ; Ignore quit-config.
3420          elem)          elem)
3421      (while params      (while params
3422        (setq elem (car params)        (setq elem (car params)
# Line 2852  the thread are to be displayed." Line 3424  the thread are to be displayed."
3424        (and (consp elem)                 ; Has to be a cons.        (and (consp elem)                 ; Has to be a cons.
3425             (consp (cdr elem))           ; The cdr has to be a list.             (consp (cdr elem))           ; The cdr has to be a list.
3426             (symbolp (car elem))         ; Has to be a symbol in there.             (symbolp (car elem))         ; Has to be a symbol in there.
3427             (not (memq (car elem) '(quit-config))) ; Ignore quit-config.             (not (memq (car elem) vars))
3428             (ignore-errors               ; So we set it.             (ignore-errors               ; So we set it.
3429                 (push (car elem) vars)
3430               (make-local-variable (car elem))               (make-local-variable (car elem))
3431               (set (car elem) (eval (nth 1 elem))))))))               (set (car elem) (eval (nth 1 elem))))))))
3432    
# Line 2890  If NO-DISPLAY, don't generate a summary Line 3463  If NO-DISPLAY, don't generate a summary
3463                                          kill-buffer no-display                                          kill-buffer no-display
3464                                          &optional select-articles)                                          &optional select-articles)
3465    ;; Killed foreign groups can't be entered.    ;; Killed foreign groups can't be entered.
3466    (when (and (not (gnus-group-native-p group))    ;;  (when (and (not (gnus-group-native-p group))
3467               (not (gnus-gethash group gnus-newsrc-hashtb)))    ;;         (not (gnus-gethash group gnus-newsrc-hashtb)))
3468      (error "Dead non-native groups can't be entered"))    ;;    (error "Dead non-native groups can't be entered"))
3469    (gnus-message 5 "Retrieving newsgroup: %s..." group)    (gnus-message 5 "Retrieving newsgroup: %s..."
3470                    (gnus-group-decoded-name group))
3471    (let* ((new-group (gnus-summary-setup-buffer group))    (let* ((new-group (gnus-summary-setup-buffer group))
3472           (quit-config (gnus-group-quit-config group))           (quit-config (gnus-group-quit-config group))
3473           (did-select (and new-group (gnus-select-newsgroup           (did-select (and new-group (gnus-select-newsgroup
# Line 2923  If NO-DISPLAY, don't generate a summary Line 3497  If NO-DISPLAY, don't generate a summary
3497                (gnus-group-jump-to-group group)                (gnus-group-jump-to-group group)
3498                (gnus-group-next-unread-group 1))                (gnus-group-next-unread-group 1))
3499            (gnus-handle-ephemeral-exit quit-config)))            (gnus-handle-ephemeral-exit quit-config)))
3500        (gnus-message 3 "Can't select group")        (let ((grpinfo (gnus-get-info group)))
3501            (if (null (gnus-info-read grpinfo))
3502                (gnus-message 3 "Group %s contains no messages"
3503                              (gnus-group-decoded-name group))
3504              (gnus-message 3 "Can't select group")))
3505        nil)        nil)
3506       ;; The user did a `C-g' while prompting for number of articles,       ;; The user did a `C-g' while prompting for number of articles,
3507       ;; so we exit this group.       ;; so we exit this group.
# Line 2951  If NO-DISPLAY, don't generate a summary Line 3529  If NO-DISPLAY, don't generate a summary
3529               (gnus-active gnus-newsgroup-name)))               (gnus-active gnus-newsgroup-name)))
3530        ;; You can change the summary buffer in some way with this hook.        ;; You can change the summary buffer in some way with this hook.
3531        (gnus-run-hooks 'gnus-select-group-hook)        (gnus-run-hooks 'gnus-select-group-hook)
       ;; Set any local variables in the group parameters.  
       (gnus-summary-set-local-parameters gnus-newsgroup-name)  
3532        (gnus-update-format-specifications        (gnus-update-format-specifications
3533         nil 'summary 'summary-mode 'summary-dummy)         nil 'summary 'summary-mode 'summary-dummy)
3534        (gnus-update-summary-mark-positions)        (gnus-update-summary-mark-positions)
# Line 3004  If NO-DISPLAY, don't generate a summary Line 3580  If NO-DISPLAY, don't generate a summary
3580          ;; Hide conversation thread subtrees.  We cannot do this in          ;; Hide conversation thread subtrees.  We cannot do this in
3581          ;; gnus-summary-prepare-hook since kill processing may not          ;; gnus-summary-prepare-hook since kill processing may not
3582          ;; work with hidden articles.          ;; work with hidden articles.
3583          (and gnus-show-threads          (gnus-summary-maybe-hide-threads)
              gnus-thread-hide-subtree  
              (gnus-summary-hide-all-threads))  
3584          (when kill-buffer          (when kill-buffer
3585            (gnus-kill-or-deaden-summary kill-buffer))            (gnus-kill-or-deaden-summary kill-buffer))
3586            (gnus-summary-auto-select-subject)
3587          ;; Show first unread article if requested.          ;; Show first unread article if requested.
3588          (if (and (not no-article)          (if (and (not no-article)
3589                   (not no-display)                   (not no-display)
# Line 3016  If NO-DISPLAY, don't generate a summary Line 3591  If NO-DISPLAY, don't generate a summary
3591                   gnus-auto-select-first)                   gnus-auto-select-first)
3592              (progn              (progn
3593                (gnus-configure-windows 'summary)                (gnus-configure-windows 'summary)
3594                (cond                (let ((art (gnus-summary-article-number)))
3595                 ((eq gnus-auto-select-first 'best)                  (unless (and (not gnus-plugged)
3596                  (gnus-summary-best-unread-article))                               (or (memq art gnus-newsgroup-undownloaded)
3597                 ((eq gnus-auto-select-first t)                                   (memq art gnus-newsgroup-downloadable)))
3598                  (gnus-summary-first-unread-article))                    (gnus-summary-goto-article art))))
3599                 ((gnus-functionp gnus-auto-select-first)            ;; Don't select any articles.
                 (funcall gnus-auto-select-first))))  
           ;; Don't select any articles, just move point to the first  
           ;; article in the group.  
           (goto-char (point-min))  
3600            (gnus-summary-position-point)            (gnus-summary-position-point)
3601            (gnus-configure-windows 'summary 'force)            (gnus-configure-windows 'summary 'force)
3602            (gnus-set-mode-line 'summary))            (gnus-set-mode-line 'summary))
3603          (when (get-buffer-window gnus-group-buffer t)          (when (and gnus-auto-center-group
3604                       (get-buffer-window gnus-group-buffer t))
3605            ;; Gotta use windows, because recenter does weird stuff if            ;; Gotta use windows, because recenter does weird stuff if
3606            ;; the current buffer ain't the displayed window.            ;; the current buffer ain't the displayed window.
3607            (let ((owin (selected-window)))            (let ((owin (selected-window)))
# Line 3040  If NO-DISPLAY, don't generate a summary Line 3612  If NO-DISPLAY, don't generate a summary
3612          ;; Mark this buffer as "prepared".          ;; Mark this buffer as "prepared".
3613          (setq gnus-newsgroup-prepared t)          (setq gnus-newsgroup-prepared t)
3614          (gnus-run-hooks 'gnus-summary-prepared-hook)          (gnus-run-hooks 'gnus-summary-prepared-hook)
3615            (unless (gnus-ephemeral-group-p group)
3616              (gnus-group-update-group group))
3617          t)))))          t)))))
3618    
3619    (defun gnus-summary-auto-select-subject ()
3620      "Select the subject line on initial group entry."
3621      (goto-char (point-min))
3622      (cond
3623       ((eq gnus-auto-select-subject 'best)
3624        (gnus-summary-best-unread-subject))
3625       ((eq gnus-auto-select-subject 'unread)
3626        (gnus-summary-first-unread-subject))
3627       ((eq gnus-auto-select-subject 'unseen)
3628        (gnus-summary-first-unseen-subject))
3629       ((eq gnus-auto-select-subject 'unseen-or-unread)
3630        (gnus-summary-first-unseen-or-unread-subject))
3631       ((eq gnus-auto-select-subject 'first)
3632        ;; Do nothing.
3633        )
3634       ((functionp gnus-auto-select-subject)
3635        (funcall gnus-auto-select-subject))))
3636    
3637  (defun gnus-summary-prepare ()  (defun gnus-summary-prepare ()
3638    "Generate the summary buffer."    "Generate the summary buffer."
3639    (interactive)    (interactive)
# Line 3066  If NO-DISPLAY, don't generate a summary Line 3658  If NO-DISPLAY, don't generate a summary
3658      (gnus-run-hooks 'gnus-summary-prepare-hook)))      (gnus-run-hooks 'gnus-summary-prepare-hook)))
3659    
3660  (defsubst gnus-general-simplify-subject (subject)  (defsubst gnus-general-simplify-subject (subject)
3661    "Simply subject by the same rules as gnus-gather-threads-by-subject."    "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3662    (setq subject    (setq subject
3663          (cond          (cond
3664           ;; Truncate the subject.           ;; Truncate the subject.
# Line 3086  If NO-DISPLAY, don't generate a summary Line 3678  If NO-DISPLAY, don't generate a summary
3678    
3679    (if (and gnus-summary-gather-exclude-subject    (if (and gnus-summary-gather-exclude-subject
3680             (string-match gnus-summary-gather-exclude-subject subject))             (string-match gnus-summary-gather-exclude-subject subject))
3681        nil                               ; This article shouldn't be gathered        nil                         ; This article shouldn't be gathered
3682      subject))      subject))
3683    
3684  (defun gnus-summary-simplify-subject-query ()  (defun gnus-summary-simplify-subject-query ()
# Line 3122  If NO-DISPLAY, don't generate a summary Line 3714  If NO-DISPLAY, don't generate a summary
3714                  (setcdr prev (cdr threads))                  (setcdr prev (cdr threads))
3715                  (setq threads prev))                  (setq threads prev))
3716              ;; Enter this thread into the hash table.              ;; Enter this thread into the hash table.
3717              (gnus-sethash subject threads hashtb)))              (gnus-sethash subject
3718                              (if gnus-summary-make-false-root-always
3719                                  (progn
3720                                    ;; If you want a dummy root above all
3721                                    ;; threads...
3722                                    (setcar threads (list whole-subject
3723                                                          (car threads)))
3724                                    threads)
3725                                threads)
3726                              hashtb)))
3727          (setq prev threads)          (setq prev threads)
3728          (setq threads (cdr threads)))          (setq threads (cdr threads)))
3729        result)))        result)))
# Line 3137  If NO-DISPLAY, don't generate a summary Line 3738  If NO-DISPLAY, don't generate a summary
3738      (while threads      (while threads
3739        (when (setq references (mail-header-references (caar threads)))        (when (setq references (mail-header-references (caar threads)))
3740          (setq id (mail-header-id (caar threads))          (setq id (mail-header-id (caar threads))
3741                ids (gnus-split-references references)                ids (inline (gnus-split-references references))
3742                entered nil)                entered nil)
3743          (while (setq ref (pop ids))          (while (setq ref (pop ids))
3744            (setq ids (delete ref ids))            (setq ids (delete ref ids))
# Line 3221  If NO-DISPLAY, don't generate a summary Line 3822  If NO-DISPLAY, don't generate a summary
3822                    (setq threads nil)                    (setq threads nil)
3823                    (throw 'infloop t))                    (throw 'infloop t))
3824                  (unless (car (symbol-value refs))                  (unless (car (symbol-value refs))
3825                    ;; These threads do not refer back to any other articles,                    ;; These threads do not refer back to any other
3826                    ;; so they're roots.                    ;; articles, so they're roots.
3827                    (setq threads (append (cdr (symbol-value refs)) threads))))                    (setq threads (append (cdr (symbol-value refs)) threads))))
3828                gnus-newsgroup-dependencies)))                gnus-newsgroup-dependencies)))
3829      threads))      threads))
# Line 3236  if it was already present. Line 3837  if it was already present.
3837    
3838  If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs  If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3839  will not be entered in the DEPENDENCIES table.  Otherwise duplicate  will not be entered in the DEPENDENCIES table.  Otherwise duplicate
3840  Message-IDs will be renamed be renamed to a unique Message-ID before  Message-IDs will be renamed to a unique Message-ID before being
3841  being entered.  entered.
3842    
3843  Returns HEADER if it was entered in the DEPENDENCIES.  Returns nil otherwise."  Returns HEADER if it was entered in the DEPENDENCIES.  Returns nil otherwise."
3844    (let* ((id (mail-header-id header))    (let* ((id (mail-header-id header))
3845           (id-dep (and id (intern id dependencies)))           (id-dep (and id (intern id dependencies)))
3846           ref ref-dep ref-header)           parent-id ref ref-dep ref-header replaced)
3847      ;; Enter this `header' in the `dependencies' table.      ;; Enter this `header' in the `dependencies' table.
3848      (cond      (cond
3849       ((not id-dep)       ((not id-dep)
# Line 3259  Returns HEADER if it was entered in the Line 3860  Returns HEADER if it was entered in the
3860       (force-new       (force-new
3861        ;; Overrides an existing entry;        ;; Overrides an existing entry;
3862        ;; just set the header part of the entry.        ;; just set the header part of the entry.
3863        (setcar (symbol-value id-dep) header))        (setcar (symbol-value id-dep) header)
3864          (setq replaced t))
3865    
3866       ;; Renames the existing `header' to a unique Message-ID.       ;; Renames the existing `header' to a unique Message-ID.
3867       ((not gnus-summary-ignore-duplicates)       ((not gnus-summary-ignore-duplicates)
# Line 3282  Returns HEADER if it was entered in the Line 3884  Returns HEADER if it was entered in the
3884                 (or (mail-header-xref header) "")))                 (or (mail-header-xref header) "")))
3885        (setq header nil)))        (setq header nil)))
3886    
3887      (when header      (when (and header (not replaced))
3888        ;; First check if that we are not creating a References loop.        ;; First check that we are not creating a References loop.
3889        (setq ref (gnus-parent-id (mail-header-references header)))        (setq parent-id (gnus-parent-id (mail-header-references header)))
3890          (setq ref parent-id)
3891        (while (and ref        (while (and ref
3892                    (setq ref-dep (intern-soft ref dependencies))                    (setq ref-dep (intern-soft ref dependencies))
3893                    (boundp ref-dep)                    (boundp ref-dep)
# Line 3294  Returns HEADER if it was entered in the Line 3897  Returns HEADER if it was entered in the
3897              ;; root article.              ;; root article.
3898              (progn              (progn
3899                (mail-header-set-references (car (symbol-value id-dep)) "none")                (mail-header-set-references (car (symbol-value id-dep)) "none")
3900                (setq ref nil))                (setq ref nil)
3901                  (setq parent-id nil))
3902            (setq ref (gnus-parent-id (mail-header-references ref-header)))))            (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3903        (setq ref (gnus-parent-id (mail-header-references header)))        (setq ref-dep (intern (or parent-id "none") dependencies))
       (setq ref-dep (intern (or ref "none") dependencies))  
3904        (if (boundp ref-dep)        (if (boundp ref-dep)
3905            (setcdr (symbol-value ref-dep)            (setcdr (symbol-value ref-dep)
3906                    (nconc (cdr (symbol-value ref-dep))                    (nconc (cdr (symbol-value ref-dep))
# Line 3305  Returns HEADER if it was entered in the Line 3908  Returns HEADER if it was entered in the
3908          (set ref-dep (list nil (symbol-value id-dep)))))          (set ref-dep (list nil (symbol-value id-dep)))))
3909      header))      header))
3910    
3911    (defun gnus-extract-message-id-from-in-reply-to (string)
3912      (if (string-match "<[^>]+>" string)
3913          (substring string (match-beginning 0) (match-end 0))
3914        nil))
3915    
3916  (defun gnus-build-sparse-threads ()  (defun gnus-build-sparse-threads ()
3917    (let ((headers gnus-newsgroup-headers)    (let ((headers gnus-newsgroup-headers)
3918          (mail-parse-charset gnus-newsgroup-charset)          (mail-parse-charset gnus-newsgroup-charset)
# Line 3376  Returns HEADER if it was entered in the Line 3984  Returns HEADER if it was entered in the
3984               (setq heads nil)))))               (setq heads nil)))))
3985       gnus-newsgroup-dependencies)))       gnus-newsgroup-dependencies)))
3986    
3987    (defsubst gnus-remove-odd-characters (string)
3988      "Translate STRING into something that doesn't contain weird characters."
3989      (mm-subst-char-in-string
3990       ?\r ?\-
3991       (mm-subst-char-in-string
3992        ?\n ?\- string)))
3993    
3994  ;; This function has to be called with point after the article number  ;; This function has to be called with point after the article number
3995  ;; on the beginning of the line.  ;; on the beginning of the line.
3996  (defsubst gnus-nov-parse-line (number dependencies &optional force-new)  (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3997    (let ((eol (gnus-point-at-eol))    (let ((eol (gnus-point-at-eol))
3998          (buffer (current-buffer))          (buffer (current-buffer))
3999          header)          header references in-reply-to)
4000    
4001      ;; overview: [num subject from date id refs chars lines misc]      ;; overview: [num subject from date id refs chars lines misc]
4002      (unwind-protect      (unwind-protect
4003          (progn          (let (x)
4004            (narrow-to-region (point) eol)            (narrow-to-region (point) eol)
4005            (unless (eobp)            (unless (eobp)
4006              (forward-char))              (forward-char))
# Line 3393  Returns HEADER if it was entered in the Line 4008  Returns HEADER if it was entered in the
4008            (setq header            (setq header
4009                  (make-full-mail-header                  (make-full-mail-header
4010                   number                 ; number                   number                 ; number
4011                   (funcall gnus-decode-encoded-word-function                   (condition-case ()     ; subject
4012                            (nnheader-nov-field)) ; subject                       (gnus-remove-odd-characters
4013                   (funcall gnus-decode-encoded-word-function                        (funcall gnus-decode-encoded-word-function
4014                            (nnheader-nov-field)) ; from                                 (setq x (nnheader-nov-field))))
4015                       (error x))
4016                     (condition-case ()     ; from
4017                         (gnus-remove-odd-characters
4018                          (funcall gnus-decode-encoded-word-function
4019                                   (setq x (nnheader-nov-field))))
4020                       (error x))
4021                   (nnheader-nov-field)   ; date                   (nnheader-nov-field)   ; date
4022                   (nnheader-nov-read-message-id) ; id                   (nnheader-nov-read-message-id) ; id
4023                   (nnheader-nov-field)   ; refs                   (setq references (nnheader-nov-field)) ; refs
4024                   (nnheader-nov-read-integer) ; chars                   (nnheader-nov-read-integer) ; chars
4025                   (nnheader-nov-read-integer) ; lines                   (nnheader-nov-read-integer) ; lines
4026                   (unless (eobp)                   (unless (eobp)
# Line 3410  Returns HEADER if it was entered in the Line 4031  Returns HEADER if it was entered in the
4031    
4032        (widen))        (widen))
4033    
4034        (when (and (string= references "")
4035                   (setq in-reply-to (mail-header-extra header))
4036                   (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4037          (mail-header-set-references
4038           header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4039    
4040      (when gnus-alter-header-function      (when gnus-alter-header-function
4041        (funcall gnus-alter-header-function header))        (funcall gnus-alter-header-function header))
4042      (gnus-dependencies-add-header header dependencies force-new)))      (gnus-dependencies-add-header header dependencies force-new)))
# Line 3444  the id of the parent article (if any)." Line 4071  the id of the parent article (if any)."
4071            (push header gnus-newsgroup-headers)            (push header gnus-newsgroup-headers)
4072            (if (memq number gnus-newsgroup-unselected)            (if (memq number gnus-newsgroup-unselected)
4073                (progn                (progn
4074                  (push number gnus-newsgroup-unreads)                  (setq gnus-newsgroup-unreads
4075                          (gnus-add-to-sorted-list gnus-newsgroup-unreads
4076                                                   number))
4077                  (setq gnus-newsgroup-unselected                  (setq gnus-newsgroup-unselected
4078                        (delq number gnus-newsgroup-unselected)))                        (delq number gnus-newsgroup-unselected)))
4079              (push number gnus-newsgroup-ancient)))))))              (push number gnus-newsgroup-ancient)))))))
# Line 3470  the id of the parent article (if any)." Line 4099  the id of the parent article (if any)."
4099                (if (memq (setq article (mail-header-number header))                (if (memq (setq article (mail-header-number header))
4100                          gnus-newsgroup-unselected)                          gnus-newsgroup-unselected)
4101                    (progn                    (progn
4102                      (push article gnus-newsgroup-unreads)                      (setq gnus-newsgroup-unreads
4103                              (gnus-add-to-sorted-list
4104                               gnus-newsgroup-unreads article))
4105                      (setq gnus-newsgroup-unselected                      (setq gnus-newsgroup-unselected
4106                            (delq article gnus-newsgroup-unselected)))                            (delq article gnus-newsgroup-unselected)))
4107                  (push article gnus-newsgroup-ancient)))                  (push article gnus-newsgroup-ancient)))
4108              (forward-line 1)))))))              (forward-line 1)))))))
4109    
4110  (defun gnus-summary-update-article-line (article header)  (defun gnus-summary-update-article-line (article header)
4111    "Update the line for ARTICLE using HEADERS."    "Update the line for ARTICLE using HEADER."
4112    (let* ((id (mail-header-id header))    (let* ((id (mail-header-id header))
4113           (thread (gnus-id-to-thread id)))           (thread (gnus-id-to-thread id)))
4114      (unless thread      (unless thread
# Line 3487  the id of the parent article (if any)." Line 4118  the id of the parent article (if any)."
4118      (gnus-summary-goto-subject article)      (gnus-summary-goto-subject article)
4119      (let* ((datal (gnus-data-find-list article))      (let* ((datal (gnus-data-find-list article))
4120             (data (car datal))             (data (car datal))
            (length (when (cdr datal)  
                      (- (gnus-data-pos data)  
                         (gnus-data-pos (cadr datal)))))  
4121             (buffer-read-only nil)             (buffer-read-only nil)
4122             (level (gnus-summary-thread-level)))             (level (gnus-summary-thread-level)))
4123        (gnus-delete-line)        (gnus-delete-line)
4124        (gnus-summary-insert-line        (let ((inserted (- (point)
4125         header level nil (gnus-article-mark article)                           (progn
4126         (memq article gnus-newsgroup-replied)                             (gnus-summary-insert-line
4127         (memq article gnus-newsgroup-expirable)                              header level nil
4128         ;; Only insert the Subject string when it's different                              (memq article gnus-newsgroup-undownloaded)
4129         ;; from the previous Subject string.                              (gnus-article-mark article)
4130         (if (and                              (memq article gnus-newsgroup-replied)
4131              gnus-show-threads                              (memq article gnus-newsgroup-expirable)
4132              (gnus-subject-equal                              ;; Only insert the Subject string when it's different
4133               (condition-case ()                              ;; from the previous Subject string.
4134                   (mail-header-subject                              (if (and
4135                    (gnus-data-header                                   gnus-show-threads
4136                     (cadr                                   (gnus-subject-equal
4137                      (gnus-data-find-list                                    (condition-case ()
4138                       article                                        (mail-header-subject
4139                       (gnus-data-list t)))))                                         (gnus-data-header
4140                 ;; Error on the side of excessive subjects.                                          (cadr
4141                 (error ""))                                           (gnus-data-find-list
4142               (mail-header-subject header)))                                            article
4143             ""                                            (gnus-data-list t)))))
4144           (mail-header-subject header))                                      ;; Error on the side of excessive subjects.
4145         nil (cdr (assq article gnus-newsgroup-scored))                                      (error ""))
4146         (memq article gnus-newsgroup-processable))                                    (mail-header-subject header)))
4147        (when length                                  ""
4148          (gnus-data-update-list                                (mail-header-subject header))
4149           (cdr datal) (- length (- (gnus-data-pos data) (point))))))))                              nil (cdr (assq article gnus-newsgroup-scored))
4150                                (memq article gnus-newsgroup-processable))
4151                               (point)))))
4152            (when (cdr datal)
4153              (gnus-data-update-list
4154               (cdr datal)
4155               (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4156    
4157  (defun gnus-summary-update-article (article &optional iheader)  (defun gnus-summary-update-article (article &optional iheader)
4158    "Update ARTICLE in the summary buffer."    "Update ARTICLE in the summary buffer."
# Line 3756  If LINE, insert the rebuilt thread start Line 4390  If LINE, insert the rebuilt thread start
4390    (if (not gnus-thread-sort-functions)    (if (not gnus-thread-sort-functions)
4391        threads        threads
4392      (gnus-message 8 "Sorting threads...")      (gnus-message 8 "Sorting threads...")
4393      (prog1      (let ((max-lisp-eval-depth 5000))
4394          (gnus-sort-threads-1        (prog1 (gnus-sort-threads-1
4395           threads           threads
4396           (gnus-make-sort-function gnus-thread-sort-functions))           (gnus-make-sort-function gnus-thread-sort-functions))
4397        (gnus-message 8 "Sorting threads...done"))))          (gnus-message 8 "Sorting threads...done")))))
4398    
4399  (defun gnus-sort-articles (articles)  (defun gnus-sort-articles (articles)
4400    "Sort ARTICLES."    "Sort ARTICLES."
# Line 3792  using some other form will lead to serio Line 4426  using some other form will lead to serio
4426    (gnus-article-sort-by-number    (gnus-article-sort-by-number
4427     (gnus-thread-header h1) (gnus-thread-header h2)))     (gnus-thread-header h1) (gnus-thread-header h2)))
4428    
4429    (defsubst gnus-article-sort-by-random (h1 h2)
4430      "Sort articles by article number."
4431      (zerop (random 2)))
4432    
4433    (defun gnus-thread-sort-by-random (h1 h2)
4434      "Sort threads by root article number."
4435      (gnus-article-sort-by-random
4436       (gnus-thread-header h1) (gnus-thread-header h2)))
4437    
4438  (defsubst gnus-article-sort-by-lines (h1 h2)  (defsubst gnus-article-sort-by-lines (h1 h2)
4439    "Sort articles by article Lines header."    "Sort articles by article Lines header."
4440    (< (mail-header-lines h1)    (< (mail-header-lines h1)
# Line 3873  Unscored articles will be counted as hav Line 4516  Unscored articles will be counted as hav
4516    
4517  (defun gnus-thread-total-score (thread)  (defun gnus-thread-total-score (thread)
4518    ;; This function find the total score of THREAD.    ;; This function find the total score of THREAD.
4519    (cond ((null thread)    (cond
4520           0)     ((null thread)
4521          ((consp thread)      0)
4522           (if (stringp (car thread))     ((consp thread)
4523               (apply gnus-thread-score-function 0      (if (stringp (car thread))
4524                      (mapcar 'gnus-thread-total-score-1 (cdr thread)))          (apply gnus-thread-score-function 0
4525             (gnus-thread-total-score-1 thread)))                 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4526          (t        (gnus-thread-total-score-1 thread)))
4527           (gnus-thread-total-score-1 (list thread)))))     (t
4528        (gnus-thread-total-score-1 (list thread)))))
4529    
4530    (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4531      "Sort threads such that the thread with the most recently arrived article comes first."
4532      (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4533    
4534    (defun gnus-thread-highest-number (thread)
4535      "Return the highest article number in THREAD."
4536      (apply 'max (mapcar (lambda (header)
4537                            (mail-header-number header))
4538                          (message-flatten-list thread))))
4539    
4540    (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4541      "Sort threads such that the thread with the most recently dated article comes first."
4542      (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4543    
4544    (defun gnus-thread-latest-date (thread)
4545      "Return the highest article date in THREAD."
4546      (let ((previous-time 0))
4547        (apply 'max
4548               (mapcar
4549                (lambda (header)
4550                  (setq previous-time
4551                        (condition-case ()
4552                            (time-to-seconds (mail-header-parse-date
4553                                              (mail-header-date header)))
4554                          (error previous-time))))
4555                (sort
4556                 (message-flatten-list thread)
4557                 (lambda (h1 h2)
4558                   (< (mail-header-number h1)
4559                      (mail-header-number h2))))))))
4560    
4561  (defun gnus-thread-total-score-1 (root)  (defun gnus-thread-total-score-1 (root)
4562    ;; This function find the total score of the thread below ROOT.    ;; This function find the total score of the thread below ROOT.
# Line 3909  Unscored articles will be counted as hav Line 4584  Unscored articles will be counted as hav
4584    (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))    (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4585        ""))        ""))
4586    
4587    (defvar gnus-tmp-thread-tree-header-string "")
4588    
4589    (defcustom gnus-sum-thread-tree-root "> "
4590      "With %B spec, used for the root of a thread.
4591    If nil, use subject instead."
4592      :type '(radio (const :format "%v  " nil) (string :size 0))
4593      :group 'gnus-thread)
4594    (defcustom gnus-sum-thread-tree-false-root "> "
4595      "With %B spec, used for a false root of a thread.
4596    If nil, use subject instead."
4597      :type '(radio (const :format "%v  " nil) (string :size 0))
4598      :group 'gnus-thread)
4599    (defcustom gnus-sum-thread-tree-single-indent ""
4600      "With %B spec, used for a thread with just one message.
4601    If nil, use subject instead."
4602      :type '(radio (const :format "%v  " nil) (string :size 0))
4603      :group 'gnus-thread)
4604    (defcustom gnus-sum-thread-tree-vertical "| "
4605      "With %B spec, used for drawing a vertical line."
4606      :type 'string
4607      :group 'gnus-thread)
4608    (defcustom gnus-sum-thread-tree-indent "  "
4609      "With %B spec, used for indenting."
4610      :type 'string
4611      :group 'gnus-thread)
4612    (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4613      "With %B spec, used for a leaf with brothers."
4614      :type 'string
4615      :group 'gnus-thread)
4616    (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4617      "With %B spec, used for a leaf without brothers."
4618      :type 'string
4619      :group 'gnus-thread)
4620    
4621  (defun gnus-summary-prepare-threads (threads)  (defun gnus-summary-prepare-threads (threads)
4622    "Prepare summary buffer from THREADS and indentation LEVEL.    "Prepare summary buffer from THREADS and indentation LEVEL.
4623  THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'  THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
# Line 3921  or a straight list of headers." Line 4630  or a straight list of headers."
4630    (let ((gnus-tmp-level 0)    (let ((gnus-tmp-level 0)
4631          (default-score (or gnus-summary-default-score 0))          (default-score (or gnus-summary-default-score 0))
4632          (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))          (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4633            (building-line-count gnus-summary-display-while-building)
4634            (building-count (integerp gnus-summary-display-while-building))
4635          thread number subject stack state gnus-tmp-gathered beg-match          thread number subject stack state gnus-tmp-gathered beg-match
4636          new-roots gnus-tmp-new-adopts thread-end          new-roots gnus-tmp-new-adopts thread-end simp-subject
4637          gnus-tmp-header gnus-tmp-unread          gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4638          gnus-tmp-replied gnus-tmp-subject-or-nil          gnus-tmp-replied gnus-tmp-subject-or-nil
4639          gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score          gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4640          gnus-tmp-score-char gnus-tmp-from gnus-tmp-name          gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4641          gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)          gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4642            tree-stack)
4643    
4644      (setq gnus-tmp-prev-subject nil)      (setq gnus-tmp-prev-subject nil
4645              gnus-tmp-thread-tree-header-string "")
4646    
4647      (if (vectorp (car threads))      (if (vectorp (car threads))
4648          ;; If this is a straight (sic) list of headers, then a          ;; If this is a straight (sic) list of headers, then a
# Line 3939  or a straight list of headers." Line 4652  or a straight list of headers."
4652    
4653        ;; Do the threaded display.        ;; Do the threaded display.
4654    
4655          (if gnus-summary-display-while-building
4656              (switch-to-buffer (buffer-name)))
4657        (while (or threads stack gnus-tmp-new-adopts new-roots)        (while (or threads stack gnus-tmp-new-adopts new-roots)
4658    
4659          (if (and (= gnus-tmp-level 0)          (if (and (= gnus-tmp-level 0)
# Line 3965  or a straight list of headers." Line 4680  or a straight list of headers."
4680              ;; the stack.              ;; the stack.
4681              (setq state (car stack)              (setq state (car stack)
4682                    gnus-tmp-level (car state)                    gnus-tmp-level (car state)
4683                    thread (cdr state)                    tree-stack (cadr state)
4684                      thread (caddr state)
4685                    stack (cdr stack)                    stack (cdr stack)
4686                    gnus-tmp-header (caar thread))))                    gnus-tmp-header (caar thread))))
4687    
# Line 4009  or a straight list of headers." Line 4725  or a straight list of headers."
4725                (setq gnus-tmp-level -1)))                (setq gnus-tmp-level -1)))
4726    
4727            (setq number (mail-header-number gnus-tmp-header)            (setq number (mail-header-number gnus-tmp-header)
4728                  subject (mail-header-subject gnus-tmp-header))                  subject (mail-header-subject gnus-tmp-header)
4729                    simp-subject (gnus-simplify-subject-fully subject))
4730    
4731            (cond            (cond
4732             ;; If the thread has changed subject, we might want to make             ;; If the thread has changed subject, we might want to make
# Line 4017  or a straight list of headers." Line 4734  or a straight list of headers."
4734             ((and (null gnus-thread-ignore-subject)             ((and (null gnus-thread-ignore-subject)
4735                   (not (zerop gnus-tmp-level))                   (not (zerop gnus-tmp-level))
4736                   gnus-tmp-prev-subject                   gnus-tmp-prev-subject
4737                   (not (inline                   (not (string= gnus-tmp-prev-subject simp-subject)))
                         (gnus-subject-equal gnus-tmp-prev-subject subject))))  
4738              (setq new-roots (nconc new-roots (list (car thread)))              (setq new-roots (nconc new-roots (list (car thread)))
4739                    thread-end t                    thread-end t
4740                    gnus-tmp-header nil))                    gnus-tmp-header nil))
# Line 4049  or a straight list of headers." Line 4765  or a straight list of headers."
4765              (setq gnus-newsgroup-unreads              (setq gnus-newsgroup-unreads
4766                    (delq number gnus-newsgroup-unreads))                    (delq number gnus-newsgroup-unreads))
4767              (if gnus-newsgroup-auto-expire              (if gnus-newsgroup-auto-expire
4768                  (push number gnus-newsgroup-expirable)                  (setq gnus-newsgroup-expirable
4769                          (gnus-add-to-sorted-list
4770                           gnus-newsgroup-expirable number))
4771                (push (cons number gnus-low-score-mark)                (push (cons number gnus-low-score-mark)
4772                      gnus-newsgroup-reads))))                      gnus-newsgroup-reads))))
4773    
# Line 4077  or a straight list of headers." Line 4795  or a straight list of headers."
4795               (cond               (cond
4796                ((and gnus-thread-ignore-subject                ((and gnus-thread-ignore-subject
4797                      gnus-tmp-prev-subject                      gnus-tmp-prev-subject
4798                      (not (inline (gnus-subject-equal                      (not (string= gnus-tmp-prev-subject simp-subject)))
                                   gnus-tmp-prev-subject subject))))  
4799                 subject)                 subject)
4800                ((zerop gnus-tmp-level)                ((zerop gnus-tmp-level)
4801                 (if (and (eq gnus-summary-make-false-root 'empty)                 (if (and (eq gnus-summary-make-false-root 'empty)
4802                          (memq number gnus-tmp-gathered)                          (memq number gnus-tmp-gathered)
4803                          gnus-tmp-prev-subject                          gnus-tmp-prev-subject
4804                          (inline (gnus-subject-equal                          (string= gnus-tmp-prev-subject simp-subject))
                                  gnus-tmp-prev-subject subject)))  
4805                     gnus-summary-same-subject                     gnus-summary-same-subject
4806                   subject))                   subject))
4807                (t gnus-summary-same-subject)))                (t gnus-summary-same-subject)))
# Line 4106  or a straight list of headers." Line 4822  or a straight list of headers."
4822               (if (or (null gnus-summary-default-score)               (if (or (null gnus-summary-default-score)
4823                       (<= (abs (- gnus-tmp-score gnus-summary-default-score))                       (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4824                           gnus-summary-zcore-fuzz))                           gnus-summary-zcore-fuzz))
4825                   ?  ;Whitespace                   ?                      ;Whitespace
4826                 (if (< gnus-tmp-score gnus-summary-default-score)                 (if (< gnus-tmp-score gnus-summary-default-score)
4827                     gnus-score-below-mark gnus-score-over-mark))                     gnus-score-below-mark gnus-score-over-mark))
4828               gnus-tmp-replied               gnus-tmp-replied
# Line 4116  or a straight list of headers." Line 4832  or a straight list of headers."
4832                      gnus-cached-mark)                      gnus-cached-mark)
4833                     ((memq number gnus-newsgroup-replied)                     ((memq number gnus-newsgroup-replied)
4834                      gnus-replied-mark)                      gnus-replied-mark)
4835                       ((memq number gnus-newsgroup-forwarded)
4836                        gnus-forwarded-mark)
4837                     ((memq number gnus-newsgroup-saved)                     ((memq number gnus-newsgroup-saved)
4838                      gnus-saved-mark)                      gnus-saved-mark)
4839                     (t gnus-unread-mark))                     ((memq number gnus-newsgroup-recent)
4840                        gnus-recent-mark)
4841                       ((memq number gnus-newsgroup-unseen)
4842                        gnus-unseen-mark)
4843                       (t gnus-no-mark))
4844                 gnus-tmp-downloaded
4845                 (cond ((memq number gnus-newsgroup-undownloaded)
4846                        gnus-undownloaded-mark)
4847                       (gnus-newsgroup-agentized
4848                        gnus-downloaded-mark)
4849                       (t
4850                        gnus-no-mark))
4851               gnus-tmp-from (mail-header-from gnus-tmp-header)               gnus-tmp-from (mail-header-from gnus-tmp-header)
4852               gnus-tmp-name               gnus-tmp-name
4853               (cond               (cond
4854                ((string-match "<[^>]+> *$" gnus-tmp-from)                ((string-match "<[^>]+> *$" gnus-tmp-from)
4855                 (setq beg-match (match-beginning 0))                 (setq beg-match (match-beginning 0))
4856                 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)                 (or (and (string-match "^\".+\"" gnus-tmp-from)
4857                          (substring gnus-tmp-from (1+ (match-beginning 0))                          (substring gnus-tmp-from 1 (1- (match-end 0))))
                                    (1- (match-end 0))))  
4858                     (substring gnus-tmp-from 0 beg-match)))                     (substring gnus-tmp-from 0 beg-match)))
4859                ((string-match "(.+)" gnus-tmp-from)                ((string-match "(.+)" gnus-tmp-from)
4860                 (substring gnus-tmp-from                 (substring gnus-tmp-from
4861                            (1+ (match-beginning 0)) (1- (match-end 0))))                            (1+ (match-beginning 0)) (1- (match-end 0))))
4862                (t gnus-tmp-from)))                (t gnus-tmp-from))
4863    
4864                 ;; Do the %B string
4865                 gnus-tmp-thread-tree-header-string
4866                 (cond
4867                  ((not gnus-show-threads) "")
4868                  ((zerop gnus-tmp-level)
4869                   (cond ((cdar thread)
4870                          (or gnus-sum-thread-tree-root subject))
4871                         (gnus-tmp-new-adopts
4872                          (or gnus-sum-thread-tree-false-root subject))
4873                         (t
4874                          (or gnus-sum-thread-tree-single-indent subject))))
4875                  (t
4876                   (concat (apply 'concat
4877                                  (mapcar (lambda (item)
4878                                            (if (= item 1)
4879                                                gnus-sum-thread-tree-vertical
4880                                              gnus-sum-thread-tree-indent))
4881                                          (cdr (reverse tree-stack))))
4882                           (if (nth 1 thread)
4883                               gnus-sum-thread-tree-leaf-with-other
4884                             gnus-sum-thread-tree-single-leaf)))))
4885              (when (string= gnus-tmp-name "")              (when (string= gnus-tmp-name "")
4886                (setq gnus-tmp-name gnus-tmp-from))                (setq gnus-tmp-name gnus-tmp-from))
4887              (unless (numberp gnus-tmp-lines)              (unless (numberp gnus-tmp-lines)
4888                (setq gnus-tmp-lines 0))                (setq gnus-tmp-lines -1))
4889              (gnus-put-text-property              (if (= gnus-tmp-lines -1)
4890                    (setq gnus-tmp-lines "?")
4891                  (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4892                  (gnus-put-text-property
4893               (point)               (point)
4894               (progn (eval gnus-summary-line-format-spec) (point))               (progn (eval gnus-summary-line-format-spec) (point))
4895               'gnus-number number)                 'gnus-number number)
4896              (when gnus-visual-p              (when gnus-visual-p
4897                (forward-line -1)                (forward-line -1)
4898                (gnus-run-hooks 'gnus-summary-update-hook)                (gnus-run-hooks 'gnus-summary-update-hook)
4899                (forward-line 1))                (forward-line 1))
4900    
4901              (setq gnus-tmp-prev-subject subject)))              (setq gnus-tmp-prev-subject simp-subject)))
4902    
4903          (when (nth 1 thread)          (when (nth 1 thread)
4904            (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))            (push (list (max 0 gnus-tmp-level)
4905                          (copy-sequence tree-stack)
4906                          (nthcdr 1 thread))
4907                    stack))
4908            (push (if (nth 1 thread) 1 0) tree-stack)
4909          (incf gnus-tmp-level)          (incf gnus-tmp-level)
4910          (setq threads (if thread-end nil (cdar thread)))          (setq threads (if thread-end nil (cdar thread)))
4911            (if gnus-summary-display-while-building
4912                (if building-count
4913                    (progn
4914                      ;; use a set frequency
4915                      (setq building-line-count (1- building-line-count))
4916                      (when (= building-line-count 0)
4917                        (sit-for 0)
4918                        (setq building-line-count
4919                              gnus-summary-display-while-building)))
4920                  ;; always
4921                  (sit-for 0)))
4922          (unless threads          (unless threads
4923            (setq gnus-tmp-level 0)))))            (setq gnus-tmp-level 0)))))
4924    (gnus-message 7 "Generating summary...done"))    (gnus-message 7 "Generating summary...done"))
# Line 4184  or a straight list of headers." Line 4952  or a straight list of headers."
4952                gnus-newsgroup-data)                gnus-newsgroup-data)
4953          (gnus-summary-insert-line          (gnus-summary-insert-line
4954           header 0 number           header 0 number
4955             (memq number gnus-newsgroup-undownloaded)
4956           mark (memq number gnus-newsgroup-replied)           mark (memq number gnus-newsgroup-replied)
4957           (memq number gnus-newsgroup-expirable)           (memq number gnus-newsgroup-expirable)
4958           (mail-header-subject header) nil           (mail-header-subject header) nil
# Line 4192  or a straight list of headers." Line 4961  or a straight list of headers."
4961    
4962  (defun gnus-summary-remove-list-identifiers ()  (defun gnus-summary-remove-list-identifiers ()
4963    "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."    "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4964    (let ((regexp (if (stringp gnus-list-identifiers)    (let ((regexp (if (consp gnus-list-identifiers)
4965                      gnus-list-identifiers                      (mapconcat 'identity gnus-list-identifiers " *\\|")
4966                    (mapconcat 'identity gnus-list-identifiers " *\\|"))))                    gnus-list-identifiers))
4967      (dolist (header gnus-newsgroup-headers)          changed subject)
4968        (when (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp      (when regexp
4969                                    " *\\)\\)+\\(Re: +\\)?\\)")        (dolist (header gnus-newsgroup-headers)
4970                            (mail-header-subject header))          (setq subject (mail-header-subject header)
4971          (mail-header-set-subject                changed nil)
4972           header (concat (substring (mail-header-subject header)          (while (string-match
4973                                     0 (match-beginning 1))                  (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
4974                          (or                  subject)
4975                           (match-string 3 (mail-header-subject header))            (setq subject
4976                           (match-string 5 (mail-header-subject header)))                  (concat (substring subject 0 (match-beginning 2))
4977                          (substring (mail-header-subject header)                          (substring subject (match-end 0)))
4978                                     (match-end 1))))))))                  changed t))
4979            (when (and changed
4980                       (string-match
4981                        "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
4982              (setq subject
4983                    (concat (substring subject 0 (match-beginning 1))
4984                            (substring subject (match-end 1)))))
4985            (when changed
4986              (mail-header-set-subject header subject))))))
4987    
4988    (defun gnus-fetch-headers (articles)
4989      "Fetch headers of ARTICLES."
4990      (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
4991        (gnus-message 5 "Fetching headers for %s..." name)
4992        (prog1
4993            (if (eq 'nov
4994                    (setq gnus-headers-retrieved-by
4995                          (gnus-retrieve-headers
4996                           articles gnus-newsgroup-name
4997                           ;; We might want to fetch old headers, but
4998                           ;; not if there is only 1 article.
4999                           (and (or (and
5000                                     (not (eq gnus-fetch-old-headers 'some))
5001                                     (not (numberp gnus-fetch-old-headers)))
5002                                    (> (length articles) 1))
5003                                gnus-fetch-old-headers))))
5004                (gnus-get-newsgroup-headers-xover
5005                 articles nil nil gnus-newsgroup-name t)
5006              (gnus-get-newsgroup-headers))
5007          (gnus-message 5 "Fetching headers for %s...done" name))))
5008    
5009  (defun gnus-select-newsgroup (group &optional read-all select-articles)  (defun gnus-select-newsgroup (group &optional read-all select-articles)
5010    "Select newsgroup GROUP.    "Select newsgroup GROUP.
# Line 4215  If SELECT-ARTICLES, only select those ar Line 5013  If SELECT-ARTICLES, only select those ar
5013    (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))    (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5014           ;;!!! Dirty hack; should be removed.           ;;!!! Dirty hack; should be removed.
5015           (gnus-summary-ignore-duplicates           (gnus-summary-ignore-duplicates
5016            (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)            (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5017                t                t
5018              gnus-summary-ignore-duplicates))              gnus-summary-ignore-duplicates))
5019           (info (nth 2 entry))           (info (nth 2 entry))
# Line 4230  If SELECT-ARTICLES, only select those ar Line 5028  If SELECT-ARTICLES, only select those ar
5028          (gnus-activate-group group)     ; Or we can activate it...          (gnus-activate-group group)     ; Or we can activate it...
5029          (progn                          ; Or we bug out.          (progn                          ; Or we bug out.
5030            (when (equal major-mode 'gnus-summary-mode)            (when (equal major-mode 'gnus-summary-mode)
5031              (kill-buffer (current-buffer)))              (gnus-kill-buffer (current-buffer)))
5032            (error "Couldn't request group %s: %s"            (error "Couldn't activate group %s: %s"
5033                   group (gnus-status-message group))))                   group (gnus-status-message group))))
5034    
5035      (unless (gnus-request-group group t)      (unless (gnus-request-group group t)
5036        (when (equal major-mode 'gnus-summary-mode)        (when (equal major-mode 'gnus-summary-mode)
5037          (kill-buffer (current-buffer)))          (gnus-kill-buffer (current-buffer)))
5038        (error "Couldn't request group %s: %s"        (error "Couldn't request group %s: %s"
5039               group (gnus-status-message group)))               group (gnus-status-message group)))
5040    
5041      (setq gnus-newsgroup-name group)      (when gnus-agent
5042      (setq gnus-newsgroup-unselected nil)        ;; The agent may be storing articles that are no longer in the
5043      (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))        ;; server's active range.  If that is the case, the active range
5044      (gnus-summary-setup-default-charset)        ;; needs to be expanded such that the agent's articles can be
5045          ;; included in the summary.
5046          (let* ((gnus-command-method (gnus-find-method-for-group group))
5047                 (alist (gnus-agent-load-alist group))
5048                 (active (gnus-active group)))
5049            (if (and (car alist)
5050                     (< (caar alist) (car active)))
5051                (gnus-set-active group (cons (caar alist) (cdr active)))))
5052    
5053          (setq gnus-summary-use-undownloaded-faces
5054                (gnus-agent-find-parameter
5055                 group
5056                 'agent-enable-undownloaded-faces)))
5057    
5058        (setq gnus-newsgroup-name group
5059              gnus-newsgroup-unselected nil
5060              gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5061    
5062      ;; Adjust and set lists of article marks.      (let ((display (gnus-group-find-parameter group 'display)))
5063      (when info        (setq gnus-newsgroup-display
5064        (gnus-adjust-marked-articles info))              (cond
5065                 ((not (zerop (or (car-safe read-all) 0)))
5066                  ;; The user entered the group with C-u SPC/RET, let's show
5067                  ;; all articles.
5068                  'gnus-not-ignore)
5069                 ((eq display 'all)
5070                  'gnus-not-ignore)
5071                 ((arrayp display)
5072                  (gnus-summary-display-make-predicate (mapcar 'identity display)))
5073                 ((numberp display)
5074                  ;; The following is probably the "correct" solution, but
5075                  ;; it makes Gnus fetch all headers and then limit the
5076                  ;; articles (which is slow), so instead we hack the
5077                  ;; select-articles parameter instead. -- Simon Josefsson
5078                  ;; <jas@kth.se>
5079                  ;;
5080                  ;; (gnus-byte-compile
5081                  ;;  `(lambda () (> number ,(- (cdr (gnus-active group))
5082                  ;;                         display)))))
5083                  (setq select-articles
5084                        (gnus-uncompress-range
5085                         (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5086                                 (if (> tmp 0)
5087                                     tmp
5088                                   1))
5089                               (cdr (gnus-active group)))))
5090                  nil)
5091                 (t
5092                  nil))))
5093    
5094        (gnus-summary-setup-default-charset)
5095    
5096      ;; Kludge to avoid having cached articles nixed out in virtual groups.      ;; Kludge to avoid having cached articles nixed out in virtual groups.
5097      (when (gnus-virtual-group-p group)      (when (gnus-virtual-group-p group)
5098        (setq cached gnus-newsgroup-cached))        (setq cached gnus-newsgroup-cached))
5099    
5100      (setq gnus-newsgroup-unreads      (setq gnus-newsgroup-unreads
5101            (gnus-set-difference            (gnus-sorted-ndifference
5102             (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)             (gnus-sorted-ndifference gnus-newsgroup-unreads
5103                                        gnus-newsgroup-marked)
5104             gnus-newsgroup-dormant))             gnus-newsgroup-dormant))
5105    
5106      (setq gnus-newsgroup-processable nil)      (setq gnus-newsgroup-processable nil)
5107    
5108      (gnus-update-read-articles group gnus-newsgroup-unreads)      (gnus-update-read-articles group gnus-newsgroup-unreads)
5109    
5110        ;; Adjust and set lists of article marks.
5111        (when info
5112          (gnus-adjust-marked-articles info))
5113      (if (setq articles select-articles)      (if (setq articles select-articles)
5114          (setq gnus-newsgroup-unselected          (setq gnus-newsgroup-unselected
5115                (gnus-sorted-intersection                (gnus-sorted-difference gnus-newsgroup-unreads articles))
                gnus-newsgroup-unreads  
                (gnus-sorted-complement gnus-newsgroup-unreads articles)))  
5116        (setq articles (gnus-articles-to-read group read-all)))        (setq articles (gnus-articles-to-read group read-all)))
5117    
5118      (cond      (cond
# Line 4280  If SELECT-ARTICLES, only select those ar Line 5126  If SELECT-ARTICLES, only select those ar
5126              (gnus-make-hashtable (length articles)))              (gnus-make-hashtable (length articles)))
5127        (gnus-set-global-variables)        (gnus-set-global-variables)
5128        ;; Retrieve the headers and read them in.        ;; Retrieve the headers and read them in.
5129        (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)  
5130        (setq gnus-newsgroup-headers        (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
             (if (eq 'nov  
                     (setq gnus-headers-retrieved-by  
                           (gnus-retrieve-headers  
                            articles gnus-newsgroup-name  
                            ;; We might want to fetch old headers, but  
                            ;; not if there is only 1 article.  
                            (and (or (and  
                                      (not (eq gnus-fetch-old-headers 'some))  
                                      (not (numberp gnus-fetch-old-headers)))  
                                     (> (length articles) 1))  
                                 gnus-fetch-old-headers))))  
                 (gnus-get-newsgroup-headers-xover  
                  articles nil nil gnus-newsgroup-name t)  
               (gnus-get-newsgroup-headers)))  
       (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)  
5131    
5132        ;; Kludge to avoid having cached articles nixed out in virtual groups.        ;; Kludge to avoid having cached articles nixed out in virtual groups.
5133        (when cached        (when cached
# Line 4309  If SELECT-ARTICLES, only select those ar Line 5140  If SELECT-ARTICLES, only select those ar
5140        ;; Set the initial limit.        ;; Set the initial limit.
5141        (setq gnus-newsgroup-limit (copy-sequence articles))        (setq gnus-newsgroup-limit (copy-sequence articles))
5142        ;; Remove canceled articles from the list of unread articles.        ;; Remove canceled articles from the list of unread articles.
5143          (setq fetched-articles
5144                (mapcar (lambda (headers) (mail-header-number headers))
5145                        gnus-newsgroup-headers))
5146          (setq gnus-newsgroup-articles fetched-articles)
5147        (setq gnus-newsgroup-unreads        (setq gnus-newsgroup-unreads
5148              (gnus-set-sorted-intersection              (gnus-sorted-nintersection
5149               gnus-newsgroup-unreads               gnus-newsgroup-unreads fetched-articles))
5150               (setq fetched-articles        (gnus-compute-unseen-list)
5151                     (mapcar (lambda (headers) (mail-header-number headers))  
                            gnus-newsgroup-headers))))  
5152        ;; Removed marked articles that do not exist.        ;; Removed marked articles that do not exist.
5153        (gnus-update-missing-marks        (gnus-update-missing-marks
5154         (gnus-sorted-complement fetched-articles articles))         (gnus-sorted-difference articles fetched-articles))
5155        ;; We might want to build some more threads first.        ;; We might want to build some more threads first.
5156        (when (and gnus-fetch-old-headers        (when (and gnus-fetch-old-headers
5157                   (eq gnus-headers-retrieved-by 'nov))                   (eq gnus-headers-retrieved-by 'nov))
# Line 4346  If SELECT-ARTICLES, only select those ar Line 5180  If SELECT-ARTICLES, only select those ar
5180        ;; GROUP is successfully selected.        ;; GROUP is successfully selected.
5181        (or gnus-newsgroup-headers t)))))        (or gnus-newsgroup-headers t)))))
5182    
5183    (defun gnus-compute-unseen-list ()
5184      ;; The `seen' marks are treated specially.
5185      (if (not gnus-newsgroup-seen)
5186          (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5187        (setq gnus-newsgroup-unseen
5188              (gnus-inverse-list-range-intersection
5189               gnus-newsgroup-articles gnus-newsgroup-seen))))
5190    
5191    (defun gnus-summary-display-make-predicate (display)
5192      (require 'gnus-agent)
5193      (when (= (length display) 1)
5194        (setq display (car display)))
5195      (unless gnus-summary-display-cache
5196        (dolist (elem (append '((unread . unread)
5197                                (read . read)
5198                                (unseen . unseen))
5199                              gnus-article-mark-lists))
5200          (push (cons (cdr elem)
5201                      (gnus-byte-compile
5202                       `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5203                gnus-summary-display-cache)))
5204      (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5205            (gnus-category-predicate-cache gnus-summary-display-cache))
5206        (gnus-get-predicate display)))
5207    
5208    ;; Uses the dynamically bound `number' variable.
5209    (eval-when-compile
5210      (defvar number))
5211    (defun gnus-article-marked-p (type &optional article)
5212      (let ((article (or article number)))
5213        (cond
5214         ((eq type 'tick)
5215          (memq article gnus-newsgroup-marked))
5216         ((eq type 'spam)
5217          (memq article gnus-newsgroup-spam-marked))
5218         ((eq type 'unsend)
5219          (memq article gnus-newsgroup-unsendable))
5220         ((eq type 'undownload)
5221          (memq article gnus-newsgroup-undownloaded))
5222         ((eq type 'download)
5223          (memq article gnus-newsgroup-downloadable))
5224         ((eq type 'unread)
5225          (memq article gnus-newsgroup-unreads))
5226         ((eq type 'read)
5227          (memq article gnus-newsgroup-reads))
5228         ((eq type 'dormant)
5229          (memq article gnus-newsgroup-dormant) )
5230         ((eq type 'expire)
5231          (memq article gnus-newsgroup-expirable))
5232         ((eq type 'reply)
5233          (memq article gnus-newsgroup-replied))
5234         ((eq type 'killed)
5235          (memq article gnus-newsgroup-killed))
5236         ((eq type 'bookmark)
5237          (assq article gnus-newsgroup-bookmarks))
5238         ((eq type 'score)
5239          (assq article gnus-newsgroup-scored))
5240         ((eq type 'save)
5241          (memq article gnus-newsgroup-saved))
5242         ((eq type 'cache)
5243          (memq article gnus-newsgroup-cached))
5244         ((eq type 'forward)
5245          (memq article gnus-newsgroup-forwarded))
5246         ((eq type 'seen)
5247          (not (memq article gnus-newsgroup-unseen)))
5248         ((eq type 'recent)
5249          (memq article gnus-newsgroup-recent))
5250         (t t))))
5251    
5252  (defun gnus-articles-to-read (group &optional read-all)  (defun gnus-articles-to-read (group &optional read-all)
5253    "Find out what articles the user wants to read."    "Find out what articles the user wants to read."
5254    (let* ((articles    (let* ((display (gnus-group-find-parameter group 'display))
5255             (articles
5256            ;; Select all articles if `read-all' is non-nil, or if there            ;; Select all articles if `read-all' is non-nil, or if there
5257            ;; are no unread articles.            ;; are no unread articles.
5258            (if (or read-all            (if (or read-all
5259                    (and (zerop (length gnus-newsgroup-marked))                    (and (zerop (length gnus-newsgroup-marked))
5260                         (zerop (length gnus-newsgroup-unreads)))                         (zerop (length gnus-newsgroup-unreads)))
5261                    (eq (gnus-group-find-parameter group 'display)                    ;; Fetch all if the predicate is non-nil.
5262                        'all))                    gnus-newsgroup-display)
5263                  ;; We want to select the headers for all the articles in
5264                  ;; the group, so we select either all the active
5265                  ;; articles in the group, or (if that's nil), the
5266                  ;; articles in the cache.
5267                (or                (or
5268                 (gnus-uncompress-range (gnus-active group))                 (gnus-uncompress-range (gnus-active group))
5269                 (gnus-cache-articles-in-group group))                 (gnus-cache-articles-in-group group))
5270              (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked              ;; Select only the "normal" subset of articles.
5271                            (copy-sequence gnus-newsgroup-unreads))              (gnus-sorted-nunion
5272                    '<)))               (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5273                 gnus-newsgroup-unreads)))
5274           (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))           (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5275           (scored (length scored-list))           (scored (length scored-list))
5276           (number (length articles))           (number (length articles))
# Line 4371  If SELECT-ARTICLES, only select those ar Line 5280  If SELECT-ARTICLES, only select those ar
5280            (cond            (cond
5281             ((numberp read-all)             ((numberp read-all)
5282              read-all)              read-all)
5283               ((numberp gnus-newsgroup-display)
5284                gnus-newsgroup-display)
5285             (t             (t
5286              (condition-case ()              (condition-case ()
5287                  (cond                  (cond
5288                   ((and (or (<= scored marked) (= scored number))                   ((and (or (<= scored marked) (= scored number))
5289                         (numberp gnus-large-newsgroup)                         (numberp gnus-large-newsgroup)
5290                         (> number gnus-large-newsgroup))                         (> number gnus-large-newsgroup))
5291                    (let ((input                    (let* ((cursor-in-echo-area nil)
5292                           (read-string                           (initial (gnus-parameter-large-newsgroup-initial
5293                            (format                                     gnus-newsgroup-name))
5294                             "How many articles from %s (default %d): "                           (input
5295                             (gnus-limit-string gnus-newsgroup-name 35)                            (read-string
5296                             number))))                             (format
5297                                "How many articles from %s (%s %d): "
5298                                (gnus-limit-string
5299                                 (gnus-group-decoded-name gnus-newsgroup-name)
5300                                 35)
5301                                (if initial "max" "default")
5302                                number)
5303                               (if initial
5304                                   (cons (number-to-string initial)
5305                                         0)))))
5306                      (if (string-match "^[ \t]*$" input) number input)))                      (if (string-match "^[ \t]*$" input) number input)))
5307                   ((and (> scored marked) (< scored number)                   ((and (> scored marked) (< scored number)
5308                         (> (- scored number) 20))                         (> (- scored number) 20))
# Line 4390  If SELECT-ARTICLES, only select those ar Line 5310  If SELECT-ARTICLES, only select those ar
5310                           (read-string                           (read-string
5311                            (format "%s %s (%d scored, %d total): "                            (format "%s %s (%d scored, %d total): "
5312                                    "How many articles from"                                    "How many articles from"
5313                                    group scored number))))                                    (gnus-group-decoded-name group)
5314                                      scored number))))
5315                      (if (string-match "^[ \t]*$" input)                      (if (string-match "^[ \t]*$" input)
5316                          number input)))                          number input)))
5317                   (t number))                   (t number))
# Line 4413  If SELECT-ARTICLES, only select those ar Line 5334  If SELECT-ARTICLES, only select those ar
5334            ;; Select the N most recent articles.            ;; Select the N most recent articles.
5335            (setq articles (nthcdr (- number select) articles))))            (setq articles (nthcdr (- number select) articles))))
5336        (setq gnus-newsgroup-unselected        (setq gnus-newsgroup-unselected
5337              (gnus-sorted-intersection              (gnus-sorted-difference gnus-newsgroup-unreads articles))
              gnus-newsgroup-unreads  
              (gnus-sorted-complement gnus-newsgroup-unreads articles)))  
5338        (when gnus-alter-articles-to-read-function        (when gnus-alter-articles-to-read-function
5339          (setq gnus-newsgroup-unreads          (setq articles
5340                (sort                (sort
5341                 (funcall gnus-alter-articles-to-read-function                 (funcall gnus-alter-articles-to-read-function
5342                          gnus-newsgroup-name gnus-newsgroup-unreads)                          gnus-newsgroup-name articles)
5343                 '<)))                 '<)))
5344        articles)))        articles)))
5345    
# Line 4443  If SELECT-ARTICLES, only select those ar Line 5362  If SELECT-ARTICLES, only select those ar
5362        (setq marks (cdr marks)))        (setq marks (cdr marks)))
5363      out))      out))
5364    
5365    (defun gnus-article-mark-to-type (mark)
5366      "Return the type of MARK."
5367      (or (cadr (assq mark gnus-article-special-mark-lists))
5368          'list))
5369    
5370    (defun gnus-article-unpropagatable-p (mark)
5371      "Return whether MARK should be propagated to back end."
5372      (memq mark gnus-article-unpropagated-mark-lists))
5373    
5374  (defun gnus-adjust-marked-articles (info)  (defun gnus-adjust-marked-articles (info)
5375    "Set all article lists and remove all marks that are no longer valid."    "Set all article lists and remove all marks that are no longer valid."
5376    (let* ((marked-lists (gnus-info-marks info))    (let* ((marked-lists (gnus-info-marks info))
# Line 4450  If SELECT-ARTICLES, only select those ar Line 5378  If SELECT-ARTICLES, only select those ar
5378           (min (car active))           (min (car active))
5379           (max (cdr active))           (max (cdr active))
5380           (types gnus-article-mark-lists)           (types gnus-article-mark-lists)
5381           (uncompressed '(score bookmark killed))           marks var articles article mark mark-type)
          marks var articles article mark)  
5382    
5383      (while marked-lists      (dolist (marks marked-lists)
5384        (setq marks (pop marked-lists))        (setq mark (car marks)
5385        (set (setq var (intern (format "gnus-newsgroup-%s"              mark-type (gnus-article-mark-to-type mark)
5386                                       (car (rassq (setq mark (car marks))              var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
                                                  types)))))  
            (if (memq (car marks) uncompressed) (cdr marks)  
              (gnus-uncompress-range (cdr marks))))  
5387    
5388        (setq articles (symbol-value var))        ;; We set the variable according to the type of the marks list,
5389          ;; and then adjust the marks to a subset of the active articles.
       ;; All articles have to be subsets of the active articles.  
5390        (cond        (cond
5391         ;; Adjust "simple" lists.         ;; Adjust "simple" lists.
5392         ((memq mark '(tick dormant expire reply save))         ((eq mark-type 'list)
5393          (while articles          (set var (setq articles (gnus-uncompress-range (cdr marks))))
5394            (when (or (< (setq article (pop articles)) min) (> article max))          (when (memq mark '(tick dormant expire reply save))
5395              (set var (delq article (symbol-value var))))))            (while articles
5396                (when (or (< (setq article (pop articles)) min) (> article max))
5397                  (set var (delq article (symbol-value var)))))))
5398         ;; Adjust assocs.         ;; Adjust assocs.
5399         ((memq mark uncompressed)         ((eq mark-type 'tuple)
5400            (set var (setq articles (cdr marks)))
5401          (when (not (listp (cdr (symbol-value var))))          (when (not (listp (cdr (symbol-value var))))
5402            (set var (list (symbol-value var))))            (set var (list (symbol-value var))))
5403          (when (not (listp (cdr articles)))          (when (not (listp (cdr articles)))
# Line 4480  If SELECT-ARTICLES, only select those ar Line 5406  If SELECT-ARTICLES, only select those ar
5406            (when (or (not (consp (setq article (pop articles))))            (when (or (not (consp (setq article (pop articles))))
5407                      (< (car article) min)                      (< (car article) min)
5408                      (> (car article) max))                      (> (car article) max))
5409              (set var (delq article (symbol-value var))))))))))              (set var (delq article (symbol-value var))))))
5410           ;; Adjust ranges (sloppily).
5411           ((eq mark-type 'range)
5412            (cond
5413             ((eq mark 'seen)
5414              ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5415              ;; It should be (seen (NUM1 . NUM2)).
5416              (when (numberp (cddr marks))
5417                (setcdr marks (list (cdr marks))))
5418              (setq articles (cdr marks))
5419              (while (and articles
5420                          (or (and (consp (car articles))
5421                                   (> min (cdar articles)))
5422                              (and (numberp (car articles))
5423                                   (> min (car articles)))))
5424                (pop articles))
5425              (set var articles))))))))
5426    
5427  (defun gnus-update-missing-marks (missing)  (defun gnus-update-missing-marks (missing)
5428    "Go through the list of MISSING articles and remove them from the mark lists."    "Go through the list of MISSING articles and remove them from the mark lists."
5429    (when missing    (when missing
5430      (let ((types gnus-article-mark-lists)      (let (var m)
           var m)  
5431        ;; Go through all types.        ;; Go through all types.
5432        (while types        (dolist (elem gnus-article-mark-lists)
5433          (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))          (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5434          (when (symbol-value var)            (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5435            ;; This list has articles.  So we delete all missing articles            (when (symbol-value var)
5436            ;; from it.              ;; This list has articles.  So we delete all missing
5437            (setq m missing)              ;; articles from it.
5438            (while m              (setq m missing)
5439              (set var (delq (pop m) (symbol-value var)))))))))              (while m
5440                  (set var (delq (pop m) (symbol-value var))))))))))
5441    
5442  (defun gnus-update-marks ()  (defun gnus-update-marks ()
5443    "Enter the various lists of marked articles into the newsgroup info list."    "Enter the various lists of marked articles into the newsgroup info list."
5444    (let ((types gnus-article-mark-lists)    (let ((types gnus-article-mark-lists)
5445          (info (gnus-get-info gnus-newsgroup-name))          (info (gnus-get-info gnus-newsgroup-name))
         (uncompressed '(score bookmark killed))  
5446          type list newmarked symbol delta-marks)          type list newmarked symbol delta-marks)
5447      (when info      (when info
5448        ;; Add all marks lists to the list of marks lists.        ;; Add all marks lists to the list of marks lists.
5449        (while (setq type (pop types))        (while (setq type (pop types))
5450          (setq list (symbol-value          (setq list (symbol-value
5451                      (setq symbol                      (setq symbol
5452                            (intern (format "gnus-newsgroup-%s"                            (intern (format "gnus-newsgroup-%s" (car type))))))
                                           (car type))))))  
5453    
5454          (when list          (when list
5455            ;; Get rid of the entries of the articles that have the            ;; Get rid of the entries of the articles that have the
# Line 4528  If SELECT-ARTICLES, only select those ar Line 5468  If SELECT-ARTICLES, only select those ar
5468                  (setq arts (cdr arts)))                  (setq arts (cdr arts)))
5469                (setq list (cdr all)))))                (setq list (cdr all)))))
5470    
5471          (unless (memq (cdr type) uncompressed)          (when (eq (cdr type) 'seen)
5472              (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5473    
5474            (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5475            (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))            (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5476    
5477          (when (gnus-check-backend-function          (when (and (gnus-check-backend-function
5478                 'request-set-mark gnus-newsgroup-name)                      'request-set-mark gnus-newsgroup-name)
5479            ;; propagate flags to server, with the following exceptions:                     (not (gnus-article-unpropagatable-p (cdr type))))
5480            ;; uncompressed:s are not proper flags (they are cons cells)            (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5481            ;; cache is a internal gnus flag                   (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5482            ;; download are local to one gnus installation (well)                   (add (gnus-remove-from-range
5483            ;; unsend are for nndraft groups only                         (gnus-copy-sequence list) old)))
5484            ;; xxx: generality of this?  this suits nnimap anyway              (when add
5485            (unless (memq (cdr type) (append '(cache download unsend)                (push (list add 'add (list (cdr type))) delta-marks))
5486                                             uncompressed))              (when del
5487              (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))                (push (list del 'del (list (cdr type))) delta-marks))))
                    (del (gnus-remove-from-range (gnus-copy-sequence old) list))  
                    (add (gnus-remove-from-range  
                          (gnus-copy-sequence list) old)))  
               (when add  
                 (push (list add 'add (list (cdr type))) delta-marks))  
               (when del  
                 (push (list del 'del (list (cdr type))) delta-marks)))))  
5488    
5489          (when list          (when list
5490            (push (cons (cdr type) list) newmarked)))            (push (cons (cdr type) list) newmarked)))
# Line 4584  If WHERE is `summary', the summary mode Line 5520  If WHERE is `summary', the summary mode
5520          ;; We evaluate this in the summary buffer since these          ;; We evaluate this in the summary buffer since these
5521          ;; variables are buffer-local to that buffer.          ;; variables are buffer-local to that buffer.
5522          (set-buffer gnus-summary-buffer)          (set-buffer gnus-summary-buffer)
5523          ;; We bind all these variables that are used in the `eval' form         ;; We bind all these variables that are used in the `eval' form
5524          ;; below.          ;; below.
5525          (let* ((mformat (symbol-value          (let* ((mformat (symbol-value
5526                           (intern                           (intern
5527                            (format "gnus-%s-mode-line-format-spec" where))))                            (format "gnus-%s-mode-line-format-spec" where))))
5528                 (gnus-tmp-group-name (gnus-group-name-decode                 (gnus-tmp-group-name (gnus-group-decoded-name
5529                                       gnus-newsgroup-name                                       gnus-newsgroup-name))
                                      (gnus-group-name-charset  
                                       nil  
                                       gnus-newsgroup-name)))  
5530                 (gnus-tmp-article-number (or gnus-current-article 0))                 (gnus-tmp-article-number (or gnus-current-article 0))
5531                 (gnus-tmp-unread gnus-newsgroup-unreads)                 (gnus-tmp-unread gnus-newsgroup-unreads)
5532                 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))                 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
# Line 4614  If WHERE is `summary', the summary mode Line 5547  If WHERE is `summary', the summary mode
5547                       (mail-header-subject gnus-current-headers))                       (mail-header-subject gnus-current-headers))
5548                    ""))                    ""))
5549                 bufname-length max-len                 bufname-length max-len
5550                 gnus-tmp-header);; passed as argument to any user-format-funcs                 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5551            (setq mode-string (eval mformat))            (setq mode-string (eval mformat))
5552            (setq bufname-length (if (string-match "%b" mode-string)            (setq bufname-length (if (string-match "%b" mode-string)
5553                                     (- (length                                     (- (length
# Line 4755  The resulting hash table is returned, or Line 5688  The resulting hash table is returned, or
5688               (gnus-info-set-marks ',info ',(gnus-info-marks info) t)               (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5689               (gnus-info-set-read ',info ',(gnus-info-read info))               (gnus-info-set-read ',info ',(gnus-info-read info))
5690               (gnus-get-unread-articles-in-group ',info (gnus-active ,group))               (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5691                 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5692               (gnus-group-update-group ,group t))))               (gnus-group-update-group ,group t))))
5693        ;; Add the read articles to the range.        ;; Add the read articles to the range.
5694        (gnus-info-set-read info range)        (gnus-info-set-read info range)
5695          (gnus-request-set-mark group (list (list range 'add '(read))))
5696        ;; Then we have to re-compute how many unread        ;; Then we have to re-compute how many unread
5697        ;; articles there are in this group.        ;; articles there are in this group.
5698        (when active        (when active
# Line 4777  The resulting hash table is returned, or Line 5712  The resulting hash table is returned, or
5712          ;; Update the number of unread articles.          ;; Update the number of unread articles.
5713          (setcar entry num)          (setcar entry num)
5714          ;; Update the group buffer.          ;; Update the group buffer.
5715          (gnus-group-update-group group t)))))          (unless (gnus-ephemeral-group-p group)
5716              (gnus-group-update-group group t))))))
5717    
5718  (defvar gnus-newsgroup-none-id 0)  (defvar gnus-newsgroup-none-id 0)
5719    
# Line 4799  The resulting hash table is returned, or Line 5735  The resulting hash table is returned, or
5735        ;; Translate all TAB characters into SPACE characters.        ;; Translate all TAB characters into SPACE characters.
5736        (subst-char-in-region (point-min) (point-max) ?\t ?  t)        (subst-char-in-region (point-min) (point-max) ?\t ?  t)
5737        (subst-char-in-region (point-min) (point-max) ?\r ?  t)        (subst-char-in-region (point-min) (point-max) ?\r ?  t)
5738          (ietf-drums-unfold-fws)
5739        (gnus-run-hooks 'gnus-parse-headers-hook)        (gnus-run-hooks 'gnus-parse-headers-hook)
5740        (let ((case-fold-search t)        (let ((case-fold-search t)
5741              in-reply-to header p lines chars)              in-reply-to header p lines chars)
# Line 4829  The resulting hash table is returned, or Line 5766  The resulting hash table is returned, or
5766              ;; Subject.              ;; Subject.
5767              (progn              (progn
5768                (goto-char p)                (goto-char p)
5769                (if (search-forward "\nsubject: " nil t)                (if (search-forward "\nsubject:" nil t)
5770                    (funcall gnus-decode-encoded-word-function                    (funcall gnus-decode-encoded-word-function
5771                             (nnheader-header-value))                             (nnheader-header-value))
5772                  "(none)"))                  "(none)"))
5773              ;; From.              ;; From.
5774              (progn              (progn
5775                (goto-char p)                (goto-char p)
5776                (if (or (search-forward "\nfrom: " nil t)                (if (search-forward "\nfrom:" nil t)
                       (search-forward "\nfrom:" nil t))  
5777                    (funcall gnus-decode-encoded-word-function                    (funcall gnus-decode-encoded-word-function
5778                             (nnheader-header-value))                             (nnheader-header-value))
5779                  "(nobody)"))                  "(nobody)"))
5780              ;; Date.              ;; Date.
5781              (progn              (progn
5782                (goto-char p)                (goto-char p)
5783                (if (search-forward "\ndate: " nil t)                (if (search-forward "\ndate:" nil t)
5784                    (nnheader-header-value) ""))                    (nnheader-header-value) ""))
5785              ;; Message-ID.              ;; Message-ID.
5786              (progn              (progn
# Line 4861  The resulting hash table is returned, or Line 5797  The resulting hash table is returned, or
5797              ;; References.              ;; References.
5798              (progn              (progn
5799                (goto-char p)                (goto-char p)
5800                (if (search-forward "\nreferences: " nil t)                (if (search-forward "\nreferences:" nil t)
5801                    (progn                    (progn
5802                      (setq end (point))                      (setq end (point))
5803                      (prog1                      (prog1
# Line 4878  The resulting hash table is returned, or Line 5814  The resulting hash table is returned, or
5814                  ;; Get the references from the in-reply-to header if there                  ;; Get the references from the in-reply-to header if there
5815                  ;; were no references and the in-reply-to header looks                  ;; were no references and the in-reply-to header looks
5816                  ;; promising.                  ;; promising.
5817                  (if (and (search-forward "\nin-reply-to: " nil t)                  (if (and (search-forward "\nin-reply-to:" nil t)
5818                           (setq in-reply-to (nnheader-header-value))                           (setq in-reply-to (nnheader-header-value))
5819                           (string-match "<[^>]+>" in-reply-to))                           (string-match "<[^>]+>" in-reply-to))
5820                      (let (ref2)                      (let (ref2)
# Line 4896  The resulting hash table is returned, or Line 5832  The resulting hash table is returned, or
5832                (goto-char p)                (goto-char p)
5833                (if (search-forward "\nchars: " nil t)                (if (search-forward "\nchars: " nil t)
5834                    (if (numberp (setq chars (ignore-errors (read cur))))                    (if (numberp (setq chars (ignore-errors (read cur))))
5835                        chars 0)                        chars -1)
5836                  0))                  -1))
5837              ;; Lines.              ;; Lines.
5838              (progn              (progn
5839                (goto-char p)                (goto-char p)
5840                (if (search-forward "\nlines: " nil t)                (if (search-forward "\nlines: " nil t)
5841                    (if (numberp (setq lines (ignore-errors (read cur))))                    (if (numberp (setq lines (ignore-errors (read cur))))
5842                        lines 0)                        lines -1)
5843                  0))                  -1))
5844              ;; Xref.              ;; Xref.
5845              (progn              (progn
5846                (goto-char p)                (goto-char p)
5847                (and (search-forward "\nxref: " nil t)                (and (search-forward "\nxref:" nil t)
5848                     (nnheader-header-value)))                     (nnheader-header-value)))
5849              ;; Extra.              ;; Extra.
5850              (when gnus-extra-headers              (when gnus-extra-headers
# Line 4917  The resulting hash table is returned, or Line 5853  The resulting hash table is returned, or
5853                  (while extra                  (while extra
5854                    (goto-char p)                    (goto-char p)
5855                    (when (search-forward                    (when (search-forward
5856                           (concat "\n" (symbol-name (car extra)) ": ") nil t)                           (concat "\n" (symbol-name (car extra)) ":") nil t)
5857                      (push (cons (car extra) (nnheader-header-value))                      (push (cons (car extra) (nnheader-header-value))
5858                            out))                            out))
5859                    (pop extra))                    (pop extra))
# Line 4952  Return a list of headers that match SEQU Line 5888  Return a list of headers that match SEQU
5888          (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)          (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5889          (cur nntp-server-buffer)          (cur nntp-server-buffer)
5890          (dependencies (or dependencies gnus-newsgroup-dependencies))          (dependencies (or dependencies gnus-newsgroup-dependencies))
5891            (allp (cond
5892                   ((eq gnus-read-all-available-headers t)
5893                    t)
5894                   ((stringp gnus-read-all-available-headers)
5895                    (string-match gnus-read-all-available-headers group))
5896                   (t
5897                    nil)))
5898          number headers header)          number headers header)
5899      (save-excursion      (save-excursion
5900        (set-buffer nntp-server-buffer)        (set-buffer nntp-server-buffer)
# Line 4959  Return a list of headers that match SEQU Line 5902  Return a list of headers that match SEQU
5902        ;; Allow the user to mangle the headers before parsing them.        ;; Allow the user to mangle the headers before parsing them.
5903        (gnus-run-hooks 'gnus-parse-headers-hook)        (gnus-run-hooks 'gnus-parse-headers-hook)
5904        (goto-char (point-min))        (goto-char (point-min))
5905        (while (not (eobp))        (gnus-parse-without-error
5906          (condition-case ()          (while (and (or sequence allp)
5907              (while (and sequence (not (eobp)))                      (not (eobp)))
5908                (setq number (read cur))            (setq number (read cur))
5909                (while (and sequence            (when (not allp)
5910                            (< (car sequence) number))              (while (and sequence
5911                  (setq sequence (cdr sequence)))                          (< (car sequence) number))
5912                (and sequence                (setq sequence (cdr sequence))))
5913                     (eq number (car sequence))            (when (and (or allp
5914                     (progn                           (and sequence
5915                       (setq sequence (cdr sequence))                                (eq number (car sequence))))
5916                       (setq header (inline                       (progn
5917                                      (gnus-nov-parse-line                         (setq sequence (cdr sequence))
5918                                       number dependencies force-new))))                         (setq header (inline
5919                     (push header headers))                                        (gnus-nov-parse-line
5920                (forward-line 1))                                         number dependencies force-new)))))
5921            (error              (push header headers))
5922             (gnus-error 4 "Strange nov line (%d)"            (forward-line 1)))
                        (count-lines (point-min) (point)))))  
         (forward-line 1))  
5923        ;; A common bug in inn is that if you have posted an article and        ;; A common bug in inn is that if you have posted an article and
5924        ;; then retrieves the active file, it will answer correctly --        ;; then retrieves the active file, it will answer correctly --
5925        ;; the new article is included.  However, a NOV entry for the        ;; the new article is included.  However, a NOV entry for the
# Line 4992  Return a list of headers that match SEQU Line 5933  Return a list of headers that match SEQU
5933          (let ((gnus-nov-is-evil t))          (let ((gnus-nov-is-evil t))
5934            (nconc            (nconc
5935             (nreverse headers)             (nreverse headers)
5936             (when (gnus-retrieve-headers sequence group)             (when (eq (gnus-retrieve-headers sequence group) 'headers)
5937               (gnus-get-newsgroup-headers))))))))               (gnus-get-newsgroup-headers))))))))
5938    
5939  (defun gnus-article-get-xrefs ()  (defun gnus-article-get-xrefs ()
# Line 5014  This is meant to be called in `gnus-arti Line 5955  This is meant to be called in `gnus-arti
5955                             (looking-at "Xref:"))                             (looking-at "Xref:"))
5956                        (search-forward "\nXref:" nil t))                        (search-forward "\nXref:" nil t))
5957                (goto-char (1+ (match-end 0)))                (goto-char (1+ (match-end 0)))
5958                (setq xref (buffer-substring (point)                (setq xref (buffer-substring (point) (gnus-point-at-eol)))
                                            (progn (end-of-line) (point))))  
5959                (mail-header-set-xref headers xref)))))))                (mail-header-set-xref headers xref)))))))
5960    
5961  (defun gnus-summary-insert-subject (id &optional old-header use-old-header)  (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
# Line 5047  the subject line on." Line 5987  the subject line on."
5987                (prog1                (prog1
5988                    (1+ (gnus-point-at-eol))                    (1+ (gnus-point-at-eol))
5989                  (gnus-delete-line))))))                  (gnus-delete-line))))))
5990          ;; Remove list identifiers from subject.
5991          (when gnus-list-identifiers
5992            (let ((gnus-newsgroup-headers (list header)))
5993              (gnus-summary-remove-list-identifiers)
5994              (setq header (car gnus-newsgroup-headers))))
5995        (when old-header        (when old-header
5996          (mail-header-set-number header (mail-header-number old-header)))          (mail-header-set-number header (mail-header-number old-header)))
5997        (setq gnus-newsgroup-sparse        (setq gnus-newsgroup-sparse
# Line 5177  If EXCLUDE-GROUP, do not go to this grou Line 6122  If EXCLUDE-GROUP, do not go to this grou
6122      (save-excursion      (save-excursion
6123        (gnus-group-best-unread-group exclude-group))))        (gnus-group-best-unread-group exclude-group))))
6124    
6125  (defun gnus-summary-find-next (&optional unread article backward undownloaded)  (defun gnus-summary-find-next (&optional unread article backward)
6126    (if backward (gnus-summary-find-prev)    (if backward
6127          (gnus-summary-find-prev unread article)
6128      (let* ((dummy (gnus-summary-article-intangible-p))      (let* ((dummy (gnus-summary-article-intangible-p))
6129             (article (or article (gnus-summary-article-number)))             (article (or article (gnus-summary-article-number)))
6130             (arts (gnus-data-find-list article))             (data (gnus-data-find-list article))
6131             result)             result)
6132        (when (and (not dummy)        (when (and (not dummy)
6133                   (or (not gnus-summary-check-current)                   (or (not gnus-summary-check-current)
6134                       (not unread)                       (not unread)
6135                       (not (gnus-data-unread-p (car arts)))))                       (not (gnus-data-unread-p (car data)))))
6136          (setq arts (cdr arts)))          (setq data (cdr data)))
6137        (when (setq result        (when (setq result
6138                    (if unread                    (if unread
6139                        (progn                        (progn
6140                          (while arts                          (while data
6141                            (when (or (and undownloaded                            (unless (memq (gnus-data-number (car data))
6142                                           (eq gnus-undownloaded-mark                                          (cond
6143                                               (gnus-data-mark (car arts))))                                           ((eq gnus-auto-goto-ignores
6144                                      (gnus-data-unread-p (car arts)))                                                'always-undownloaded)
6145                              (setq result (car arts)                                            gnus-newsgroup-undownloaded)
6146                                    arts nil))                                           (gnus-plugged
6147                            (setq arts (cdr arts)))                                            nil)
6148                                             ((eq gnus-auto-goto-ignores
6149                                                  'unfetched)
6150                                              gnus-newsgroup-unfetched)
6151                                             ((eq gnus-auto-goto-ignores
6152                                                  'undownloaded)
6153                                              gnus-newsgroup-undownloaded)))
6154                                (when (gnus-data-unread-p (car data))
6155                                  (setq result (car data)
6156                                        data nil)))
6157                              (setq data (cdr data)))
6158                          result)                          result)
6159                      (car arts)))                      (car data)))
6160          (goto-char (gnus-data-pos result))          (goto-char (gnus-data-pos result))
6161          (gnus-data-number result)))))          (gnus-data-number result)))))
6162    
6163  (defun gnus-summary-find-prev (&optional unread article)  (defun gnus-summary-find-prev (&optional unread article)
6164    (let* ((eobp (eobp))    (let* ((eobp (eobp))
6165           (article (or article (gnus-summary-article-number)))           (article (or article (gnus-summary-article-number)))
6166           (arts (gnus-data-find-list article (gnus-data-list 'rev)))           (data (gnus-data-find-list article (gnus-data-list 'rev)))
6167           result)           result)
6168      (when (and (not eobp)      (when (and (not eobp)
6169                 (or (not gnus-summary-check-current)                 (or (not gnus-summary-check-current)
6170                     (not unread)                     (not unread)
6171                     (not (gnus-data-unread-p (car arts)))))                     (not (gnus-data-unread-p (car data)))))
6172        (setq arts (cdr arts)))        (setq data (cdr data)))
6173      (when (setq result      (when (setq result
6174                  (if unread                  (if unread
6175                      (progn                      (progn
6176                        (while arts                        (while data
6177                          (when (gnus-data-unread-p (car arts))                          (unless (memq (gnus-data-number (car data))
6178                            (setq result (car arts)                                        (cond
6179                                  arts nil))                                         ((eq gnus-auto-goto-ignores
6180                          (setq arts (cdr arts)))                                              'always-undownloaded)
6181                                            gnus-newsgroup-undownloaded)
6182                                           (gnus-plugged
6183                                            nil)
6184                                           ((eq gnus-auto-goto-ignores
6185                                                'unfetched)
6186                                            gnus-newsgroup-unfetched)
6187                                           ((eq gnus-auto-goto-ignores
6188                                                'undownloaded)
6189                                            gnus-newsgroup-undownloaded)))
6190                              (when (gnus-data-unread-p (car data))
6191                                (setq result (car data)
6192                                      data nil)))
6193                            (setq data (cdr data)))
6194                        result)                        result)
6195                    (car arts)))                    (car data)))
6196        (goto-char (gnus-data-pos result))        (goto-char (gnus-data-pos result))
6197        (gnus-data-number result))))        (gnus-data-number result))))
6198    
# Line 5274  displayed, no centering will be performe Line 6243  displayed, no centering will be performe
6243    ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).    ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6244    ;; Recenter only when requested.  Suggested by popovich@park.cs.columbia.edu.    ;; Recenter only when requested.  Suggested by popovich@park.cs.columbia.edu.
6245    (interactive)    (interactive)
6246    (let* ((top (cond ((< (window-height) 4) 0)    ;; The user has to want it.
6247                      ((< (window-height) 7) 1)    (when gnus-auto-center-summary
6248                      (t (if (numberp gnus-auto-center-summary)      (let* ((top (cond ((< (window-height) 4) 0)
6249                             gnus-auto-center-summary                        ((< (window-height) 7) 1)
6250                           2))))                        (t (if (numberp gnus-auto-center-summary)
6251           (height (1- (window-height)))                               gnus-auto-center-summary
6252           (bottom (save-excursion (goto-char (point-max))                             2))))
6253                                   (forward-line (- height))             (height (1- (window-height)))
6254                                   (point)))             (bottom (save-excursion (goto-char (point-max))
6255           (window (get-buffer-window (current-buffer))))                                     (forward-line (- height))
6256      ;; The user has to want it.                                     (point)))
6257      (when gnus-auto-center-summary             (window (get-buffer-window (current-buffer))))
6258        (when (get-buffer-window gnus-article-buffer)        (when (get-buffer-window gnus-article-buffer)
6259          ;; Only do recentering when the article buffer is displayed,          ;; Only do recentering when the article buffer is displayed,
6260          ;; Set the window start to either `bottom', which is the biggest          ;; Set the window start to either `bottom', which is the biggest
# Line 5377  displayed, no centering will be performe Line 6346  displayed, no centering will be performe
6346           (marked (gnus-info-marks info))           (marked (gnus-info-marks info))
6347           (active (gnus-active group)))           (active (gnus-active group)))
6348      (and info active      (and info active
6349           (gnus-set-difference           (gnus-list-range-difference
6350            (gnus-sorted-complement            (gnus-list-range-difference
6351             (gnus-uncompress-range active)             (gnus-sorted-complement
6352             (gnus-list-of-unread-articles group))              (gnus-uncompress-range active)
6353            (append              (gnus-list-of-unread-articles group))
6354             (gnus-uncompress-range (cdr (assq 'dormant marked)))             (cdr (assq 'dormant marked)))
6355             (gnus-uncompress-range (cdr (assq 'tick marked))))))))            (cdr (assq 'tick marked))))))
6356    
6357  ;; Various summary commands  ;; Various summary commands
6358    
# Line 5419  displayed, no centering will be performe Line 6388  displayed, no centering will be performe
6388    
6389  (defun gnus-summary-toggle-truncation (&optional arg)  (defun gnus-summary-toggle-truncation (&optional arg)
6390    "Toggle truncation of summary lines.    "Toggle truncation of summary lines.
6391  With arg, turn line truncation on if arg is positive."  With ARG, turn line truncation on if ARG is positive."
6392    (interactive "P")    (interactive "P")
6393    (setq truncate-lines    (setq truncate-lines
6394          (if (null arg) (not truncate-lines)          (if (null arg) (not truncate-lines)
6395            (> (prefix-numeric-value arg) 0)))            (> (prefix-numeric-value arg) 0)))
6396    (redraw-display))    (redraw-display))
6397    
6398    (defun gnus-summary-find-for-reselect ()
6399      "Return the number of an article to stay on across a reselect.
6400    The current article is considered, then following articles, then previous
6401    articles.  An article is sought which is not cancelled and isn't a temporary
6402    insertion from another group.  If there's no such then return a dummy 0."
6403      (let (found)
6404        (dolist (rev '(nil t))
6405          (unless found      ; don't demand the reverse list if we don't need it
6406            (let ((data (gnus-data-find-list
6407                         (gnus-summary-article-number) (gnus-data-list rev))))
6408              (while (and data (not found))
6409                (if (and (< 0 (gnus-data-number (car data)))
6410                         (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6411                    (setq found (gnus-data-number (car data))))
6412                (setq data (cdr data))))))
6413        (or found 0)))
6414    
6415  (defun gnus-summary-reselect-current-group (&optional all rescan)  (defun gnus-summary-reselect-current-group (&optional all rescan)
6416    "Exit and then reselect the current newsgroup.    "Exit and then reselect the current newsgroup.
6417  The prefix argument ALL means to select all articles."  The prefix argument ALL means to select all articles."
6418    (interactive "P")    (interactive "P")
6419    (when (gnus-ephemeral-group-p gnus-newsgroup-name)    (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6420      (error "Ephemeral groups can't be reselected"))      (error "Ephemeral groups can't be reselected"))
6421    (let ((current-subject (gnus-summary-article-number))    (let ((current-subject (gnus-summary-find-for-reselect))
6422          (group gnus-newsgroup-name))          (group gnus-newsgroup-name))
6423      (setq gnus-newsgroup-begin nil)      (setq gnus-newsgroup-begin nil)
6424      (gnus-summary-exit)      (gnus-summary-exit nil 'leave-hidden)
6425      ;; We have to adjust the point of group mode buffer because      ;; We have to adjust the point of group mode buffer because
6426      ;; point was moved to the next unread newsgroup by exiting.      ;; point was moved to the next unread newsgroup by exiting.
6427      (gnus-summary-jump-to-group group)      (gnus-summary-jump-to-group group)
# Line 5457  The prefix argument ALL means to select Line 6443  The prefix argument ALL means to select
6443          (when gnus-newsgroup-kill-headers          (when gnus-newsgroup-kill-headers
6444            (setq gnus-newsgroup-killed            (setq gnus-newsgroup-killed
6445                  (gnus-compress-sequence                  (gnus-compress-sequence
6446                   (nconc                   (gnus-sorted-union
6447                    (gnus-set-sorted-intersection                    (gnus-list-range-intersection
6448                     (gnus-uncompress-range gnus-newsgroup-killed)                     gnus-newsgroup-unselected gnus-newsgroup-killed)
6449                     (setq gnus-newsgroup-unselected                    gnus-newsgroup-unreads)
                          (sort gnus-newsgroup-unselected '<)))  
                   (setq gnus-newsgroup-unreads  
                         (sort gnus-newsgroup-unreads '<)))  
6450                   t)))                   t)))
6451          (unless (listp (cdr gnus-newsgroup-killed))          (unless (listp (cdr gnus-newsgroup-killed))
6452            (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))            (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
# Line 5473  The prefix argument ALL means to select Line 6456  The prefix argument ALL means to select
6456              (set-buffer gnus-group-buffer)              (set-buffer gnus-group-buffer)
6457              (gnus-undo-force-boundary))              (gnus-undo-force-boundary))
6458            (gnus-update-read-articles            (gnus-update-read-articles
6459             group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))             group (gnus-sorted-union
6460                      gnus-newsgroup-unreads gnus-newsgroup-unselected))
6461            ;; Set the current article marks.            ;; Set the current article marks.
6462            (let ((gnus-newsgroup-scored            (let ((gnus-newsgroup-scored
6463                   (if (and (not gnus-save-score)                   (if (and (not gnus-save-score)
# Line 5500  If FORCE (the prefix), also save the .ne Line 6484  If FORCE (the prefix), also save the .ne
6484        (gnus-save-newsrc-file)        (gnus-save-newsrc-file)
6485      (gnus-dribble-save)))      (gnus-dribble-save)))
6486    
6487  (defun gnus-summary-exit (&optional temporary)  (defun gnus-summary-exit (&optional temporary leave-hidden)
6488    "Exit reading current newsgroup, and then return to group selection mode.    "Exit reading current newsgroup, and then return to group selection mode.
6489  `gnus-exit-group-hook' is called with no arguments if that value is non-nil."  `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6490    (interactive)    (interactive)
# Line 5516  If FORCE (the prefix), also save the .ne Line 6500  If FORCE (the prefix), also save the .ne
6500    (gnus-async-halt-prefetch)    (gnus-async-halt-prefetch)
6501    (let* ((group gnus-newsgroup-name)    (let* ((group gnus-newsgroup-name)
6502           (quit-config (gnus-group-quit-config gnus-newsgroup-name))           (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6503             (gnus-group-is-exiting-p t)
6504           (mode major-mode)           (mode major-mode)
6505           (group-point nil)           (group-point nil)
6506           (buf (current-buffer)))           (buf (current-buffer)))
6507      (unless quit-config      (unless quit-config
6508        ;; Do adaptive scoring, and possibly save score files.        ;; Do adaptive scoring, and possibly save score files.
# Line 5567  If FORCE (the prefix), also save the .ne Line 6552  If FORCE (the prefix), also save the .ne
6552          (setq gnus-article-current nil))          (setq gnus-article-current nil))
6553        (set-buffer buf)        (set-buffer buf)
6554        (if (not gnus-kill-summary-on-exit)        (if (not gnus-kill-summary-on-exit)
6555            (gnus-deaden-summary)            (progn
6556                (gnus-deaden-summary)
6557                (setq mode nil))
6558          ;; We set all buffer-local variables to nil.  It is unclear why          ;; We set all buffer-local variables to nil.  It is unclear why
6559          ;; this is needed, but if we don't, buffer-local variables are          ;; this is needed, but if we don't, buffer-local variables are
6560          ;; not garbage-collected, it seems.  This would the lead to en          ;; not garbage-collected, it seems.  This would the lead to en
6561          ;; ever-growing Emacs.          ;; ever-growing Emacs.
6562          (gnus-summary-clear-local-variables)          (gnus-summary-clear-local-variables)
6563            (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6564              (gnus-summary-clear-local-variables))
6565          (when (get-buffer gnus-article-buffer)          (when (get-buffer gnus-article-buffer)
6566            (bury-buffer gnus-article-buffer))            (bury-buffer gnus-article-buffer))
6567          ;; We clear the global counterparts of the buffer-local          ;; We clear the global counterparts of the buffer-local
6568          ;; variables as well, just to be on the safe side.          ;; variables as well, just to be on the safe side.
6569          (set-buffer gnus-group-buffer)          (set-buffer gnus-group-buffer)
6570          (gnus-summary-clear-local-variables)          (gnus-summary-clear-local-variables)
6571            (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6572              (gnus-summary-clear-local-variables))
6573          ;; Return to group mode buffer.          ;; Return to group mode buffer.
6574          (when (eq mode 'gnus-summary-mode)          (when (eq mode 'gnus-summary-mode)
6575            (gnus-kill-buffer buf)))            (gnus-kill-buffer buf)))
6576        (setq gnus-current-select-method gnus-select-method)        (setq gnus-current-select-method gnus-select-method)
6577        (pop-to-buffer gnus-group-buffer)        (if leave-hidden
6578              (set-buffer gnus-group-buffer)
6579            (pop-to-buffer gnus-group-buffer))
6580        (if (not quit-config)        (if (not quit-config)
6581            (progn            (progn
6582              (goto-char group-point)              (goto-char group-point)
6583              (gnus-configure-windows 'group 'force))              (unless leave-hidden
6584                  (gnus-configure-windows 'group 'force)))
6585          (gnus-handle-ephemeral-exit quit-config))          (gnus-handle-ephemeral-exit quit-config))
6586        ;; Clear the current group name.        ;; Clear the current group name.
6587        (unless quit-config        (unless quit-config
# Line 5598  If FORCE (the prefix), also save the .ne Line 6592  If FORCE (the prefix), also save the .ne
6592    "Quit reading current newsgroup without updating read article info."    "Quit reading current newsgroup without updating read article info."
6593    (interactive)    (interactive)
6594    (let* ((group gnus-newsgroup-name)    (let* ((group gnus-newsgroup-name)
6595             (gnus-group-is-exiting-p t)
6596             (gnus-group-is-exiting-without-update-p t)
6597           (quit-config (gnus-group-quit-config group)))           (quit-config (gnus-group-quit-config group)))
6598      (when (or no-questions      (when (or no-questions
6599                gnus-expert-user                gnus-expert-user
6600                (gnus-y-or-n-p "Discard changes to this group and exit? "))                (gnus-y-or-n-p "Discard changes to this group and exit? "))
6601        (gnus-async-halt-prefetch)        (gnus-async-halt-prefetch)
6602        (mapcar 'funcall        (run-hooks 'gnus-summary-prepare-exit-hook)
               (delq 'gnus-summary-expire-articles  
                     (copy-sequence gnus-summary-prepare-exit-hook)))  
6603        (when (gnus-buffer-live-p gnus-article-buffer)        (when (gnus-buffer-live-p gnus-article-buffer)
6604          (save-excursion          (save-excursion
6605            (set-buffer gnus-article-buffer)            (set-buffer gnus-article-buffer)
# Line 5622  If FORCE (the prefix), also save the .ne Line 6616  If FORCE (the prefix), also save the .ne
6616            (gnus-deaden-summary)            (gnus-deaden-summary)
6617          (gnus-close-group group)          (gnus-close-group group)
6618          (gnus-summary-clear-local-variables)          (gnus-summary-clear-local-variables)
6619            (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6620              (gnus-summary-clear-local-variables))
6621          (set-buffer gnus-group-buffer)          (set-buffer gnus-group-buffer)
6622          (gnus-summary-clear-local-variables)          (gnus-summary-clear-local-variables)
6623          (when (get-buffer gnus-summary-buffer)          (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6624            (kill-buffer gnus-summary-buffer)))            (gnus-summary-clear-local-variables))
6625            (gnus-kill-buffer gnus-summary-buffer))
6626        (unless gnus-single-article-buffer        (unless gnus-single-article-buffer
6627          (setq gnus-article-current nil))          (setq gnus-article-current nil))
6628        (when gnus-use-trees        (when gnus-use-trees
# Line 5637  If FORCE (the prefix), also save the .ne Line 6634  If FORCE (the prefix), also save the .ne
6634        (gnus-configure-windows 'group 'force)        (gnus-configure-windows 'group 'force)
6635        ;; Clear the current group name.        ;; Clear the current group name.
6636        (setq gnus-newsgroup-name nil)        (setq gnus-newsgroup-name nil)
6637          (unless (gnus-ephemeral-group-p group)
6638            (gnus-group-update-group group))
6639        (when (equal (gnus-group-group-name) group)        (when (equal (gnus-group-group-name) group)
6640          (gnus-group-next-unread-group 1))          (gnus-group-next-unread-group 1))
6641        (when quit-config        (when quit-config
6642          (gnus-handle-ephemeral-exit quit-config)))))          (gnus-handle-ephemeral-exit quit-config)))))
6643    
6644  (defun gnus-handle-ephemeral-exit (quit-config)  (defun gnus-handle-ephemeral-exit (quit-config)
6645    "Handle movement when leaving an ephemeral group.    "Handle movement when leaving an ephemeral group.
# Line 5649  The state which existed when entering th Line 6648  The state which existed when entering th
6648        (gnus-configure-windows 'group 'force)        (gnus-configure-windows 'group 'force)
6649      (set-buffer (car quit-config))      (set-buffer (car quit-config))
6650      (cond ((eq major-mode 'gnus-summary-mode)      (cond ((eq major-mode 'gnus-summary-mode)
6651             (gnus-set-global-variables))             (gnus-set-global-variables))
6652            ((eq major-mode 'gnus-article-mode)            ((eq major-mode 'gnus-article-mode)
6653             (save-excursion             (save-excursion
6654               ;; The `gnus-summary-buffer' variable may point               ;; The `gnus-summary-buffer' variable may point
6655               ;; to the old summary buffer when using a single               ;; to the old summary buffer when using a single
6656               ;; article buffer.               ;; article buffer.
6657               (unless (gnus-buffer-live-p gnus-summary-buffer)               (unless (gnus-buffer-live-p gnus-summary-buffer)
6658                 (set-buffer gnus-group-buffer))                 (set-buffer gnus-group-buffer))
6659               (set-buffer gnus-summary-buffer)               (set-buffer gnus-summary-buffer)
6660               (gnus-set-global-variables))))               (gnus-set-global-variables))))
6661      (if (or (eq (cdr quit-config) 'article)      (if (or (eq (cdr quit-config) 'article)
6662              (eq (cdr quit-config) 'pick))              (eq (cdr quit-config) 'pick))
6663          (progn          (progn
6664            ;; The current article may be from the ephemeral group            ;; The current article may be from the ephemeral group
6665            ;; thus it is best that we reload this article            ;; thus it is best that we reload this article
6666            (gnus-summary-show-article)            ;;
6667            (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))            ;; If we're exiting from a large digest, this can be
6668                (gnus-configure-windows 'pick 'force)            ;; extremely slow.  So, it's better not to reload it. -- jh.
6669              (gnus-configure-windows (cdr quit-config) 'force)))            ;;(gnus-summary-show-article)
6670              (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6671                  (gnus-configure-windows 'pick 'force)
6672                (gnus-configure-windows (cdr quit-config) 'force)))
6673        (gnus-configure-windows (cdr quit-config) 'force))        (gnus-configure-windows (cdr quit-config) 'force))
6674      (when (eq major-mode 'gnus-summary-mode)      (when (eq major-mode 'gnus-summary-mode)
6675        (gnus-summary-next-subject 1 nil t)        (gnus-summary-next-subject 1 nil t)
# Line 5683  The state which existed when entering th Line 6685  The state which existed when entering th
6685    (suppress-keymap gnus-dead-summary-mode-map)    (suppress-keymap gnus-dead-summary-mode-map)
6686    (substitute-key-definition    (substitute-key-definition
6687     'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)     'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6688    (let ((keys '("\C-d" "\r" "\177" [delete])))    (dolist (key '("\C-d" "\r" "\177" [delete]))
6689      (while keys      (define-key gnus-dead-summary-mode-map
6690        (define-key gnus-dead-summary-mode-map        key 'gnus-summary-wake-up-the-dead))
6691          (pop keys) 'gnus-summary-wake-up-the-dead))))    (dolist (key '("q" "Q"))
6692        (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6693    
6694  (defvar gnus-dead-summary-mode nil  (defvar gnus-dead-summary-mode nil
6695    "Minor mode for Gnus summary buffers.")    "Minor mode for Gnus summary buffers.")
# Line 5732  The state which existed when entering th Line 6735  The state which existed when entering th
6735          (set-buffer buffer)          (set-buffer buffer)
6736          (gnus-kill-buffer gnus-article-buffer)          (gnus-kill-buffer gnus-article-buffer)
6737          (gnus-kill-buffer gnus-original-article-buffer)))          (gnus-kill-buffer gnus-original-article-buffer)))
6738      (cond (gnus-kill-summary-on-exit      (cond
6739             (when (and gnus-use-trees       ;; Kill the buffer.
6740                        (gnus-buffer-exists-p buffer))       (gnus-kill-summary-on-exit
6741               (save-excursion        (when (and gnus-use-trees
6742                 (set-buffer buffer)                   (gnus-buffer-exists-p buffer))
6743                 (gnus-tree-close gnus-newsgroup-name)))          (save-excursion
6744             (gnus-kill-buffer buffer))            (set-buffer buffer)
6745            ((gnus-buffer-exists-p buffer)            (gnus-tree-close gnus-newsgroup-name)))
6746             (save-excursion        (gnus-kill-buffer buffer))
6747               (set-buffer buffer)       ;; Deaden the buffer.
6748               (gnus-deaden-summary))))))       ((gnus-buffer-exists-p buffer)
6749          (save-excursion
6750            (set-buffer buffer)
6751            (gnus-deaden-summary))))))
6752    
6753  (defun gnus-summary-wake-up-the-dead (&rest args)  (defun gnus-summary-wake-up-the-dead (&rest args)
6754    "Wake up the dead summary buffer."    "Wake up the dead summary buffer."
# Line 5789  in." Line 6795  in."
6795  (defun gnus-summary-next-group (&optional no-article target-group backward)  (defun gnus-summary-next-group (&optional no-article target-group backward)
6796    "Exit current newsgroup and then select next unread newsgroup.    "Exit current newsgroup and then select next unread newsgroup.
6797  If prefix argument NO-ARTICLE is non-nil, no article is selected  If prefix argument NO-ARTICLE is non-nil, no article is selected
6798  initially.  If NEXT-GROUP, go to this group.  If BACKWARD, go to  initially.  If TARGET-GROUP, go to this group.  If BACKWARD, go to
6799  previous group instead."  previous group instead."
6800    (interactive "P")    (interactive "P")
6801    ;; Stop pre-fetching.    ;; Stop pre-fetching.
# Line 5826  previous group instead." Line 6832  previous group instead."
6832          (let ((unreads (gnus-group-group-unread)))          (let ((unreads (gnus-group-group-unread)))
6833            (if (and (or (eq t unreads)            (if (and (or (eq t unreads)
6834                         (and unreads (not (zerop unreads))))                         (and unreads (not (zerop unreads))))
6835                     (gnus-summary-read-group                     (gnus-summary-read-group
6836                      target-group nil no-article                      target-group nil no-article
6837                      (and (buffer-name current-buffer) current-buffer)                      (and (buffer-name current-buffer) current-buffer)
6838                      nil backward))                      nil backward))
6839                (setq entered t)                (setq entered t)
6840              (setq current-group target-group              (setq current-group target-group
6841                    target-group nil)))))))                    target-group nil)))))))
# Line 5842  If prefix argument NO-ARTICLE is non-nil Line 6848  If prefix argument NO-ARTICLE is non-nil
6848    
6849  ;; Walking around summary lines.  ;; Walking around summary lines.
6850    
6851  (defun gnus-summary-first-subject (&optional unread undownloaded)  (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6852    "Go to the first unread subject.    "Go to the first subject satisfying any non-nil constraint.
6853  If UNREAD is non-nil, go to the first unread article.  If UNREAD is non-nil, the article should be unread.
6854  Returns the article selected or nil if there are no unread articles."  If UNDOWNLOADED is non-nil, the article should be undownloaded.
6855    If UNSEEN is non-nil, the article should be unseen.
6856    Returns the article selected or nil if there are no matching articles."
6857    (interactive "P")    (interactive "P")
6858    (prog1    (cond
6859        (cond     ;; Empty summary.
6860         ;; Empty summary.     ((null gnus-newsgroup-data)
6861         ((null gnus-newsgroup-data)      (gnus-message 3 "No articles in the group")
6862          (gnus-message 3 "No articles in the group")      nil)
6863          nil)     ;; Pick the first article.
6864         ;; Pick the first article.     ((not (or unread undownloaded unseen))
6865         ((not unread)      (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6866          (goto-char (gnus-data-pos (car gnus-newsgroup-data)))      (gnus-data-number (car gnus-newsgroup-data)))
6867          (gnus-data-number (car gnus-newsgroup-data)))     ;; Find the first unread article.
6868         ;; No unread articles.     (t
6869         ((null gnus-newsgroup-unreads)      (let ((data gnus-newsgroup-data))
6870          (gnus-message 3 "No more unread articles")        (while (and data
6871          nil)                    (let ((num (gnus-data-number (car data))))
6872         ;; Find the first unread article.                      (or (memq num gnus-newsgroup-unfetched)
6873         (t                          (not (or (and unread
6874          (let ((data gnus-newsgroup-data))                                        (memq num gnus-newsgroup-unreads))
6875            (while (and data                                   (and undownloaded
6876                        (and (not (and undownloaded                                        (memq num gnus-newsgroup-undownloaded))
6877                                       (eq gnus-undownloaded-mark                                   (and unseen
6878                                           (gnus-data-mark (car data)))))                                        (memq num gnus-newsgroup-unseen)))))))
6879                             (not (gnus-data-unread-p (car data)))))          (setq data (cdr data)))
6880              (setq data (cdr data)))        (prog1
6881            (when data            (if data
6882              (goto-char (gnus-data-pos (car data)))                (progn
6883              (gnus-data-number (car data))))))                  (goto-char (gnus-data-pos (car data)))
6884      (gnus-summary-position-point)))                  (gnus-data-number (car data)))
6885                (gnus-message 3 "No more%s articles"
6886                              (let* ((r (when unread " unread"))
6887                                     (d (when undownloaded " undownloaded"))
6888                                     (s (when unseen " unseen"))
6889                                     (l (delq nil (list r d s))))
6890                                (cond ((= 3 (length l))
6891                                       (concat r "," d ", or" s))
6892                                      ((= 2 (length l))
6893                                       (concat (car l) ", or" (cadr l)))
6894                                      ((= 1 (length l))
6895                                       (car l))
6896                                      (t
6897                                       ""))))
6898                nil
6899                )
6900            (gnus-summary-position-point))))))
6901    
6902  (defun gnus-summary-next-subject (n &optional unread dont-display)  (defun gnus-summary-next-subject (n &optional unread dont-display)
6903    "Go to next N'th summary line.    "Go to next N'th summary line.
# Line 5914  If optional argument UNREAD is non-nil, Line 6938  If optional argument UNREAD is non-nil,
6938    (interactive "p")    (interactive "p")
6939    (gnus-summary-next-subject (- n) t))    (gnus-summary-next-subject (- n) t))
6940    
6941    (defun gnus-summary-goto-subjects (articles)
6942      "Insert the subject header for ARTICLES in the current buffer."
6943      (save-excursion
6944        (dolist (article articles)
6945          (gnus-summary-goto-subject article t)))
6946      (gnus-summary-limit (append articles gnus-newsgroup-limit))
6947      (gnus-summary-position-point))
6948    
6949  (defun gnus-summary-goto-subject (article &optional force silent)  (defun gnus-summary-goto-subject (article &optional force silent)
6950    "Go the subject line of ARTICLE.    "Go the subject line of ARTICLE.
6951  If FORCE, also allow jumping to articles not currently shown."  If FORCE, also allow jumping to articles not currently shown."
6952    (interactive "nArticle number: ")    (interactive "nArticle number: ")
6953      (unless (numberp article)
6954        (error "Article %s is not a number" article))
6955    (let ((b (point))    (let ((b (point))
6956          (data (gnus-data-find article)))          (data (gnus-data-find article)))
6957      ;; We read in the article if we have to.      ;; We read in the article if we have to.
# Line 5934  If FORCE, also allow jumping to articles Line 6968  If FORCE, also allow jumping to articles
6968            (unless silent            (unless silent
6969              (gnus-message 3 "Can't find article %d" article))              (gnus-message 3 "Can't find article %d" article))
6970            nil)            nil)
6971        (goto-char (gnus-data-pos data))        (let ((pt (gnus-data-pos data)))
6972            (goto-char pt)
6973            (gnus-summary-set-article-display-arrow pt))
6974        (gnus-summary-position-point)        (gnus-summary-position-point)
6975        article)))        article)))
6976    
# Line 5954  Given a prefix, will force an `article' Line 6990  Given a prefix, will force an `article'
6990      (with-current-buffer gnus-article-buffer      (with-current-buffer gnus-article-buffer
6991        (mm-enable-multibyte)))        (mm-enable-multibyte)))
6992    (gnus-set-global-variables)    (gnus-set-global-variables)
6993      (when (gnus-buffer-live-p gnus-article-buffer)
6994        (with-current-buffer gnus-article-buffer
6995          (setq gnus-article-charset gnus-newsgroup-charset)
6996          (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
6997          (mm-enable-multibyte)))
6998    (if (null article)    (if (null article)
6999        nil        nil
7000      (prog1      (prog1
# Line 6004  be displayed." Line 7045  be displayed."
7045            (progn            (progn
7046              (gnus-summary-display-article article all-headers)              (gnus-summary-display-article article all-headers)
7047              (when (gnus-buffer-live-p gnus-article-buffer)              (when (gnus-buffer-live-p gnus-article-buffer)
7048                 (with-current-buffer gnus-article-buffer                (with-current-buffer gnus-article-buffer
7049                  (if (not gnus-article-decoded-p) ;; a local variable                  (if (not gnus-article-decoded-p) ;; a local variable
7050                      (mm-disable-multibyte))))                      (mm-disable-multibyte))))
             (when (or all-headers gnus-show-all-headers)  
               (gnus-article-show-all-headers))  
7051              (gnus-article-set-window-start              (gnus-article-set-window-start
7052               (cdr (assq article gnus-newsgroup-bookmarks)))               (cdr (assq article gnus-newsgroup-bookmarks)))
7053              article)              article)
         (when (or all-headers gnus-show-all-headers)  
           (gnus-article-show-all-headers))  
7054          'old))))          'old))))
7055    
7056    (defun gnus-summary-force-verify-and-decrypt ()
7057      "Display buttons for signed/encrypted parts and verify/decrypt them."
7058      (interactive)
7059      (let ((mm-verify-option 'known)
7060            (mm-decrypt-option 'known)
7061            (gnus-article-emulate-mime t)
7062            (gnus-buttonized-mime-types (append (list "multipart/signed"
7063                                                      "multipart/encrypted")
7064                                                gnus-buttonized-mime-types)))
7065        (gnus-summary-select-article nil 'force)))
7066    
7067  (defun gnus-summary-set-current-mark (&optional current-mark)  (defun gnus-summary-set-current-mark (&optional current-mark)
7068    "Obsolete function."    "Obsolete function."
7069    nil)    nil)
# Line 6087  If BACKWARD, the previous article is sel Line 7135  If BACKWARD, the previous article is sel
7135    (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))    (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7136                        (?\C-p (gnus-group-prev-unread-group 1))))                        (?\C-p (gnus-group-prev-unread-group 1))))
7137          (cursor-in-echo-area t)          (cursor-in-echo-area t)
7138          keve key group ended)          keve key group ended prompt)
7139      (save-excursion      (save-excursion
7140        (set-buffer gnus-group-buffer)        (set-buffer gnus-group-buffer)
7141        (goto-char start)        (goto-char start)
# Line 6096  If BACKWARD, the previous article is sel Line 7144  If BACKWARD, the previous article is sel
7144                  (gnus-summary-best-group gnus-newsgroup-name)                  (gnus-summary-best-group gnus-newsgroup-name)
7145                (gnus-summary-search-group backward gnus-keep-same-level))))                (gnus-summary-search-group backward gnus-keep-same-level))))
7146      (while (not ended)      (while (not ended)
7147        (gnus-message        (setq prompt
7148         5 "No more%s articles%s" (if unread " unread" "")              (format
7149         (if (and group               "No more%s articles%s " (if unread " unread" "")
7150                  (not (gnus-ephemeral-group-p gnus-newsgroup-name)))               (if (and group
7151             (format " (Type %s for %s [%s])"                        (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7152                     (single-key-description cmd) group                   (format " (Type %s for %s [%s])"
7153                     (car (gnus-gethash group gnus-newsrc-hashtb)))                           (single-key-description cmd) group
7154           (format " (Type %s to exit %s)"                           (car (gnus-gethash group gnus-newsrc-hashtb)))
7155                   (single-key-description cmd)                 (format " (Type %s to exit %s)"
7156                   gnus-newsgroup-name)))                         (single-key-description cmd)
7157                           gnus-newsgroup-name))))
7158        ;; Confirm auto selection.        ;; Confirm auto selection.
7159        (setq key (car (setq keve (gnus-read-event-char))))        (setq key (car (setq keve (gnus-read-event-char prompt)))
7160        (setq ended t)              ended t)
7161        (cond        (cond
7162         ((assq key keystrokes)         ((assq key keystrokes)
7163          (let ((obuf (current-buffer)))          (let ((obuf (current-buffer)))
# Line 6151  If UNREAD is non-nil, only unread articl Line 7200  If UNREAD is non-nil, only unread articl
7200     (and gnus-auto-select-same     (and gnus-auto-select-same
7201          (gnus-summary-article-subject))))          (gnus-summary-article-subject))))
7202    
7203  (defun gnus-summary-next-page (&optional lines circular)  (defun gnus-summary-next-page (&optional lines circular stop)
7204    "Show next page of the selected article.    "Show next page of the selected article.
7205  If at the end of the current article, select the next article.  If at the end of the current article, select the next article.
7206  LINES says how many lines should be scrolled up.  LINES says how many lines should be scrolled up.
7207    
7208  If CIRCULAR is non-nil, go to the start of the article instead of  If CIRCULAR is non-nil, go to the start of the article instead of
7209  selecting the next article when reaching the end of the current  selecting the next article when reaching the end of the current
7210  article."  article.
7211    
7212    If STOP is non-nil, just stop when reaching the end of the message.
7213    
7214    Also see the variable `gnus-article-skip-boring'."
7215    (interactive "P")    (interactive "P")
7216    (setq gnus-summary-buffer (current-buffer))    (setq gnus-summary-buffer (current-buffer))
7217    (gnus-set-global-variables)    (gnus-set-global-variables)
# Line 6182  article." Line 7235  article."
7235            (gnus-summary-display-article article)            (gnus-summary-display-article article)
7236          (when article-window          (when article-window
7237            (gnus-eval-in-buffer-window gnus-article-buffer            (gnus-eval-in-buffer-window gnus-article-buffer
7238              (setq endp (gnus-article-next-page lines)))              (setq endp (or (gnus-article-next-page lines)
7239                               (gnus-article-only-boring-p))))
7240            (when endp            (when endp
7241              (cond (circular              (cond (stop
7242                       (gnus-message 3 "End of message"))
7243                      (circular
7244                     (gnus-summary-beginning-of-article))                     (gnus-summary-beginning-of-article))
7245                    (lines                    (lines
7246                     (gnus-message 3 "End of message"))                     (gnus-message 3 "End of message"))
# Line 6296  Return nil if there are no unread articl Line 7352  Return nil if there are no unread articl
7352          (gnus-summary-first-subject t))          (gnus-summary-first-subject t))
7353      (gnus-summary-position-point)))      (gnus-summary-position-point)))
7354    
7355    (defun gnus-summary-first-unseen-subject ()
7356      "Place the point on the subject line of the first unseen article.
7357    Return nil if there are no unseen articles."
7358      (interactive)
7359      (prog1
7360          (when (gnus-summary-first-subject nil nil t)
7361            (gnus-summary-show-thread)
7362            (gnus-summary-first-subject nil nil t))
7363        (gnus-summary-position-point)))
7364    
7365    (defun gnus-summary-first-unseen-or-unread-subject ()
7366      "Place the point on the subject line of the first unseen article or,
7367    if all article have been seen, on the subject line of the first unread
7368    article."
7369      (interactive)
7370      (prog1
7371          (unless (when (gnus-summary-first-subject nil nil t)
7372                    (gnus-summary-show-thread)
7373                    (gnus-summary-first-subject nil nil t))
7374            (when (gnus-summary-first-subject t)
7375              (gnus-summary-show-thread)
7376              (gnus-summary-first-subject t)))
7377        (gnus-summary-position-point)))
7378    
7379  (defun gnus-summary-first-article ()  (defun gnus-summary-first-article ()
7380    "Select the first article.    "Select the first article.
7381  Return nil if there are no articles."  Return nil if there are no articles."
# Line 6307  Return nil if there are no articles." Line 7387  Return nil if there are no articles."
7387          (gnus-summary-display-article (gnus-summary-article-number)))          (gnus-summary-display-article (gnus-summary-article-number)))
7388      (gnus-summary-position-point)))      (gnus-summary-position-point)))
7389    
7390  (defun gnus-summary-best-unread-article ()  (defun gnus-summary-best-unread-article (&optional arg)
7391    "Select the unread article with the highest score."    "Select the unread article with the highest score.
7392    If given a prefix argument, select the next unread article that has a
7393    score higher than the default score."
7394      (interactive "P")
7395      (let ((article (if arg
7396                         (gnus-summary-better-unread-subject)
7397                       (gnus-summary-best-unread-subject))))
7398        (if article
7399            (gnus-summary-goto-article article)
7400          (error "No unread articles"))))
7401    
7402    (defun gnus-summary-best-unread-subject ()
7403      "Select the unread subject with the highest score."
7404    (interactive)    (interactive)
7405    (let ((best -1000000)    (let ((best -1000000)
7406          (data gnus-newsgroup-data)          (data gnus-newsgroup-data)
# Line 6321  Return nil if there are no articles." Line 7413  Return nil if there are no articles."
7413             (setq best score             (setq best score
7414                   article (gnus-data-number (car data))))                   article (gnus-data-number (car data))))
7415        (setq data (cdr data)))        (setq data (cdr data)))
7416      (prog1      (when article
7417          (if article        (gnus-summary-goto-subject article))
7418              (gnus-summary-goto-article article)      (gnus-summary-position-point)
7419            (error "No unread articles"))      article))
7420        (gnus-summary-position-point))))  
7421    (defun gnus-summary-better-unread-subject ()
7422      "Select the first unread subject that has a score over the default score."
7423      (interactive)
7424      (let ((data gnus-newsgroup-data)
7425            article score)
7426        (while (and (setq article (gnus-data-number (car data)))
7427                    (or (gnus-data-read-p (car data))
7428                        (not (> (gnus-summary-article-score article)
7429                                gnus-summary-default-score))))
7430          (setq data (cdr data)))
7431        (when article
7432          (gnus-summary-goto-subject article))
7433        (gnus-summary-position-point)
7434        article))
7435    
7436  (defun gnus-summary-last-subject ()  (defun gnus-summary-last-subject ()
7437    "Go to the last displayed subject line in the group."    "Go to the last displayed subject line in the group."
# Line 6348  is a number, it is the line the article Line 7454  is a number, it is the line the article
7454      t))      t))
7455    (prog1    (prog1
7456        (if (and (stringp article)        (if (and (stringp article)
7457                 (string-match "@" article))                 (string-match "@\\|%40" article))
7458            (gnus-summary-refer-article article)            (gnus-summary-refer-article article)
7459          (when (stringp article)          (when (stringp article)
7460            (setq article (string-to-number article)))            (setq article (string-to-number article)))
# Line 6443  articles that are younger than AGE days. Line 7549  articles that are younger than AGE days.
7549           days)           days)
7550       (while (not days-got)       (while (not days-got)
7551         (setq days (if younger         (setq days (if younger
7552                        (read-string "Limit to articles within (in days): ")                        (read-string "Limit to articles younger than (in days, older when negative): ")
7553                      (read-string "Limit to articles old than (in days): ")))                      (read-string
7554                         "Limit to articles older than (in days, younger when negative): ")))
7555         (when (> (length days) 0)         (when (> (length days) 0)
7556           (setq days (read days)))           (setq days (read days)))
7557         (if (numberp days)         (if (numberp days)
7558             (setq days-got t)             (progn
7559                 (setq days-got t)
7560                 (if (< days 0)
7561                     (progn
7562                       (setq younger (not younger))
7563                       (setq days (* days -1)))))
7564           (message "Please enter a number.")           (message "Please enter a number.")
7565           (sleep-for 1)))           (sleep-for 1)))
7566       (list days younger)))       (list days younger)))
# Line 6476  articles that are younger than AGE days. Line 7588  articles that are younger than AGE days.
7588    (interactive    (interactive
7589     (let ((header     (let ((header
7590            (intern            (intern
7591             (gnus-completing-read             (gnus-completing-read-with-default
7592              (symbol-name (car gnus-extra-headers))              (symbol-name (car gnus-extra-headers))
7593              (if current-prefix-arg              (if current-prefix-arg
7594                  "Exclude extra header:"                  "Exclude extra header:"
# Line 6501  articles that are younger than AGE days. Line 7613  articles that are younger than AGE days.
7613            (gnus-summary-limit articles))            (gnus-summary-limit articles))
7614        (gnus-summary-position-point))))        (gnus-summary-position-point))))
7615    
7616    (defun gnus-summary-limit-to-display-predicate ()
7617      "Limit the summary buffer to the predicated in the `display' group parameter."
7618      (interactive)
7619      (unless gnus-newsgroup-display
7620        (error "There is no `display' group parameter"))
7621      (let (articles)
7622        (dolist (number gnus-newsgroup-articles)
7623          (when (funcall gnus-newsgroup-display)
7624            (push number articles)))
7625        (gnus-summary-limit articles))
7626      (gnus-summary-position-point))
7627    
7628  (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)  (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7629  (make-obsolete  (make-obsolete
7630   'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)   'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
# Line 6515  If ALL is non-nil, limit strictly to unr Line 7639  If ALL is non-nil, limit strictly to unr
7639       ;; Concat all the marks that say that an article is read and have       ;; Concat all the marks that say that an article is read and have
7640       ;; those removed.       ;; those removed.
7641       (list gnus-del-mark gnus-read-mark gnus-ancient-mark       (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7642             gnus-killed-mark gnus-kill-file-mark             gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7643             gnus-low-score-mark gnus-expirable-mark             gnus-low-score-mark gnus-expirable-mark
7644             gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark             gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7645             gnus-duplicate-mark gnus-souped-mark)             gnus-duplicate-mark gnus-souped-mark)
# Line 6553  Returns how many articles were removed." Line 7677  Returns how many articles were removed."
7677          (gnus-summary-limit articles))          (gnus-summary-limit articles))
7678      (gnus-summary-position-point)))      (gnus-summary-position-point)))
7679    
7680  (defun gnus-summary-limit-to-score (&optional score)  (defun gnus-summary-limit-to-score (score)
7681    "Limit to articles with score at or above SCORE."    "Limit to articles with score at or above SCORE."
7682    (interactive "P")    (interactive "NLimit to articles with score of at least: ")
   (setq score (if score  
                   (prefix-numeric-value score)  
                 (or gnus-summary-default-score 0)))  
7683    (let ((data gnus-newsgroup-data)    (let ((data gnus-newsgroup-data)
7684          articles)          articles)
7685      (while data      (while data
# Line 6570  Returns how many articles were removed." Line 7691  Returns how many articles were removed."
7691          (gnus-summary-limit articles)          (gnus-summary-limit articles)
7692        (gnus-summary-position-point))))        (gnus-summary-position-point))))
7693    
7694    (defun gnus-summary-limit-to-unseen ()
7695      "Limit to unseen articles."
7696      (interactive)
7697      (prog1
7698          (gnus-summary-limit gnus-newsgroup-unseen)
7699        (gnus-summary-position-point)))
7700    
7701  (defun gnus-summary-limit-include-thread (id)  (defun gnus-summary-limit-include-thread (id)
7702    "Display all the hidden articles that in the current thread."    "Display all the hidden articles that is in the thread with ID in it.
7703    When called interactively, ID is the Message-ID of the current
7704    article."
7705    (interactive (list (mail-header-id (gnus-summary-article-header))))    (interactive (list (mail-header-id (gnus-summary-article-header))))
7706    (let ((articles (gnus-articles-in-thread    (let ((articles (gnus-articles-in-thread
7707                     (gnus-id-to-thread (gnus-root-id id)))))                     (gnus-id-to-thread (gnus-root-id id)))))
7708      (prog1      (prog1
7709          (gnus-summary-limit (nconc articles gnus-newsgroup-limit))          (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7710          (gnus-summary-limit-include-matching-articles
7711           "subject"
7712           (regexp-quote (gnus-simplify-subject-re
7713                          (mail-header-subject (gnus-id-to-header id)))))
7714          (gnus-summary-position-point))))
7715    
7716    (defun gnus-summary-limit-include-matching-articles (header regexp)
7717      "Display all the hidden articles that have HEADERs that match REGEXP."
7718      (interactive (list (read-string "Match on header: ")
7719                         (read-string "Regexp: ")))
7720      (let ((articles (gnus-find-matching-articles header regexp)))
7721        (prog1
7722            (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7723        (gnus-summary-position-point))))        (gnus-summary-position-point))))
7724    
7725    (defun gnus-summary-insert-dormant-articles ()
7726      "Insert all the dormant articles for this group into the current buffer."
7727      (interactive)
7728      (let ((gnus-verbose (max 6 gnus-verbose)))
7729        (if (not gnus-newsgroup-dormant)
7730            (gnus-message 3 "No cached articles for this group")
7731          (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
7732    
7733  (defun gnus-summary-limit-include-dormant ()  (defun gnus-summary-limit-include-dormant ()
7734    "Display all the hidden articles that are marked as dormant.    "Display all the hidden articles that are marked as dormant.
7735  Note that this command only works on a subset of the articles currently  Note that this command only works on a subset of the articles currently
# Line 6625  fetched for this group." Line 7776  fetched for this group."
7776    "Mark all unread excluded articles as read.    "Mark all unread excluded articles as read.
7777  If ALL, mark even excluded ticked and dormants as read."  If ALL, mark even excluded ticked and dormants as read."
7778    (interactive "P")    (interactive "P")
7779    (let ((articles (gnus-sorted-complement    (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7780      (let ((articles (gnus-sorted-ndifference
7781                     (sort                     (sort
7782                      (mapcar (lambda (h) (mail-header-number h))                      (mapcar (lambda (h) (mail-header-number h))
7783                              gnus-newsgroup-headers)                              gnus-newsgroup-headers)
7784                      '<)                      '<)
7785                     (sort gnus-newsgroup-limit '<)))                     gnus-newsgroup-limit))
7786          article)          article)
7787      (setq gnus-newsgroup-unreads      (setq gnus-newsgroup-unreads
7788            (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))            (gnus-sorted-intersection gnus-newsgroup-unreads
7789                                        gnus-newsgroup-limit))
7790      (if all      (if all
7791          (setq gnus-newsgroup-dormant nil          (setq gnus-newsgroup-dormant nil
7792                gnus-newsgroup-marked nil                gnus-newsgroup-marked nil
# Line 6663  If ALL, mark even excluded ticked and do Line 7816  If ALL, mark even excluded ticked and do
7816      ;; according to the new limit.      ;; according to the new limit.
7817      (gnus-summary-prepare)      (gnus-summary-prepare)
7818      ;; Hide any threads, possibly.      ;; Hide any threads, possibly.
7819      (and gnus-show-threads      (gnus-summary-maybe-hide-threads)
          gnus-thread-hide-subtree  
          (gnus-summary-hide-all-threads))  
7820      ;; Try to return to the article you were at, or one in the      ;; Try to return to the article you were at, or one in the
7821      ;; neighborhood.      ;; neighborhood.
7822      (when data      (when data
# Line 6725  If ALL, mark even excluded ticked and do Line 7876  If ALL, mark even excluded ticked and do
7876    thread)    thread)
7877    
7878  (defun gnus-cut-threads (threads)  (defun gnus-cut-threads (threads)
7879    "Cut off all uninteresting articles from the beginning of threads."    "Cut off all uninteresting articles from the beginning of THREADS."
7880    (when (or (eq gnus-fetch-old-headers 'some)    (when (or (eq gnus-fetch-old-headers 'some)
7881              (eq gnus-fetch-old-headers 'invisible)              (eq gnus-fetch-old-headers 'invisible)
7882              (numberp gnus-fetch-old-headers)              (numberp gnus-fetch-old-headers)
# Line 6745  fetch-old-headers verbiage, and so on." Line 7896  fetch-old-headers verbiage, and so on."
7896    ;; Most groups have nothing to remove.    ;; Most groups have nothing to remove.
7897    (if (or gnus-inhibit-limiting    (if (or gnus-inhibit-limiting
7898            (and (null gnus-newsgroup-dormant)            (and (null gnus-newsgroup-dormant)
7899                   (eq gnus-newsgroup-display 'gnus-not-ignore)
7900                 (not (eq gnus-fetch-old-headers 'some))                 (not (eq gnus-fetch-old-headers 'some))
7901                 (not (numberp gnus-fetch-old-headers))                 (not (numberp gnus-fetch-old-headers))
7902                 (not (eq gnus-fetch-old-headers 'invisible))                 (not (eq gnus-fetch-old-headers 'invisible))
# Line 6784  fetch-old-headers verbiage, and so on." Line 7936  fetch-old-headers verbiage, and so on."
7936    ;; will really go down to a leaf article first, before slowly    ;; will really go down to a leaf article first, before slowly
7937    ;; working its way up towards the root.    ;; working its way up towards the root.
7938    (when thread    (when thread
7939      (let ((children      (let* ((max-lisp-eval-depth 5000)
7940               (children
7941             (if (cdr thread)             (if (cdr thread)
7942                 (apply '+ (mapcar 'gnus-summary-limit-children                 (apply '+ (mapcar 'gnus-summary-limit-children
7943                                   (cdr thread)))                                   (cdr thread)))
# Line 6833  fetch-old-headers verbiage, and so on." Line 7986  fetch-old-headers verbiage, and so on."
7986                    (push (cons number gnus-low-score-mark)                    (push (cons number gnus-low-score-mark)
7987                          gnus-newsgroup-reads)))                          gnus-newsgroup-reads)))
7988                t)                t)
7989                ;; Do the `display' group parameter.
7990                (and gnus-newsgroup-display
7991                     (not (funcall gnus-newsgroup-display)))
7992              ;; Check NoCeM things.              ;; Check NoCeM things.
7993              (if (and gnus-use-nocem              (if (and gnus-use-nocem
7994                       (gnus-nocem-unwanted-article-p                       (gnus-nocem-unwanted-article-p
# Line 6890  The difference between N and the number Line 8046  The difference between N and the number
8046              (set-buffer gnus-original-article-buffer)              (set-buffer gnus-original-article-buffer)
8047              (nnheader-narrow-to-headers)              (nnheader-narrow-to-headers)
8048              (unless (setq ref (message-fetch-field "references"))              (unless (setq ref (message-fetch-field "references"))
8049                (setq ref (message-fetch-field "in-reply-to")))                (when (setq ref (message-fetch-field "in-reply-to"))
8050                    (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8051              (widen))              (widen))
8052          (setq ref          (setq ref
8053                ;; It's not the current article, so we take a bet on                ;; It's not the current article, so we take a bet on
# Line 6936  of what's specified by the `gnus-refer-t Line 8093  of what's specified by the `gnus-refer-t
8093    (let ((id (mail-header-id (gnus-summary-article-header)))    (let ((id (mail-header-id (gnus-summary-article-header)))
8094          (limit (if limit (prefix-numeric-value limit)          (limit (if limit (prefix-numeric-value limit)
8095                   gnus-refer-thread-limit)))                   gnus-refer-thread-limit)))
     ;; We want to fetch LIMIT *old* headers, but we also have to  
     ;; re-fetch all the headers in the current buffer, because many of  
     ;; them may be undisplayed.  So we adjust LIMIT.  
     (when (numberp limit)  
       (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))  
8096      (unless (eq gnus-fetch-old-headers 'invisible)      (unless (eq gnus-fetch-old-headers 'invisible)
8097        (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)        (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8098        ;; Retrieve the headers and read them in.        ;; Retrieve the headers and read them in.
8099        (if (eq (gnus-retrieve-headers        (if (eq (if (numberp limit)
8100                 (list gnus-newsgroup-end) gnus-newsgroup-name limit)                    (gnus-retrieve-headers
8101                       (list (min
8102                              (+ (mail-header-number
8103                                  (gnus-summary-article-header))
8104                                 limit)
8105                              gnus-newsgroup-end))
8106                       gnus-newsgroup-name (* limit 2))
8107                    ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8108                    ;; headers.
8109                    (gnus-retrieve-headers (list gnus-newsgroup-end)
8110                                           gnus-newsgroup-name limit))
8111                'nov)                'nov)
8112            (gnus-build-all-threads)            (gnus-build-all-threads)
8113          (error "Can't fetch thread from backends that don't support NOV"))          (error "Can't fetch thread from back ends that don't support NOV"))
8114        (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))        (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8115      (gnus-summary-limit-include-thread id)))      (gnus-summary-limit-include-thread id)))
8116    
# Line 6957  of what's specified by the `gnus-refer-t Line 8119  of what's specified by the `gnus-refer-t
8119    (interactive "sMessage-ID: ")    (interactive "sMessage-ID: ")
8120    (when (and (stringp message-id)    (when (and (stringp message-id)
8121               (not (zerop (length message-id))))               (not (zerop (length message-id))))
8122        (setq message-id (gnus-replace-in-string message-id " " ""))
8123      ;; Construct the correct Message-ID if necessary.      ;; Construct the correct Message-ID if necessary.
8124      ;; Suggested by tale@pawl.rpi.edu.      ;; Suggested by tale@pawl.rpi.edu.
8125      (unless (string-match "^<" message-id)      (unless (string-match "^<" message-id)
8126        (setq message-id (concat "<" message-id)))        (setq message-id (concat "<" message-id)))
8127      (unless (string-match ">$" message-id)      (unless (string-match ">$" message-id)
8128        (setq message-id (concat message-id ">")))        (setq message-id (concat message-id ">")))
8129        ;; People often post MIDs from URLs, so unhex it:
8130        (unless (string-match "@" message-id)
8131          (setq message-id (gnus-url-unhex-string message-id)))
8132      (let* ((header (gnus-id-to-header message-id))      (let* ((header (gnus-id-to-header message-id))
8133             (sparse (and header             (sparse (and header
8134                          (gnus-summary-article-sparse-p                          (gnus-summary-article-sparse-p
# Line 6985  of what's specified by the `gnus-refer-t Line 8151  of what's specified by the `gnus-refer-t
8151          ;; We fetch the article.          ;; We fetch the article.
8152          (catch 'found          (catch 'found
8153            (dolist (gnus-override-method (gnus-refer-article-methods))            (dolist (gnus-override-method (gnus-refer-article-methods))
8154              (gnus-check-server gnus-override-method)              (when (and (gnus-check-server gnus-override-method)
8155              ;; Fetch the header, and display the article.                         ;; Fetch the header,
8156              (when (setq number (gnus-summary-insert-subject message-id))                         (setq number (gnus-summary-insert-subject message-id)))
8157                  ;; and display the article.
8158                (gnus-summary-select-article nil nil nil number)                (gnus-summary-select-article nil nil nil number)
8159                (throw 'found t)))                (throw 'found t)))
8160            (gnus-message 3 "Couldn't fetch article %s" message-id)))))))            (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
# Line 7031  If FORCE, force a digest interpretation. Line 8198  If FORCE, force a digest interpretation.
8198  to guess what the document format is."  to guess what the document format is."
8199    (interactive "P")    (interactive "P")
8200    (let ((conf gnus-current-window-configuration))    (let ((conf gnus-current-window-configuration))
8201      (save-excursion      (save-window-excursion
8202        (gnus-summary-select-article))        (save-excursion
8203            (let (gnus-article-prepare-hook
8204                  gnus-display-mime-function
8205                  gnus-break-pages)
8206              (gnus-summary-select-article))))
8207      (setq gnus-current-window-configuration conf)      (setq gnus-current-window-configuration conf)
8208      (let* ((name (format "%s-%d"      (let* ((name (format "%s-%d"
8209                           (gnus-group-prefixed-name                           (gnus-group-prefixed-name
# Line 7043  to guess what the document format is." Line 8214  to guess what the document format is."
8214             (ogroup gnus-newsgroup-name)             (ogroup gnus-newsgroup-name)
8215             (params (append (gnus-info-params (gnus-get-info ogroup))             (params (append (gnus-info-params (gnus-get-info ogroup))
8216                             (list (cons 'to-group ogroup))                             (list (cons 'to-group ogroup))
8217                               (list (cons 'parent-group ogroup))
8218                             (list (cons 'save-article-group ogroup))))                             (list (cons 'save-article-group ogroup))))
8219             (case-fold-search t)             (case-fold-search t)
8220             (buf (current-buffer))             (buf (current-buffer))
# Line 7051  to guess what the document format is." Line 8223  to guess what the document format is."
8223          (set-buffer gnus-original-article-buffer)          (set-buffer gnus-original-article-buffer)
8224          ;; Have the digest group inherit the main mail address of          ;; Have the digest group inherit the main mail address of
8225          ;; the parent article.          ;; the parent article.
8226          (when (setq to-address (or (message-fetch-field "reply-to")          (when (setq to-address (or (gnus-fetch-field "reply-to")
8227                                     (message-fetch-field "from")))                                     (gnus-fetch-field "from")))
8228            (setq params (append            (setq params (append
8229                          (list (cons 'to-address                          (list (cons 'to-address
8230                                      (funcall gnus-decode-encoded-word-function                                      (funcall gnus-decode-encoded-word-function
# Line 7068  to guess what the document format is." Line 8240  to guess what the document format is."
8240          (delete-matching-lines "^Path:\\|^From ")          (delete-matching-lines "^Path:\\|^From ")
8241          (widen))          (widen))
8242        (unwind-protect        (unwind-protect
8243            (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)            (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8244                      (gnus-newsgroup-ephemeral-ignored-charsets                      (gnus-newsgroup-ephemeral-ignored-charsets
8245                       gnus-newsgroup-ignored-charsets))                       gnus-newsgroup-ignored-charsets))
8246                  (gnus-group-read-ephemeral-group                  (gnus-group-read-ephemeral-group
8247                   name `(nndoc ,name (nndoc-address ,(get-buffer dig))                   name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8248                                (nndoc-article-type                                (nndoc-article-type
8249                                 ,(if force 'mbox 'guess))) t))                                 ,(if force 'mbox 'guess)))
8250                     t nil nil nil
8251                     `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8252                                                            "ADAPT")))))
8253                ;; Make all postings to this group go to the parent group.                ;; Make all postings to this group go to the parent group.
8254                (nconc (gnus-info-params (gnus-get-info name))                (nconc (gnus-info-params (gnus-get-info name))
8255                       params)                       params)
8256              ;; Couldn't select this doc group.              ;; Couldn't select this doc group.
8257              (switch-to-buffer buf)              (switch-to-buffer buf)
8258              (gnus-set-global-variables)              (gnus-set-global-variables)
8259              (gnus-configure-windows 'summary)              (gnus-configure-windows 'summary)
8260              (gnus-message 3 "Article couldn't be entered?"))              (gnus-message 3 "Article couldn't be entered?"))
8261          (kill-buffer dig)))))          (kill-buffer dig)))))
8262    
8263  (defun gnus-summary-read-document (n)  (defun gnus-summary-read-document (n)
# Line 7115  Obeys the standard process/prefix conven Line 8290  Obeys the standard process/prefix conven
8290                                       (nndoc-article-type guess))                                       (nndoc-article-type guess))
8291                         t nil t))                         t nil t))
8292                  (progn                  (progn
8293                    ;; Make all postings to this group go to the parent group.              ;; Make all postings to this group go to the parent group.
8294                    (nconc (gnus-info-params (gnus-get-info egroup))                    (nconc (gnus-info-params (gnus-get-info egroup))
8295                           params)                           params)
8296                    (push egroup groups))                    (push egroup groups))
# Line 7159  If BACKWARD, search backward instead." Line 8334  If BACKWARD, search backward instead."
8334           current-prefix-arg))           current-prefix-arg))
8335    (if (string-equal regexp "")    (if (string-equal regexp "")
8336        (setq regexp (or gnus-last-search-regexp ""))        (setq regexp (or gnus-last-search-regexp ""))
8337      (setq gnus-last-search-regexp regexp))      (setq gnus-last-search-regexp regexp)
8338    (if (gnus-summary-search-article regexp backward)      (setq gnus-article-before-search gnus-current-article))
8339        (gnus-summary-show-thread)    ;; Intentionally set gnus-last-article.
8340      (error "Search failed: \"%s\"" regexp)))    (setq gnus-last-article gnus-article-before-search)
8341      (let ((gnus-last-article gnus-last-article))
8342        (if (gnus-summary-search-article regexp backward)
8343            (gnus-summary-show-thread)
8344          (signal 'search-failed (list regexp)))))
8345    
8346  (defun gnus-summary-search-article-backward (regexp)  (defun gnus-summary-search-article-backward (regexp)
8347    "Search for an article containing REGEXP backward."    "Search for an article containing REGEXP backward."
# Line 7188  Optional argument BACKWARD means do sear Line 8367  Optional argument BACKWARD means do sear
8367          (gnus-use-article-prefetch nil)          (gnus-use-article-prefetch nil)
8368          (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.          (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8369          (gnus-use-trees nil)            ;Inhibit updating tree buffer.          (gnus-use-trees nil)            ;Inhibit updating tree buffer.
8370            (gnus-visual nil)
8371            (gnus-keep-backlog nil)
8372            (gnus-break-pages nil)
8373            (gnus-summary-display-arrow nil)
8374            (gnus-updated-mode-lines nil)
8375            (gnus-auto-center-summary nil)
8376          (sum (current-buffer))          (sum (current-buffer))
8377          (gnus-display-mime-function nil)          (gnus-display-mime-function nil)
8378          (found nil)          (found nil)
# Line 7241  Optional argument BACKWARD means do sear Line 8426  Optional argument BACKWARD means do sear
8426        (gnus-summary-position-point)        (gnus-summary-position-point)
8427        t)))        t)))
8428    
8429    (defun gnus-find-matching-articles (header regexp)
8430      "Return a list of all articles that match REGEXP on HEADER.
8431    This search includes all articles in the current group that Gnus has
8432    fetched headers for, whether they are displayed or not."
8433      (let ((articles nil)
8434            (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8435            (case-fold-search t))
8436        (dolist (header gnus-newsgroup-headers)
8437          (when (string-match regexp (funcall func header))
8438            (push (mail-header-number header) articles)))
8439        (nreverse articles)))
8440    
8441  (defun gnus-summary-find-matching (header regexp &optional backward unread  (defun gnus-summary-find-matching (header regexp &optional backward unread
8442                                            not-case-fold not-matching)                                            not-case-fold not-matching)
8443    "Return a list of all articles that match REGEXP on HEADER.    "Return a list of all articles that match REGEXP on HEADER.
# Line 7287  article.  If BACKWARD (the prefix) is no Line 8484  article.  If BACKWARD (the prefix) is no
8484     (list (let ((completion-ignore-case t))     (list (let ((completion-ignore-case t))
8485             (completing-read             (completing-read
8486              "Header name: "              "Header name: "
8487              (mapcar (lambda (string) (list string))              (mapcar (lambda (header) (list (format "%s" header)))
8488                      '("Number" "Subject" "From" "Lines" "Date"                      (append
8489                        "Message-ID" "Xref" "References" "Body"))                       '("Number" "Subject" "From" "Lines" "Date"
8490                           "Message-ID" "Xref" "References" "Body")
8491                         gnus-extra-headers))
8492              nil 'require-match))              nil 'require-match))
8493           (read-string "Regexp: ")           (read-string "Regexp: ")
8494           (read-key-sequence "Command: ")           (read-key-sequence "Command: ")
# Line 7301  article.  If BACKWARD (the prefix) is no Line 8500  article.  If BACKWARD (the prefix) is no
8500    ;; We don't want to change current point nor window configuration.    ;; We don't want to change current point nor window configuration.
8501    (save-excursion    (save-excursion
8502      (save-window-excursion      (save-window-excursion
8503        (gnus-message 6 "Executing %s..." (key-description command))        (let (gnus-visual
8504        ;; We'd like to execute COMMAND interactively so as to give arguments.              gnus-treat-strip-trailing-blank-lines
8505        (gnus-execute header regexp              gnus-treat-strip-leading-blank-lines
8506                      `(call-interactively ',(key-binding command))              gnus-treat-strip-multiple-blank-lines
8507                      backward)              gnus-treat-hide-boring-headers
8508        (gnus-message 6 "Executing %s...done" (key-description command)))))              gnus-treat-fold-newsgroups
8509                gnus-article-prepare-hook)
8510            (gnus-message 6 "Executing %s..." (key-description command))
8511            ;; We'd like to execute COMMAND interactively so as to give arguments.
8512            (gnus-execute header regexp
8513                          `(call-interactively ',(key-binding command))
8514                          backward)
8515            (gnus-message 6 "Executing %s...done" (key-description command))))))
8516    
8517  (defun gnus-summary-beginning-of-article ()  (defun gnus-summary-beginning-of-article ()
8518    "Scroll the article back to the beginning."    "Scroll the article back to the beginning."
# Line 7316  article.  If BACKWARD (the prefix) is no Line 8522  article.  If BACKWARD (the prefix) is no
8522    (gnus-eval-in-buffer-window gnus-article-buffer    (gnus-eval-in-buffer-window gnus-article-buffer
8523      (widen)      (widen)
8524      (goto-char (point-min))      (goto-char (point-min))
8525      (when gnus-page-broken      (when gnus-break-pages
8526        (gnus-narrow-to-page))))        (gnus-narrow-to-page))))
8527    
8528  (defun gnus-summary-end-of-article ()  (defun gnus-summary-end-of-article ()
# Line 7328  article.  If BACKWARD (the prefix) is no Line 8534  article.  If BACKWARD (the prefix) is no
8534      (widen)      (widen)
8535      (goto-char (point-max))      (goto-char (point-max))
8536      (recenter -3)      (recenter -3)
8537      (when gnus-page-broken      (when gnus-break-pages
8538          (when (re-search-backward page-delimiter nil t)
8539            (narrow-to-region (match-end 0) (point-max)))
8540        (gnus-narrow-to-page))))        (gnus-narrow-to-page))))
8541    
8542    (defun gnus-summary-print-truncate-and-quote (string &optional len)
8543      "Truncate to LEN and quote all \"(\"'s in STRING."
8544      (gnus-replace-in-string (if (and len (> (length string) len))
8545                                  (substring string 0 len)
8546                                string)
8547                              "[()]" "\\\\\\&"))
8548    
8549  (defun gnus-summary-print-article (&optional filename n)  (defun gnus-summary-print-article (&optional filename n)
8550    "Generate and print a PostScript image of the N next (mail) articles.    "Generate and print a PostScript image of the process-marked (mail) articles.
8551    
8552  If N is negative, print the N previous articles.  If N is nil and articles  If used interactively, print the current article if none are
8553  have been marked with the process mark, print these instead.  process-marked.  With prefix arg, prompt the user for the name of the
8554    file to save in.
8555    
8556    When used from Lisp, accept two optional args FILENAME and N.  N means
8557    to print the next N articles.  If N is negative, print the N previous
8558    articles.  If N is nil and articles have been marked with the process
8559    mark, print these instead.
8560    
8561  If the optional first argument FILENAME is nil, send the image to the  If the optional first argument FILENAME is nil, send the image to the
8562  printer.  If FILENAME is a string, save the PostScript image in a file with  printer.  If FILENAME is a string, save the PostScript image in a file with
# Line 7345  to save in." Line 8566  to save in."
8566    (dolist (article (gnus-summary-work-articles n))    (dolist (article (gnus-summary-work-articles n))
8567      (gnus-summary-select-article nil nil 'pseudo article)      (gnus-summary-select-article nil nil 'pseudo article)
8568      (gnus-eval-in-buffer-window gnus-article-buffer      (gnus-eval-in-buffer-window gnus-article-buffer
8569        (let ((buffer (generate-new-buffer " *print*")))        (gnus-print-buffer))
         (unwind-protect  
             (progn  
               (copy-to-buffer buffer (point-min) (point-max))  
               (set-buffer buffer)  
               (gnus-article-delete-invisible-text)  
               (let ((ps-left-header  
                      (list  
                       (concat "("  
                               (mail-header-subject gnus-current-headers) ")")  
                       (concat "("  
                               (mail-header-from gnus-current-headers) ")")))  
                     (ps-right-header  
                      (list  
                       "/pagenumberstring load"  
                       (concat "("  
                               (mail-header-date gnus-current-headers) ")"))))  
                 (gnus-run-hooks 'gnus-ps-print-hook)  
                 (save-excursion  
                   (ps-spool-buffer-with-faces))))  
           (kill-buffer buffer))))  
8570      (gnus-summary-remove-process-mark article))      (gnus-summary-remove-process-mark article))
8571    (ps-despool filename))    (ps-despool filename))
8572    
8573    (defun gnus-print-buffer ()
8574      (let ((buffer (generate-new-buffer " *print*")))
8575        (unwind-protect
8576            (progn
8577              (copy-to-buffer buffer (point-min) (point-max))
8578              (set-buffer buffer)
8579              (gnus-remove-text-with-property 'gnus-decoration)
8580              (when (gnus-visual-p 'article-highlight 'highlight)
8581                ;; Copy-to-buffer doesn't copy overlay.  So redo
8582                ;; highlight.
8583                (let ((gnus-article-buffer buffer))
8584                  (gnus-article-highlight-citation t)
8585                  (gnus-article-highlight-signature)
8586                  (gnus-article-emphasize)
8587                  (gnus-article-delete-invisible-text)))
8588              (let ((ps-left-header
8589                     (list
8590                      (concat "("
8591                              (gnus-summary-print-truncate-and-quote
8592                               (mail-header-subject gnus-current-headers)
8593                               66) ")")
8594                      (concat "("
8595                              (gnus-summary-print-truncate-and-quote
8596                               (mail-header-from gnus-current-headers)
8597                               45) ")")))
8598                    (ps-right-header
8599                     (list
8600                      "/pagenumberstring load"
8601                      (concat "("
8602                              (mail-header-date gnus-current-headers) ")"))))
8603                (gnus-run-hooks 'gnus-ps-print-hook)
8604                (save-excursion
8605                  (if window-system
8606                      (ps-spool-buffer-with-faces)
8607                    (ps-spool-buffer)))))
8608          (kill-buffer buffer))))
8609    
8610  (defun gnus-summary-show-article (&optional arg)  (defun gnus-summary-show-article (&optional arg)
8611    "Force re-fetching of the current article.    "Force redisplaying of the current article.
8612  If ARG (the prefix) is a number, show the article with the charset  If ARG (the prefix) is a number, show the article with the charset
8613  defined in `gnus-summary-show-article-charset-alist', or the charset  defined in `gnus-summary-show-article-charset-alist', or the charset
8614  inputed.  input.
8615  If ARG (the prefix) is non-nil and not a number, show the raw article  If ARG (the prefix) is non-nil and not a number, show the raw article
8616  without any article massaging functions being run."  without any article massaging functions being run.  Normally, the key
8617    strokes are `C-u g'."
8618    (interactive "P")    (interactive "P")
8619    (cond    (cond
8620     ((numberp arg)     ((numberp arg)
8621        (gnus-summary-show-article t)
8622      (let ((gnus-newsgroup-charset      (let ((gnus-newsgroup-charset
8623             (or (cdr (assq arg gnus-summary-show-article-charset-alist))             (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8624                 (read-coding-system "Charset: ")))                 (mm-read-coding-system
8625                    "View as charset: " ;; actually it is coding system.
8626                    (save-excursion
8627                      (set-buffer gnus-article-buffer)
8628                      (mm-detect-coding-region (point) (point-max))))))
8629            (gnus-newsgroup-ignored-charsets 'gnus-all))            (gnus-newsgroup-ignored-charsets 'gnus-all))
8630        (gnus-summary-select-article nil 'force)))        (gnus-summary-select-article nil 'force)
8631          (let ((deps gnus-newsgroup-dependencies)
8632                head header lines)
8633            (save-excursion
8634              (set-buffer gnus-original-article-buffer)
8635              (save-restriction
8636                (message-narrow-to-head)
8637                (setq head (buffer-string))
8638                (goto-char (point-min))
8639                (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8640                  (goto-char (point-max))
8641                  (widen)
8642                  (setq lines (1- (count-lines (point) (point-max))))))
8643              (with-temp-buffer
8644                (insert (format "211 %d Article retrieved.\n"
8645                                (cdr gnus-article-current)))
8646                (insert head)
8647                (if lines (insert (format "Lines: %d\n" lines)))
8648                (insert ".\n")
8649                (let ((nntp-server-buffer (current-buffer)))
8650                  (setq header (car (gnus-get-newsgroup-headers deps t))))))
8651            (gnus-data-set-header
8652             (gnus-data-find (cdr gnus-article-current))
8653             header)
8654            (gnus-summary-update-article-line
8655             (cdr gnus-article-current) header)
8656            (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8657              (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8658     ((not arg)     ((not arg)
8659      ;; Select the article the normal way.      ;; Select the article the normal way.
8660      (gnus-summary-select-article nil 'force))      (gnus-summary-select-article nil 'force))
# Line 7410  without any article massaging functions Line 8681  without any article massaging functions
8681    (gnus-summary-goto-subject gnus-current-article)    (gnus-summary-goto-subject gnus-current-article)
8682    (gnus-summary-position-point))    (gnus-summary-position-point))
8683    
8684    (defun gnus-summary-show-raw-article ()
8685      "Show the raw article without any article massaging functions being run."
8686      (interactive)
8687      (gnus-summary-show-article t))
8688    
8689  (defun gnus-summary-verbose-headers (&optional arg)  (defun gnus-summary-verbose-headers (&optional arg)
8690    "Toggle permanent full header display.    "Toggle permanent full header display.
8691  If ARG is a positive number, turn header display on.  If ARG is a positive number, turn header display on.
# Line 7428  If ARG is a negative number, turn header Line 8704  If ARG is a negative number, turn header
8704  If ARG is a positive number, show the entire header.  If ARG is a positive number, show the entire header.
8705  If ARG is a negative number, hide the unwanted header lines."  If ARG is a negative number, hide the unwanted header lines."
8706    (interactive "P")    (interactive "P")
8707    (save-excursion    (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
8708      (set-buffer gnus-article-buffer)                       (get-buffer-window gnus-article-buffer t))))
8709      (save-restriction      (with-current-buffer gnus-article-buffer
8710          (widen)
8711          (article-narrow-to-head)
8712        (let* ((buffer-read-only nil)        (let* ((buffer-read-only nil)
8713               (inhibit-point-motion-hooks t)               (inhibit-point-motion-hooks t)
8714               hidden s e)               (hidden (if (numberp arg)
8715          (setq hidden                           (>= arg 0)
8716                (if (numberp arg)                         (gnus-article-hidden-text-p 'headers)))
8717                    (>= arg 0)               s e)
8718                  (save-restriction          (delete-region (point-min) (point-max))
                   (article-narrow-to-head)  
                   (gnus-article-hidden-text-p 'headers))))  
         (goto-char (point-min))  
         (when (search-forward "\n\n" nil t)  
           (delete-region (point-min) (1- (point))))  
         (goto-char (point-min))  
8719          (with-current-buffer gnus-original-article-buffer          (with-current-buffer gnus-original-article-buffer
8720            (goto-char (setq s (point-min)))            (goto-char (setq s (point-min)))
8721            (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))            (setq e (if (search-forward "\n\n" nil t)
8722                          (1- (point))
8723                        (point-max))))
8724          (insert-buffer-substring gnus-original-article-buffer s e)          (insert-buffer-substring gnus-original-article-buffer s e)
8725          (save-restriction          (run-hooks 'gnus-article-decode-hook)
8726            (narrow-to-region (point-min) (point))          (if hidden
8727            (article-decode-encoded-words)              (let ((gnus-treat-hide-headers nil)
8728            (if  hidden                    (gnus-treat-hide-boring-headers nil))
8729                (let ((gnus-treat-hide-headers nil)                (gnus-delete-wash-type 'headers)
8730                      (gnus-treat-hide-boring-headers nil))                (gnus-treat-article 'head))
8731                  (setq gnus-article-wash-types            (gnus-treat-article 'head))
8732                        (delq 'headers gnus-article-wash-types))          (widen)
8733                  (gnus-treat-article 'head))          (if window
8734              (gnus-treat-article 'head)))              (set-window-start window (goto-char (point-min))))
8735            (if gnus-break-pages
8736                (gnus-narrow-to-page)
8737              (when (gnus-visual-p 'page-marker)
8738                (let ((buffer-read-only nil))
8739                  (gnus-remove-text-with-property 'gnus-prev)
8740                  (gnus-remove-text-with-property 'gnus-next))))
8741          (gnus-set-mode-line 'article)))))          (gnus-set-mode-line 'article)))))
8742    
8743  (defun gnus-summary-show-all-headers ()  (defun gnus-summary-show-all-headers ()
8744    "Make all header lines visible."    "Make all header lines visible."
8745    (interactive)    (interactive)
8746    (gnus-article-show-all-headers))    (gnus-summary-toggle-header 1))
8747    
8748  (defun gnus-summary-caesar-message (&optional arg)  (defun gnus-summary-caesar-message (&optional arg)
8749    "Caesar rotate the current article by 13.    "Caesar rotate the current article by 13.
# Line 7480  forward." Line 8760  forward."
8760            (message-caesar-buffer-body arg)            (message-caesar-buffer-body arg)
8761            (set-window-start (get-buffer-window (current-buffer)) start))))))            (set-window-start (get-buffer-window (current-buffer)) start))))))
8762    
8763    (autoload 'unmorse-region "morse"
8764      "Convert morse coded text in region to ordinary ASCII text."
8765      t)
8766    
8767    (defun gnus-summary-morse-message (&optional arg)
8768      "Morse decode the current article."
8769      (interactive "P")
8770      (gnus-summary-select-article)
8771      (let ((mail-header-separator ""))
8772        (gnus-eval-in-buffer-window gnus-article-buffer
8773          (save-excursion
8774            (save-restriction
8775              (widen)
8776              (let ((pos (window-start))
8777                    buffer-read-only)
8778                (goto-char (point-min))
8779                (when (message-goto-body)
8780                  (gnus-narrow-to-body))
8781                (goto-char (point-min))
8782                (while (re-search-forward "·" (point-max) t)
8783                  (replace-match "."))
8784                (unmorse-region (point-min) (point-max))
8785                (widen)
8786                (set-window-start (get-buffer-window (current-buffer)) pos)))))))
8787    
8788  (defun gnus-summary-stop-page-breaking ()  (defun gnus-summary-stop-page-breaking ()
8789    "Stop page breaking in the current article."    "Stop page breaking in the current article."
8790    (interactive)    (interactive)
# Line 7503  If TO-NEWSGROUP is string, do not prompt Line 8808  If TO-NEWSGROUP is string, do not prompt
8808  If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but  If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8809  re-spool using this method.  re-spool using this method.
8810    
8811    When called interactively with TO-NEWSGROUP being nil, the value of
8812    the variable `gnus-move-split-methods' is used for finding a default
8813    for the target newsgroup.
8814    
8815  For this function to work, both the current newsgroup and the  For this function to work, both the current newsgroup and the
8816  newsgroup that you want to move to have to support the `request-move'  newsgroup that you want to move to have to support the `request-move'
8817  and `request-accept' functions.  and `request-accept' functions.
# Line 7511  ACTION can be either `move' (the default Line 8820  ACTION can be either `move' (the default
8820    (interactive "P")    (interactive "P")
8821    (unless action    (unless action
8822      (setq action 'move))      (setq action 'move))
   ;; Disable marking as read.  
   (let (gnus-mark-article-hook)  
     (save-window-excursion  
       (gnus-summary-select-article)))  
8823    ;; Check whether the source group supports the required functions.    ;; Check whether the source group supports the required functions.
8824    (cond ((and (eq action 'move)    (cond ((and (eq action 'move)
8825                (not (gnus-check-backend-function                (not (gnus-check-backend-function
# Line 7526  ACTION can be either `move' (the default Line 8831  ACTION can be either `move' (the default
8831           (error "The current group does not support article editing")))           (error "The current group does not support article editing")))
8832    (let ((articles (gnus-summary-work-articles n))    (let ((articles (gnus-summary-work-articles n))
8833          (prefix (if (gnus-check-backend-function          (prefix (if (gnus-check-backend-function
8834                      'request-move-article gnus-newsgroup-name)                       'request-move-article gnus-newsgroup-name)
8835                      (gnus-group-real-prefix gnus-newsgroup-name)                      (gnus-group-real-prefix gnus-newsgroup-name)
8836                    ""))                    ""))
8837          (names '((move "Move" "Moving")          (names '((move "Move" "Moving")
# Line 7540  ACTION can be either `move' (the default Line 8845  ACTION can be either `move' (the default
8845      ;; Read the newsgroup name.      ;; Read the newsgroup name.
8846      (when (and (not to-newsgroup)      (when (and (not to-newsgroup)
8847                 (not select-method))                 (not select-method))
8848          (if (and gnus-move-split-methods
8849                   (not
8850                    (and (memq gnus-current-article articles)
8851                         (gnus-buffer-live-p gnus-original-article-buffer))))
8852              ;; When `gnus-move-split-methods' is non-nil, we have to
8853              ;; select an article to give `gnus-read-move-group-name' an
8854              ;; opportunity to suggest an appropriate default.  However,
8855              ;; we needn't render or mark the article.
8856              (let ((gnus-display-mime-function nil)
8857                    (gnus-article-prepare-hook nil)
8858                    (gnus-mark-article-hook nil))
8859                (gnus-summary-select-article nil nil nil (car articles))))
8860        (setq to-newsgroup        (setq to-newsgroup
8861              (gnus-read-move-group-name              (gnus-read-move-group-name
8862               (cadr (assq action names))               (cadr (assq action names))
# Line 7589  ACTION can be either `move' (the default Line 8906  ACTION can be either `move' (the default
8906                        (mail-header-xref (gnus-summary-article-header article))                        (mail-header-xref (gnus-summary-article-header article))
8907                        " ")))                        " ")))
8908             (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)             (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
8909                                    ":" article))                                    ":" (number-to-string article)))
8910             (unless xref             (unless xref
8911               (setq xref (list (system-name))))               (setq xref (list (system-name))))
8912             (setq new-xref             (setq new-xref
# Line 7606  ACTION can be either `move' (the default Line 8923  ACTION can be either `move' (the default
8923                                  (gnus-request-accept-article                                  (gnus-request-accept-article
8924                                   to-newsgroup select-method (not articles))))                                   to-newsgroup select-method (not articles))))
8925                 (setq new-xref (concat new-xref " " (car art-group)                 (setq new-xref (concat new-xref " " (car art-group)
8926                                        ":" (cdr art-group)))                                        ":"
8927                                          (number-to-string (cdr art-group))))
8928                 ;; Now we have the new Xrefs header, so we insert                 ;; Now we have the new Xrefs header, so we insert
8929                 ;; it and replace the new article.                 ;; it and replace the new article.
8930                 (nnheader-replace-header "Xref" new-xref)                 (nnheader-replace-header "Xref" new-xref)
# Line 7621  ACTION can be either `move' (the default Line 8939  ACTION can be either `move' (the default
8939         ((eq art-group 'junk)         ((eq art-group 'junk)
8940          (when (eq action 'move)          (when (eq action 'move)
8941            (gnus-summary-mark-article article gnus-canceled-mark)            (gnus-summary-mark-article article gnus-canceled-mark)
8942            (gnus-message 4 "Deleted article %s" article)))            (gnus-message 4 "Deleted article %s" article)
8943              ;; run the delete hook
8944              (run-hook-with-args 'gnus-summary-article-delete-hook
8945                                  action
8946                                  (gnus-data-header
8947                                   (assoc article (gnus-data-list nil)))
8948                                  gnus-newsgroup-name nil
8949                                  select-method)))
8950         (t         (t
8951          (let* ((pto-group (gnus-group-prefixed-name          (let* ((pto-group (gnus-group-prefixed-name
8952                             (car art-group) to-method))                             (car art-group) to-method))
8953                 (entry                 (entry
8954                  (gnus-gethash pto-group gnus-newsrc-hashtb))                  (gnus-gethash pto-group gnus-newsrc-hashtb))
8955                 (info (nth 2 entry))                 (info (nth 2 entry))
8956                 (to-group (gnus-info-group info))                 (to-group (gnus-info-group info))
8957                 to-marks)                 to-marks)
8958            ;; Update the group that has been moved to.            ;; Update the group that has been moved to.
8959            (when (and info            (when (and info
# Line 7643  ACTION can be either `move' (the default Line 8968  ACTION can be either `move' (the default
8968                                         (list (cdr art-group)))))                                         (list (cdr art-group)))))
8969    
8970              ;; See whether the article is to be put in the cache.              ;; See whether the article is to be put in the cache.
8971              (let ((marks gnus-article-mark-lists)              (let ((marks (if (gnus-group-auto-expirable-p to-group)
8972                                 gnus-article-mark-lists
8973                               (delete '(expirable . expire)
8974                                       (copy-sequence gnus-article-mark-lists))))
8975                    (to-article (cdr art-group)))                    (to-article (cdr art-group)))
8976    
8977                ;; Enter the article into the cache in the new group,                ;; Enter the article into the cache in the new group,
# Line 7665  ACTION can be either `move' (the default Line 8993  ACTION can be either `move' (the default
8993                    (setcdr gnus-newsgroup-active to-article))                    (setcdr gnus-newsgroup-active to-article))
8994    
8995                  (while marks                  (while marks
8996                    (when (memq article (symbol-value                    (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
8997                                         (intern (format "gnus-newsgroup-%s"                      (when (memq article (symbol-value
8998                                                         (caar marks)))))                                           (intern (format "gnus-newsgroup-%s"
8999                      (push (cdar marks) to-marks)                                                           (caar marks)))))
9000                      ;; If the other group is the same as this group,                        (push (cdar marks) to-marks)
9001                      ;; then we have to add the mark to the list.                        ;; If the other group is the same as this group,
9002                      (when (equal to-group gnus-newsgroup-name)                        ;; then we have to add the mark to the list.
9003                        (set (intern (format "gnus-newsgroup-%s" (caar marks)))                        (when (equal to-group gnus-newsgroup-name)
9004                             (cons to-article                          (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9005                                   (symbol-value                               (cons to-article
9006                                    (intern (format "gnus-newsgroup-%s"                                     (symbol-value
9007                                                    (caar marks)))))))                                      (intern (format "gnus-newsgroup-%s"
9008                      ;; Copy the marks to other group.                                                      (caar marks)))))))
9009                      (gnus-add-marked-articles                        ;; Copy the marks to other group.
9010                       to-group (cdar marks) (list to-article) info))                        (gnus-add-marked-articles
9011                           to-group (cdar marks) (list to-article) info)))
9012                    (setq marks (cdr marks)))                    (setq marks (cdr marks)))
9013    
9014                  (gnus-request-set-mark to-group (list (list (list to-article)                  (gnus-request-set-mark
9015                                                              'set                   to-group (list (list (list to-article) 'add to-marks))))
                                                             to-marks))))  
9016    
9017                (gnus-dribble-enter                (gnus-dribble-enter
9018                 (concat "(gnus-group-set-info '"                 (concat "(gnus-group-set-info '"
# Line 7699  ACTION can be either `move' (the default Line 9027  ACTION can be either `move' (the default
9027                (gnus-request-article-this-buffer article gnus-newsgroup-name)                (gnus-request-article-this-buffer article gnus-newsgroup-name)
9028                (nnheader-replace-header "Xref" new-xref)                (nnheader-replace-header "Xref" new-xref)
9029                (gnus-request-replace-article                (gnus-request-replace-article
9030                 article gnus-newsgroup-name (current-buffer)))))                 article gnus-newsgroup-name (current-buffer))))
9031    
9032              ;; run the move/copy/crosspost/respool hook
9033              (run-hook-with-args 'gnus-summary-article-move-hook
9034                                  action
9035                                  (gnus-data-header
9036                                   (assoc article (gnus-data-list nil)))
9037                                  gnus-newsgroup-name
9038                                  to-newsgroup
9039                                  select-method))
9040    
9041          ;;;!!!Why is this necessary?          ;;;!!!Why is this necessary?
9042          (set-buffer gnus-summary-buffer)          (set-buffer gnus-summary-buffer)
9043            
9044          (gnus-summary-goto-subject article)          (gnus-summary-goto-subject article)
9045          (when (eq action 'move)          (when (eq action 'move)
9046            (gnus-summary-mark-article article gnus-canceled-mark))))            (gnus-summary-mark-article article gnus-canceled-mark))))
9047        (gnus-summary-remove-process-mark article))        (gnus-summary-remove-process-mark article))
9048      ;; Re-activate all groups that have been moved to.      ;; Re-activate all groups that have been moved to.
9049      (while to-groups      (save-excursion
9050        (save-excursion        (set-buffer gnus-group-buffer)
9051          (set-buffer gnus-group-buffer)        (let ((gnus-group-marked to-groups))
9052          (when (gnus-group-goto-group (car to-groups) t)          (gnus-group-get-new-news-this-group nil t)))
           (gnus-group-get-new-news-this-group 1 t))  
         (pop to-groups)))  
9053    
9054      (gnus-kill-buffer copy-buf)      (gnus-kill-buffer copy-buf)
9055      (gnus-summary-position-point)      (gnus-summary-position-point)
# Line 7723  ACTION can be either `move' (the default Line 9058  ACTION can be either `move' (the default
9058  (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)  (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9059    "Move the current article to a different newsgroup.    "Move the current article to a different newsgroup.
9060  If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.  If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9061    When called interactively, if TO-NEWSGROUP is nil, use the value of
9062    the variable `gnus-move-split-methods' for finding a default target
9063    newsgroup.
9064  If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but  If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9065  re-spool using this method."  re-spool using this method."
9066    (interactive "P")    (interactive "P")
# Line 7734  re-spool using this method." Line 9072  re-spool using this method."
9072    (gnus-summary-move-article n nil nil 'crosspost))    (gnus-summary-move-article n nil nil 'crosspost))
9073    
9074  (defcustom gnus-summary-respool-default-method nil  (defcustom gnus-summary-respool-default-method nil
9075    "Default method for respooling an article.    "Default method type for respooling an article.
9076  If nil, use to the current newsgroup method."  If nil, use to the current newsgroup method."
9077    :type '(choice (gnus-select-method :value (nnml ""))    :type 'symbol
                  (const nil))  
9078    :group 'gnus-summary-mail)    :group 'gnus-summary-mail)
9079    
9080    (defcustom gnus-summary-display-while-building nil
9081      "If non-nil, show and update the summary buffer as it's being built.
9082    If the value is t, update the buffer after every line is inserted.  If
9083    the value is an integer (N), update the display every N lines."
9084      :group 'gnus-thread
9085      :type '(choice (const :tag "off" nil)
9086                     number
9087                     (const :tag "frequently" t)))
9088    
9089  (defun gnus-summary-respool-article (&optional n method)  (defun gnus-summary-respool-article (&optional n method)
9090    "Respool the current article.    "Respool the current article.
9091  The article will be squeezed through the mail spooling process again,  The article will be squeezed through the mail spooling process again,
# Line 7762  latter case, they will be copied into th Line 9108  latter case, they will be copied into th
9108                                    (car (gnus-find-method-for-group                                    (car (gnus-find-method-for-group
9109                                          gnus-newsgroup-name)))))                                          gnus-newsgroup-name)))))
9110                  (method                  (method
9111                   (gnus-completing-read                   (gnus-completing-read-with-default
9112                    methname "What backend do you want to use when respooling?"                    methname "What backend do you want to use when respooling?"
9113                    methods nil t nil 'gnus-mail-method-history))                    methods nil t nil 'gnus-mail-method-history))
9114                  ms)                  ms)
# Line 7784  latter case, they will be copied into th Line 9130  latter case, they will be copied into th
9130        (gnus-summary-move-article n nil method)        (gnus-summary-move-article n nil method)
9131      (gnus-summary-copy-article n nil method)))      (gnus-summary-copy-article n nil method)))
9132    
9133  (defun gnus-summary-import-article (file)  (defun gnus-summary-import-article (file &optional edit)
9134    "Import an arbitrary file into a mail newsgroup."    "Import an arbitrary file into a mail newsgroup."
9135    (interactive "fImport file: ")    (interactive "fImport file: \nP")
9136    (let ((group gnus-newsgroup-name)    (let ((group gnus-newsgroup-name)
9137          (now (current-time))          (now (current-time))
9138          atts lines)          atts lines group-art)
9139      (unless (gnus-check-backend-function 'request-accept-article group)      (unless (gnus-check-backend-function 'request-accept-article group)
9140        (error "%s does not support article importing" group))        (error "%s does not support article importing" group))
9141      (or (file-readable-p file)      (or (file-readable-p file)
# Line 7800  latter case, they will be copied into th Line 9146  latter case, they will be copied into th
9146        (erase-buffer)        (erase-buffer)
9147        (nnheader-insert-file-contents file)        (nnheader-insert-file-contents file)
9148        (goto-char (point-min))        (goto-char (point-min))
9149        (unless (nnheader-article-p)        (if (nnheader-article-p)
9150          ;; This doesn't look like an article, so we fudge some headers.            (save-restriction
9151                (goto-char (point-min))
9152                (search-forward "\n\n" nil t)
9153                (narrow-to-region (point-min) (1- (point)))
9154                (goto-char (point-min))
9155                (unless (re-search-forward "^date:" nil t)
9156                  (goto-char (point-max))
9157                  (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9158           ;; This doesn't look like an article, so we fudge some headers.
9159          (setq atts (file-attributes file)          (setq atts (file-attributes file)
9160                lines (count-lines (point-min) (point-max)))                lines (count-lines (point-min) (point-max)))
9161          (insert "From: " (read-string "From: ") "\n"          (insert "From: " (read-string "From: ") "\n"
9162                  "Subject: " (read-string "Subject: ") "\n"                  "Subject: " (read-string "Subject: ") "\n"
9163                  "Date: " (message-make-date (nth 5 atts))                  "Date: " (message-make-date (nth 5 atts)) "\n"
                 "\n"  
9164                  "Message-ID: " (message-make-message-id) "\n"                  "Message-ID: " (message-make-message-id) "\n"
9165                  "Lines: " (int-to-string lines) "\n"                  "Lines: " (int-to-string lines) "\n"
9166                  "Chars: " (int-to-string (nth 7 atts)) "\n\n"))                  "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9167        (gnus-request-accept-article group nil t)        (setq group-art (gnus-request-accept-article group nil t))
9168        (kill-buffer (current-buffer)))))        (kill-buffer (current-buffer)))
9169        (setq gnus-newsgroup-active (gnus-activate-group group))
9170        (forward-line 1)
9171        (gnus-summary-goto-article (cdr group-art) nil t)
9172        (when edit
9173          (gnus-summary-edit-article))))
9174    
9175    (defun gnus-summary-create-article ()
9176      "Create an article in a mail newsgroup."
9177      (interactive)
9178      (let ((group gnus-newsgroup-name)
9179            (now (current-time))
9180            group-art)
9181        (unless (gnus-check-backend-function 'request-accept-article group)
9182          (error "%s does not support article importing" group))
9183        (save-excursion
9184          (set-buffer (gnus-get-buffer-create " *import file*"))
9185          (erase-buffer)
9186          (goto-char (point-min))
9187          ;; This doesn't look like an article, so we fudge some headers.
9188          (insert "From: " (read-string "From: ") "\n"
9189                  "Subject: " (read-string "Subject: ") "\n"
9190                  "Date: " (message-make-date now) "\n"
9191                  "Message-ID: " (message-make-message-id) "\n")
9192          (setq group-art (gnus-request-accept-article group nil t))
9193          (kill-buffer (current-buffer)))
9194        (setq gnus-newsgroup-active (gnus-activate-group group))
9195        (forward-line 1)
9196        (gnus-summary-goto-article (cdr group-art) nil t)
9197        (gnus-summary-edit-article)))
9198    
9199  (defun gnus-summary-article-posted-p ()  (defun gnus-summary-article-posted-p ()
9200    "Say whether the current (mail) article is available from news as well.    "Say whether the current (mail) article is available from news as well.
# Line 7830  This will be the case if the article has Line 9212  This will be the case if the article has
9212  (defun gnus-summary-expire-articles (&optional now)  (defun gnus-summary-expire-articles (&optional now)
9213    "Expire all articles that are marked as expirable in the current group."    "Expire all articles that are marked as expirable in the current group."
9214    (interactive)    (interactive)
9215    (when (gnus-check-backend-function    (when (and (not gnus-group-is-exiting-without-update-p)
9216           'request-expire-articles gnus-newsgroup-name)               (gnus-check-backend-function
9217                  'request-expire-articles gnus-newsgroup-name))
9218      ;; This backend supports expiry.      ;; This backend supports expiry.
9219      (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))      (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9220             (expirable (if total             (expirable (if total
# Line 7865  This will be the case if the article has Line 9248  This will be the case if the article has
9248                  (setq es (gnus-request-expire-articles                  (setq es (gnus-request-expire-articles
9249                            expirable gnus-newsgroup-name)))                            expirable gnus-newsgroup-name)))
9250              (setq es (gnus-request-expire-articles              (setq es (gnus-request-expire-articles
9251                        expirable gnus-newsgroup-name))))                        expirable gnus-newsgroup-name)))
9252          (unless total            (unless total
9253            (setq gnus-newsgroup-expirable es))              (setq gnus-newsgroup-expirable es))
9254          ;; We go through the old list of expirable, and mark all            ;; We go through the old list of expirable, and mark all
9255          ;; really expired articles as nonexistent.            ;; really expired articles as nonexistent.
9256          (unless (eq es expirable)       ;If nothing was expired, we don't mark.            (unless (eq es expirable) ;If nothing was expired, we don't mark.
9257            (let ((gnus-use-cache nil))              (let ((gnus-use-cache nil))
9258              (while expirable                (dolist (article expirable)
9259                (unless (memq (car expirable) es)                  (when (and (not (memq article es))
9260                  (when (gnus-data-find (car expirable))                             (gnus-data-find article))
9261                    (gnus-summary-mark-article                    (gnus-summary-mark-article article gnus-canceled-mark)
9262                     (car expirable) gnus-canceled-mark)))                    (run-hook-with-args 'gnus-summary-article-expire-hook
9263                (setq expirable (cdr expirable)))))                                        'delete
9264                                          (gnus-data-header
9265                                           (assoc article (gnus-data-list nil)))
9266                                          gnus-newsgroup-name
9267                                          nil
9268                                          nil))))))
9269          (gnus-message 6 "Expiring articles...done")))))          (gnus-message 6 "Expiring articles...done")))))
9270    
9271  (defun gnus-summary-expire-articles-now ()  (defun gnus-summary-expire-articles-now ()
# Line 7897  deleted forever, right now." Line 9285  deleted forever, right now."
9285  This command actually deletes articles.  This is not a marking  This command actually deletes articles.  This is not a marking
9286  command.  The article will disappear forever from your life, never to  command.  The article will disappear forever from your life, never to
9287  return.  return.
9288    
9289  If N is negative, delete backwards.  If N is negative, delete backwards.
9290  If N is nil and articles have been marked with the process mark,  If N is nil and articles have been marked with the process mark,
9291  delete these instead."  delete these instead.
9292    
9293    If `gnus-novice-user' is non-nil you will be asked for
9294    confirmation before the articles are deleted."
9295    (interactive "P")    (interactive "P")
9296    (unless (gnus-check-backend-function 'request-expire-articles    (unless (gnus-check-backend-function 'request-expire-articles
9297                                         gnus-newsgroup-name)                                         gnus-newsgroup-name)
# Line 7908  delete these instead." Line 9300  delete these instead."
9300      (error "Couldn't open server"))      (error "Couldn't open server"))
9301    ;; Compute the list of articles to delete.    ;; Compute the list of articles to delete.
9302    (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))    (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9303            (nnmail-expiry-target 'delete)
9304          not-deleted)          not-deleted)
9305      (if (and gnus-novice-user      (if (and gnus-novice-user
9306               (not (gnus-yes-or-no-p               (not (gnus-yes-or-no-p
# Line 7925  delete these instead." Line 9318  delete these instead."
9318          ;; after all.          ;; after all.
9319          (unless (memq (car articles) not-deleted)          (unless (memq (car articles) not-deleted)
9320            (gnus-summary-mark-article (car articles) gnus-canceled-mark))            (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9321            (let* ((article (car articles))
9322                   (id (mail-header-id (gnus-data-header
9323                                        (assoc article (gnus-data-list nil))))))
9324              (run-hook-with-args 'gnus-summary-article-delete-hook
9325                                  'delete id gnus-newsgroup-name nil
9326                                  nil))
9327          (setq articles (cdr articles)))          (setq articles (cdr articles)))
9328        (when not-deleted        (when not-deleted
9329          (gnus-message 4 "Couldn't delete articles %s" not-deleted)))          (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
# Line 7938  This will have permanent effect only in Line 9337  This will have permanent effect only in
9337  If ARG is nil, edit the decoded articles.  If ARG is nil, edit the decoded articles.
9338  If ARG is 1, edit the raw articles.  If ARG is 1, edit the raw articles.
9339  If ARG is 2, edit the raw articles even in read-only groups.  If ARG is 2, edit the raw articles even in read-only groups.
9340    If ARG is 3, edit the articles with the current handles.
9341  Otherwise, allow editing of articles even in read-only  Otherwise, allow editing of articles even in read-only
9342  groups."  groups."
9343    (interactive "P")    (interactive "P")
9344    (let (force raw)    (let (force raw current-handles)
9345      (cond      (cond
9346       ((null arg))       ((null arg))
9347       ((eq arg 1) (setq raw t))       ((eq arg 1)
9348       ((eq arg 2) (setq raw t        (setq raw t))
9349                         force t))       ((eq arg 2)
9350       (t (setq force t)))        (setq raw t
9351      (if (and raw (not force) (equal gnus-newsgroup-name "nndraft:drafts"))              force t))
9352          (error "Can't edit the raw article in group nndraft:drafts"))       ((eq arg 3)
9353          (setq current-handles
9354                (and (gnus-buffer-live-p gnus-article-buffer)
9355                     (with-current-buffer gnus-article-buffer
9356                       (prog1
9357                           gnus-article-mime-handles
9358                         (setq gnus-article-mime-handles nil))))))
9359         (t
9360          (setq force t)))
9361        (when (and raw (not force)
9362                   (member gnus-newsgroup-name '("nndraft:delayed"
9363                                                 "nndraft:drafts"
9364                                                 "nndraft:queue")))
9365          (error "Can't edit the raw article in group %s"
9366                 gnus-newsgroup-name))
9367      (save-excursion      (save-excursion
9368        (set-buffer gnus-summary-buffer)        (set-buffer gnus-summary-buffer)
9369        (let ((mail-parse-charset gnus-newsgroup-charset)        (let ((mail-parse-charset gnus-newsgroup-charset)
# Line 7962  groups." Line 9376  groups."
9376          (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))          (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9377            (with-current-buffer gnus-article-buffer            (with-current-buffer gnus-article-buffer
9378              (mm-enable-multibyte)))              (mm-enable-multibyte)))
9379          (if (equal gnus-newsgroup-name "nndraft:drafts")          (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9380              (setq raw t))              (setq raw t))
9381          (gnus-article-edit-article          (gnus-article-edit-article
9382           (if raw 'ignore           (if raw 'ignore
9383             #'(lambda ()             `(lambda ()
9384                 (let ((mbl mml-buffer-list))                (let ((mbl mml-buffer-list))
9385                   (setq mml-buffer-list nil)                  (setq mml-buffer-list nil)
9386                   (mime-to-mml)                  (mime-to-mml ,'current-handles)
9387                   (make-local-hook 'kill-buffer-hook)                  (let ((mbl1 mml-buffer-list))
9388                   (let ((mml-buffer-list mml-buffer-list))                    (setq mml-buffer-list mbl)
9389                     (setq mml-buffer-list mbl)                    (set (make-local-variable 'mml-buffer-list) mbl1))
9390                     (make-local-variable 'mml-buffer-list))                  (gnus-make-local-hook 'kill-buffer-hook)
9391                   (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))                  (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9392           `(lambda (no-highlight)           `(lambda (no-highlight)
9393              (let ((mail-parse-charset ',gnus-newsgroup-charset)              (let ((mail-parse-charset ',gnus-newsgroup-charset)
9394                      (message-options message-options)
9395                      (message-options-set-recipient)
9396                    (mail-parse-ignored-charsets                    (mail-parse-ignored-charsets
9397                     ',gnus-newsgroup-ignored-charsets))                     ',gnus-newsgroup-ignored-charsets))
9398                ,(if (not raw) '(progn                ,(if (not raw) '(progn
# Line 7996  groups." Line 9412  groups."
9412                                                   no-highlight)                                                   no-highlight)
9413    "Make edits to the current article permanent."    "Make edits to the current article permanent."
9414    (interactive)    (interactive)
9415      (save-excursion
9416       ;; The buffer restriction contains the entire article if it exists.
9417        (when (article-goto-body)
9418          (let ((lines (count-lines (point) (point-max)))
9419                (length (- (point-max) (point)))
9420                (case-fold-search t)
9421                (body (copy-marker (point))))
9422            (goto-char (point-min))
9423            (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9424              (delete-region (match-beginning 1) (match-end 1))
9425              (insert (number-to-string length)))
9426            (goto-char (point-min))
9427            (when (re-search-forward
9428                   "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9429              (delete-region (match-beginning 1) (match-end 1))
9430              (insert (number-to-string length)))
9431            (goto-char (point-min))
9432            (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9433              (delete-region (match-beginning 1) (match-end 1))
9434              (insert (number-to-string lines))))))
9435    ;; Replace the article.    ;; Replace the article.
9436    (let ((buf (current-buffer)))    (let ((buf (current-buffer)))
9437      (with-temp-buffer      (with-temp-buffer
9438        (insert-buffer-substring buf)        (insert-buffer-substring buf)
9439    
9440        (if (and (not read-only)        (if (and (not read-only)
9441                 (not (gnus-request-replace-article                 (not (gnus-request-replace-article
9442                       (cdr gnus-article-current) (car gnus-article-current)                       (cdr gnus-article-current) (car gnus-article-current)
# Line 8023  groups." Line 9460  groups."
9460                      (insert ".\n")                      (insert ".\n")
9461                      (let ((nntp-server-buffer (current-buffer)))                      (let ((nntp-server-buffer (current-buffer)))
9462                        (setq header (car (gnus-get-newsgroup-headers                        (setq header (car (gnus-get-newsgroup-headers
9463                                           (save-excursion                                           nil t))))
                                            (set-buffer gnus-summary-buffer)  
                                            gnus-newsgroup-dependencies)  
                                          t))))  
9464                      (save-excursion                      (save-excursion
9465                        (set-buffer gnus-summary-buffer)                        (set-buffer gnus-summary-buffer)
9466                        (gnus-data-set-header                        (gnus-data-set-header
9467                         (gnus-data-find (cdr gnus-article-current))                         (gnus-data-find (cdr gnus-article-current))
9468                         header)                         header)
9469                        (gnus-summary-update-article-line                        (gnus-summary-update-article-line
9470                         (cdr gnus-article-current) header))))))                         (cdr gnus-article-current) header)
9471                          (if (gnus-summary-goto-subject
9472                               (cdr gnus-article-current) nil t)
9473                              (gnus-summary-update-secondary-mark
9474                               (cdr gnus-article-current))))))))
9475            ;; Update threads.            ;; Update threads.
9476            (set-buffer (or buffer gnus-summary-buffer))            (set-buffer (or buffer gnus-summary-buffer))
9477            (gnus-summary-update-article (cdr gnus-article-current)))            (gnus-summary-update-article (cdr gnus-article-current))
9478              (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9479                  (gnus-summary-update-secondary-mark
9480                   (cdr gnus-article-current))))
9481          ;; Prettify the article buffer again.          ;; Prettify the article buffer again.
9482          (unless no-highlight          (unless no-highlight
9483            (save-excursion            (save-excursion
# Line 8072  groups." Line 9513  groups."
9513      (gnus-summary-select-article)      (gnus-summary-select-article)
9514      (save-excursion      (save-excursion
9515        (set-buffer gnus-original-article-buffer)        (set-buffer gnus-original-article-buffer)
9516        (save-restriction        (let ((groups (nnmail-article-group 'identity trace)))
9517          (message-narrow-to-head)          (unless silent
9518          (let ((groups (nnmail-article-group 'identity trace)))            (if groups
9519            (unless silent                (message "This message would go to %s"
9520              (if groups                         (mapconcat 'car groups ", "))
9521                  (message "This message would go to %s"              (message "This message would go to no groups"))
9522                           (mapconcat 'car groups ", "))            groups)))))
               (message "This message would go to no groups"))  
             groups))))))  
9523    
9524  (defun gnus-summary-respool-trace ()  (defun gnus-summary-respool-trace ()
9525    "Trace where the respool algorithm would put this article.    "Trace where the respool algorithm would put this article.
# Line 8162  If optional argument UNMARK is negative, Line 9601  If optional argument UNMARK is negative,
9601  If N is negative, mark backward instead.  If UNMARK is non-nil, remove  If N is negative, mark backward instead.  If UNMARK is non-nil, remove
9602  the process mark instead.  The difference between N and the actual  the process mark instead.  The difference between N and the actual
9603  number of articles marked is returned."  number of articles marked is returned."
9604    (interactive "p")    (interactive "P")
9605    (let ((backward (< n 0))    (if (and (null n) (gnus-region-active-p))
9606          (n (abs n)))        (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9607      (while (and      (setq n (prefix-numeric-value n))
9608              (> n 0)      (let ((backward (< n 0))
9609              (if unmark            (n (abs n)))
9610                  (gnus-summary-remove-process-mark        (while (and
9611                   (gnus-summary-article-number))                (> n 0)
9612                (gnus-summary-set-process-mark (gnus-summary-article-number)))                (if unmark
9613              (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))                    (gnus-summary-remove-process-mark
9614        (setq n (1- n)))                     (gnus-summary-article-number))
9615      (when (/= 0 n)                  (gnus-summary-set-process-mark (gnus-summary-article-number)))
9616        (gnus-message 7 "No more articles"))                (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9617      (gnus-summary-recenter)          (setq n (1- n)))
9618      (gnus-summary-position-point)        (when (/= 0 n)
9619      n))          (gnus-message 7 "No more articles"))
9620          (gnus-summary-recenter)
9621          (gnus-summary-position-point)
9622          n)))
9623    
9624  (defun gnus-summary-unmark-as-processable (n)  (defun gnus-summary-unmark-as-processable (n)
9625    "Remove the process mark from the next N articles.    "Remove the process mark from the next N articles.
9626  If N is negative, unmark backward instead.  The difference between N and  If N is negative, unmark backward instead.  The difference between N and
9627  the actual number of articles unmarked is returned."  the actual number of articles unmarked is returned."
9628    (interactive "p")    (interactive "P")
9629    (gnus-summary-mark-as-processable n t))    (gnus-summary-mark-as-processable n t))
9630    
9631  (defun gnus-summary-unmark-all-processable ()  (defun gnus-summary-unmark-all-processable ()
# Line 8194  the actual number of articles unmarked i Line 9636  the actual number of articles unmarked i
9636        (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))        (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9637    (gnus-summary-position-point))    (gnus-summary-position-point))
9638    
9639    (defun gnus-summary-add-mark (article type)
9640      "Mark ARTICLE with a mark of TYPE."
9641      (let ((vtype (car (assq type gnus-article-mark-lists)))
9642            var)
9643        (if (not vtype)
9644            (error "No such mark type: %s" type)
9645          (setq var (intern (format "gnus-newsgroup-%s" type)))
9646          (set var (cons article (symbol-value var)))
9647          (if (memq type '(processable cached replied forwarded recent saved))
9648              (gnus-summary-update-secondary-mark article)
9649            ;;; !!! This is bogus.  We should find out what primary
9650            ;;; !!! mark we want to set.
9651            (gnus-summary-update-mark gnus-del-mark 'unread)))))
9652    
9653  (defun gnus-summary-mark-as-expirable (n)  (defun gnus-summary-mark-as-expirable (n)
9654    "Mark N articles forward as expirable.    "Mark N articles forward as expirable.
9655  If N is negative, mark backward instead.  The difference between N and  If N is negative, mark backward instead.  The difference between N and
# Line 8201  the actual number of articles marked is Line 9657  the actual number of articles marked is
9657    (interactive "p")    (interactive "p")
9658    (gnus-summary-mark-forward n gnus-expirable-mark))    (gnus-summary-mark-forward n gnus-expirable-mark))
9659    
9660    (defun gnus-summary-mark-as-spam (n)
9661      "Mark N articles forward as spam.
9662    If N is negative, mark backward instead.  The difference between N and
9663    the actual number of articles marked is returned."
9664      (interactive "p")
9665      (gnus-summary-mark-forward n gnus-spam-mark))
9666    
9667  (defun gnus-summary-mark-article-as-replied (article)  (defun gnus-summary-mark-article-as-replied (article)
9668    "Mark ARTICLE replied and update the summary line."    "Mark ARTICLE as replied to and update the summary line.
9669    (push article gnus-newsgroup-replied)  ARTICLE can also be a list of articles."
9670    (let ((buffer-read-only nil))    (interactive (list (gnus-summary-article-number)))
9671      (when (gnus-summary-goto-subject article nil t)    (let ((articles (if (listp article) article (list article))))
9672        (gnus-summary-update-secondary-mark article))))      (dolist (article articles)
9673          (unless (numberp article)
9674            (error "%s is not a number" article))
9675          (push article gnus-newsgroup-replied)
9676          (let ((buffer-read-only nil))
9677            (when (gnus-summary-goto-subject article nil t)
9678              (gnus-summary-update-secondary-mark article))))))
9679    
9680    (defun gnus-summary-mark-article-as-forwarded (article)
9681      "Mark ARTICLE as forwarded and update the summary line.
9682    ARTICLE can also be a list of articles."
9683      (let ((articles (if (listp article) article (list article))))
9684        (dolist (article articles)
9685          (push article gnus-newsgroup-forwarded)
9686          (let ((buffer-read-only nil))
9687            (when (gnus-summary-goto-subject article nil t)
9688              (gnus-summary-update-secondary-mark article))))))
9689    
9690  (defun gnus-summary-set-bookmark (article)  (defun gnus-summary-set-bookmark (article)
9691    "Set a bookmark in current article."    "Set a bookmark in current article."
# Line 8217  the actual number of articles marked is Line 9696  the actual number of articles marked is
9696              (not (equal gnus-newsgroup-name (car gnus-article-current))))              (not (equal gnus-newsgroup-name (car gnus-article-current))))
9697      (error "No current article selected"))      (error "No current article selected"))
9698    ;; Remove old bookmark, if one exists.    ;; Remove old bookmark, if one exists.
9699    (let ((old (assq article gnus-newsgroup-bookmarks)))    (gnus-pull article gnus-newsgroup-bookmarks)
     (when old  
       (setq gnus-newsgroup-bookmarks  
             (delq old gnus-newsgroup-bookmarks))))  
9700    ;; Set the new bookmark, which is on the form    ;; Set the new bookmark, which is on the form
9701    ;; (article-number . line-number-in-body).    ;; (article-number . line-number-in-body).
9702    (push    (push
# Line 8230  the actual number of articles marked is Line 9706  the actual number of articles marked is
9706             (count-lines             (count-lines
9707              (min (point)              (min (point)
9708                   (save-excursion                   (save-excursion
9709                     (goto-char (point-min))                     (article-goto-body)
                    (search-forward "\n\n" nil t)  
9710                     (point)))                     (point)))
9711              (point))))              (point))))
9712     gnus-newsgroup-bookmarks)     gnus-newsgroup-bookmarks)
# Line 8241  the actual number of articles marked is Line 9716  the actual number of articles marked is
9716    "Remove the bookmark from the current article."    "Remove the bookmark from the current article."
9717    (interactive (list (gnus-summary-article-number)))    (interactive (list (gnus-summary-article-number)))
9718    ;; Remove old bookmark, if one exists.    ;; Remove old bookmark, if one exists.
9719    (let ((old (assq article gnus-newsgroup-bookmarks)))    (if (not (assq article gnus-newsgroup-bookmarks))
9720      (if old        (gnus-message 6 "No bookmark in current article.")
9721          (progn      (gnus-pull article gnus-newsgroup-bookmarks)
9722            (setq gnus-newsgroup-bookmarks      (gnus-message 6 "Removed bookmark.")))
                 (delq old gnus-newsgroup-bookmarks))  
           (gnus-message 6 "Removed bookmark."))  
       (gnus-message 6 "No bookmark in current article."))))  
9723    
9724  ;; Suggested by Daniel Quinlan <quinlan@best.com>.  ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9725  (defun gnus-summary-mark-as-dormant (n)  (defun gnus-summary-mark-as-dormant (n)
# Line 8293  If NO-EXPIRE, auto-expiry will be inhibi Line 9765  If NO-EXPIRE, auto-expiry will be inhibi
9765          (gnus-summary-goto-unread          (gnus-summary-goto-unread
9766           (and gnus-summary-goto-unread           (and gnus-summary-goto-unread
9767                (not (eq gnus-summary-goto-unread 'never))                (not (eq gnus-summary-goto-unread 'never))
9768                (not (memq mark (list gnus-unread-mark                (not (memq mark (list gnus-unread-mark gnus-spam-mark
9769                                      gnus-ticked-mark gnus-dormant-mark)))))                                      gnus-ticked-mark gnus-dormant-mark)))))
9770          (n (abs n))          (n (abs n))
9771          (mark (or mark gnus-del-mark)))          (mark (or mark gnus-del-mark)))
# Line 8317  If NO-EXPIRE, auto-expiry will be inhibi Line 9789  If NO-EXPIRE, auto-expiry will be inhibi
9789    (let ((article (gnus-summary-article-number)))    (let ((article (gnus-summary-article-number)))
9790      (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))      (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9791      (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))      (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9792        (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9793      (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))      (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9794      (push (cons article mark) gnus-newsgroup-reads)      (push (cons article mark) gnus-newsgroup-reads)
9795      ;; Possibly remove from cache, if that is used.      ;; Possibly remove from cache, if that is used.
# Line 8348  If NO-EXPIRE, auto-expiry will be inhibi Line 9821  If NO-EXPIRE, auto-expiry will be inhibi
9821              (gnus-error 1 "Can't mark negative article numbers")              (gnus-error 1 "Can't mark negative article numbers")
9822              nil)              nil)
9823          (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))          (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9824            (setq gnus-newsgroup-spam-marked
9825                  (delq article gnus-newsgroup-spam-marked))
9826          (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))          (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9827          (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))          (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9828          (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))          (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9829          (cond ((= mark gnus-ticked-mark)          (cond ((= mark gnus-ticked-mark)
9830                 (push article gnus-newsgroup-marked))                 (setq gnus-newsgroup-marked
9831                         (gnus-add-to-sorted-list gnus-newsgroup-marked
9832                                                  article)))
9833                  ((= mark gnus-spam-mark)
9834                   (setq gnus-newsgroup-spam-marked
9835                         (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9836                                                  article)))
9837                ((= mark gnus-dormant-mark)                ((= mark gnus-dormant-mark)
9838                 (push article gnus-newsgroup-dormant))                 (setq gnus-newsgroup-dormant
9839                         (gnus-add-to-sorted-list gnus-newsgroup-dormant
9840                                                  article)))
9841                (t                (t
9842                 (push article gnus-newsgroup-unreads)))                 (setq gnus-newsgroup-unreads
9843                         (gnus-add-to-sorted-list gnus-newsgroup-unreads
9844                                                  article))))
9845          (gnus-pull article gnus-newsgroup-reads)          (gnus-pull article gnus-newsgroup-reads)
9846    
9847          ;; See whether the article is to be put in the cache.          ;; See whether the article is to be put in the cache.
# Line 8388  If NO-EXPIRE, auto-expiry will be inhibi Line 9873  If NO-EXPIRE, auto-expiry will be inhibi
9873      (setq mark gnus-del-mark))      (setq mark gnus-del-mark))
9874    (when (and (not no-expire)    (when (and (not no-expire)
9875               gnus-newsgroup-auto-expire               gnus-newsgroup-auto-expire
9876               (memq mark gnus-auto-expirable-marks))               (memq mark gnus-auto-expirable-marks))
9877      (setq mark gnus-expirable-mark))      (setq mark gnus-expirable-mark))
9878    (let ((article (or article (gnus-summary-article-number)))    (let ((article (or article (gnus-summary-article-number)))
9879          (old-mark (gnus-summary-article-mark article)))          (old-mark (gnus-summary-article-mark article)))
# Line 8400  If NO-EXPIRE, auto-expiry will be inhibi Line 9885  If NO-EXPIRE, auto-expiry will be inhibi
9885          (error "No article on current line"))          (error "No article on current line"))
9886        (if (not (if (or (= mark gnus-unread-mark)        (if (not (if (or (= mark gnus-unread-mark)
9887                         (= mark gnus-ticked-mark)                         (= mark gnus-ticked-mark)
9888                           (= mark gnus-spam-mark)
9889                         (= mark gnus-dormant-mark))                         (= mark gnus-dormant-mark))
9890                     (gnus-mark-article-as-unread article mark)                     (gnus-mark-article-as-unread article mark)
9891                   (gnus-mark-article-as-read article mark)))                   (gnus-mark-article-as-read article mark)))
# Line 8430  If NO-EXPIRE, auto-expiry will be inhibi Line 9916  If NO-EXPIRE, auto-expiry will be inhibi
9916            gnus-cached-mark)            gnus-cached-mark)
9917           ((memq article gnus-newsgroup-replied)           ((memq article gnus-newsgroup-replied)
9918            gnus-replied-mark)            gnus-replied-mark)
9919             ((memq article gnus-newsgroup-forwarded)
9920              gnus-forwarded-mark)
9921           ((memq article gnus-newsgroup-saved)           ((memq article gnus-newsgroup-saved)
9922            gnus-saved-mark)            gnus-saved-mark)
9923           (t gnus-unread-mark))           ((memq article gnus-newsgroup-recent)
9924              gnus-recent-mark)
9925             ((memq article gnus-newsgroup-unseen)
9926              gnus-unseen-mark)
9927             (t gnus-no-mark))
9928     'replied)     'replied)
9929    (when (gnus-visual-p 'summary-highlight 'highlight)    (when (gnus-visual-p 'summary-highlight 'highlight)
9930      (gnus-run-hooks 'gnus-summary-update-hook))      (gnus-run-hooks 'gnus-summary-update-hook))
9931    t)    t)
9932    
9933    (defun gnus-summary-update-download-mark (article)
9934      "Update the download mark."
9935      (gnus-summary-update-mark
9936       (cond ((memq article gnus-newsgroup-undownloaded)
9937              gnus-undownloaded-mark)
9938             (gnus-newsgroup-agentized
9939              gnus-downloaded-mark)
9940             (t
9941              gnus-no-mark))
9942       'download)
9943      (gnus-summary-update-line t)
9944      t)
9945    
9946  (defun gnus-summary-update-mark (mark type)  (defun gnus-summary-update-mark (mark type)
9947    (let ((forward (cdr (assq type gnus-summary-mark-positions)))    (let ((forward (cdr (assq type gnus-summary-mark-positions)))
9948          (buffer-read-only nil))          (buffer-read-only nil))
9949      (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)      (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
9950      (when forward      (when forward
9951        (when (looking-at "\r")        (when (looking-at "\r")
# Line 8460  If NO-EXPIRE, auto-expiry will be inhibi Line 9965  If NO-EXPIRE, auto-expiry will be inhibi
9965    "Enter ARTICLE in the pertinent lists and remove it from others."    "Enter ARTICLE in the pertinent lists and remove it from others."
9966    ;; Make the article expirable.    ;; Make the article expirable.
9967    (let ((mark (or mark gnus-del-mark)))    (let ((mark (or mark gnus-del-mark)))
9968      (if (= mark gnus-expirable-mark)      (setq gnus-newsgroup-expirable
9969          (push article gnus-newsgroup-expirable)            (if (= mark gnus-expirable-mark)
9970        (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))                (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
9971                (delq article gnus-newsgroup-expirable)))
9972      ;; Remove from unread and marked lists.      ;; Remove from unread and marked lists.
9973      (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))      (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9974      (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))      (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9975        (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9976      (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))      (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9977      (push (cons article mark) gnus-newsgroup-reads)      (push (cons article mark) gnus-newsgroup-reads)
9978      ;; Possibly remove from cache, if that is used.      ;; Possibly remove from cache, if that is used.
# Line 8481  If NO-EXPIRE, auto-expiry will be inhibi Line 9988  If NO-EXPIRE, auto-expiry will be inhibi
9988            (gnus-error 1 "Can't mark negative article numbers")            (gnus-error 1 "Can't mark negative article numbers")
9989            nil)            nil)
9990        (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)        (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
9991                gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
9992              gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)              gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
9993              gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)              gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
9994              gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))              gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
# Line 8490  If NO-EXPIRE, auto-expiry will be inhibi Line 9998  If NO-EXPIRE, auto-expiry will be inhibi
9998          (gnus-dup-unsuppress-article article))          (gnus-dup-unsuppress-article article))
9999    
10000        (cond ((= mark gnus-ticked-mark)        (cond ((= mark gnus-ticked-mark)
10001               (push article gnus-newsgroup-marked))               (setq gnus-newsgroup-marked
10002                       (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10003                ((= mark gnus-spam-mark)
10004                 (setq gnus-newsgroup-spam-marked
10005                       (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10006                                                article)))
10007              ((= mark gnus-dormant-mark)              ((= mark gnus-dormant-mark)
10008               (push article gnus-newsgroup-dormant))               (setq gnus-newsgroup-dormant
10009                       (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10010              (t              (t
10011               (push article gnus-newsgroup-unreads)))               (setq gnus-newsgroup-unreads
10012                       (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10013        (gnus-pull article gnus-newsgroup-reads)        (gnus-pull article gnus-newsgroup-reads)
10014        t)))        t)))
10015    
# Line 8569  The difference between N and the number Line 10084  The difference between N and the number
10084    (when (memq gnus-current-article gnus-newsgroup-unreads)    (when (memq gnus-current-article gnus-newsgroup-unreads)
10085      (gnus-summary-mark-article gnus-current-article gnus-read-mark)))      (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10086    
10087  (defun gnus-summary-mark-read-and-unread-as-read ()  (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10088      "Intended to be used by `gnus-summary-mark-article-hook'."
10089      (let ((mark (gnus-summary-article-mark)))
10090        (when (or (gnus-unread-mark-p mark)
10091                  (gnus-read-mark-p mark))
10092          (gnus-summary-mark-article gnus-current-article
10093                                     (or new-mark gnus-read-mark)))))
10094    
10095    (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10096    "Intended to be used by `gnus-summary-mark-article-hook'."    "Intended to be used by `gnus-summary-mark-article-hook'."
10097    (let ((mark (gnus-summary-article-mark)))    (let ((mark (gnus-summary-article-mark)))
10098      (when (or (gnus-unread-mark-p mark)      (when (or (gnus-unread-mark-p mark)
10099                (gnus-read-mark-p mark))                (gnus-read-mark-p mark))
10100        (gnus-summary-mark-article gnus-current-article gnus-read-mark))))        (gnus-summary-mark-article (gnus-summary-article-number)
10101                                     (or new-mark gnus-read-mark)))))
10102    
10103    (defun gnus-summary-mark-unread-as-ticked ()
10104      "Intended to be used by `gnus-summary-mark-article-hook'."
10105      (when (memq gnus-current-article gnus-newsgroup-unreads)
10106        (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10107    
10108  (defun gnus-summary-mark-region-as-read (point mark all)  (defun gnus-summary-mark-region-as-read (point mark all)
10109    "Mark all unread articles between point and mark as read.    "Mark all unread articles between point and mark as read.
# Line 8649  even ticked and dormant ones." Line 10178  even ticked and dormant ones."
10178      (let ((scored gnus-newsgroup-scored)      (let ((scored gnus-newsgroup-scored)
10179            headers h)            headers h)
10180        (while scored        (while scored
10181          (unless (gnus-summary-goto-subject (caar scored))          (unless (gnus-summary-article-header (caar scored))
10182            (and (setq h (gnus-summary-article-header (caar scored)))            (and (setq h (gnus-number-to-header (caar scored)))
10183                 (< (cdar scored) gnus-summary-expunge-below)                 (< (cdar scored) gnus-summary-expunge-below)
10184                 (push h headers)))                 (push h headers)))
10185          (setq scored (cdr scored)))          (setq scored (cdr scored)))
# Line 8658  even ticked and dormant ones." Line 10187  even ticked and dormant ones."
10187            (when (not no-error)            (when (not no-error)
10188              (error "No expunged articles hidden"))              (error "No expunged articles hidden"))
10189          (goto-char (point-min))          (goto-char (point-min))
10190            (push gnus-newsgroup-limit gnus-newsgroup-limits)
10191            (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10192            (mapcar (lambda (x) (push (mail-header-number x)
10193                                      gnus-newsgroup-limit))
10194                    headers)
10195          (gnus-summary-prepare-unthreaded (nreverse headers))          (gnus-summary-prepare-unthreaded (nreverse headers))
10196          (goto-char (point-min))          (goto-char (point-min))
10197          (gnus-summary-position-point)          (gnus-summary-position-point)
10198          t))))          t))))
10199    
10200  (defun gnus-summary-catchup (&optional all quietly to-here not-mark)  (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10201    "Mark all unread articles in this newsgroup as read.    "Mark all unread articles in this newsgroup as read.
10202  If prefix argument ALL is non-nil, ticked and dormant articles will  If prefix argument ALL is non-nil, ticked and dormant articles will
10203  also be marked as read.  also be marked as read.
10204  If QUIETLY is non-nil, no questions will be asked.  If QUIETLY is non-nil, no questions will be asked.
10205    
10206  If TO-HERE is non-nil, it should be a point in the buffer.  All  If TO-HERE is non-nil, it should be a point in the buffer.  All
10207  articles before this point will be marked as read.  articles before (after, if REVERSE is set) this point will be marked
10208    as read.
10209    
10210  Note that this function will only catch up the unread article  Note that this function will only catch up the unread article
10211  in the current summary buffer limitation.  in the current summary buffer limitation.
10212    
10213  The number of articles marked as read is returned."  The number of articles marked as read is returned."
10214    (interactive "P")    (interactive "P")
10215    (prog1    (prog1
# Line 8692  The number of articles marked as read is Line 10230  The number of articles marked as read is
10230                (progn                (progn
10231                  (when all                  (when all
10232                    (setq gnus-newsgroup-marked nil                    (setq gnus-newsgroup-marked nil
10233                            gnus-newsgroup-spam-marked nil
10234                          gnus-newsgroup-dormant nil))                          gnus-newsgroup-dormant nil))
10235                  (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))                  (setq gnus-newsgroup-unreads
10236                          (gnus-sorted-nunion
10237                           (gnus-intersection gnus-newsgroup-unreads
10238                                              gnus-newsgroup-downloadable)
10239                           gnus-newsgroup-unfetched)))
10240              ;; We actually mark all articles as canceled, which we              ;; We actually mark all articles as canceled, which we
10241              ;; have to do when using auto-expiry or adaptive scoring.              ;; have to do when using auto-expiry or adaptive scoring.
10242              (gnus-summary-show-all-threads)              (gnus-summary-show-all-threads)
10243              (when (gnus-summary-first-subject (not all) t)              (if (and to-here reverse)
10244                (while (and                  (progn
10245                        (if to-here (< (point) to-here) t)                    (goto-char to-here)
10246                        (gnus-summary-mark-article-as-read gnus-catchup-mark)                    (gnus-summary-mark-current-read-and-unread-as-read
10247                        (gnus-summary-find-next (not all) nil nil t))))                     gnus-catchup-mark)
10248                      (while (gnus-summary-find-next (not all))
10249                        (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10250                  (when (gnus-summary-first-subject (not all))
10251                    (while (and
10252                            (if to-here (< (point) to-here) t)
10253                            (gnus-summary-mark-article-as-read gnus-catchup-mark)
10254                            (gnus-summary-find-next (not all))))))
10255              (gnus-set-mode-line 'summary))              (gnus-set-mode-line 'summary))
10256            t))            t))
10257      (gnus-summary-position-point)))      (gnus-summary-position-point)))
# Line 8718  If ALL is non-nil, also mark ticked and Line 10268  If ALL is non-nil, also mark ticked and
10268            (gnus-summary-catchup all t beg)))))            (gnus-summary-catchup all t beg)))))
10269    (gnus-summary-position-point))    (gnus-summary-position-point))
10270    
10271    (defun gnus-summary-catchup-from-here (&optional all)
10272      "Mark all unticked articles after (and including) the current one as read.
10273    If ALL is non-nil, also mark ticked and dormant articles as read."
10274      (interactive "P")
10275      (save-excursion
10276        (gnus-save-hidden-threads
10277          (let ((beg (point)))
10278            ;; We check that there are unread articles.
10279            (when (or all (gnus-summary-find-next))
10280              (gnus-summary-catchup all t beg nil t)))))
10281      (gnus-summary-position-point))
10282    
10283  (defun gnus-summary-catchup-all (&optional quietly)  (defun gnus-summary-catchup-all (&optional quietly)
10284    "Mark all articles in this newsgroup as read."    "Mark all articles in this newsgroup as read.
10285    This command is dangerous.  Normally, you want \\[gnus-summary-catchup]
10286    instead, which marks only unread articles as read."
10287    (interactive "P")    (interactive "P")
10288    (gnus-summary-catchup t quietly))    (gnus-summary-catchup t quietly))
10289    
10290  (defun gnus-summary-catchup-and-exit (&optional all quietly)  (defun gnus-summary-catchup-and-exit (&optional all quietly)
10291    "Mark all unread articles in this group as read, then exit.    "Mark all unread articles in this group as read, then exit.
10292  If prefix argument ALL is non-nil, all articles are marked as read."  If prefix argument ALL is non-nil, all articles are marked as read.
10293    If QUIETLY is non-nil, no questions will be asked."
10294    (interactive "P")    (interactive "P")
10295    (when (gnus-summary-catchup all quietly nil 'fast)    (when (gnus-summary-catchup all quietly nil 'fast)
10296      ;; Select next newsgroup or exit.      ;; Select next newsgroup or exit.
# Line 8735  If prefix argument ALL is non-nil, all a Line 10300  If prefix argument ALL is non-nil, all a
10300        (gnus-summary-exit))))        (gnus-summary-exit))))
10301    
10302  (defun gnus-summary-catchup-all-and-exit (&optional quietly)  (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10303    "Mark all articles in this newsgroup as read, and then exit."    "Mark all articles in this newsgroup as read, and then exit.
10304    This command is dangerous.  Normally, you want \\[gnus-summary-catchup-and-exit]
10305    instead, which marks only unread articles as read."
10306    (interactive "P")    (interactive "P")
10307    (gnus-summary-catchup-and-exit t quietly))    (gnus-summary-catchup-and-exit t quietly))
10308    
# Line 8870  is non-nil or the Subject: of both artic Line 10437  is non-nil or the Subject: of both artic
10437          (set-buffer gnus-summary-buffer)          (set-buffer gnus-summary-buffer)
10438          (gnus-summary-unmark-all-processable)          (gnus-summary-unmark-all-processable)
10439          (gnus-summary-update-article current-article)          (gnus-summary-update-article current-article)
10440            (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10441                (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10442          (gnus-summary-rethread-current)          (gnus-summary-rethread-current)
10443          (gnus-message 3 "Article %d is now the child of article %d"          (gnus-message 3 "Article %d is now the child of article %d"
10444                        current-article parent-article)))))                        current-article parent-article)))))
# Line 8901  Returns nil if no thread was there to be Line 10470  Returns nil if no thread was there to be
10470    (interactive)    (interactive)
10471    (let ((buffer-read-only nil)    (let ((buffer-read-only nil)
10472          (orig (point))          (orig (point))
10473          ;; first goto end then to beg, to have point at beg after let          (end (gnus-point-at-eol))
10474          (end (progn (end-of-line) (point)))          ;; Leave point at bol
10475          (beg (progn (beginning-of-line) (point))))          (beg (progn (beginning-of-line) (point))))
10476      (prog1      (prog1
10477          ;; Any hidden lines here?          ;; Any hidden lines here?
# Line 8911  Returns nil if no thread was there to be Line 10480  Returns nil if no thread was there to be
10480        (goto-char orig)        (goto-char orig)
10481        (gnus-summary-position-point))))        (gnus-summary-position-point))))
10482    
10483  (defun gnus-summary-hide-all-threads ()  (defun gnus-summary-maybe-hide-threads ()
10484    "Hide all thread subtrees."    "If requested, hide the threads that should be hidden."
10485      (when (and gnus-show-threads
10486                 gnus-thread-hide-subtree)
10487        (gnus-summary-hide-all-threads
10488         (if (or (consp gnus-thread-hide-subtree)
10489                 (functionp gnus-thread-hide-subtree))
10490             (gnus-make-predicate gnus-thread-hide-subtree)
10491           nil))))
10492    
10493    ;;; Hiding predicates.
10494    
10495    (defun gnus-article-unread-p (header)
10496      (memq (mail-header-number header) gnus-newsgroup-unreads))
10497    
10498    (defun gnus-article-unseen-p (header)
10499      (memq (mail-header-number header) gnus-newsgroup-unseen))
10500    
10501    (defun gnus-map-articles (predicate articles)
10502      "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10503      (apply 'gnus-or (mapcar predicate
10504                              (mapcar 'gnus-summary-article-header articles))))
10505    
10506    (defun gnus-summary-hide-all-threads (&optional predicate)
10507      "Hide all thread subtrees.
10508    If PREDICATE is supplied, threads that satisfy this predicate
10509    will not be hidden."
10510    (interactive)    (interactive)
10511    (save-excursion    (save-excursion
10512      (goto-char (point-min))      (goto-char (point-min))
10513      (gnus-summary-hide-thread)      (let ((end nil))
10514      (while (zerop (gnus-summary-next-thread 1 t))        (while (not end)
10515        (gnus-summary-hide-thread)))          (when (or (not predicate)
10516                      (gnus-map-articles
10517                       predicate (gnus-summary-article-children)))
10518                (gnus-summary-hide-thread))
10519            (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10520    (gnus-summary-position-point))    (gnus-summary-position-point))
10521    
10522  (defun gnus-summary-hide-thread ()  (defun gnus-summary-hide-thread ()
10523    "Hide thread subtrees.    "Hide thread subtrees.
10524    If PREDICATE is supplied, threads that satisfy this predicate
10525    will not be hidden.
10526  Returns nil if no threads were there to be hidden."  Returns nil if no threads were there to be hidden."
10527    (interactive)    (interactive)
10528    (let ((buffer-read-only nil)    (let ((buffer-read-only nil)
# Line 9020  taken." Line 10620  taken."
10620    
10621  (defun gnus-summary-up-thread (n)  (defun gnus-summary-up-thread (n)
10622    "Go up thread N steps.    "Go up thread N steps.
10623  If N is negative, go up instead.  If N is negative, go down instead.
10624  Returns the difference between N and how many steps down that were  Returns the difference between N and how many steps down that were
10625  taken."  taken."
10626    (interactive "p")    (interactive "p")
# Line 9071  Argument REVERSE means reverse order." Line 10671  Argument REVERSE means reverse order."
10671    (interactive "P")    (interactive "P")
10672    (gnus-summary-sort 'number reverse))    (gnus-summary-sort 'number reverse))
10673    
10674    (defun gnus-summary-sort-by-random (&optional reverse)
10675      "Randomize the order in the summary buffer.
10676    Argument REVERSE means to randomize in reverse order."
10677      (interactive "P")
10678      (gnus-summary-sort 'random reverse))
10679    
10680  (defun gnus-summary-sort-by-author (&optional reverse)  (defun gnus-summary-sort-by-author (&optional reverse)
10681    "Sort the summary buffer by author name alphabetically.    "Sort the summary buffer by author name alphabetically.
10682  If `case-fold-search' is non-nil, case of letters is ignored.  If `case-fold-search' is non-nil, case of letters is ignored.
# Line 9109  Argument REVERSE means reverse order." Line 10715  Argument REVERSE means reverse order."
10715    (interactive "P")    (interactive "P")
10716    (gnus-summary-sort 'chars reverse))    (gnus-summary-sort 'chars reverse))
10717    
10718    (defun gnus-summary-sort-by-original (&optional reverse)
10719      "Sort the summary buffer using the default sorting method.
10720    Argument REVERSE means reverse order."
10721      (interactive "P")
10722      (let* ((buffer-read-only)
10723             (gnus-summary-prepare-hook nil))
10724        ;; We do the sorting by regenerating the threads.
10725        (gnus-summary-prepare)
10726        ;; Hide subthreads if needed.
10727        (gnus-summary-maybe-hide-threads)))
10728    
10729  (defun gnus-summary-sort (predicate reverse)  (defun gnus-summary-sort (predicate reverse)
10730    "Sort summary buffer by PREDICATE.  REVERSE means reverse order."    "Sort summary buffer by PREDICATE.  REVERSE means reverse order."
10731    (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))    (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
# Line 9130  Argument REVERSE means reverse order." Line 10747  Argument REVERSE means reverse order."
10747      ;; We do the sorting by regenerating the threads.      ;; We do the sorting by regenerating the threads.
10748      (gnus-summary-prepare)      (gnus-summary-prepare)
10749      ;; Hide subthreads if needed.      ;; Hide subthreads if needed.
10750      (when (and gnus-show-threads gnus-thread-hide-subtree)      (gnus-summary-maybe-hide-threads)))
       (gnus-summary-hide-all-threads))))  
10751    
10752  ;; Summary saving commands.  ;; Summary saving commands.
10753    
# Line 9173  The variable `gnus-default-article-saver Line 10789  The variable `gnus-default-article-saver
10789      (gnus-set-mode-line 'summary)      (gnus-set-mode-line 'summary)
10790      n))      n))
10791    
10792  (defun gnus-summary-pipe-output (&optional arg)  (defun gnus-summary-pipe-output (&optional arg headers)
10793    "Pipe the current article to a subprocess.    "Pipe the current article to a subprocess.
10794  If N is a positive number, pipe the N next articles.  If N is a positive number, pipe the N next articles.
10795  If N is a negative number, pipe the N previous articles.  If N is a negative number, pipe the N previous articles.
10796  If N is nil and any articles have been marked with the process mark,  If N is nil and any articles have been marked with the process mark,
10797  pipe those articles instead."  pipe those articles instead.
10798    (interactive "P")  If HEADERS (the symbolic prefix), include the headers, too."
10799      (interactive (gnus-interactive "P\ny"))
10800    (require 'gnus-art)    (require 'gnus-art)
10801    (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))    (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
10802            (gnus-save-all-headers (or headers gnus-save-all-headers)))
10803      (gnus-summary-save-article arg t))      (gnus-summary-save-article arg t))
10804    (gnus-configure-windows 'pipe))    (let ((buffer (get-buffer "*Shell Command Output*")))
10805        (when (and buffer
10806                   (not (zerop (buffer-size buffer))))
10807          (gnus-configure-windows 'pipe))))
10808    
10809  (defun gnus-summary-save-article-mail (&optional arg)  (defun gnus-summary-save-article-mail (&optional arg)
10810    "Append the current article to an mail file.    "Append the current article to an mail file.
# Line 9240  save those articles instead." Line 10861  save those articles instead."
10861    (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))    (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10862      (gnus-summary-save-article arg)))      (gnus-summary-save-article arg)))
10863    
10864    (defun gnus-summary-muttprint (&optional arg)
10865      "Print the current article using Muttprint.
10866    If N is a positive number, save the N next articles.
10867    If N is a negative number, save the N previous articles.
10868    If N is nil and any articles have been marked with the process mark,
10869    save those articles instead."
10870      (interactive "P")
10871      (require 'gnus-art)
10872      (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10873        (gnus-summary-save-article arg t)))
10874    
10875  (defun gnus-summary-pipe-message (program)  (defun gnus-summary-pipe-message (program)
10876    "Pipe the current article through PROGRAM."    "Pipe the current article through PROGRAM."
10877    (interactive "sProgram: ")    (interactive "sProgram: ")
# Line 9247  save those articles instead." Line 10879  save those articles instead."
10879    (let ((mail-header-separator ""))    (let ((mail-header-separator ""))
10880      (gnus-eval-in-buffer-window gnus-article-buffer      (gnus-eval-in-buffer-window gnus-article-buffer
10881        (save-restriction        (save-restriction
10882          (widen)          (widen)
10883          (let ((start (window-start))          (let ((start (window-start))
10884                buffer-read-only)                buffer-read-only)
10885            (message-pipe-buffer-body program)            (message-pipe-buffer-body program)
10886            (set-window-start (get-buffer-window (current-buffer)) start))))))            (set-window-start (get-buffer-window (current-buffer)) start))))))
10887    
10888  (defun gnus-get-split-value (methods)  (defun gnus-get-split-value (methods)
10889    "Return a value based on the split METHODS."    "Return a value based on the split METHODS."
# Line 9270  save those articles instead." Line 10902  save those articles instead."
10902                      ;; Regular expression.                      ;; Regular expression.
10903                      (ignore-errors                      (ignore-errors
10904                        (re-search-forward match nil t)))                        (re-search-forward match nil t)))
10905                     ((gnus-functionp match)                     ((functionp match)
10906                      ;; Function.                      ;; Function.
10907                      (save-restriction                      (save-restriction
10908                        (widen)                        (widen)
# Line 9309  save those articles instead." Line 10941  save those articles instead."
10941           (to-newsgroup           (to-newsgroup
10942            (cond            (cond
10943             ((null split-name)             ((null split-name)
10944              (gnus-completing-read default prom              (gnus-completing-read-with-default
10945                                    gnus-active-hashtb               default prom
10946                                    'gnus-valid-move-group-p               gnus-active-hashtb
10947                                    nil prefix               'gnus-valid-move-group-p
10948                                    'gnus-group-history))               nil prefix
10949                 'gnus-group-history))
10950             ((= 1 (length split-name))             ((= 1 (length split-name))
10951              (gnus-completing-read (car split-name) prom              (gnus-completing-read-with-default
10952                                    gnus-active-hashtb               (car split-name) prom
10953                                    'gnus-valid-move-group-p               gnus-active-hashtb
10954                                    nil nil               'gnus-valid-move-group-p
10955                                    'gnus-group-history))               nil nil
10956                 'gnus-group-history))
10957             (t             (t
10958              (gnus-completing-read nil prom              (gnus-completing-read-with-default
10959                                    (mapcar (lambda (el) (list el))               nil prom
10960                                            (nreverse split-name))               (mapcar (lambda (el) (list el))
10961                                    nil nil nil                       (nreverse split-name))
10962                                    'gnus-group-history))))               nil nil nil
10963           (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))               'gnus-group-history))))
10964             (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
10965      (when to-newsgroup      (when to-newsgroup
10966        (if (or (string= to-newsgroup "")        (if (or (string= to-newsgroup "")
10967                (string= to-newsgroup prefix))                (string= to-newsgroup prefix))
# Line 9365  If REVERSE, save parts that do not match Line 11000  If REVERSE, save parts that do not match
11000      (save-excursion      (save-excursion
11001        (set-buffer gnus-article-buffer)        (set-buffer gnus-article-buffer)
11002        (let ((handles (or gnus-article-mime-handles        (let ((handles (or gnus-article-mime-handles
11003                           (mm-dissect-buffer) (mm-uu-dissect))))                           (mm-dissect-buffer nil gnus-article-loose-mime)
11004                             (and gnus-article-emulate-mime
11005                                  (mm-uu-dissect)))))
11006          (when handles          (when handles
11007            (gnus-summary-save-parts-1 type dir handles reverse)            (gnus-summary-save-parts-1 type dir handles reverse)
11008            (unless gnus-article-mime-handles ;; Don't destroy this case.            (unless gnus-article-mime-handles ;; Don't destroy this case.
# Line 9379  If REVERSE, save parts that do not match Line 11016  If REVERSE, save parts that do not match
11016                (not (string-match type (mm-handle-media-type handle)))                (not (string-match type (mm-handle-media-type handle)))
11017              (string-match type (mm-handle-media-type handle)))              (string-match type (mm-handle-media-type handle)))
11018        (let ((file (expand-file-name        (let ((file (expand-file-name
11019                     (file-name-nondirectory                     (gnus-map-function
11020                      (or                      mm-file-name-rewrite-functions
11021                       (mail-content-type-get                      (file-name-nondirectory
11022                        (mm-handle-disposition handle) 'filename)                       (or
11023                       (concat gnus-newsgroup-name                        (mail-content-type-get
11024                               "." (number-to-string                         (mm-handle-disposition handle) 'filename)
11025                                    (cdr gnus-article-current)))))                        (mail-content-type-get
11026                           (mm-handle-type handle) 'name)
11027                          (concat gnus-newsgroup-name
11028                                  "." (number-to-string
11029                                       (cdr gnus-article-current))))))
11030                     dir)))                     dir)))
11031          (unless (file-exists-p file)          (unless (file-exists-p file)
11032            (mm-save-part-to-file handle file))))))            (mm-save-part-to-file handle file))))))
# Line 9452  If REVERSE, save parts that do not match Line 11093  If REVERSE, save parts that do not match
11093            (gnus-data-enter            (gnus-data-enter
11094             after-article gnus-reffed-article-number             after-article gnus-reffed-article-number
11095             gnus-unread-mark b (car pslist) 0 (- e b))             gnus-unread-mark b (car pslist) 0 (- e b))
11096            (push gnus-reffed-article-number gnus-newsgroup-unreads)            (setq gnus-newsgroup-unreads
11097                    (gnus-add-to-sorted-list gnus-newsgroup-unreads
11098                                             gnus-reffed-article-number))
11099            (setq gnus-reffed-article-number (1- gnus-reffed-article-number))            (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11100            (setq pslist (cdr pslist)))))))            (setq pslist (cdr pslist)))))))
11101    
# Line 9518  If REVERSE, save parts that do not match Line 11161  If REVERSE, save parts that do not match
11161               (not (gnus-summary-article-sparse-p (mail-header-number header))))               (not (gnus-summary-article-sparse-p (mail-header-number header))))
11162          ;; We have found the header.          ;; We have found the header.
11163          header          header
       ;; If this is a sparse article, we have to nix out its  
       ;; previous entry in the thread hashtb.  
       (when (and header  
                  (gnus-summary-article-sparse-p (mail-header-number header)))  
         (let* ((parent (gnus-parent-id (mail-header-references header)))  
                (thread (and parent (gnus-id-to-thread parent))))  
           (when thread  
             (delq (assq header thread) thread))))  
11164        ;; We have to really fetch the header to this article.        ;; We have to really fetch the header to this article.
11165        (save-excursion        (save-excursion
11166          (set-buffer nntp-server-buffer)          (set-buffer nntp-server-buffer)
# Line 9583  If REVERSE, save parts that do not match Line 11218  If REVERSE, save parts that do not match
11218    ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.    ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11219    (when gnus-summary-selected-face    (when gnus-summary-selected-face
11220      (save-excursion      (save-excursion
11221        (let* ((beg (progn (beginning-of-line) (point)))        (let* ((beg (gnus-point-at-bol))
11222               (end (progn (end-of-line) (point)))               (end (gnus-point-at-eol))
11223               ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.               ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11224               (from (if (get-text-property beg gnus-mouse-face-prop)               (from (if (get-text-property beg gnus-mouse-face-prop)
11225                         beg                         beg
# Line 9611  If REVERSE, save parts that do not match Line 11246  If REVERSE, save parts that do not match
11246             (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))             (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11247             'face gnus-summary-selected-face))))))             'face gnus-summary-selected-face))))))
11248    
11249  ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.  (defvar gnus-summary-highlight-line-cached nil)
11250    (defvar gnus-summary-highlight-line-trigger nil)
11251    
11252    (defun gnus-summary-highlight-line-0 ()
11253      (if (and (eq gnus-summary-highlight-line-trigger
11254                   gnus-summary-highlight)
11255               gnus-summary-highlight-line-cached)
11256          gnus-summary-highlight-line-cached
11257        (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11258              gnus-summary-highlight-line-cached
11259              (let* ((cond (list 'cond))
11260                     (c cond)
11261                     (list gnus-summary-highlight))
11262                (while list
11263                  (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11264                                  nil))
11265                  (setq c (cdr c)
11266                        list (cdr list)))
11267                (gnus-byte-compile (list 'lambda nil cond))))))
11268    
11269  (defun gnus-summary-highlight-line ()  (defun gnus-summary-highlight-line ()
11270    "Highlight current line according to `gnus-summary-highlight'."    "Highlight current line according to `gnus-summary-highlight'."
11271    (let* ((list gnus-summary-highlight)    (let* ((beg (gnus-point-at-bol))
11272           (p (point))           (article (or (gnus-summary-article-number) gnus-current-article))
11273           (end (progn (end-of-line) (point)))           (score (or (cdr (assq article
          ;; now find out where the line starts and leave point there.  
          (beg (progn (beginning-of-line) (point)))  
          (article (gnus-summary-article-number))  
          (score (or (cdr (assq (or article gnus-current-article)  
11274                                 gnus-newsgroup-scored))                                 gnus-newsgroup-scored))
11275                      gnus-summary-default-score 0))                      gnus-summary-default-score 0))
11276           (mark (or (gnus-summary-article-mark) gnus-unread-mark))           (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11277           (inhibit-read-only t))           (inhibit-read-only t)
11278      ;; Eval the cars of the lists until we find a match.           (default gnus-summary-default-score)
11279      (let ((default gnus-summary-default-score))           (default-high gnus-summary-default-high-score)
11280        (while (and list           (default-low gnus-summary-default-low-score)
11281                    (not (eval (caar list))))           (uncached (and gnus-summary-use-undownloaded-faces
11282          (setq list (cdr list))))                          (memq article gnus-newsgroup-undownloaded))))
11283      (let ((face (cdar list)))      (let ((face (funcall (gnus-summary-highlight-line-0))))
11284        (unless (eq face (get-text-property beg 'face))        (unless (eq face (get-text-property beg 'face))
11285          (gnus-put-text-property-excluding-characters-with-faces          (gnus-put-text-property-excluding-characters-with-faces
11286           beg end 'face           beg (gnus-point-at-eol) 'face
11287           (setq face (if (boundp face) (symbol-value face) face)))           (setq face (if (boundp face) (symbol-value face) face)))
11288          (when gnus-summary-highlight-line-function          (when gnus-summary-highlight-line-function
11289            (funcall gnus-summary-highlight-line-function article face))))            (funcall gnus-summary-highlight-line-function article face))))))
     (goto-char p)))  
11290    
11291  (defun gnus-update-read-articles (group unread &optional compute)  (defun gnus-update-read-articles (group unread &optional compute)
11292    "Update the list of read articles in GROUP."    "Update the list of read articles in GROUP.
11293    UNREAD is a sorted list."
11294    (let* ((active (or gnus-newsgroup-active (gnus-active group)))    (let* ((active (or gnus-newsgroup-active (gnus-active group)))
11295           (entry (gnus-gethash group gnus-newsrc-hashtb))           (entry (gnus-gethash group gnus-newsrc-hashtb))
11296           (info (nth 2 entry))           (info (nth 2 entry))
11297           (prev 1)           (prev 1)
          (unread (sort (copy-sequence unread) '<))  
11298           read)           read)
11299      (if (or (not info) (not active))      (if (or (not info) (not active))
11300          ;; There is no info on this group if it was, in fact,          ;; There is no info on this group if it was, in fact,
# Line 9709  If REVERSE, save parts that do not match Line 11358  If REVERSE, save parts that do not match
11358    
11359  (defun gnus-offer-save-summaries ()  (defun gnus-offer-save-summaries ()
11360    "Offer to save all active summary buffers."    "Offer to save all active summary buffers."
11361    (save-excursion    (let (buffers)
11362      (let ((buflist (buffer-list))      ;; Go through all buffers and find all summaries.
11363            buffers bufname)      (dolist (buffer (buffer-list))
11364        ;; Go through all buffers and find all summaries.        (when (and (setq buffer (buffer-name buffer))
11365        (while buflist                   (string-match "Summary" buffer)
11366          (and (setq bufname (buffer-name (car buflist)))                   (save-excursion
11367               (string-match "Summary" bufname)                     (set-buffer buffer)
11368               (save-excursion                     ;; We check that this is, indeed, a summary buffer.
11369                 (set-buffer bufname)                     (and (eq major-mode 'gnus-summary-mode)
11370                 ;; We check that this is, indeed, a summary buffer.                          ;; Also make sure this isn't bogus.
11371                 (and (eq major-mode 'gnus-summary-mode)                          gnus-newsgroup-prepared
11372                      ;; Also make sure this isn't bogus.                          ;; Also make sure that this isn't a
11373                      gnus-newsgroup-prepared                          ;; dead summary buffer.
11374                      ;; Also make sure that this isn't a dead summary buffer.                          (not gnus-dead-summary-mode))))
11375                      (not gnus-dead-summary-mode)))          (push buffer buffers)))
11376               (push bufname buffers))      ;; Go through all these summary buffers and offer to save them.
11377          (setq buflist (cdr buflist)))      (when buffers
11378        ;; Go through all these summary buffers and offer to save them.        (save-excursion
       (when buffers  
11379          (map-y-or-n-p          (map-y-or-n-p
11380           "Update summary buffer %s? "           "Update summary buffer %s? "
11381           (lambda (buf)           (lambda (buf)
# Line 9737  If REVERSE, save parts that do not match Line 11385  If REVERSE, save parts that do not match
11385    
11386  (defun gnus-summary-setup-default-charset ()  (defun gnus-summary-setup-default-charset ()
11387    "Setup newsgroup default charset."    "Setup newsgroup default charset."
11388    (if (equal gnus-newsgroup-name "nndraft:drafts")    (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11389        (setq gnus-newsgroup-charset nil)        (setq gnus-newsgroup-charset nil)
11390      (let* ((name (and gnus-newsgroup-name      (let* ((ignored-charsets
                       (gnus-group-real-name gnus-newsgroup-name)))  
            (ignored-charsets  
11391              (or gnus-newsgroup-ephemeral-ignored-charsets              (or gnus-newsgroup-ephemeral-ignored-charsets
11392                  (append                  (append
11393                   (and gnus-newsgroup-name                   (and gnus-newsgroup-name
11394                        (or (gnus-group-find-parameter gnus-newsgroup-name                        (gnus-parameter-ignored-charsets gnus-newsgroup-name))
                                                      'ignored-charsets t)  
                           (let ((alist gnus-group-ignored-charsets-alist)  
                                 elem (charsets nil))  
                             (while (setq elem (pop alist))  
                               (when (and name  
                                          (string-match (car elem) name))  
                                 (setq alist nil  
                                       charsets (cdr elem))))  
                             charsets)))  
11395                   gnus-newsgroup-ignored-charsets))))                   gnus-newsgroup-ignored-charsets))))
11396        (setq gnus-newsgroup-charset        (setq gnus-newsgroup-charset
11397              (or gnus-newsgroup-ephemeral-charset              (or gnus-newsgroup-ephemeral-charset
11398                  (and gnus-newsgroup-name                  (and gnus-newsgroup-name
11399                       (or (gnus-group-find-parameter gnus-newsgroup-name 'charset)                       (gnus-parameter-charset gnus-newsgroup-name))
                          (let ((alist gnus-group-charset-alist)  
                                elem charset)  
                            (while (setq elem (pop alist))  
                              (when (and name  
                                         (string-match (car elem) name))  
                                (setq alist nil  
                                      charset (cadr elem))))  
                            charset)))  
11400                  gnus-default-charset))                  gnus-default-charset))
11401        (set (make-local-variable 'gnus-newsgroup-ignored-charsets)        (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11402             ignored-charsets))))             ignored-charsets))))
# Line 9791  treated as multipart/mixed." Line 11420  treated as multipart/mixed."
11420    (interactive (list (gnus-summary-article-number)))    (interactive (list (gnus-summary-article-number)))
11421    (gnus-with-article article    (gnus-with-article article
11422      (message-narrow-to-head)      (message-narrow-to-head)
11423        (message-remove-header "Mime-Version")
11424      (goto-char (point-max))      (goto-char (point-max))
11425        (insert "Mime-Version: 1.0\n")
11426      (widen)      (widen)
11427      (when (search-forward "\n--" nil t)      (when (search-forward "\n--" nil t)
11428        (let ((separator (buffer-substring (point) (gnus-point-at-eol))))        (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
11429          (message-narrow-to-head)          (message-narrow-to-head)
         (message-remove-header "Mime-Version")  
11430          (message-remove-header "Content-Type")          (message-remove-header "Content-Type")
11431          (goto-char (point-max))          (goto-char (point-max))
11432          (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"          (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11433                          separator))                          separator))
         (insert "Mime-Version: 1.0\n")  
11434          (widen))))          (widen))))
11435    (let (gnus-mark-article-hook)    (let (gnus-mark-article-hook)
11436      (gnus-summary-select-article t t nil article)))      (gnus-summary-select-article t t nil article)))
# Line 9892  returned." Line 11521  returned."
11521      (gnus-set-mode-line 'summary)      (gnus-set-mode-line 'summary)
11522      n))      n))
11523    
11524    (defun gnus-summary-insert-articles (articles)
11525      (when (setq articles
11526                  (gnus-sorted-difference articles
11527                                          (mapcar (lambda (h)
11528                                                    (mail-header-number h))
11529                                                  gnus-newsgroup-headers)))
11530        (setq gnus-newsgroup-headers
11531              (gnus-merge 'list
11532                          gnus-newsgroup-headers
11533                          (gnus-fetch-headers articles)
11534                          'gnus-article-sort-by-number))
11535        ;; Suppress duplicates?
11536        (when gnus-suppress-duplicates
11537          (gnus-dup-suppress-articles))
11538    
11539        ;; We might want to build some more threads first.
11540        (when (and gnus-fetch-old-headers
11541                   (eq gnus-headers-retrieved-by 'nov))
11542          (if (eq gnus-fetch-old-headers 'invisible)
11543              (gnus-build-all-threads)
11544            (gnus-build-old-threads)))
11545        ;; Let the Gnus agent mark articles as read.
11546        (when gnus-agent
11547          (gnus-agent-get-undownloaded-list))
11548        ;; Remove list identifiers from subject
11549        (when gnus-list-identifiers
11550          (gnus-summary-remove-list-identifiers))
11551        ;; First and last article in this newsgroup.
11552        (when gnus-newsgroup-headers
11553          (setq gnus-newsgroup-begin
11554                (mail-header-number (car gnus-newsgroup-headers))
11555                gnus-newsgroup-end
11556                (mail-header-number
11557                 (gnus-last-element gnus-newsgroup-headers))))
11558        (when gnus-use-scoring
11559          (gnus-possibly-score-headers))))
11560    
11561    (defun gnus-summary-insert-old-articles (&optional all)
11562      "Insert all old articles in this group.
11563    If ALL is non-nil, already read articles become readable.
11564    If ALL is a number, fetch this number of articles."
11565      (interactive "P")
11566      (prog1
11567          (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11568                older len)
11569            (setq older
11570                  ;; Some nntp servers lie about their active range.  When
11571                  ;; this happens, the active range can be in the millions.
11572                  ;; Use a compressed range to avoid creating a huge list.
11573                  (gnus-range-difference (list gnus-newsgroup-active) old))
11574            (setq len (gnus-range-length older))
11575            (cond
11576             ((null older) nil)
11577             ((numberp all)
11578              (if (< all len)
11579                  (let ((older-range (nreverse older)))
11580                    (setq older nil)
11581    
11582                    (while (> all 0)
11583                      (let* ((r (pop older-range))
11584                             (min (if (numberp r) r (car r)))
11585                             (max (if (numberp r) r (cdr r))))
11586                        (while (and (<= min max)
11587                                    (> all 0))
11588                          (push max older)
11589                          (setq all (1- all)
11590                                max (1- max))))))
11591                (setq older (gnus-uncompress-range older))))
11592             (all
11593              (setq older (gnus-uncompress-range older)))
11594             (t
11595              (when (and (numberp gnus-large-newsgroup)
11596                       (> len gnus-large-newsgroup))
11597                  (let* ((cursor-in-echo-area nil)
11598                         (initial (gnus-parameter-large-newsgroup-initial
11599                                   gnus-newsgroup-name))
11600                         (input
11601                          (read-string
11602                           (format
11603                            "How many articles from %s (%s %d): "
11604                            (gnus-limit-string
11605                             (gnus-group-decoded-name gnus-newsgroup-name) 35)
11606                            (if initial "max" "default")
11607                            len)
11608                           (if initial
11609                               (cons (number-to-string initial)
11610                                     0)))))
11611                    (unless (string-match "^[ \t]*$" input)
11612                      (setq all (string-to-number input))
11613                      (if (< all len)
11614                          (let ((older-range (nreverse older)))
11615                            (setq older nil)
11616    
11617                            (while (> all 0)
11618                              (let* ((r (pop older-range))
11619                                     (min (if (numberp r) r (car r)))
11620                                     (max (if (numberp r) r (cdr r))))
11621                                (while (and (<= min max)
11622                                            (> all 0))
11623                                  (push max older)
11624                                  (setq all (1- all)
11625                                        max (1- max))))))))))
11626              (setq older (gnus-uncompress-range older))))
11627            (if (not older)
11628                (message "No old news.")
11629              (gnus-summary-insert-articles older)
11630              (gnus-summary-limit (gnus-sorted-nunion old older))))
11631        (gnus-summary-position-point)))
11632    
11633    (defun gnus-summary-insert-new-articles ()
11634      "Insert all new articles in this group."
11635      (interactive)
11636      (prog1
11637          (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11638                (old-active gnus-newsgroup-active)
11639                (nnmail-fetched-sources (list t))
11640                i new)
11641            (setq gnus-newsgroup-active
11642                  (gnus-activate-group gnus-newsgroup-name 'scan))
11643            (setq i (cdr gnus-newsgroup-active))
11644            (while (> i (cdr old-active))
11645              (push i new)
11646              (decf i))
11647            (if (not new)
11648                (message "No gnus is bad news.")
11649              (gnus-summary-insert-articles new)
11650              (setq gnus-newsgroup-unreads
11651                    (gnus-sorted-nunion gnus-newsgroup-unreads new))
11652              (gnus-summary-limit (gnus-sorted-nunion old new))))
11653        (gnus-summary-position-point)))
11654    
11655  (gnus-summary-make-all-marking-commands)  (gnus-summary-make-all-marking-commands)
11656    
11657  (gnus-ems-redefine)  (gnus-ems-redefine)
# Line 9900  returned." Line 11660  returned."
11660    
11661  (run-hooks 'gnus-sum-load-hook)  (run-hooks 'gnus-sum-load-hook)
11662    
11663    ;; Local Variables:
11664    ;; coding: iso-8859-1
11665    ;; End:
11666    
11667  ;;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235  ;;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
11668  ;;; gnus-sum.el ends here  ;;; gnus-sum.el ends here

Legend:
Removed from v.1.38.6.2  
changed lines
  Added in v.1.38.6.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26