*** empty log message ***
[gnus] / lisp / gnus-sum.el
index e398de8..092b28a 100644 (file)
 
 ;;; Code:
 
-(require 'gnus-load)
+(require 'gnus)
 (require 'gnus-group)
 (require 'gnus-spec)
 (require 'gnus-range)
 (require 'gnus-int)
 (require 'gnus-undo)
-(require 'gnus)
 
-(defvar gnus-kill-summary-on-exit t
+(defgroup gnus-summary nil
+  "Summary buffers."
+  :group 'gnus)
+
+(defcustom gnus-kill-summary-on-exit t
   "*If non-nil, kill the summary buffer when you exit from it.
 If nil, the summary will become a \"*Dead Summary*\" buffer, and
-it will be killed sometime later.")
+it will be killed sometime later."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-fetch-old-headers nil
+(defcustom gnus-fetch-old-headers nil
   "*Non-nil means that Gnus will try to build threads by grabbing old headers.
 If an unread article in the group refers to an older, already read (or
 just marked as read) article, the old article will not normally be
@@ -49,9 +54,14 @@ headers to connect otherwise loose threads will be displayed.
 This variable can also be a number.  In that case, no more than that
 number of old headers will be fetched.
 
-The server has to support NOV for any of this to work.")
+The server has to support NOV for any of this to work."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                (const some)
+                number
+                (sexp :menu-tag "other" t)))
 
-(defvar gnus-summary-make-false-root 'adopt
+(defcustom gnus-summary-make-false-root 'adopt
   "*nil means that Gnus won't gather loose threads.
 If the root of a thread has expired or been read in a previous
 session, the information necessary to build a complete thread has been
@@ -72,15 +82,23 @@ If this variable is `adopt', Gnus will make one of the \"children\"
 the parent and mark all the step-children as such.
 If this variable is `empty', the \"children\" are printed with empty
 subject fields.         (Or rather, they will be printed with a string
-given by the `gnus-summary-same-subject' variable.)")
-
-(defvar gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
+given by the `gnus-summary-same-subject' variable.)"
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                (const none)
+                (const dummy)
+                (const adopt)
+                (const empty)))
+
+(defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
   "*A regexp to match subjects to be excluded from loose thread gathering.
 As loose thread gathering is done on subjects only, that means that
 there can be many false gatherings performed.  By rooting out certain
-common subjects, gathering might become saner.")
+common subjects, gathering might become saner."
+  :group 'gnus-summary
+  :type 'regexp)
 
-(defvar gnus-summary-gather-subject-limit nil
+(defcustom gnus-summary-gather-subject-limit nil
   "*Maximum length of subject comparisons when gathering loose threads.
 Use nil to compare full subjects.  Setting this variable to a low
 number will help gather threads that have been corrupted by
@@ -89,68 +107,105 @@ unrelated articles that have subject that happen to begin with the
 same few characters will be incorrectly gathered.
 
 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
-comparing subjects.")
-
-(defvar gnus-simplify-ignored-prefixes nil
-  "*Regexp, matches for which are removed from subject lines when simplifying fuzzily.")
-
-(defvar gnus-build-sparse-threads nil
+comparing subjects."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                (const fuzzy)
+                (sexp :menu-tag "on" t)))
+
+(defcustom gnus-simplify-ignored-prefixes nil
+  "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                regexp))
+
+(defcustom gnus-build-sparse-threads nil
   "*If non-nil, fill in the gaps in threads.
 If `some', only fill in the gaps that are needed to tie loose threads
 together.  If `more', fill in all leaf nodes that Gnus can find.  If
-non-nil and non-`some', fill in all gaps that Gnus manages to guess.")
-
-(defvar gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
+non-nil and non-`some', fill in all gaps that Gnus manages to guess."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                (const some)
+                (const more)
+                (sexp :menu-tag "all" t)))
+
+(defcustom gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
   "Function used for gathering loose threads.
 There are two pre-defined functions: `gnus-gather-threads-by-subject',
 which only takes Subjects into consideration; and
 `gnus-gather-threads-by-references', which compared the References
-headers of the articles to find matches.")
+headers of the articles to find matches."
+  :group 'gnus-summary
+  :type '(set (function-item gnus-gather-threads-by-subject)
+             (function-item gnus-gather-threads-by-references)
+             (function :tag "other")))
 
 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
-(defvar gnus-summary-same-subject ""
+(defcustom gnus-summary-same-subject ""
   "*String indicating that the current article has the same subject as the previous.
 This variable will only be used if the value of
-`gnus-summary-make-false-root' is `empty'.")
+`gnus-summary-make-false-root' is `empty'."
+  :group 'gnus-summary
+  :type 'string)
 
-(defvar gnus-summary-goto-unread t
+(defcustom gnus-summary-goto-unread t
   "*If non-nil, marking commands will go to the next unread article.
 If `never', \\<gnus-summary-mode-map>\\[gnus-summary-next-page] will go to the next article,
-whether it is read or not.")
+whether it is read or not."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                (const never)
+                (sexp :menu-tag "on" t)))
 
-(defvar gnus-summary-default-score 0
+(defcustom gnus-summary-default-score 0
   "*Default article score level.
-If this variable is nil, scoring will be disabled.")
+If this variable is nil, scoring will be disabled."
+  :group 'gnus-summary
+  :type '(choice (const :tag "disable")
+                integer))
 
-(defvar gnus-summary-zcore-fuzz 0
+(defcustom gnus-summary-zcore-fuzz 0
   "*Fuzziness factor for the zcore in the summary buffer.
 Articles with scores closer than this to `gnus-summary-default-score'
-will not be marked.")
+will not be marked."
+  :group 'gnus-summary
+  :type 'integer)
 
-(defvar gnus-simplify-subject-fuzzy-regexp nil
+(defcustom gnus-simplify-subject-fuzzy-regexp nil
   "*Strings to be removed when doing fuzzy matches.
 This can either be a regular expression or list of regular expressions
 that will be removed from subject strings if fuzzy subject
-simplification is selected.")
+simplification is selected."
+  :group 'gnus-summary
+  :type '(repeat regexp))
 
-(defvar gnus-show-threads t
-  "*If non-nil, display threads in summary mode.")
+(defcustom gnus-show-threads t
+  "*If non-nil, display threads in summary mode."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-thread-hide-subtree nil
+(defcustom gnus-thread-hide-subtree nil
   "*If non-nil, hide all threads initially.
 If threads are hidden, you have to run the command
 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
-to expose hidden threads.")
+to expose hidden threads."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-thread-hide-killed t
-  "*If non-nil, hide killed threads automatically.")
+(defcustom gnus-thread-hide-killed t
+  "*If non-nil, hide killed threads automatically."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-thread-ignore-subject nil
+(defcustom gnus-thread-ignore-subject nil
   "*If non-nil, ignore subjects and do all threading based on the Reference header.
 If nil, which is the default, articles that have different subjects
-from their parents will start separate threads.")
+from their parents will start separate threads."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-thread-operation-ignore-subject t
+(defcustom gnus-thread-operation-ignore-subject t
   "*If non-nil, subjects will be ignored when doing thread commands.
 This affects commands like `gnus-summary-kill-thread' and
 `gnus-summary-lower-thread'.
@@ -158,15 +213,23 @@ This affects commands like `gnus-summary-kill-thread' and
 If this variable is nil, articles in the same thread with different
 subjects will not be included in the operation in question.  If this
 variable is `fuzzy', only articles that have subjects that are fuzzily
-equal will be included.")
-
-(defvar gnus-thread-indent-level 4
-  "*Number that says how much each sub-thread should be indented.")
-
-(defvar gnus-auto-extend-newsgroup t
-  "*If non-nil, extend newsgroup forward and backward when requested.")
-
-(defvar gnus-auto-select-first t
+equal will be included."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                (const fuzzy)
+                (sexp :tag "on" t)))
+
+(defcustom gnus-thread-indent-level 4
+  "*Number that says how much each sub-thread should be indented."
+  :group 'gnus-summary
+  :type 'integer)
+
+(defcustom gnus-auto-extend-newsgroup t
+  "*If non-nil, extend newsgroup forward and backward when requested."
+  :group 'gnus-summary
+  :type 'boolean)
+
+(defcustom gnus-auto-select-first t
   "*If nil, don't select the first unread article when entering a group.
 If this variable is `best', select the highest-scored unread article
 in the group.  If neither nil nor `best', select the first unread
@@ -174,9 +237,13 @@ 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'.")
+`gnus-select-group-hook'."
+  :group 'gnus-summary
+  :type '(choice (const :tag "none" nil)
+                (const best)
+                (sexp :menu-tag "first" t)))
 
-(defvar gnus-auto-select-next t
+(defcustom gnus-auto-select-next t
   "*If non-nil, offer to go to the next group from the end of the previous.
 If the value is t and the next newsgroup is empty, Gnus will exit
 summary mode and go back to group mode.         If the value is neither nil
@@ -186,114 +253,222 @@ newsgroup will be selected without any confirmation, and if it is
 `almost-quietly', the next group will be selected without any
 confirmation if you are located on the last article in the group.
 Finally, if this variable is `slightly-quietly', the `Z n' command
-will go to the next group without confirmation.")
-
-(defvar gnus-auto-select-same nil
-  "*If non-nil, select the next article with the same subject.")
-
-(defvar gnus-summary-check-current nil
+will go to the next group without confirmation."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                (const quietly)
+                (const almost-quietly)
+                (const slightly-quietly)
+                (sexp :menu-tag "on" t)))
+
+(defcustom gnus-auto-select-same nil
+  "*If non-nil, select the next article with the same subject."
+  :group 'gnus-summary
+  :type 'boolean)
+
+(defcustom gnus-summary-check-current nil
   "*If non-nil, consider the current article when moving.
 The \"unread\" movement commands will stay on the same line if the
-current article is unread.")
+current article is unread."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-auto-center-summary t
+(defcustom gnus-auto-center-summary t
   "*If non-nil, always center the current summary buffer.
 In particular, if `vertical' do only vertical recentering.  If non-nil
-and non-`vertical', do both horizontal and vertical recentering.")
-
-(defvar gnus-show-all-headers nil
-  "*If non-nil, don't hide any headers.")
-
-(defvar gnus-single-article-buffer t
+and non-`vertical', do both horizontal and vertical recentering."
+  :group 'gnus-summary
+  :type '(choice (const "none" nil)
+                (const vertical)
+                (sexp :menu-tag "both" t)))
+
+(defcustom gnus-show-all-headers nil
+  "*If non-nil, don't hide any headers."
+  :group 'gnus-summary
+  :type 'boolean)
+
+(defcustom gnus-single-article-buffer t
   "*If non-nil, display all articles in the same buffer.
-If nil, each group will get its own article buffer.")
+If nil, each group will get its own article buffer."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-break-pages t
+(defcustom gnus-break-pages t
   "*If non-nil, do page breaking on articles.
 The page delimiter is specified by the `gnus-page-delimiter'
-variable.")
+variable."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-show-mime nil
+(defcustom gnus-show-mime nil
   "*If non-nil, do mime processing of articles.
 The articles will simply be fed to the function given by
-`gnus-show-mime-method'.")
+`gnus-show-mime-method'."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-move-split-methods nil
+(defcustom gnus-move-split-methods nil
   "*Variable used to suggest where articles are to be moved to.
-It uses the same syntax as the `gnus-split-methods' variable.")
+It uses the same syntax as the `gnus-split-methods' variable."
+  :group 'gnus-summary
+  :type '(repeat (choice (list function)
+                        (cons regexp (repeat string))
+                        sexp)))
 
 ;; Mark variables suggested by Thomas Michanek
 ;; <Thomas.Michanek@telelogic.se>.
-(defvar gnus-unread-mark ? 
-  "*Mark used for unread articles.")
-(defvar gnus-ticked-mark ?!
-  "*Mark used for ticked articles.")
-(defvar gnus-dormant-mark ??
-  "*Mark used for dormant articles.")
-(defvar gnus-del-mark ?r
-  "*Mark used for del'd articles.")
-(defvar gnus-read-mark ?R
-  "*Mark used for read articles.")
-(defvar gnus-expirable-mark ?E
-  "*Mark used for expirable articles.")
-(defvar gnus-killed-mark ?K
-  "*Mark used for killed articles.")
-(defvar gnus-souped-mark ?F
-  "*Mark used for killed articles.")
-(defvar gnus-kill-file-mark ?X
-  "*Mark used for articles killed by kill files.")
-(defvar gnus-low-score-mark ?Y
-  "*Mark used for articles with a low score.")
-(defvar gnus-catchup-mark ?C
-  "*Mark used for articles that are caught up.")
-(defvar gnus-replied-mark ?A
-  "*Mark used for articles that have been replied to.")
-(defvar gnus-cached-mark ?*
-  "*Mark used for articles that are in the cache.")
-(defvar gnus-saved-mark ?S
-  "*Mark used for articles that have been saved to.")
-(defvar gnus-ancient-mark ?O
-  "*Mark used for ancient articles.")
-(defvar gnus-sparse-mark ?Q
-  "*Mark used for sparsely reffed articles.")
-(defvar gnus-canceled-mark ?G
-  "*Mark used for canceled articles.")
-(defvar gnus-duplicate-mark ?M
-  "*Mark used for duplicate articles.")
-(defvar gnus-score-over-mark ?+
-  "*Score mark used for articles with high scores.")
-(defvar gnus-score-below-mark ?-
-  "*Score mark used for articles with low scores.")
-(defvar gnus-empty-thread-mark ? 
-  "*There is no thread under the article.")
-(defvar gnus-not-empty-thread-mark ?=
-  "*There is a thread under the article.")
-
-(defvar gnus-view-pseudo-asynchronously nil
-  "*If non-nil, Gnus will view pseudo-articles asynchronously.")
-
-(defvar gnus-view-pseudos nil
+
+(defgroup gnus-summary-marks nil
+  "Marks used in summary buffers."
+  :group 'gnus-summary)
+
+(defcustom gnus-unread-mark ? 
+  "*Mark used for unread articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-ticked-mark ?!
+  "*Mark used for ticked articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-dormant-mark ??
+  "*Mark used for dormant articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-del-mark ?r
+  "*Mark used for del'd articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-read-mark ?R
+  "*Mark used for read articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-expirable-mark ?E
+  "*Mark used for expirable articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-killed-mark ?K
+  "*Mark used for killed articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-souped-mark ?F
+  "*Mark used for killed articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-kill-file-mark ?X
+  "*Mark used for articles killed by kill files."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-low-score-mark ?Y
+  "*Mark used for articles with a low score."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-catchup-mark ?C
+  "*Mark used for articles that are caught up."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-replied-mark ?A
+  "*Mark used for articles that have been replied to."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-cached-mark ?*
+  "*Mark used for articles that are in the cache."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-saved-mark ?S
+  "*Mark used for articles that have been saved to."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-ancient-mark ?O
+  "*Mark used for ancient articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-sparse-mark ?Q
+  "*Mark used for sparsely reffed articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-canceled-mark ?G
+  "*Mark used for canceled articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-duplicate-mark ?M
+  "*Mark used for duplicate articles."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-score-over-mark ?+
+  "*Score mark used for articles with high scores."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-score-below-mark ?-
+  "*Score mark used for articles with low scores."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-empty-thread-mark ? 
+  "*There is no thread under the article."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-not-empty-thread-mark ?=
+  "*There is a thread under the article."
+  :group 'gnus-summary-marks
+  :type 'character)
+
+(defcustom gnus-view-pseudo-asynchronously nil
+  "*If non-nil, Gnus will view pseudo-articles asynchronously."
+  :group 'gnus-summary
+  :type 'boolean)
+
+(defcustom gnus-view-pseudos nil
   "*If `automatic', pseudo-articles will be viewed automatically.
 If `not-confirm', pseudos will be viewed automatically, and the user
-will not be asked to confirm the command.")
+will not be asked to confirm the command."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                (const automatic)
+                (const not-confirm)))
 
-(defvar gnus-view-pseudos-separately t
+(defcustom gnus-view-pseudos-separately t
   "*If non-nil, one pseudo-article will be created for each file to be viewed.
 If nil, all files that use the same viewing command will be given as a
-list of parameters to that command.")
+list of parameters to that command."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-insert-pseudo-articles t
-  "*If non-nil, insert pseudo-articles when decoding articles.")
+(defcustom gnus-insert-pseudo-articles t
+  "*If non-nil, insert pseudo-articles when decoding articles."
+  :group 'gnus-summary
+  :type 'boolean)
 
-(defvar gnus-summary-dummy-line-format
+(defcustom gnus-summary-dummy-line-format
   "*  %(:                          :%) %S\n"
   "*The format specification for the dummy roots in the summary buffer.
 It works along the same lines as a normal formatting string,
 with some simple extensions.
 
-%S  The subject")
+%S  The subject"
+  :group 'gnus-summary
+  :type 'string)
 
-(defvar gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
+(defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
   "*The format specification for the summary mode line.
 It works along the same lines as a normal formatting string,
 with some simple extensions:
@@ -311,18 +486,29 @@ with some simple extensions:
 %s  Current score file name
 %d  Number of dormant articles
 %r  Number of articles that have been marked as read in this session
-%E  Number of articles expunged by the score files")
+%E  Number of articles expunged by the score files"
+  :group 'gnus-summary
+  :type 'string)
 
-(defvar gnus-summary-mark-below 0
+(defcustom gnus-summary-mark-below 0
   "*Mark all articles with a score below this variable as read.
 This variable is local to each summary buffer and usually set by the
-score file.")
+score file."
+  :group 'gnus-summary
+  :type 'integer)
 
-(defvar gnus-article-sort-functions '(gnus-article-sort-by-number)
+(defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
   "*List of functions used for sorting articles in the summary buffer.
-This variable is only used when not using a threaded display.")
-
-(defvar gnus-thread-sort-functions '(gnus-thread-sort-by-number)
+This variable is only used when not using a threaded display."
+  :group 'gnus-summary
+  :type '(repeat (choice (function-item gnus-article-sort-by-number)
+                        (function-item gnus-article-sort-by-author)
+                        (function-item gnus-article-sort-by-subject)
+                        (function-item gnus-article-sort-by-date)
+                        (function-item gnus-article-sort-by-score)
+                        (function :tag "other"))))
+
+(defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
   "*List of functions used for sorting threads in the summary buffer.
 By default, threads are sorted by article number.
 
@@ -332,47 +518,73 @@ the primary sort function should be the last.  You should probably
 always include `gnus-thread-sort-by-number' in the list of sorting
 functions -- preferably first.
 
-Ready-mady functions include `gnus-thread-sort-by-number',
+Ready-made functions include `gnus-thread-sort-by-number',
 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
-`gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').")
-
-(defvar gnus-thread-score-function '+
+`gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
+  :group 'gnus-summary
+  :type '(repeat (choice (function-item gnus-thread-sort-by-number)
+                        (function-item gnus-thread-sort-by-author)
+                        (function-item gnus-thread-sort-by-subject)
+                        (function-item gnus-thread-sort-by-date)
+                        (function-item gnus-thread-sort-by-score)
+                        (function-item gnus-thread-sort-by-total-score)
+                        (function :tag "other"))))
+
+(defcustom gnus-thread-score-function '+
   "*Function used for calculating the total score of a thread.
 
 The function is called with the scores of the article and each
 subthread and should then return the score of the thread.
 
-Some functions you can use are `+', `max', or `min'.")
+Some functions you can use are `+', `max', or `min'."
+  :group 'gnus-summary
+  :type 'function)
 
-(defvar gnus-summary-expunge-below nil
-  "All articles that have a score less than this variable will be expunged.")
+(defcustom gnus-summary-expunge-below nil
+  "All articles that have a score less than this variable will be expunged."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                integer))
 
-(defvar gnus-thread-expunge-below nil
+(defcustom gnus-thread-expunge-below nil
   "All threads that have a total score less than this variable will be expunged.
 See `gnus-thread-score-function' for en explanation of what a
-\"thread score\" is.")
+\"thread score\" is."
+  :group 'gnus-summary
+  :type '(choice (const :tag "off" nil)
+                integer))
 
-(defvar gnus-summary-mode-hook nil
+(defcustom gnus-summary-mode-hook nil
   "*A hook for Gnus summary mode.
-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."
+  :group 'gnus-summary
+  :type 'hook)
 
-(defvar gnus-summary-menu-hook nil
-  "*Hook run after the creation of the summary mode menu.")
+(defcustom gnus-summary-menu-hook nil
+  "*Hook run after the creation of the summary mode menu."
+  :group 'gnus-summary
+  :type 'hook)
 
-(defvar gnus-summary-exit-hook nil
-  "*A hook called on exit from the summary buffer.")
+(defcustom gnus-summary-exit-hook nil
+  "*A hook called on exit from the summary buffer."
+  :group 'gnus-summary
+  :type 'hook)
 
-(defvar gnus-summary-prepare-hook nil
+(defcustom gnus-summary-prepare-hook nil
   "*A hook called after the summary buffer has been generated.
-If you want to modify the summary buffer, you can use this hook.")
+If you want to modify the summary buffer, you can use this hook."
+  :group 'gnus-summary
+  :type 'hook)
 
-(defvar gnus-summary-generate-hook nil
+(defcustom gnus-summary-generate-hook nil
   "*A hook run just before generating the summary buffer.
 This hook is commonly used to customize threading variables and the
-like.")
+like."
+  :group 'gnus-summary
+  :type 'hook)
 
-(defvar gnus-select-group-hook nil
+(defcustom gnus-select-group-hook nil
   "*A hook called when a newsgroup is selected.
 
 If you'd like to simplify subjects like the
@@ -387,40 +599,237 @@ following hook:
                      header
                      (gnus-simplify-subject
                       (mail-header-subject header) 're-only)))
-                 gnus-newsgroup-headers))))")
+                 gnus-newsgroup-headers))))"
+  :group 'gnus-summary
+  :type 'hook)
 
-(defvar gnus-select-article-hook nil
-  "*A hook called when an article is selected.")
+(defcustom gnus-select-article-hook nil
+  "*A hook called when an article is selected."
+  :group 'gnus-summary
+  :type 'hook)
 
-(defvar gnus-visual-mark-article-hook
+(defcustom gnus-visual-mark-article-hook
   (list 'gnus-highlight-selected-summary)
   "*Hook run after selecting an article in the summary buffer.
 It is meant to be used for highlighting the article in some way.  It
-is not run if `gnus-visual' is nil.")
-
-(defvar gnus-parse-headers-hook nil
-  "*A hook called before parsing the headers.")
-(add-hook 'gnus-parse-headers-hook 'gnus-decode-rfc1522)
-
-(defvar gnus-exit-group-hook nil
-  "*A hook called when exiting (not quitting) summary mode.")
-
-(defvar gnus-summary-update-hook
+is not run if `gnus-visual' is nil."
+  :group 'gnus-summary
+  :type 'hook)
+
+(defcustom gnus-parse-headers-hook 
+  (list 'gnus-decode-rfc1522)
+  "*A hook called before parsing the headers."
+  :group 'gnus-summary
+  :type 'hook)
+
+(defcustom gnus-exit-group-hook nil
+  "*A hook called when exiting (not quitting) summary mode."
+  :group 'gnus-summary
+  :type 'hook)
+
+(defcustom gnus-summary-update-hook
   (list 'gnus-summary-highlight-line)
   "*A hook called when a summary line is changed.
 The hook will not be called if `gnus-visual' is nil.
 
 The default function `gnus-summary-highlight-line' will
 highlight the line according to the `gnus-summary-highlight'
-variable.")
+variable."
+  :group 'gnus-summary
+  :type 'hook)
 
-(defvar gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
+(defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
   "*A hook called when an article is selected for the first time.
 The hook is intended to mark an article as read (or unread)
-automatically when it is selected.")
-
-(defvar gnus-group-no-more-groups-hook nil
-  "*A hook run when returning to group mode having no more (unread) groups.")
+automatically when it is selected."
+  :group 'gnus-summary
+  :type 'hook)
+
+(defcustom gnus-group-no-more-groups-hook nil
+  "*A hook run when returning to group mode having no more (unread) groups."
+  :group 'gnus-summary
+  :type 'hook)
+
+(defface gnus-summary-selected-face '((t 
+                                      (:underline t)))
+  "Face used for selected articles.")
+
+(defcustom gnus-summary-selected-face 'gnus-summary-selected-face
+  "Face used for highlighting the current article in the summary buffer."
+  :group 'gnus-summary
+  :type 'face)
+
+(defface gnus-summary-cancelled-face 
+  '((((class color))
+     (:foreground "yellow" :background "black")))
+  "Face used for cancelled articles.")
+
+(defface gnus-summary-high-ticked-face
+  '((((class color)
+      (background dark))
+     (:foreground "pink" :bold t))
+    (((class color)
+      (background light))
+     (:foreground "firebrick" :bold t))
+    (t 
+     (:bold t)))
+  "Face used for high interest ticked articles.")
+
+(defface gnus-summary-low-ticked-face
+  '((((class color)
+      (background dark))
+     (:foreground "pink" :italic t))
+    (((class color)
+      (background light))
+     (:foreground "firebrick" :italic t))
+    (t 
+     (:italic t)))
+  "Face used for low interest ticked articles.")
+
+(defface gnus-summary-normal-ticked-face
+  '((((class color)
+      (background dark))
+     (:foreground "pink"))
+    (((class color)
+      (background light))
+     (:foreground "firebrick"))
+    (t 
+     ()))
+  "Face used for normal interest ticked articles.")
+  
+(defface gnus-summary-high-ancient-face
+  '((((class color)
+      (background dark))
+     (:foreground "SkyBlue" :bold t))
+    (((class color)
+      (background light))
+     (:foreground "RoyalBlue" :bold t))
+    (t 
+     (:bold t)))
+  "Face used for high interest ancient articles.")
+
+(defface gnus-summary-low-ancient-face
+  '((((class color)
+      (background dark))
+     (:foreground "SkyBlue" :italic t))
+    (((class color)
+      (background light))
+     (:foreground "RoyalBlue" :italic t))
+    (t 
+     (:italic t)))
+  "Face used for low interest ancient articles.")
+
+(defface gnus-summary-normal-ancient-face
+  '((((class color)
+      (background dark))
+     (:foreground "SkyBlue"))
+    (((class color)
+      (background light))
+     (:foreground "RoyalBlue"))
+    (t 
+     ()))
+  "Face used for normal interest ancient articles.")
+  
+(defface gnus-summary-high-unread-face
+  '((t 
+     (:bold t)))
+  "Face used for high interest unread articles.")
+
+(defface gnus-summary-low-unread-face
+  '((t 
+     (:italic t)))
+  "Face used for low interest unread articles.")
+
+(defface gnus-summary-normal-unread-face
+  '((t 
+     ()))
+  "Face used for normal interest unread articles.")
+  
+(defface gnus-summary-high-read-face
+  '((((class color)
+      (background dark))
+     (:foreground "PaleGreen"
+                 :bold t))
+    (((class color)
+      (background light))
+     (:foreground "DarkGreen"
+                 :bold t))
+    (t 
+     (:bold t)))
+  "Face used for high interest read articles.")
+
+(defface gnus-summary-low-read-face
+  '((((class color)
+      (background dark))
+     (:foreground "PaleGreen"
+                 :italic t))
+    (((class color)
+      (background light))
+     (:foreground "DarkGreen"
+                 :italic t))
+    (t 
+     (:italic t)))
+  "Face used for low interest read articles.")
+
+(defface gnus-summary-normal-read-face
+  '((((class color)
+      (background dark))
+     (:foreground "PaleGreen"))
+    (((class color)
+      (background light))
+     (:foreground "DarkGreen"))
+    (t 
+     ()))
+  "Face used for normal interest read articles.")
+
+(defcustom gnus-summary-highlight 
+  '(((= mark gnus-canceled-mark)
+     . gnus-summary-cancelled-face)
+    ((and (> score default)
+         (or (= mark gnus-dormant-mark)
+             (= mark gnus-ticked-mark)))
+     . gnus-summary-high-ticked-face)
+    ((and (< score default)
+         (or (= mark gnus-dormant-mark)
+             (= mark gnus-ticked-mark)))
+     . gnus-summary-low-ticked-face)
+    ((or (= mark gnus-dormant-mark)
+        (= mark gnus-ticked-mark))
+     . gnus-summary-normal-ticked-face)
+    ((and (> score default) (= mark gnus-ancient-mark))
+     . gnus-summary-high-ancient-face)
+    ((and (< score default) (= mark gnus-ancient-mark))
+     . gnus-summary-low-ancient-face)
+    ((= mark gnus-ancient-mark)
+     . gnus-summary-normal-ancient-face)
+    ((and (> score default) (= mark gnus-unread-mark))
+     . gnus-summary-high-unread-face)
+    ((and (< score default) (= mark gnus-unread-mark))
+     . gnus-summary-low-unread-face)
+    ((and (= mark gnus-unread-mark))
+     . gnus-summary-normal-unread-face)
+    ((> score default) 
+     . gnus-summary-high-read-face)
+    ((< score default) 
+     . gnus-summary-low-read-face)
+    (t 
+     . gnus-summary-normal-read-face))
+  "Controls the highlighting of summary buffer lines. 
+
+A list of (FORM . FACE) pairs.  When deciding how a a particular
+summary line should be displayed, each form is evaluated.  The content
+of the face field after the first true form is used.  You can change
+how those summary lines are displayed, by editing the face field.
+
+You can use the following variables in the FORM field.
+
+score:   The articles score
+default: The default article score.
+below:   The score below which articles are automatically marked as read. 
+mark:    The articles mark."
+  :group 'gnus-summary
+  :type '(repeat (cons (sexp :tag "Form" nil)
+                      face)))
 
 ;;; Internal variables
 
@@ -671,10 +1080,10 @@ If RE-ONLY is non-nil, strip leading `Re:'s only."
     (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
       (setq subject (substring subject (match-end 0))))
     ;; Remove uninteresting prefixes.
-    (if (and (not re-only)
-            gnus-simplify-ignored-prefixes
-            (string-match gnus-simplify-ignored-prefixes subject))
-       (setq subject (substring subject (match-end 0))))
+    (when (and (not re-only)
+              gnus-simplify-ignored-prefixes
+              (string-match gnus-simplify-ignored-prefixes subject))
+      (setq subject (substring subject (match-end 0))))
     ;; Remove words in parentheses from end.
     (unless re-only
       (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
@@ -732,7 +1141,7 @@ If RE-ONLY is non-nil, strip leading `Re:'s only."
          (replace-match "" t t))))))
 
 (defun gnus-simplify-subject-fuzzy (subject)
-  "Siplify a subject string fuzzily."
+  "Simplify a subject string fuzzily."
   (save-excursion
     (gnus-set-work-buffer)
     (let ((case-fold-search t))
@@ -1114,14 +1523,13 @@ increase the score of each group you read."
          ["Clear above" gnus-summary-clear-above t])
         ["Current score" gnus-summary-current-score t]
         ["Set score" gnus-summary-set-score t]
-        ["Customize score file" gnus-score-customize t]
         ["Switch current score file..." gnus-score-change-score-file t]
         ["Set mark below..." gnus-score-set-mark-below t]
         ["Set expunge below..." gnus-score-set-expunge-below t]
         ["Edit current score file" gnus-score-edit-current-scores t]
         ["Edit score file" gnus-score-edit-file t]
         ["Trace score" gnus-score-find-trace t]
-        ["Find words" gnus-score-find-favuorite-words t]
+        ["Find words" gnus-score-find-favourite-words t]
         ["Rescore buffer" gnus-summary-rescore t]
         ["Increase score..." gnus-summary-increase-score t]
         ["Lower score..." gnus-summary-lower-score t]))))
@@ -1144,7 +1552,7 @@ increase the score of each group you read."
        (gnus-score-set-default 'gnus-score-default-header 'h)
        :style radio 
        :selected (eq gnus-score-default-header 'h )]
-       ["Message-Id" (gnus-score-set-default 'gnus-score-default-header 'i)
+       ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
        :style radio 
        :selected (eq gnus-score-default-header 'i )]
        ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
@@ -1293,7 +1701,7 @@ increase the score of each group you read."
         (gnus-check-backend-function
          'request-replace-article gnus-newsgroup-name)]
        ["Import file..." gnus-summary-import-article t]
-       ["Chek if posted" gnus-summary-article-posted-p t]
+       ["Check if posted" gnus-summary-article-posted-p t]
        ["Edit article" gnus-summary-edit-article
         (not (gnus-group-read-only-p))]
        ["Delete article" gnus-summary-delete-article
@@ -1435,7 +1843,7 @@ increase the score of each group you read."
        ["Go to subject number..." gnus-summary-goto-subject t]
        ["Go to article number..." gnus-summary-goto-article t]
        ["Go to the last article" gnus-summary-goto-last-article t]
-       ["Pop article off history" gnus-summary-pop-article t]) 
+       ["Pop article off history" gnus-summary-pop-article t])
        ("Sort"
        ["Sort by number" gnus-summary-sort-by-number t]
        ["Sort by author" gnus-summary-sort-by-author t]
@@ -1532,11 +1940,11 @@ increase the score of each group you read."
                                    (setq outp
                                          (cons
                                           (vector
-                                           (caar ps) 
+                                           (caar ps)
                                            (list
                                             'gnus-summary-score-entry
                                             (nth 1 header)
-                                            (if (or (string= (nth 1 header) 
+                                            (if (or (string= (nth 1 header)
                                                              "head")
                                                     (string= (nth 1 header)
                                                              "body"))
@@ -1685,7 +2093,8 @@ The following commands are available:
 
 (defun gnus-data-enter (after-article number mark pos header level offset)
   (let ((data (gnus-data-find-list after-article)))
-    (or data (error "No such article: %d" after-article))
+    (unless data
+      (error "No such article: %d" after-article))
     (setcdr data (cons (gnus-data-make number mark pos header level)
                       (cdr data)))
     (setq gnus-newsgroup-data-reverse nil)
@@ -1704,10 +2113,12 @@ The following commands are available:
          (progn
            (setcdr list gnus-newsgroup-data)
            (setq gnus-newsgroup-data ilist)
-           (and offset (gnus-data-update-list (cdr list) offset)))
+           (when offset
+             (gnus-data-update-list (cdr list) offset)))
        (setcdr list (cdr data))
        (setcdr data ilist)
-       (and offset (gnus-data-update-list (cdr data) offset)))
+       (when offset
+         (gnus-data-update-list (cdr data) offset)))
       (setq gnus-newsgroup-data-reverse nil))))
 
 (defun gnus-data-remove (article &optional offset)
@@ -1716,12 +2127,12 @@ The following commands are available:
        (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
              gnus-newsgroup-data-reverse nil)
       (while (cdr data)
-       (and (= (gnus-data-number (cadr data)) article)
-            (progn
-              (setcdr data (cddr data))
-              (and offset (gnus-data-update-list (cdr data) offset))
-              (setq data nil
-                    gnus-newsgroup-data-reverse nil)))
+       (when (= (gnus-data-number (cadr data)) article)
+         (setcdr data (cddr data))
+         (when offset
+           (gnus-data-update-list (cdr data) offset))
+         (setq data nil
+               gnus-newsgroup-data-reverse nil))
        (setq data (cdr data))))))
 
 (defmacro gnus-data-list (backward)
@@ -1842,8 +2253,8 @@ article number."
     (while (and (setq data (cdr data))
                (> (setq l (gnus-data-level (car data))) level))
       (and (= (1+ level) l)
-          (setq children (cons (gnus-data-number (car data))
-                               children))))
+          (push (gnus-data-number (car data))
+                children)))
     (nreverse children)))
 
 (defun gnus-summary-article-parent (&optional number)
@@ -1978,7 +2389,7 @@ This is all marks except unread, ticked, dormant, and expirable."
 (defun gnus-summary-last-article-p (&optional article)
   "Return whether ARTICLE is the last article in the buffer."
   (if (not (setq article (or article (gnus-summary-article-number))))
-      t                                        ; All non-existant numbers are the last article.  :-)
+      t                                        ; All non-existent numbers are the last article.  :-)
     (not (cdr (gnus-data-find-list article)))))
 
 (defun gnus-make-thread-indent-array ()
@@ -2015,7 +2426,7 @@ This is all marks except unread, ticked, dormant, and expirable."
          (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
                                             (- (point) 2)))))
          (goto-char (point-min))
-         (push (cons 'replied (and (search-forward "\201" nil t) 
+         (push (cons 'replied (and (search-forward "\201" nil t)
                                    (- (point) 2)))
                pos)
          (goto-char (point-min))
@@ -2030,26 +2441,30 @@ This is all marks except unread, ticked, dormant, and expirable."
    (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
    (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
 
-(defun gnus-summary-insert-line
-  (gnus-tmp-header gnus-tmp-level gnus-tmp-current gnus-tmp-unread
-                  gnus-tmp-replied gnus-tmp-expirable gnus-tmp-subject-or-nil
-                  &optional gnus-tmp-dummy gnus-tmp-score gnus-tmp-process)
+(defun gnus-summary-insert-line (gnus-tmp-header 
+                                gnus-tmp-level gnus-tmp-current 
+                                gnus-tmp-unread gnus-tmp-replied 
+                                gnus-tmp-expirable gnus-tmp-subject-or-nil
+                                &optional gnus-tmp-dummy gnus-tmp-score 
+                                gnus-tmp-process)
   (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
         (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
         (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
         (gnus-tmp-score-char
          (if (or (null gnus-summary-default-score)
                  (<= (abs (- gnus-tmp-score gnus-summary-default-score))
-                     gnus-summary-zcore-fuzz)) ? 
+                     gnus-summary-zcore-fuzz))
+             ? 
            (if (< gnus-tmp-score gnus-summary-default-score)
                gnus-score-below-mark gnus-score-over-mark)))
-        (gnus-tmp-replied (cond (gnus-tmp-process gnus-process-mark)
-                                ((memq gnus-tmp-current gnus-newsgroup-cached)
-                                 gnus-cached-mark)
-                                (gnus-tmp-replied gnus-replied-mark)
-                                ((memq gnus-tmp-current gnus-newsgroup-saved)
-                                 gnus-saved-mark)
-                                (t gnus-unread-mark)))
+        (gnus-tmp-replied
+         (cond (gnus-tmp-process gnus-process-mark)
+               ((memq gnus-tmp-current gnus-newsgroup-cached)
+                gnus-cached-mark)
+               (gnus-tmp-replied gnus-replied-mark)
+               ((memq gnus-tmp-current gnus-newsgroup-saved)
+                gnus-saved-mark)
+               (t gnus-unread-mark)))
         (gnus-tmp-from (mail-header-from gnus-tmp-header))
         (gnus-tmp-name
          (cond
@@ -2070,7 +2485,8 @@ This is all marks except unread, ticked, dormant, and expirable."
         (buffer-read-only nil))
     (when (string= gnus-tmp-name "")
       (setq gnus-tmp-name gnus-tmp-from))
-    (or (numberp gnus-tmp-lines) (setq gnus-tmp-lines 0))
+    (unless (numberp gnus-tmp-lines)
+      (setq gnus-tmp-lines 0))
     (gnus-put-text-property
      (point)
      (progn (eval gnus-summary-line-format-spec) (point))
@@ -2102,9 +2518,11 @@ This is all marks except unread, ticked, dormant, and expirable."
        (gnus-summary-update-mark
         (if (or (null gnus-summary-default-score)
                 (<= (abs (- score gnus-summary-default-score))
-                    gnus-summary-zcore-fuzz)) ? 
+                    gnus-summary-zcore-fuzz))
+            ? 
           (if (< score gnus-summary-default-score)
-              gnus-score-below-mark gnus-score-over-mark)) 'score))
+              gnus-score-below-mark gnus-score-over-mark))
+        'score))
       ;; Do visual highlighting.
       (when (gnus-visual-p 'summary-highlight 'highlight)
        (run-hooks 'gnus-summary-update-hook)))))
@@ -2149,7 +2567,7 @@ the thread are to be displayed."
       (and (consp elem)                        ; Has to be a cons.
           (consp (cdr elem))           ; The cdr has to be a list.
           (symbolp (car elem))         ; Has to be a symbol in there.
-          (not (memq (car elem) 
+          (not (memq (car elem)
                      '(quit-config to-address to-list to-group)))
           (progn                       ; So we set it.
             (make-local-variable (car elem))
@@ -2186,12 +2604,7 @@ If NO-DISPLAY, don't generate a summary buffer."
              (set-buffer gnus-group-buffer)
              (gnus-group-jump-to-group group)
              (gnus-group-next-unread-group 1))
-         (if (not (buffer-name (car quit-config)))
-             (gnus-configure-windows 'group 'force)
-           (set-buffer (car quit-config))
-           (and (eq major-mode 'gnus-summary-mode)
-                (gnus-set-global-variables))
-           (gnus-configure-windows (cdr quit-config)))))
+         (gnus-handle-ephemeral-exit quit-config)))
       (gnus-message 3 "Can't select group")
       nil)
      ;; The user did a `C-g' while prompting for number of articles,
@@ -2208,12 +2621,7 @@ If NO-DISPLAY, don't generate a summary buffer."
            (gnus-group-jump-to-group group)
            (gnus-group-next-unread-group 1)
            (gnus-configure-windows 'group 'force))
-       (if (not (buffer-name (car quit-config)))
-           (gnus-configure-windows 'group 'force)
-         (set-buffer (car quit-config))
-         (and (eq major-mode 'gnus-summary-mode)
-              (gnus-set-global-variables))
-         (gnus-configure-windows (cdr quit-config))))
+       (gnus-handle-ephemeral-exit quit-config))
       ;; Finally signal the quit.
       (signal 'quit nil))
      ;; The group was successfully selected.
@@ -2297,7 +2705,7 @@ If NO-DISPLAY, don't generate a summary buffer."
        (when kill-buffer
          (gnus-kill-or-deaden-summary kill-buffer))
        (when (get-buffer-window gnus-group-buffer t)
-         ;; Gotta use windows, because recenter does wierd stuff if
+         ;; Gotta use windows, because recenter does weird stuff if
          ;; the current buffer ain't the displayed window.
          (let ((owin (selected-window)))
            (select-window (get-buffer-window gnus-group-buffer t))
@@ -2372,22 +2780,22 @@ If NO-DISPLAY, don't generate a summary buffer."
        (setq subject (gnus-general-simplify-subject
                       (setq whole-subject (mail-header-subject 
                                            (caar threads)))))
-       (if subject
-           (if (setq hthread (gnus-gethash subject hashtb))
-               (progn
-                 ;; We enter a dummy root into the thread, if we
-                 ;; haven't done that already.
-                 (unless (stringp (caar hthread))
-                   (setcar hthread (list whole-subject (car hthread))))
-                 ;; We add this new gathered thread to this gathered
-                 ;; thread.
-                 (setcdr (car hthread)
-                         (nconc (cdar hthread) (list (car threads))))
-                 ;; Remove it from the list of threads.
-                 (setcdr prev (cdr threads))
-                 (setq threads prev))
-             ;; Enter this thread into the hash table.
-             (gnus-sethash subject threads hashtb)))
+       (when subject
+         (if (setq hthread (gnus-gethash subject hashtb))
+             (progn
+               ;; We enter a dummy root into the thread, if we
+               ;; haven't done that already.
+               (unless (stringp (caar hthread))
+                 (setcar hthread (list whole-subject (car hthread))))
+               ;; We add this new gathered thread to this gathered
+               ;; thread.
+               (setcdr (car hthread)
+                       (nconc (cdar hthread) (list (car threads))))
+               ;; Remove it from the list of threads.
+               (setcdr prev (cdr threads))
+               (setq threads prev))
+           ;; Enter this thread into the hash table.
+           (gnus-sethash subject threads hashtb)))
        (setq prev threads)
        (setq threads (cdr threads)))
       result)))
@@ -2459,7 +2867,7 @@ If NO-DISPLAY, don't generate a summary buffer."
        header references generation relations 
        cthread subject child end pthread relation)
     ;; First we create an alist of generations/relations, where 
-    ;; generations is how much we trust the ralation, and the relation
+    ;; generations is how much we trust the relation, and the relation
     ;; is parent/child.
     (gnus-message 7 "Making sparse threads...")
     (save-excursion
@@ -2474,7 +2882,7 @@ If NO-DISPLAY, don't generate a summary buffer."
          (while (search-backward ">" nil t)
            (setq end (1+ (point)))
            (when (search-backward "<" nil t)
-             (push (list (incf generation) 
+             (push (list (incf generation)
                          child (setq child (buffer-substring (point) end))
                          subject)
                    relations)))
@@ -2489,13 +2897,13 @@ If NO-DISPLAY, don't generate a summary buffer."
                  ;; Make this article the parent of these threads.
                  (setcar (symbol-value cthread)
                          (vector gnus-reffed-article-number 
-                                 (cadddr relation) 
+                                 (cadddr relation)
                                  "" ""
-                                 (cadr relation) 
+                                 (cadr relation)
                                  (or (caddr relation) "") 0 0 "")))
              (set cthread (list (vector gnus-reffed-article-number
-                                        (cadddr relation) 
-                                        "" "" (cadr relation) 
+                                        (cadddr relation)
+                                        "" "" (cadr relation)
                                         (or (caddr relation) "") 0 0 ""))))
        (push gnus-reffed-article-number gnus-newsgroup-limit)
        (push gnus-reffed-article-number gnus-newsgroup-sparse)
@@ -2603,9 +3011,9 @@ If NO-DISPLAY, don't generate a summary buffer."
         (parent
          (gnus-id-to-thread
           (or (gnus-parent-id 
-               (if (and references
-                        (not (equal "" references)))
-                   references))
+               (when (and references
+                          (not (equal "" references)))
+                 references))
               "none")))
         (buffer-read-only nil)
         (old (car thread))
@@ -2654,7 +3062,9 @@ If NO-DISPLAY, don't generate a summary buffer."
     (let (threads)
       ;; We then insert this thread into the summary buffer.
       (let (gnus-newsgroup-data gnus-newsgroup-threads)
-       (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
+       (if gnus-show-threads
+           (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
+         (gnus-summary-prepare-unthreaded thread))
        (setq data (nreverse gnus-newsgroup-data))
        (setq threads gnus-newsgroup-threads))
       ;; We splice the new data into the data structure.
@@ -2908,10 +3318,10 @@ Unscored articles will be counted as having a score of zero."
              (mapcar 'gnus-thread-total-score
                      (cdr (gnus-gethash (mail-header-id root)
                                         gnus-newsgroup-dependencies)))
-             (if (> (mail-header-number root) 0)
-                 (list (or (cdr (assq (mail-header-number root) 
-                                      gnus-newsgroup-scored))
-                           gnus-summary-default-score 0))))
+             (when (> (mail-header-number root) 0)
+               (list (or (cdr (assq (mail-header-number root)
+                                    gnus-newsgroup-scored))
+                         gnus-summary-default-score 0))))
             (list gnus-summary-default-score)
             '(0))))
 
@@ -2964,10 +3374,10 @@ or a straight list of headers."
                      thread (list (car gnus-tmp-new-adopts))
                      gnus-tmp-header (caar thread)
                      gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
-             (if new-roots
-                 (setq thread (list (car new-roots))
-                       gnus-tmp-header (caar thread)
-                       new-roots (cdr new-roots))))
+             (when new-roots
+               (setq thread (list (car new-roots))
+                     gnus-tmp-header (caar thread)
+                     new-roots (cdr new-roots))))
 
          (if threads
              ;; If there are some threads, we do them before the
@@ -3116,7 +3526,8 @@ or a straight list of headers."
             gnus-tmp-score-char
             (if (or (null gnus-summary-default-score)
                     (<= (abs (- gnus-tmp-score gnus-summary-default-score))
-                        gnus-summary-zcore-fuzz)) ? 
+                        gnus-summary-zcore-fuzz))
+                ? 
               (if (< gnus-tmp-score gnus-summary-default-score)
                   gnus-score-below-mark gnus-score-over-mark))
             gnus-tmp-replied
@@ -3144,7 +3555,8 @@ or a straight list of headers."
              (t gnus-tmp-from)))
            (when (string= gnus-tmp-name "")
              (setq gnus-tmp-name gnus-tmp-from))
-           (or (numberp gnus-tmp-lines) (setq gnus-tmp-lines 0))
+           (unless (numberp gnus-tmp-lines)
+             (setq gnus-tmp-lines 0))
            (gnus-put-text-property
             (point)
             (progn (eval gnus-summary-line-format-spec) (point))
@@ -3187,11 +3599,11 @@ or a straight list of headers."
                  gnus-newsgroup-reads)))
 
        (setq mark (gnus-article-mark number))
-       (setq gnus-newsgroup-data
-             (cons (gnus-data-make number mark (1+ (point)) header 0)
-                   gnus-newsgroup-data))
+       (push (gnus-data-make number mark (1+ (point)) header 0)
+             gnus-newsgroup-data)
        (gnus-summary-insert-line
-        header 0 nil mark (memq number gnus-newsgroup-replied)
+        header 0 number
+        mark (memq number gnus-newsgroup-replied)
         (memq number gnus-newsgroup-expirable)
         (mail-header-subject header) nil
         (cdr (assq number gnus-newsgroup-scored))
@@ -3204,9 +3616,9 @@ If READ-ALL is non-nil, all articles in the group are selected."
         (info (nth 2 entry))
         articles fetched-articles cached)
 
-    (or (gnus-check-server
-        (setq gnus-current-select-method (gnus-find-method-for-group group)))
-       (error "Couldn't open server"))
+    (unless (gnus-check-server
+            (setq gnus-current-select-method (gnus-find-method-for-group group)))
+      (error "Couldn't open server"))
 
     (or (and entry (not (eq (car entry) t))) ; Either it's active...
        (gnus-activate-group group)     ; Or we can activate it...
@@ -3220,7 +3632,7 @@ If READ-ALL is non-nil, all articles in the group are selected."
       (when (equal major-mode 'gnus-summary-mode)
        (kill-buffer (current-buffer)))
       (error "Couldn't request group %s: %s"
-            group (gnus-status-message group)))      
+            group (gnus-status-message group)))
 
     (setq gnus-newsgroup-name group)
     (setq gnus-newsgroup-unselected nil)
@@ -3365,12 +3777,12 @@ If READ-ALL is non-nil, all articles in the group are selected."
            (setq number (length articles)))
        (setq articles (copy-sequence articles)))
 
-      (if (< (abs select) number)
-         (if (< select 0)
-             ;; Select the N oldest articles.
-             (setcdr (nthcdr (1- (abs select)) articles) nil)
-           ;; Select the N most recent articles.
-           (setq articles (nthcdr (- number select) articles))))
+      (when (< (abs select) number)
+       (if (< select 0)
+           ;; Select the N oldest articles.
+           (setcdr (nthcdr (1- (abs select)) articles) nil)
+         ;; Select the N most recent articles.
+         (setq articles (nthcdr (- number select) articles))))
       (setq gnus-newsgroup-unselected
            (gnus-sorted-intersection
             gnus-newsgroup-unreads
@@ -3380,8 +3792,8 @@ If READ-ALL is non-nil, all articles in the group are selected."
 (defun gnus-killed-articles (killed articles)
   (let (out)
     (while articles
-      (if (inline (gnus-member-of-range (car articles) killed))
-         (setq out (cons (car articles) out)))
+      (when (inline (gnus-member-of-range (car articles) killed))
+       (push (car articles) out))
       (setq articles (cdr articles)))
     out))
 
@@ -3502,7 +3914,8 @@ If WHERE is `summary', the summary mode line format will be used."
               (gnus-tmp-unselected (length gnus-newsgroup-unselected))
               (gnus-tmp-unread-and-unselected
                (cond ((and (zerop gnus-tmp-unread-and-unticked)
-                           (zerop gnus-tmp-unselected)) "")
+                           (zerop gnus-tmp-unselected))
+                      "")
                      ((zerop gnus-tmp-unselected)
                       (format "{%d more}" gnus-tmp-unread-and-unticked))
                      (t (format "{%d(+%d) more}"
@@ -3512,7 +3925,8 @@ If WHERE is `summary', the summary mode line format will be used."
                (if (and gnus-current-headers
                         (vectorp gnus-current-headers))
                    (gnus-mode-string-quote
-                    (mail-header-subject gnus-current-headers)) ""))
+                    (mail-header-subject gnus-current-headers))
+                 ""))
               max-len
               gnus-tmp-header);; passed as argument to any user-format-funcs
          (setq mode-string (eval mformat))
@@ -3576,8 +3990,8 @@ The resulting hash table is returned, or nil if no Xrefs were found."
             (and (prog1
                      (setq entry (gnus-gethash name gnus-newsrc-hashtb)
                            info (nth 2 entry))
-                   (if (stringp (setq nth4 (gnus-info-method info)))
-                       (setq nth4 (gnus-server-to-method nth4))))
+                   (when (stringp (setq nth4 (gnus-info-method info)))
+                     (setq nth4 (gnus-server-to-method nth4))))
                  ;; Only do the xrefs if the group has the same
                  ;; select method as the group we have just read.
                  (or (gnus-methods-equal-p
@@ -3795,7 +4209,8 @@ The resulting hash table is returned, or nil if no Xrefs were found."
                    (mail-header-set-xref
                     (car (symbol-value id-dep))
                     (concat (or (mail-header-xref
-                                 (car (symbol-value id-dep))) "")
+                                 (car (symbol-value id-dep)))
+                                "")
                             (or (mail-header-xref header) "")))
                    (setq header nil))
                (setcar (symbol-value id-dep) header))
@@ -3806,7 +4221,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
                        (nconc (cdr (symbol-value ref-dep))
                               (list (symbol-value id-dep))))
              (set ref-dep (list nil (symbol-value id-dep))))
-           (setq headers (cons header headers)))
+           (push header headers))
          (goto-char (point-max))
          (widen))
        (nreverse headers)))))
@@ -3820,7 +4235,8 @@ The resulting hash table is returned, or nil if no Xrefs were found."
           0
         (let ((num (condition-case nil (read buffer) (error nil))))
           (if (numberp num) num 0)))
-     (or (eobp) (forward-char 1))))
+     (unless (eobp)
+       (forward-char 1))))
 
 (defmacro gnus-nov-skip-field ()
   '(search-forward "\t" eol 'move))
@@ -3828,106 +4244,71 @@ The resulting hash table is returned, or nil if no Xrefs were found."
 (defmacro gnus-nov-field ()
   '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
 
-;; Goes through the xover lines and returns a list of vectors
-(defun gnus-get-newsgroup-headers-xover (sequence &optional 
-                                                 force-new dependencies)
-  "Parse the news overview data in the server buffer, and return a
-list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
-  ;; Get the Xref when the users reads the articles since most/some
-  ;; NNTP servers do not include Xrefs when using XOVER.
-  (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
-  (let ((cur nntp-server-buffer)
-       (dependencies (or dependencies gnus-newsgroup-dependencies))
-       number headers header)
-    (save-excursion
-      (set-buffer nntp-server-buffer)
-      ;; Allow the user to mangle the headers before parsing them.
-      (run-hooks 'gnus-parse-headers-hook)
-      (goto-char (point-min))
-      (while (and sequence (not (eobp)))
-       (setq number (read cur))
-       (while (and sequence (< (car sequence) number))
-         (setq sequence (cdr sequence)))
-       (and sequence
-            (eq number (car sequence))
-            (progn
-              (setq sequence (cdr sequence))
-              (if (setq header
-                        (inline (gnus-nov-parse-line
-                                 number dependencies force-new)))
-                  (setq headers (cons header headers)))))
-       (forward-line 1))
-      (setq headers (nreverse headers)))
-    headers))
+(defvar gnus-nov-none-counter 0)
 
 ;; This function has to be called with point after the article number
 ;; on the beginning of the line.
 (defun gnus-nov-parse-line (number dependencies &optional force-new)
-  (let ((none 0)
-       (eol (gnus-point-at-eol))
+  (let ((eol (gnus-point-at-eol))
        (buffer (current-buffer))
        header ref id id-dep ref-dep)
 
     ;; overview: [num subject from date id refs chars lines misc]
     (narrow-to-region (point) eol)
-    (or (eobp) (forward-char))
-
-    (condition-case nil
-       (setq header
-             (vector
-              number                   ; number
-              (gnus-nov-field)         ; subject
-              (gnus-nov-field)         ; from
-              (gnus-nov-field)         ; date
-              (setq id (or (gnus-nov-field)
-                           (concat "none+"
-                                   (int-to-string
-                                    (setq none (1+ none)))))) ; id
-              (progn
-                (save-excursion
-                  (let ((beg (point)))
-                    (search-forward "\t" eol)
-                    (if (search-backward ">" beg t)
-                        (setq ref
-                              (buffer-substring
-                               (1+ (point))
-                               (search-backward "<" beg t)))
-                      (setq ref nil))))
-                (gnus-nov-field))      ; refs
-              (gnus-nov-read-integer)  ; chars
-              (gnus-nov-read-integer)  ; lines
-              (if (= (following-char) ?\n)
-                  nil
-                (gnus-nov-field))      ; misc
-              ))
-      (error (progn
-              (gnus-error 4 "Strange nov line")
-              (setq header nil)
-              (goto-char eol))))
+    (unless (eobp)
+      (forward-char))
+
+    (setq header
+         (vector
+          number                       ; number
+          (gnus-nov-field)             ; subject
+          (gnus-nov-field)             ; from
+          (gnus-nov-field)             ; date
+          (setq id (or (gnus-nov-field)
+                       (concat "none+"
+                               (int-to-string
+                                (incf gnus-nov-none-counter))))) ; id
+          (progn
+            (let ((beg (point)))
+              (search-forward "\t" eol)
+              (if (search-backward ">" beg t)
+                  (setq ref
+                        (buffer-substring
+                         (1+ (point))
+                         (search-backward "<" beg t)))
+                (setq ref nil))
+              (goto-char beg))
+            (gnus-nov-field))          ; refs
+          (gnus-nov-read-integer)      ; chars
+          (gnus-nov-read-integer)      ; lines
+          (if (= (following-char) ?\n)
+              nil
+            (gnus-nov-field))          ; misc
+          ))
 
     (widen)
 
     ;; We build the thread tree.
-    (when header
-      (when (equal id ref)
-       ;; This article refers back to itself.  Naughty, naughty.
-       (setq ref nil))
-      (if (boundp (setq id-dep (intern id dependencies)))
-         (if (and (car (symbol-value id-dep))
-                  (not force-new))
-             ;; An article with this Message-ID has already been seen,
-             ;; so we ignore this one, except we add any additional
-             ;; Xrefs (in case the two articles came from different
-             ;; servers.
-             (progn
-               (mail-header-set-xref
-                (car (symbol-value id-dep))
-                (concat (or (mail-header-xref
-                             (car (symbol-value id-dep))) "")
-                        (or (mail-header-xref header) "")))
-               (setq header nil))
-           (setcar (symbol-value id-dep) header))
-       (set id-dep (list header))))
+    (when (equal id ref)
+      ;; This article refers back to itself.  Naughty, naughty.
+      (setq ref nil))
+    (if (boundp (setq id-dep (intern id dependencies)))
+       (if (and (car (symbol-value id-dep))
+                (not force-new))
+           ;; An article with this Message-ID has already been seen,
+           ;; so we ignore this one, except we add any additional
+           ;; Xrefs (in case the two articles came from different
+           ;; servers.
+           (progn
+             (mail-header-set-xref
+              (car (symbol-value id-dep))
+              (concat (or (mail-header-xref
+                           (car (symbol-value id-dep)))
+                          "")
+                      (or (mail-header-xref header) "")))
+             (setq header nil))
+         (setcar (symbol-value id-dep) header))
+      (set id-dep (list header)))
     (when header
       (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
          (setcdr (symbol-value ref-dep)
@@ -3936,6 +4317,43 @@ list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
        (set ref-dep (list nil (symbol-value id-dep)))))
     header))
 
+;; Goes through the xover lines and returns a list of vectors
+(defun gnus-get-newsgroup-headers-xover (sequence &optional 
+                                                 force-new dependencies)
+  "Parse the news overview data in the server buffer, and return a
+list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
+  ;; Get the Xref when the users reads the articles since most/some
+  ;; NNTP servers do not include Xrefs when using XOVER.
+  (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
+  (let ((cur nntp-server-buffer)
+       (dependencies (or dependencies gnus-newsgroup-dependencies))
+       number headers header)
+    (save-excursion
+      (set-buffer nntp-server-buffer)
+      ;; Allow the user to mangle the headers before parsing them.
+      (run-hooks 'gnus-parse-headers-hook)
+      (goto-char (point-min))
+      (while (not (eobp))
+       (condition-case ()
+           (while (and sequence (not (eobp)))
+             (setq number (read cur))
+             (while (and sequence
+                         (< (car sequence) number))
+               (setq sequence (cdr sequence)))
+             (and sequence
+                  (eq number (car sequence))
+                  (progn
+                    (setq sequence (cdr sequence))
+                    (setq header (inline
+                                   (gnus-nov-parse-line
+                                    number dependencies force-new))))
+                  (push header headers))
+             (forward-line 1))
+         (error
+          (gnus-error 4 "Strange nov line")))
+       (forward-line 1))
+      (nreverse headers))))
+
 (defun gnus-article-get-xrefs ()
   "Fill in the Xref value in `gnus-current-headers', if necessary.
 This is meant to be called in `gnus-article-internal-prepare-hook'."
@@ -3950,14 +4368,13 @@ This is meant to be called in `gnus-article-internal-prepare-hook'."
          (save-restriction
            (nnheader-narrow-to-headers)
            (goto-char (point-min))
-           (if (or (and (eq (downcase (following-char)) ?x)
-                        (looking-at "Xref:"))
-                   (search-forward "\nXref:" nil t))
-               (progn
-                 (goto-char (1+ (match-end 0)))
-                 (setq xref (buffer-substring (point)
-                                              (progn (end-of-line) (point))))
-                 (mail-header-set-xref headers xref))))))))
+           (when (or (and (eq (downcase (following-char)) ?x)
+                          (looking-at "Xref:"))
+                     (search-forward "\nXref:" nil t))
+             (goto-char (1+ (match-end 0)))
+             (setq xref (buffer-substring (point)
+                                          (progn (end-of-line) (point))))
+             (mail-header-set-xref headers xref)))))))
 
 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
   "Find article ID and insert the summary line for that article."
@@ -3979,7 +4396,7 @@ This is meant to be called in `gnus-article-internal-prepare-hook'."
       (when old-header
        (mail-header-set-number header (mail-header-number old-header)))
       (setq gnus-newsgroup-sparse
-           (delq (setq number (mail-header-number header)) 
+           (delq (setq number (mail-header-number header))
                  gnus-newsgroup-sparse))
       (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
       (gnus-rebuild-thread (mail-header-id header))
@@ -3990,10 +4407,10 @@ This is meant to be called in `gnus-article-internal-prepare-hook'."
       ;; article if ID is a number -- so that the next `P' or `N'
       ;; command will fetch the previous (or next) article even
       ;; if the one we tried to fetch this time has been canceled.
-      (and (> number gnus-newsgroup-end)
-          (setq gnus-newsgroup-end number))
-      (and (< number gnus-newsgroup-begin)
-          (setq gnus-newsgroup-begin number))
+      (when (> number gnus-newsgroup-end)
+       (setq gnus-newsgroup-end number))
+      (when (< number gnus-newsgroup-begin)
+       (setq gnus-newsgroup-begin number))
       (setq gnus-newsgroup-unselected
            (delq number gnus-newsgroup-unselected)))
     ;; Report back a success?
@@ -4077,9 +4494,9 @@ taken into consideration."
 If optional argument BACKWARD is non-nil, search backward instead."
   (save-excursion
     (set-buffer gnus-group-buffer)
-    (if (gnus-group-search-forward
-        backward nil (if use-level (gnus-group-group-level) nil))
-       (gnus-group-group-name))))
+    (when (gnus-group-search-forward
+          backward nil (if use-level (gnus-group-group-level) nil))
+      (gnus-group-group-name))))
 
 (defun gnus-summary-best-group (&optional exclude-group)
   "Find the name of the best unread group.
@@ -4123,19 +4540,18 @@ If EXCLUDE-GROUP, do not go to this group."
                   (not unread)
                   (not (gnus-data-unread-p (car arts)))))
       (setq arts (cdr arts)))
-    (if (setq result
-             (if unread
-                 (progn
-                   (while arts
-                     (and (gnus-data-unread-p (car arts))
-                          (setq result (car arts)
-                                arts nil))
-                     (setq arts (cdr arts)))
-                   result)
-               (car arts)))
-       (progn
-         (goto-char (gnus-data-pos result))
-         (gnus-data-number result)))))
+    (when (setq result
+               (if unread
+                   (progn
+                     (while arts
+                       (when (gnus-data-unread-p (car arts))
+                         (setq result (car arts)
+                               arts nil))
+                       (setq arts (cdr arts)))
+                     result)
+                 (car arts)))
+      (goto-char (gnus-data-pos result))
+      (gnus-data-number result))))
 
 (defun gnus-summary-find-subject (subject &optional unread backward article)
   (let* ((simp-subject (gnus-simplify-subject-fully subject))
@@ -4216,8 +4632,8 @@ displayed, no centering will be performed."
   (if (eq (current-buffer) (get-buffer gnus-group-buffer))
       (save-window-excursion
        ;; Take care of tree window mode.
-       (if (get-buffer-window gnus-group-buffer)
-           (pop-to-buffer gnus-group-buffer))
+       (when (get-buffer-window gnus-group-buffer)
+         (pop-to-buffer gnus-group-buffer))
        (gnus-group-jump-to-group newsgroup))
     (save-excursion
       ;; Take care of tree window mode.
@@ -4243,20 +4659,21 @@ displayed, no centering will be performed."
       (if (not (listp (cdr read)))
          (setq first (1+ (cdr read)))
        ;; `read' is a list of ranges.
-       (if (/= (setq nlast (or (and (numberp (car read)) (car read))
-                               (caar read))) 1)
-           (setq first 1))
+       (when (/= (setq nlast (or (and (numberp (car read)) (car read))
+                                 (caar read)))
+                 1)
+         (setq first 1))
        (while read
-         (if first
-             (while (< first nlast)
-               (setq unread (cons first unread))
-               (setq first (1+ first))))
+         (when first
+           (while (< first nlast)
+             (push first unread)
+             (setq first (1+ first))))
          (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
          (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
          (setq read (cdr read)))))
     ;; And add the last unread articles.
     (while (<= first last)
-      (setq unread (cons first unread))
+      (push first unread)
       (setq first (1+ first)))
     ;; Return the list of unread articles.
     (nreverse unread)))
@@ -4346,7 +4763,8 @@ The prefix argument ALL means to select all articles."
               (setq gnus-newsgroup-unselected
                     (sort gnus-newsgroup-unselected '<)))
              (setq gnus-newsgroup-unreads
-                   (sort gnus-newsgroup-unreads '<))) t)))
+                   (sort gnus-newsgroup-unreads '<)))
+            t)))
     (unless (listp (cdr gnus-newsgroup-killed))
       (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
     (let ((headers gnus-newsgroup-headers))
@@ -4368,8 +4786,8 @@ The prefix argument ALL means to select all articles."
        (gnus-score-save))
       ;; Do not switch windows but change the buffer to work.
       (set-buffer gnus-group-buffer)
-      (or (gnus-ephemeral-group-p gnus-newsgroup-name)
-         (gnus-group-update-group group)))))
+      (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
+       (gnus-group-update-group group)))))
 
 (defun gnus-summary-exit (&optional temporary)
   "Exit reading current newsgroup, and then return to group selection mode.
@@ -4427,8 +4845,8 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
        (set-buffer gnus-group-buffer)
        (gnus-summary-clear-local-variables)
        ;; Return to group mode buffer.
-       (if (eq mode 'gnus-summary-mode)
-           (gnus-kill-buffer buf)))
+       (when (eq mode 'gnus-summary-mode)
+         (gnus-kill-buffer buf)))
       (setq gnus-current-select-method gnus-select-method)
       (pop-to-buffer gnus-group-buffer)
       ;; Clear the current group name.
@@ -4437,21 +4855,7 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
            (gnus-group-jump-to-group group)
            (gnus-group-next-unread-group 1)
            (gnus-configure-windows 'group 'force))
-       (if (not (buffer-name (car quit-config)))
-           (gnus-configure-windows 'group 'force)
-         (set-buffer (car quit-config))
-         (cond ((eq major-mode 'gnus-summary-mode)
-                (gnus-set-global-variables))
-               ((eq major-mode 'gnus-article-mode)
-                (save-excursion
-                  ;; The `gnus-summary-buffer' variable may point
-                  ;; to the old summary buffer when using a single
-                  ;; article buffer.
-                  (unless (gnus-buffer-live-p gnus-summary-buffer)
-                    (set-buffer gnus-group-buffer))
-                  (set-buffer gnus-summary-buffer)
-                  (gnus-set-global-variables))))
-         (gnus-configure-windows (cdr quit-config) 'force)))
+       (gnus-handle-ephemeral-exit quit-config))
       (unless quit-config
        (setq gnus-newsgroup-name nil)))))
 
@@ -4492,12 +4896,35 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
       (when (equal (gnus-group-group-name) group)
        (gnus-group-next-unread-group 1))
       (when quit-config
-       (if (not (buffer-name (car quit-config)))
-           (gnus-configure-windows 'group 'force)
-         (set-buffer (car quit-config))
-         (when (eq major-mode 'gnus-summary-mode)
-           (gnus-set-global-variables))
-         (gnus-configure-windows (cdr quit-config)))))))
+        (gnus-handle-ephemeral-exit quit-config)))))
+
+(defun gnus-handle-ephemeral-exit (quit-config)
+  "Handle movement when leaving an ephemeral group.  The state
+which existed when entering the ephemeral is reset."
+  (if (not (buffer-name (car quit-config)))
+      (gnus-configure-windows 'group 'force)
+    (set-buffer (car quit-config))
+    (cond ((eq major-mode 'gnus-summary-mode)
+           (gnus-set-global-variables))
+          ((eq major-mode 'gnus-article-mode)
+           (save-excursion
+             ;; The `gnus-summary-buffer' variable may point
+             ;; to the old summary buffer when using a single
+             ;; article buffer.
+             (unless (gnus-buffer-live-p gnus-summary-buffer)
+               (set-buffer gnus-group-buffer))
+             (set-buffer gnus-summary-buffer)
+             (gnus-set-global-variables))))
+    (if (or (eq (cdr quit-config) 'article)
+            (eq (cdr quit-config) 'pick))
+        (progn
+          ;; The current article may be from the ephemeral group
+          ;; thus it is best that we reload this article
+          (gnus-summary-show-article)
+          (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
+              (gnus-configure-windows 'pick 'force)
+            (gnus-configure-windows (cdr quit-config) 'force)))
+      (gnus-configure-windows (cdr quit-config) 'force))))
 
 ;;; Dead summaries.
 
@@ -4547,7 +4974,8 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
     (when (string-match "Summary" name)
       (rename-buffer
        (concat (substring name 0 (match-beginning 0)) "Dead "
-              (substring name (match-beginning 0))) t))))
+              (substring name (match-beginning 0)))
+       t))))
 
 (defun gnus-kill-or-deaden-summary (buffer)
   "Kill or deaden the summary BUFFER."
@@ -4579,7 +5007,8 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
     (when (string-match "Dead " name)
       (rename-buffer
        (concat (substring name 0 (match-beginning 0))
-              (substring name (match-end 0))) t)))
+              (substring name (match-end 0)))
+       t)))
   (gnus-message 3 "This dead summary is now alive again"))
 
 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
@@ -4589,14 +5018,14 @@ If FAQ-DIR (the prefix), prompt for a directory to search for the faq
 in."
   (interactive
    (list
-    (if current-prefix-arg
-       (completing-read
-        "Faq dir: " (and (listp gnus-group-faq-directory)
-                         gnus-group-faq-directory)))))
+    (when current-prefix-arg
+      (completing-read
+       "Faq dir: " (and (listp gnus-group-faq-directory)
+                       gnus-group-faq-directory)))))
   (let (gnus-faq-buffer)
-    (and (setq gnus-faq-buffer
-              (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
-        (gnus-configure-windows 'summary-faq))))
+    (when (setq gnus-faq-buffer
+               (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
+      (gnus-configure-windows 'summary-faq))))
 
 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
 (defun gnus-summary-describe-group (&optional force)
@@ -4689,10 +5118,9 @@ Returns the article selected or nil if there are no unread articles."
          (while (and data
                      (not (gnus-data-unread-p (car data))))
            (setq data (cdr data)))
-         (if data
-             (progn
-               (goto-char (gnus-data-pos (car data)))
-               (gnus-data-number (car data)))))))
+         (when data
+           (goto-char (gnus-data-pos (car data)))
+           (gnus-data-number (car data))))))
     (gnus-summary-position-point)))
 
 (defun gnus-summary-next-subject (n &optional unread dont-display)
@@ -4709,8 +5137,9 @@ returned."
                    (gnus-summary-find-prev unread)
                  (gnus-summary-find-next unread)))
       (setq n (1- n)))
-    (if (/= 0 n) (gnus-message 7 "No more%s articles"
-                              (if unread " unread" "")))
+    (when (/= 0 n)
+      (gnus-message 7 "No more%s articles"
+                   (if unread " unread" "")))
     (unless dont-display
       (gnus-summary-recenter)
       (gnus-summary-position-point))
@@ -4735,6 +5164,7 @@ If optional argument UNREAD is non-nil, only unread article is selected."
 (defun gnus-summary-goto-subject (article &optional force silent)
   "Go the subject line of ARTICLE.
 If FORCE, also allow jumping to articles not currently shown."
+  (interactive "nArticle number: ")
   (let ((b (point))
        (data (gnus-data-find article)))
     ;; We read in the article if we have to.
@@ -4776,7 +5206,7 @@ Given a prefix, will force an `article' buffer configuration."
                 (not (zerop gnus-current-article)))
        (gnus-summary-goto-subject gnus-current-article))
       (gnus-summary-recenter)
-      (when gnus-use-trees
+      (when (and gnus-use-trees gnus-show-threads)
        (gnus-possibly-generate-tree article)
        (gnus-highlight-selected-tree article))
       ;; Successfully display article.
@@ -4817,12 +5247,12 @@ be displayed."
              (prog1
                  (gnus-summary-display-article article all-headers)
                (setq did article))
-           (if (or all-headers gnus-show-all-headers)
-               (gnus-article-show-all-headers))
+           (when (or all-headers gnus-show-all-headers)
+             (gnus-article-show-all-headers))
            'old))
-      (if did
-         (gnus-article-set-window-start
-          (cdr (assq article gnus-newsgroup-bookmarks)))))))
+      (when did
+       (gnus-article-set-window-start
+        (cdr (assq article gnus-newsgroup-bookmarks)))))))
 
 (defun gnus-summary-set-current-mark (&optional current-mark)
   "Obsolete function."
@@ -4860,8 +5290,8 @@ If BACKWARD, the previous article is selected instead of the next."
      nil t))
    ;; Go to next/previous group.
    (t
-    (or (gnus-ephemeral-group-p gnus-newsgroup-name)
-       (gnus-summary-jump-to-group gnus-newsgroup-name))
+    (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
+      (gnus-summary-jump-to-group gnus-newsgroup-name))
     (let ((cmd last-command-char)
          (group
           (if (eq gnus-keep-same-level 'best)
@@ -4922,8 +5352,8 @@ If BACKWARD, the previous article is selected instead of the next."
        ((assq key keystrokes)
        (let ((obuf (current-buffer)))
          (switch-to-buffer gnus-group-buffer)
-         (and group
-              (gnus-group-jump-to-group group))
+         (when group
+           (gnus-group-jump-to-group group))
          (eval (cadr (assq key keystrokes)))
          (setq group (gnus-group-group-name))
          (switch-to-buffer obuf))
@@ -5022,8 +5452,8 @@ Argument LINES specifies lines to be scrolled up (or down if negative)."
   (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
     (gnus-eval-in-buffer-window gnus-article-buffer
       (cond ((> lines 0)
-            (if (gnus-article-next-page lines)
-                (gnus-message 3 "End of message")))
+            (when (gnus-article-next-page lines)
+              (gnus-message 3 "End of message")))
            ((< lines 0)
             (gnus-article-prev-page (- lines))))))
   (gnus-summary-recenter)
@@ -5114,8 +5544,8 @@ If ALL-HEADERS is non-nil, no header lines are hidden."
   "Go to the previously read article."
   (interactive)
   (prog1
-      (and gnus-last-article
-          (gnus-summary-goto-article gnus-last-article))
+      (when gnus-last-article
+       (gnus-summary-goto-article gnus-last-article))
     (gnus-summary-position-point)))
 
 (defun gnus-summary-pop-article (number)
@@ -5167,7 +5597,8 @@ If given a prefix, remove all limits."
     (prog1
        (let ((articles (gnus-summary-find-matching
                         (or header "subject") subject 'all)))
-         (or articles (error "Found no matches for \"%s\"" subject))
+         (unless articles
+           (error "Found no matches for \"%s\"" subject))
          (gnus-summary-limit articles))
       (gnus-summary-position-point))))
 
@@ -5212,9 +5643,9 @@ Returns how many articles were removed."
                     (append marks nil))) ; Transform to list.
            articles)
        (while data
-         (and (if reverse (not (memq (gnus-data-mark (car data)) marks))
-                (memq (gnus-data-mark (car data)) marks))
-              (setq articles (cons (gnus-data-number (car data)) articles)))
+         (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
+                 (memq (gnus-data-mark (car data)) marks))
+           (push (gnus-data-number (car data)) articles))
          (setq data (cdr data)))
        (gnus-summary-limit articles))
     (gnus-summary-position-point)))
@@ -5241,8 +5672,8 @@ Returns how many articles were removed."
   "Display all the hidden articles that are marked as dormant."
   (interactive)
   (gnus-set-global-variables)
-  (or gnus-newsgroup-dormant
-      (error "There are no dormant articles in this group"))
+  (unless gnus-newsgroup-dormant
+    (error "There are no dormant articles in this group"))
   (prog1
       (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
     (gnus-summary-position-point)))
@@ -5310,8 +5741,7 @@ If ALL, mark even excluded ticked and dormants as read."
       (setq articles (car gnus-newsgroup-limits)
            gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
     ;; We use the new limit, so we push the old limit on the stack.
-    (setq gnus-newsgroup-limits
-         (cons gnus-newsgroup-limit gnus-newsgroup-limits)))
+    (push gnus-newsgroup-limit gnus-newsgroup-limits))
   ;; Set the limit.
   (setq gnus-newsgroup-limit articles)
   (let ((total (length gnus-newsgroup-data))
@@ -5476,7 +5906,7 @@ fetch-old-headers verbiage, and so on."
          0
        ;; Ok, this article is to be visible, so we add it to the limit
        ;; and return 1.
-       (setq gnus-newsgroup-limit (cons number gnus-newsgroup-limit))
+       (push number gnus-newsgroup-limit)
        1))))
 
 (defun gnus-expunge-thread (thread)
@@ -5627,17 +6057,18 @@ to guess what the document format is."
        (delete-matching-lines "^\\(Path\\):\\|^From ")
        (widen))
       (unwind-protect
-         (if (gnus-group-read-ephemeral-group
-              name `(nndoc ,name (nndoc-address ,(get-buffer dig))
-                           (nndoc-article-type ,(if force 'digest 'guess))) t)
-             ;; Make all postings to this group go to the parent group.
-             (nconc (gnus-info-params (gnus-get-info name))
-                    params)
-           ;; Couldn't select this doc group.
-           (switch-to-buffer buf)
-           (gnus-set-global-variables)
-           (gnus-configure-windows 'summary)
-           (gnus-message 3 "Article couldn't be entered?"))
+          (if (gnus-group-read-ephemeral-group
+               name `(nndoc ,name (nndoc-address ,(get-buffer dig))
+                            (nndoc-article-type 
+                             ,(if force 'digest 'guess))) t)
+              ;; Make all postings to this group go to the parent group.
+              (nconc (gnus-info-params (gnus-get-info name))
+                     params)
+            ;; Couldn't select this doc group.
+            (switch-to-buffer buf)
+            (gnus-set-global-variables)
+            (gnus-configure-windows 'summary)
+            (gnus-message 3 "Article couldn't be entered?"))
        (kill-buffer dig)))))
 
 (defun gnus-summary-read-document (n)
@@ -5793,15 +6224,15 @@ in the comparisons."
        (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
        (case-fold-search (not not-case-fold))
        articles d)
-    (or (fboundp (intern (concat "mail-header-" header)))
-       (error "%s is not a valid header" header))
+    (unless (fboundp (intern (concat "mail-header-" header)))
+      (error "%s is not a valid header" header))
     (while data
       (setq d (car data))
       (and (or (not unread)            ; We want all articles...
               (gnus-data-unread-p d))  ; Or just unreads.
           (vectorp (gnus-data-header d)) ; It's not a pseudo.
           (string-match regexp (funcall func (gnus-data-header d))) ; Match.
-          (setq articles (cons (gnus-data-number d) articles))) ; Success!
+          (push (gnus-data-number d) articles)) ; Success!
       (setq data (cdr data)))
     (nreverse articles)))
 
@@ -5844,7 +6275,8 @@ article.  If BACKWARD (the prefix) is non-nil, search backward instead."
   (gnus-eval-in-buffer-window gnus-article-buffer
     (widen)
     (goto-char (point-min))
-    (and gnus-break-pages (gnus-narrow-to-page))))
+    (when gnus-break-pages
+      (gnus-narrow-to-page))))
 
 (defun gnus-summary-end-of-article ()
   "Scroll to the end of the article."
@@ -5856,7 +6288,8 @@ article.  If BACKWARD (the prefix) is non-nil, search backward instead."
     (widen)
     (goto-char (point-max))
     (recenter -3)
-    (and gnus-break-pages (gnus-narrow-to-page))))
+    (when gnus-break-pages
+      (gnus-narrow-to-page))))
 
 (defun gnus-summary-show-article (&optional arg)
   "Force re-fetching of the current article.
@@ -5917,8 +6350,8 @@ If ARG is a negative number, hide the unwanted header lines."
       (insert-buffer-substring gnus-original-article-buffer 1 e)
       (let ((article-inhibit-hiding t))
        (run-hooks 'gnus-article-display-hook))
-      (if (or (not hidden) (and (numberp arg) (< arg 0)))
-         (gnus-article-hide-headers)))))
+      (when (or (not hidden) (and (numberp arg) (< arg 0)))
+       (gnus-article-hide-headers)))))
 
 (defun gnus-summary-show-all-headers ()
   "Make all header lines visible."
@@ -5974,7 +6407,8 @@ For this function to work, both the current newsgroup and the
 newsgroup that you want to move to have to support the `request-move'
 and `request-accept' functions."
   (interactive "P")
-  (unless action (setq action 'move))
+  (unless action
+    (setq action 'move))
   (gnus-set-global-variables)
   ;; Check whether the source group supports the required functions.
   (cond ((and (eq action 'move)
@@ -6007,10 +6441,10 @@ and `request-accept' functions."
     (setq to-method (or select-method 
                        (gnus-group-name-to-method to-newsgroup)))
     ;; Check the method we are to move this article to...
-    (or (gnus-check-backend-function 'request-accept-article (car to-method))
-       (error "%s does not support article copying" (car to-method)))
-    (or (gnus-check-server to-method)
-       (error "Can't open server %s" (car to-method)))
+    (unless (gnus-check-backend-function 'request-accept-article (car to-method))
+      (error "%s does not support article copying" (car to-method)))
+    (unless (gnus-check-server to-method)
+      (error "Can't open server %s" (car to-method)))
     (gnus-message 6 "%s to %s: %s..."
                  (caddr (assq action names))
                  (or (car select-method) to-newsgroup) articles)
@@ -6023,7 +6457,7 @@ and `request-accept' functions."
        ((eq action 'move)
         (gnus-request-move-article
          article                       ; Article to move
-         gnus-newsgroup-name           ; From newsgrouo
+         gnus-newsgroup-name           ; From newsgroup
          (nth 1 (gnus-find-method-for-group
                  gnus-newsgroup-name)) ; Server
          (list 'gnus-request-accept-article
@@ -6177,7 +6611,7 @@ latter case, they will be copied into the relevant groups."
                (method
                 (gnus-completing-read 
                  methname "What backend do you want to use when respooling?"
-                 methods nil t nil 'gnus-method-history))
+                 methods nil t nil 'gnus-mail-method-history))
                ms)
           (cond
            ((zerop (length (setq ms (gnus-servers-using-backend method))))
@@ -6204,8 +6638,8 @@ latter case, they will be copied into the relevant groups."
   (let ((group gnus-newsgroup-name)
        (now (current-time))
        atts lines)
-    (or (gnus-check-backend-function 'request-accept-article group)
-       (error "%s does not support article importing" group))
+    (unless (gnus-check-backend-function 'request-accept-article group)
+      (error "%s does not support article importing" group))
     (or (file-readable-p file)
        (not (file-regular-p file))
        (error "Can't read %s" file))
@@ -6224,7 +6658,8 @@ latter case, they will be copied into the relevant groups."
                "Date: " (timezone-make-date-arpa-standard
                          (current-time-string (nth 5 atts))
                          (current-time-zone now)
-                         (current-time-zone now)) "\n"
+                         (current-time-zone now))
+               "\n"
                "Message-ID: " (message-make-message-id) "\n"
                "Lines: " (int-to-string lines) "\n"
                "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
@@ -6310,16 +6745,16 @@ If N is nil and articles have been marked with the process mark,
 delete these instead."
   (interactive "P")
   (gnus-set-global-variables)
-  (or (gnus-check-backend-function 'request-expire-articles
-                                  gnus-newsgroup-name)
-      (error "The current newsgroup does not support article deletion."))
+  (unless (gnus-check-backend-function 'request-expire-articles
+                                      gnus-newsgroup-name)
+    (error "The current newsgroup does not support article deletion."))
   ;; Compute the list of articles to delete.
   (let ((articles (gnus-summary-work-articles n))
        not-deleted)
     (if (and gnus-novice-user
             (not (gnus-y-or-n-p
                   (format "Do you really want to delete %s forever? "
-                          (if (> (length articles) 1) 
+                          (if (> (length articles) 1)
                               (format "these %s articles" (length articles))
                             "this article")))))
        ()
@@ -6330,8 +6765,8 @@ delete these instead."
        (gnus-summary-remove-process-mark (car articles))
        ;; The backend might not have been able to delete the article
        ;; after all.
-       (or (memq (car articles) not-deleted)
-           (gnus-summary-mark-article (car articles) gnus-canceled-mark))
+       (unless (memq (car articles) not-deleted)
+         (gnus-summary-mark-article (car articles) gnus-canceled-mark))
        (setq articles (cdr articles))))
     (gnus-summary-position-point)
     (gnus-set-mode-line 'summary)
@@ -6420,8 +6855,8 @@ groups."
       (goto-char (point-min))
       (search-forward "\n\n")
       (narrow-to-region (point-min) (point))
-      (pp-eval-expression
-       (list 'quote (mapcar 'car (nnmail-article-group 'identity)))))))
+      (message "This message would go to %s"
+              (mapconcat 'car (nnmail-article-group 'identity) ", ")))))
 
 ;; Summary marking commands.
 
@@ -6431,8 +6866,8 @@ If UNMARK is positive, remove any kind of mark.
 If UNMARK is negative, tick articles."
   (interactive "P")
   (gnus-set-global-variables)
-  (if unmark
-      (setq unmark (prefix-numeric-value unmark)))
+  (when unmark
+    (setq unmark (prefix-numeric-value unmark)))
   (let ((count
         (gnus-summary-mark-same-subject
          (gnus-summary-article-subject) unmark)))
@@ -6450,15 +6885,15 @@ If UNMARK is positive, remove any kind of mark.
 If UNMARK is negative, tick articles."
   (interactive "P")
   (gnus-set-global-variables)
-  (if unmark
-      (setq unmark (prefix-numeric-value unmark)))
+  (when unmark
+    (setq unmark (prefix-numeric-value unmark)))
   (let ((count
         (gnus-summary-mark-same-subject
          (gnus-summary-article-subject) unmark)))
     ;; If marked as read, go to next unread subject.
-    (if (null unmark)
-       ;; Go to next unread subject.
-       (gnus-summary-next-subject 1 t))
+    (when (null unmark)
+      ;; Go to next unread subject.
+      (gnus-summary-next-subject 1 t))
     (gnus-message 7 "%d articles are marked as %s"
                  count (if unmark "unread" "read"))))
 
@@ -6511,7 +6946,8 @@ number of articles marked is returned."
              (gnus-summary-set-process-mark (gnus-summary-article-number)))
            (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
       (setq n (1- n)))
-    (if (/= 0 n) (gnus-message 7 "No more articles"))
+    (when (/= 0 n)
+      (gnus-message 7 "No more articles"))
     (gnus-summary-recenter)
     (gnus-summary-position-point)
     n))
@@ -6543,7 +6979,7 @@ the actual number of articles marked is returned."
 
 (defun gnus-summary-mark-article-as-replied (article)
   "Mark ARTICLE replied and update the summary line."
-  (setq gnus-newsgroup-replied (cons article gnus-newsgroup-replied))
+  (push article gnus-newsgroup-replied)
   (let ((buffer-read-only nil))
     (when (gnus-summary-goto-subject article)
       (gnus-summary-update-secondary-mark article))))
@@ -6552,30 +6988,30 @@ the actual number of articles marked is returned."
   "Set a bookmark in current article."
   (interactive (list (gnus-summary-article-number)))
   (gnus-set-global-variables)
-  (if (or (not (get-buffer gnus-article-buffer))
-         (not gnus-current-article)
-         (not gnus-article-current)
-         (not (equal gnus-newsgroup-name (car gnus-article-current))))
-      (error "No current article selected"))
+  (when (or (not (get-buffer gnus-article-buffer))
+           (not gnus-current-article)
+           (not gnus-article-current)
+           (not (equal gnus-newsgroup-name (car gnus-article-current))))
+    (error "No current article selected"))
   ;; Remove old bookmark, if one exists.
   (let ((old (assq article gnus-newsgroup-bookmarks)))
-    (if old (setq gnus-newsgroup-bookmarks
-                 (delq old gnus-newsgroup-bookmarks))))
+    (when old
+      (setq gnus-newsgroup-bookmarks
+           (delq old gnus-newsgroup-bookmarks))))
   ;; Set the new bookmark, which is on the form
   ;; (article-number . line-number-in-body).
-  (setq gnus-newsgroup-bookmarks
-       (cons
-        (cons article
-              (save-excursion
-                (set-buffer gnus-article-buffer)
-                (count-lines
-                 (min (point)
-                      (save-excursion
-                        (goto-char (point-min))
-                        (search-forward "\n\n" nil t)
-                        (point)))
-                 (point))))
-        gnus-newsgroup-bookmarks))
+  (push
+   (cons article
+        (save-excursion
+          (set-buffer gnus-article-buffer)
+          (count-lines
+           (min (point)
+                (save-excursion
+                  (goto-char (point-min))
+                  (search-forward "\n\n" nil t)
+                  (point)))
+           (point))))
+   gnus-newsgroup-bookmarks)
   (gnus-message 6 "A bookmark has been added to the current article."))
 
 (defun gnus-summary-remove-bookmark (article)
@@ -6645,7 +7081,8 @@ returned."
                             (not (eq gnus-summary-goto-unread 'never)))
                        t)))
       (setq n (1- n)))
-    (if (/= 0 n) (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
+    (when (/= 0 n)
+      (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
     (gnus-summary-recenter)
     (gnus-summary-position-point)
     (gnus-set-mode-line 'summary)
@@ -6657,10 +7094,10 @@ returned."
     (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
     (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
     (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
-    (setq gnus-newsgroup-reads
-         (cons (cons article mark) gnus-newsgroup-reads))
+    (push (cons article mark) gnus-newsgroup-reads)
     ;; Possibly remove from cache, if that is used.
-    (and gnus-use-cache (gnus-cache-enter-remove-article article))
+    (when gnus-use-cache
+      (gnus-cache-enter-remove-article article))
     ;; Allow the backend to change the mark.
     (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
     ;; Check for auto-expiry.
@@ -6717,8 +7154,8 @@ If MARK is nil, then the default character `?D' is used.
 If ARTICLE is nil, then the article on the current line will be
 marked."
   ;; The mark might be a string.
-  (and (stringp mark)
-       (setq mark (aref mark 0)))
+  (when (stringp mark)
+    (setq mark (aref mark 0)))
   ;; If no mark is given, then we check auto-expiring.
   (and (not no-expire)
        gnus-newsgroup-auto-expire
@@ -6731,7 +7168,8 @@ marked."
        (setq mark gnus-expirable-mark))
   (let* ((mark (or mark gnus-del-mark))
         (article (or article (gnus-summary-article-number))))
-    (or article (error "No article on current line"))
+    (unless article
+      (error "No article on current line"))
     (if (or (= mark gnus-unread-mark)
            (= mark gnus-ticked-mark)
            (= mark gnus-dormant-mark))
@@ -6749,12 +7187,12 @@ marked."
            (= mark gnus-ticked-mark)
            (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
 
-    (if (gnus-summary-goto-subject article nil t)
-       (let ((buffer-read-only nil))
-         (gnus-summary-show-thread)
-         ;; Fix the mark.
-         (gnus-summary-update-mark mark 'unread)
-         t))))
+    (when (gnus-summary-goto-subject article nil t)
+      (let ((buffer-read-only nil))
+       (gnus-summary-show-thread)
+       ;; Fix the mark.
+       (gnus-summary-update-mark mark 'unread)
+       t))))
 
 (defun gnus-summary-update-secondary-mark (article)
   "Update the secondary (read, process, cache) mark."
@@ -6777,7 +7215,8 @@ marked."
   (let ((forward (cdr (assq type gnus-summary-mark-positions)))
         (buffer-read-only nil))
     (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
-    (and (looking-at "\r") (setq forward (1+ forward)))
+    (when (looking-at "\r")
+      (incf forward))
     (when (and forward
                (<= (+ forward (point)) (point-max)))
       ;; Go to the right position on the line.
@@ -6795,7 +7234,7 @@ marked."
   ;; Make the article expirable.
   (let ((mark (or mark gnus-del-mark)))
     (if (= mark gnus-expirable-mark)
-       (setq gnus-newsgroup-expirable (cons article gnus-newsgroup-expirable))
+       (push article gnus-newsgroup-expirable)
       (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
     ;; Remove from unread and marked lists.
     (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
@@ -6969,8 +7408,8 @@ even ticked and dormant ones."
     (set-buffer gnus-summary-buffer)
     (goto-char (point-min))
     (while (and (progn
-                 (if (> (gnus-summary-article-score) score)
-                     (gnus-summary-mark-article nil mark))
+                 (when (> (gnus-summary-article-score) score)
+                   (gnus-summary-mark-article nil mark))
                  t)
                (gnus-summary-find-next)))))
 
@@ -6984,10 +7423,10 @@ even ticked and dormant ones."
     (let ((scored gnus-newsgroup-scored)
          headers h)
       (while scored
-       (or (gnus-summary-goto-subject (caar scored))
-           (and (setq h (gnus-summary-article-header (caar scored)))
-                (< (cdar scored) gnus-summary-expunge-below)
-                (setq headers (cons h headers))))
+       (unless (gnus-summary-goto-subject (caar scored))
+         (and (setq h (gnus-summary-article-header (caar scored)))
+              (< (cdar scored) gnus-summary-expunge-below)
+              (push h headers)))
        (setq scored (cdr scored)))
       (if (not headers)
          (when (not no-error)
@@ -7106,7 +7545,7 @@ with that article."
                  (mail-header-subject (gnus-data-header (car data)))))
                (t nil)))
         (end-point (save-excursion
-                     (if (gnus-summary-go-to-next-thread) 
+                     (if (gnus-summary-go-to-next-thread)
                          (point) (point-max))))
         articles)
     (while (and data
@@ -7146,10 +7585,10 @@ with that article."
 Note that the re-threading will only work if `gnus-thread-ignore-subject'
 is non-nil or the Subject: of both articles are the same."
   (interactive)
-  (or (not (gnus-group-read-only-p))
-      (error "The current newsgroup does not support article editing."))
-  (or (<= (length gnus-newsgroup-processable) 1)
-      (error "No more than one article may be marked."))
+  (unless (not (gnus-group-read-only-p))
+    (error "The current newsgroup does not support article editing."))
+  (unless (<= (length gnus-newsgroup-processable) 1)
+    (error "No more than one article may be marked."))
   (save-window-excursion
     (let ((gnus-article-buffer " *reparent*")
          (current-article (gnus-summary-article-number))
@@ -7160,12 +7599,12 @@ is non-nil or the Subject: of both articles are the same."
                              (if (eq (forward-line -1) 0)
                                  (gnus-summary-article-number)
                                (error "Beginning of summary buffer."))))))
-      (or (not (eq current-article parent-article))
-         (error "An article may not be self-referential."))
+      (unless (not (eq current-article parent-article))
+       (error "An article may not be self-referential."))
       (let ((message-id (mail-header-id 
                         (gnus-summary-article-header parent-article))))
-       (or (and message-id (not (equal message-id "")))
-           (error "No message-id in desired parent."))
+       (unless (and message-id (not (equal message-id "")))
+         (error "No message-id in desired parent."))
        (gnus-summary-select-article t t nil current-article)
        (set-buffer gnus-article-buffer)
        (setq buffer-read-only nil)
@@ -7176,10 +7615,10 @@ is non-nil or the Subject: of both articles are the same."
        (if (search-forward-regexp "^References: " nil t)
            (insert message-id " " )
          (insert "References: " message-id "\n"))
-       (or (gnus-request-replace-article current-article
-                                         (car gnus-article-current)
-                                         gnus-article-buffer)
-           (error "Couldn't replace article."))
+       (unless (gnus-request-replace-article current-article
+                                             (car gnus-article-current)
+                                             gnus-article-buffer)
+         (error "Couldn't replace article."))
        (set-buffer gnus-summary-buffer)
        (gnus-summary-unmark-all-processable)
        (gnus-summary-rethread-current)
@@ -7313,14 +7752,14 @@ done."
 (defun gnus-summary-go-down-thread ()
   "Go down one level in the current thread."
   (let ((children (gnus-summary-article-children)))
-    (and children
-        (gnus-summary-goto-subject (car children)))))
+    (when children
+      (gnus-summary-goto-subject (car children)))))
 
 (defun gnus-summary-go-up-thread ()
   "Go up one level in the current thread."
   (let ((parent (gnus-summary-article-parent)))
-    (and parent
-        (gnus-summary-goto-subject parent))))
+    (when parent
+      (gnus-summary-goto-subject parent))))
 
 (defun gnus-summary-down-thread (n)
   "Go down thread N steps.
@@ -7336,7 +7775,8 @@ taken."
                  (gnus-summary-go-down-thread)))
       (setq n (1- n)))
     (gnus-summary-position-point)
-    (if (/= 0 n) (gnus-message 7 "Can't go further"))
+    (when (/= 0 n)
+      (gnus-message 7 "Can't go further"))
     n))
 
 (defun gnus-summary-up-thread (n)
@@ -7382,9 +7822,9 @@ If the prefix argument is negative, tick articles instead."
         gnus-thread-hide-killed
         (gnus-summary-hide-thread))
     ;; If marked as read, go to next unread subject.
-    (if (null unmark)
-       ;; Go to next unread subject.
-       (gnus-summary-next-subject 1 t)))
+    (when (null unmark)
+      ;; Go to next unread subject.
+      (gnus-summary-next-subject 1 t)))
   (gnus-set-mode-line 'summary))
 
 ;; Summary sorting commands
@@ -7582,7 +8022,7 @@ save those articles instead."
         (minibuffer-confirm-incomplete nil) ; XEmacs
         group-map
         (dum (mapatoms
-              (lambda (g) 
+              (lambda (g)
                 (and (boundp g)
                      (symbol-name g)
                      (memq 'respool
@@ -7615,19 +8055,19 @@ save those articles instead."
                                  nil nil nil
                                  'gnus-group-history)))))
     (when to-newsgroup
-      (if (or (string= to-newsgroup "")
-             (string= to-newsgroup prefix))
-         (setq to-newsgroup (or default "")))
+      (when (or (string= to-newsgroup "")
+               (string= to-newsgroup prefix))
+       (setq to-newsgroup (or default "")))
       (or (gnus-active to-newsgroup)
          (gnus-activate-group to-newsgroup)
-         (if (gnus-y-or-n-p (format "No such group: %s.  Create it? "
-                                    to-newsgroup))
-             (or (and (gnus-request-create-group 
-                       to-newsgroup (gnus-group-name-to-method to-newsgroup))
-                      (gnus-activate-group to-newsgroup nil nil
-                                           (gnus-group-name-to-method
-                                            to-newsgroup)))
-                 (error "Couldn't create group %s" to-newsgroup)))
+         (when (gnus-y-or-n-p (format "No such group: %s.  Create it? "
+                                      to-newsgroup))
+           (or (and (gnus-request-create-group 
+                     to-newsgroup (gnus-group-name-to-method to-newsgroup))
+                    (gnus-activate-group to-newsgroup nil nil
+                                         (gnus-group-name-to-method
+                                          to-newsgroup)))
+               (error "Couldn't create group %s" to-newsgroup)))
          (error "No such group: %s" to-newsgroup)))
     to-newsgroup))
 
@@ -7637,8 +8077,8 @@ save those articles instead."
   (let ((buffer-read-only nil)
        (article (gnus-summary-article-number))
        after-article b e)
-    (or (gnus-summary-goto-subject article)
-       (error (format "No such article: %d" article)))
+    (unless (gnus-summary-goto-subject article)
+      (error "No such article: %d" article))
     (gnus-summary-position-point)
     ;; If all commands are to be bunched up on one line, we collect
     ;; them here.
@@ -7652,13 +8092,13 @@ save those articles instead."
          (while (and ps (cdr ps)
                      (string= (or action "1")
                               (or (cdr (assq 'action (cadr ps))) "2")))
-           (setq files (cons (cdr (assq 'name (cadr ps))) files))
+           (push (cdr (assq 'name (cadr ps))) files)
            (setcdr ps (cddr ps)))
          (if (not files)
              ()
-           (if (not (string-match "%s" action))
-               (setq files (cons " " files)))
-           (setq files (cons " " files))
+           (when (not (string-match "%s" action))
+             (push " " files))
+           (push " " files)
            (and (assq 'execute (car ps))
                 (setcdr (assq 'execute (car ps))
                         (funcall (if (string-match "%s" action)
@@ -7668,9 +8108,9 @@ save those articles instead."
          (setq ps (cdr ps)))))
     (if (and gnus-view-pseudos (not not-view))
        (while pslist
-         (and (assq 'execute (car pslist))
-              (gnus-execute-command (cdr (assq 'execute (car pslist)))
-                                    (eq gnus-view-pseudos 'not-confirm)))
+         (when (assq 'execute (car pslist))
+           (gnus-execute-command (cdr (assq 'execute (car pslist)))
+                                 (eq gnus-view-pseudos 'not-confirm)))
          (setq pslist (cdr pslist)))
       (save-excursion
        (while pslist
@@ -7748,7 +8188,7 @@ save those articles instead."
   (let ((group gnus-newsgroup-name)
        (gnus-override-method 
         (and (gnus-news-group-p gnus-newsgroup-name)
-             gnus-refer-article-method))       
+             gnus-refer-article-method))
        where)
     ;; First we check to see whether the header in question is already
     ;; fetched.
@@ -7762,9 +8202,9 @@ save those articles instead."
        ;; We have found the header.
        header
       ;; We have to really fetch the header to this article.
-      (when (setq where (gnus-request-head id group))
-       (save-excursion
-         (set-buffer nntp-server-buffer)
+      (save-excursion
+       (set-buffer nntp-server-buffer)
+       (when (setq where (gnus-request-head id group))
          (goto-char (point-max))
          (insert ".\n")
          (goto-char (point-min))
@@ -7776,24 +8216,23 @@ save those articles instead."
                  (t gnus-reffed-article-number))
                 (current-buffer))
          (insert " Article retrieved.\n"))
-                                       ;(when (and header
-                                       ;          (memq (mail-header-number header) gnus-newsgroup-sparse))
-                                       ;  (setcar (gnus-id-to-thread id) nil))
-       (if (not (setq header (car (gnus-get-newsgroup-headers))))
+       (if (not (setq header (car (gnus-get-newsgroup-headers nil t))))
            ()                          ; Malformed head.
          (unless (memq (mail-header-number header) gnus-newsgroup-sparse)
-           (if (and (stringp id)
-                    (not (string= (gnus-group-real-name group)
-                                  (car where))))
-               ;; If we fetched by Message-ID and the article came
-               ;; from a different group, we fudge some bogus article
-               ;; numbers for this article.
-               (mail-header-set-number header gnus-reffed-article-number))
-           (decf gnus-reffed-article-number)
-           (gnus-remove-header (mail-header-number header))
-           (push header gnus-newsgroup-headers)
-           (setq gnus-current-headers header)
-           (push (mail-header-number header) gnus-newsgroup-limit))
+           (when (and (stringp id)
+                      (not (string= (gnus-group-real-name group)
+                                    (car where))))
+             ;; If we fetched by Message-ID and the article came
+             ;; from a different group, we fudge some bogus article
+             ;; numbers for this article.
+             (mail-header-set-number header gnus-reffed-article-number))
+           (save-excursion
+             (set-buffer gnus-summary-buffer)
+             (decf gnus-reffed-article-number)
+             (gnus-remove-header (mail-header-number header))
+             (push header gnus-newsgroup-headers)
+             (setq gnus-current-headers header)
+             (push (mail-header-number header) gnus-newsgroup-limit)))
          header)))))
 
 (defun gnus-remove-header (number)
@@ -7820,10 +8259,10 @@ save those articles instead."
       (let* ((beg (progn (beginning-of-line) (point)))
             (end (progn (end-of-line) (point)))
             ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
-            (from (if (get-text-property beg gnus-mouse-face-prop) 
+            (from (if (get-text-property beg gnus-mouse-face-prop)
                       beg
                     (or (next-single-property-change 
-                         beg gnus-mouse-face-prop nil end) 
+                         beg gnus-mouse-face-prop nil end)
                         beg)))
             (to
              (if (= from end)
@@ -7897,13 +8336,14 @@ save those articles instead."
       ;; Compute the ranges of read articles by looking at the list of
       ;; unread articles.
       (while unread
-       (if (/= (car unread) prev)
-           (setq read (cons (if (= prev (1- (car unread))) prev
-                              (cons prev (1- (car unread)))) read)))
+       (when (/= (car unread) prev)
+         (push (if (= prev (1- (car unread))) prev
+                 (cons prev (1- (car unread))))
+               read))
        (setq prev (1+ (car unread)))
        (setq unread (cdr unread)))
       (when (<= prev (cdr active))
-       (setq read (cons (cons prev (cdr active)) read)))
+       (push (cons prev (cdr active)) read))
       (gnus-undo-register
        `(progn
           (gnus-info-set-marks ,info ,(gnus-info-marks info))