Synch with Oort Gnus.
[elisp/gnus.git-] / lisp / gnus-sum.el
index 218334e..c21cb43 100644 (file)
@@ -48,7 +48,6 @@
   (require 'static))
 
 (eval-and-compile
-  (autoload 'gnus-cache-articles-in-group "gnus-cache")
   (autoload 'pgg-decrypt-region "pgg" nil t)
   (autoload 'pgg-verify-region "pgg" nil t))
 
@@ -403,7 +402,7 @@ this variable specifies group names."
                         (cons :value ("" "") regexp (repeat string))
                         (sexp :value nil))))
 
-(defcustom gnus-unread-mark ?  ;Whitespace
+(defcustom gnus-unread-mark ?\ ;;;Whitespace
   "*Mark used for unread articles."
   :group 'gnus-summary-marks
   :type 'character)
@@ -468,6 +467,11 @@ this variable specifies group names."
   :group 'gnus-summary-marks
   :type 'character)
 
+(defcustom gnus-recent-mark ?N
+  "*Mark used for articles that are recent."
+  :group 'gnus-summary-marks
+  :type 'character)
+
 (defcustom gnus-cached-mark ?*
   "*Mark used for articles that are in the cache."
   :group 'gnus-summary-marks
@@ -478,7 +482,7 @@ this variable specifies group names."
   :group 'gnus-summary-marks
   :type 'character)
 
-(defcustom gnus-no-mark ?  ;Whitespace
+(defcustom gnus-no-mark ?\ ;;;Whitespace
   "*Mark used for articles that have no other secondary mark."
   :group 'gnus-summary-marks
   :type 'character)
@@ -528,7 +532,7 @@ this variable specifies group names."
   :group 'gnus-summary-marks
   :type 'character)
 
-(defcustom gnus-empty-thread-mark ?  ;Whitespace
+(defcustom gnus-empty-thread-mark ?\ ;;;Whitespace
   "*There is no thread under the article."
   :group 'gnus-summary-marks
   :type 'character)
@@ -1202,6 +1206,9 @@ end position and text.")
 (defvar gnus-newsgroup-forwarded nil
   "List of articles that have been forwarded in the current newsgroup.")
 
+(defvar gnus-newsgroup-recent nil
+  "List of articles that have are recent in the current newsgroup.")
+
 (defvar gnus-newsgroup-expirable nil
   "List of articles in the current newsgroup that can be expired.")
 
@@ -1263,6 +1270,7 @@ end position and text.")
     gnus-newsgroup-unselected gnus-newsgroup-marked
     gnus-newsgroup-reads gnus-newsgroup-saved
     gnus-newsgroup-replied gnus-newsgroup-forwarded
+    gnus-newsgroup-recent
     gnus-newsgroup-expirable
     gnus-newsgroup-processable gnus-newsgroup-killed
     gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
@@ -2021,7 +2029,7 @@ increase the score of each group you read."
 
     (easy-menu-define
      gnus-summary-misc-menu gnus-summary-mode-map ""
-     `("Misc"
+     `("Gnus"
        ("Mark Read"
        ["Mark as read" gnus-summary-mark-as-read-forward t]
        ["Mark same subject and select"
@@ -2920,7 +2928,7 @@ buffer that was in action when the last article was fetched."
          (if (or (null gnus-summary-default-score)
                  (<= (abs (- gnus-tmp-score gnus-summary-default-score))
                      gnus-summary-zcore-fuzz))
-             ?  ;Whitespace
+             ?\ ;;;Whitespace
            (if (< gnus-tmp-score gnus-summary-default-score)
                gnus-score-below-mark gnus-score-over-mark)))
         (gnus-tmp-replied
@@ -2986,7 +2994,7 @@ buffer that was in action when the last article was fetched."
         (if (or (null gnus-summary-default-score)
                 (<= (abs (- score gnus-summary-default-score))
                     gnus-summary-zcore-fuzz))
-            ?  ;Whitespace
+            ?\ ;;;Whitespace
           (if (< score gnus-summary-default-score)
               gnus-score-below-mark gnus-score-over-mark))
         'score))
@@ -3027,7 +3035,7 @@ the thread are to be displayed."
 (defun gnus-summary-set-local-parameters (group)
   "Go through the local params of GROUP and set all variable specs in that list."
   (let ((params (gnus-group-find-parameter group))
-       (vars '(quit-config)) ; Ignore quit-config.
+       (vars '(quit-config))           ; Ignore quit-config.
        elem)
     (while params
       (setq elem (car params)
@@ -4118,12 +4126,20 @@ Unscored articles will be counted as having a score of zero."
 
 (defvar gnus-tmp-thread-tree-header-string "")
 
-(defvar gnus-sum-thread-tree-root "> ")
-(defvar gnus-sum-thread-tree-single-indent "")
-(defvar gnus-sum-thread-tree-vertical "| ")
-(defvar gnus-sum-thread-tree-indent "  ")
-(defvar gnus-sum-thread-tree-leaf-with-other "+-> ")
-(defvar gnus-sum-thread-tree-single-leaf "\\-> ")
+(defvar gnus-sum-thread-tree-root "> "
+  "With %B spec, used for the root of a thread.
+If nil, use subject instead.")
+(defvar gnus-sum-thread-tree-single-indent ""
+  "With %B spec, used for a thread with just one message.
+If nil, use subject instead.")
+(defvar gnus-sum-thread-tree-vertical "| "
+  "With %B spec, used for drawing a vertical line.")
+(defvar gnus-sum-thread-tree-indent "  "
+  "With %B spec, used for indenting.")
+(defvar gnus-sum-thread-tree-leaf-with-other "+-> "
+  "With %B spec, used for a leaf with brothers.")
+(defvar gnus-sum-thread-tree-single-leaf "\\-> "
+  "With %B spec, used for a leaf without brothers.")
 
 (defun gnus-summary-prepare-threads (threads)
   "Prepare summary buffer from THREADS and indentation LEVEL.
@@ -4324,7 +4340,7 @@ or a straight list of headers."
             (if (or (null gnus-summary-default-score)
                     (<= (abs (- gnus-tmp-score gnus-summary-default-score))
                         gnus-summary-zcore-fuzz))
-                ?  ;Whitespace
+                ?\ ;;;Whitespace
               (if (< gnus-tmp-score gnus-summary-default-score)
                   gnus-score-below-mark gnus-score-over-mark))
             gnus-tmp-replied
@@ -4338,6 +4354,8 @@ or a straight list of headers."
                    gnus-forwarded-mark)
                   ((memq number gnus-newsgroup-saved)
                    gnus-saved-mark)
+                  ((memq number gnus-newsgroup-recent)
+                   gnus-recent-mark)
                   (t gnus-no-mark))
             gnus-tmp-from (mail-header-from gnus-tmp-header)
             gnus-tmp-name
@@ -4352,20 +4370,20 @@ or a straight list of headers."
                          (1+ (match-beginning 0)) (1- (match-end 0))))
              (t gnus-tmp-from))
             gnus-tmp-thread-tree-header-string
-            (cond 
+            (cond
              ((not gnus-show-threads) "")
              ((zerop gnus-tmp-level)
-              (if (cdar thread) 
-                  gnus-sum-thread-tree-root
-                gnus-sum-thread-tree-single-indent))
+              (if (cdar thread)
+                  (or gnus-sum-thread-tree-root subject)
+                (or gnus-sum-thread-tree-single-indent subject)))
              (t
               (concat (apply 'concat
-                             (mapcar (lambda (item) 
-                                       (if (= item 1) 
+                             (mapcar (lambda (item)
+                                       (if (= item 1)
                                            gnus-sum-thread-tree-vertical
                                          gnus-sum-thread-tree-indent))
                                      (cdr (reverse tree-stack))))
-                      (if (nth 1 thread) 
+                      (if (nth 1 thread)
                           gnus-sum-thread-tree-leaf-with-other
                         gnus-sum-thread-tree-single-leaf)))))
            (when (string= gnus-tmp-name "")
@@ -4463,30 +4481,20 @@ or a straight list of headers."
   (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
     (gnus-message 5 "Fetching headers for %s..." name)
     (prog1
-       ;;;!!! FIXME: temporary fix for an infloop on nnimap.
-       (if (eq 'nnimap (car (gnus-find-method-for-group name)))
-           (if (eq 'nov
-                   (setq gnus-headers-retrieved-by
-                         (gnus-retrieve-headers
-                          articles gnus-newsgroup-name
-                          ;; We might want to fetch old headers, but
-                          ;; not if there is only 1 article.
-                          (and (or (and
-                                    (not (eq gnus-fetch-old-headers 'some))
-                                    (not (numberp gnus-fetch-old-headers)))
-                                   (> (length articles) 1))
-                               gnus-fetch-old-headers))))
-               (gnus-get-newsgroup-headers-xover
-                articles nil nil gnus-newsgroup-name t)
-             (gnus-get-newsgroup-headers))
-         (gnus-retrieve-parsed-headers
-          articles gnus-newsgroup-name
-          ;; We might want to fetch old headers, but
-          ;; not if there is only 1 article.
-          (and (or (and (not (eq gnus-fetch-old-headers 'some))
-                        (not (numberp gnus-fetch-old-headers)))
-                   (> (length articles) 1))
-               gnus-fetch-old-headers)))
+       (if (eq 'nov
+               (setq gnus-headers-retrieved-by
+                     (gnus-retrieve-headers
+                      articles gnus-newsgroup-name
+                      ;; We might want to fetch old headers, but
+                      ;; not if there is only 1 article.
+                      (and (or (and
+                                (not (eq gnus-fetch-old-headers 'some))
+                                (not (numberp gnus-fetch-old-headers)))
+                               (> (length articles) 1))
+                           gnus-fetch-old-headers))))
+           (gnus-get-newsgroup-headers-xover
+            articles nil nil gnus-newsgroup-name t)
+         (gnus-get-newsgroup-headers))
       (gnus-message 5 "Fetching headers for %s...done" name))))
 
 (defun gnus-select-newsgroup (group &optional read-all select-articles)
@@ -4531,10 +4539,8 @@ If SELECT-ARTICLES, only select those articles from GROUP."
       (gnus-adjust-marked-articles info))
 
     ;; Kludge to avoid having cached articles nixed out in virtual groups.
-    (setq cached
-         (if (gnus-virtual-group-p group)
-             gnus-newsgroup-cached
-           (gnus-cache-articles-in-group group)))
+    (when (gnus-virtual-group-p group)
+      (setq cached gnus-newsgroup-cached))
 
     (setq gnus-newsgroup-unreads
          (gnus-set-difference
@@ -4565,6 +4571,10 @@ If SELECT-ARTICLES, only select those articles from GROUP."
       ;; Retrieve the headers and read them in.
       (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
 
+      ;; Kludge to avoid having cached articles nixed out in virtual groups.
+      (when cached
+       (setq gnus-newsgroup-cached cached))
+
       ;; Suppress duplicates?
       (when gnus-suppress-duplicates
        (gnus-dup-suppress-articles))
@@ -4581,11 +4591,6 @@ If SELECT-ARTICLES, only select those articles from GROUP."
       ;; Removed marked articles that do not exist.
       (gnus-update-missing-marks
        (gnus-sorted-complement fetched-articles articles))
-
-      ;; Kludge to avoid having cached articles nixed out in virtual groups.
-      (when cached
-       (setq gnus-newsgroup-cached cached))
-
       ;; We might want to build some more threads first.
       (when (and gnus-fetch-old-headers
                 (eq gnus-headers-retrieved-by 'nov))
@@ -5276,11 +5281,8 @@ Return a list of headers that match SEQUENCE (see
        (let ((gnus-nov-is-evil t))
          (nconc
           (nreverse headers)
-          ;;;!!! FIXME: temporary fix for an infloop on nnimap.
-          (if (eq 'nnimap (car (gnus-find-method-for-group group)))
-              (when (eq (gnus-retrieve-headers sequence group) 'headers)
-                (gnus-get-newsgroup-headers))
-            (gnus-retrieve-parsed-headers sequence group))))))))
+          (when (eq (gnus-retrieve-headers sequence group) 'headers)
+            (gnus-get-newsgroup-headers))))))))
 
 (defun gnus-article-get-xrefs ()
   "Fill in the Xref value in `gnus-current-headers', if necessary.
@@ -7841,7 +7843,10 @@ without any article massaging functions being run."
         (gnus-data-find (cdr gnus-article-current))
         header)
        (gnus-summary-update-article-line
-        (cdr gnus-article-current) header))))
+        (cdr gnus-article-current) header)
+       (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
+           (gnus-summary-update-secondary-mark
+            (cdr gnus-article-current))))))
    ((not arg)
     ;; Select the article the normal way.
     (gnus-summary-select-article nil 'force))
@@ -8535,10 +8540,17 @@ groups."
                       (gnus-data-find (cdr gnus-article-current))
                       header)
                      (gnus-summary-update-article-line
-                      (cdr gnus-article-current) header))))))
+                      (cdr gnus-article-current) header)
+                     (if (gnus-summary-goto-subject
+                          (cdr gnus-article-current) nil t)
+                         (gnus-summary-update-secondary-mark
+                          (cdr gnus-article-current))))))))
          ;; Update threads.
          (set-buffer (or buffer gnus-summary-buffer))
-         (gnus-summary-update-article (cdr gnus-article-current)))
+         (gnus-summary-update-article (cdr gnus-article-current))
+         (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
+             (gnus-summary-update-secondary-mark
+              (cdr gnus-article-current))))
        ;; Prettify the article buffer again.
        (unless no-highlight
          (save-excursion
@@ -8707,9 +8719,9 @@ the actual number of articles unmarked is returned."
        (error "No such mark type: %s" type)
       (setq var (intern (format "gnus-newsgroup-%s" type)))
       (set var (cons article (symbol-value var)))
-      (if (memq type '(processable cached replied forwarded saved))
+      (if (memq type '(processable cached replied forwarded recent saved))
          (gnus-summary-update-secondary-mark article)
-       ;;; !!! This is bobus.  We should find out what primary
+       ;;; !!! This is bogus.  We should find out what primary
        ;;; !!! mark we want to set.
        (gnus-summary-update-mark gnus-del-mark 'unread)))))
 
@@ -8969,6 +8981,8 @@ Iff NO-EXPIRE, auto-expiry will be inhibited."
          gnus-forwarded-mark)
         ((memq article gnus-newsgroup-saved)
          gnus-saved-mark)
+        ((memq article gnus-newsgroup-recent)
+         gnus-recent-mark)
         (t gnus-no-mark))
    'replied)
   (when (gnus-visual-p 'summary-highlight 'highlight)
@@ -9436,6 +9450,8 @@ is non-nil or the Subject: of both articles are the same."
        (set-buffer gnus-summary-buffer)
        (gnus-summary-unmark-all-processable)
        (gnus-summary-update-article current-article)
+       (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
+           (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
        (gnus-summary-rethread-current)
        (gnus-message 3 "Article %d is now the child of article %d"
                      current-article parent-article)))))