Add arch taglines
[gnus] / lisp / gnus-sum.el
index 7cb0669..725d936 100644 (file)
@@ -422,6 +422,13 @@ this variable specifies group names."
                         (cons :value ("" "") regexp (repeat string))
                         (sexp :value nil))))
 
+(defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
+  "Function used to compute default prefix for article move/copy/etc prompts.
+The function should take one argument, a group name, and return a
+string with the suggested prefix."
+  :group 'gnus-summary-mail
+  :type 'function)
+
 (defcustom gnus-unread-mark ?           ;Whitespace
   "*Mark used for unread articles."
   :group 'gnus-summary-marks
@@ -672,6 +679,41 @@ score file."
   :group 'gnus-score-default
   :type 'integer)
 
+(defun gnus-widget-reversible-match (widget value)
+  "Ignoring WIDGET, convert VALUE to internal form.
+VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
+  ;; (debug value)
+  (or (symbolp value)
+      (and (listp value)
+           (eq (length value) 2)
+           (eq (nth 0 value) 'not)
+           (symbolp (nth 1 value)))))
+
+(defun gnus-widget-reversible-to-internal (widget value)
+  "Ignoring WIDGET, convert VALUE to internal form.
+VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
+FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
+  ;; (debug value)
+  (if (atom value)
+      (list value nil)
+    (list (nth 1 value) t)))
+
+(defun gnus-widget-reversible-to-external (widget value)
+  "Ignoring WIDGET, convert VALUE to external form.
+VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
+\(FOO  nil) is converted to FOO and (FOO t) is converted to (not FOO)."
+  ;; (debug value)
+  (if (nth 1 value)
+      (list 'not (nth 0 value))
+    (nth 0 value)))
+
+(define-widget 'gnus-widget-reversible 'group
+  "A `group' that convert values."
+  :match 'gnus-widget-reversible-match
+  :value-to-internal 'gnus-widget-reversible-to-internal
+  :value-to-external 'gnus-widget-reversible-to-external)
+                        
+
 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
   "*List of functions used for sorting articles in the summary buffer.
 
@@ -684,6 +726,9 @@ is often much slower than sorting by number, and the sorting order is
 very similar.  (Sorting by date means sorting by the time the message
 was sent, sorting by number means sorting by arrival time.)
 
+Each item can also be a list `(not F)' where F is a function;
+this reverses the sort order.
+
 Ready-made functions include `gnus-article-sort-by-number',
 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
@@ -692,13 +737,16 @@ and `gnus-article-sort-by-score'.
 When threading is turned on, the variable `gnus-thread-sort-functions'
 controls how articles are sorted."
   :group 'gnus-summary-sort
-  :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-item gnus-article-sort-by-random)
-                        (function :tag "other"))))
+  :type '(repeat (gnus-widget-reversible
+                  (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-item gnus-article-sort-by-random)
+                          (function :tag "other"))
+                  (boolean :tag "Reverse order"))))
+
 
 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
   "*List of functions used for sorting threads in the summary buffer.
@@ -713,6 +761,9 @@ is often much slower than sorting by number, and the sorting order is
 very similar.  (Sorting by date means sorting by the time the message
 was sent, sorting by number means sorting by arrival time.)
 
+Each list item can also be a list `(not F)' where F is a
+function; this specifies reversed sort order.
+
 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',
@@ -724,14 +775,19 @@ Ready-made functions include `gnus-thread-sort-by-number',
 When threading is turned off, the variable
 `gnus-article-sort-functions' controls how articles are sorted."
   :group 'gnus-summary-sort
-  :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-item gnus-thread-sort-by-random)
-                        (function :tag "other"))))
+  :type '(repeat 
+          (gnus-widget-reversible
+           (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-most-recent-number)
+                   (function-item gnus-thread-sort-by-most-recent-date)
+                   (function-item gnus-thread-sort-by-random)
+                   (function-item gnus-thread-sort-by-total-score)
+                   (function :tag "other"))
+           (boolean :tag "Reverse order"))))
 
 (defcustom gnus-thread-score-function '+
   "*Function used for calculating the total score of a thread.
@@ -1379,11 +1435,19 @@ This list will always be a subset of gnus-newsgroup-undownloaded.")
 (defvar gnus-newsgroup-variables nil
   "A list of variables that have separate values in different newsgroups.
 A list of newsgroup (summary buffer) local variables, or cons of
-variables and their default values (when the default values are not
-nil), that should be made global while the summary buffer is active.
+variables and their default expressions to be evalled (when the default
+values are not nil), that should be made global while the summary buffer
+is active.
+
+Note: The default expressions will be evaluated (using function `eval')
+before assignment to the local variable rather than just assigned to it.
+If the default expression is the symbol `global', that symbol will not
+be evaluated but the global value of the local variable will be used
+instead.
+
 These variables can be used to set variables in the group parameters
-while still allowing them to affect operations done in other
-buffers. For example:
+while still allowing them to affect operations done in other buffers.
+For example:
 
 \(setq gnus-newsgroup-variables
      '(message-use-followup-to
@@ -2545,6 +2609,8 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs))))
               'gnus-summary-save-article "save-art" gnus-summary-mode-map)
              (tool-bar-add-item-from-menu
               'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
+             (tool-bar-add-item-from-menu
+              'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
              (tool-bar-add-item-from-menu
               'gnus-summary-catchup "catchup" gnus-summary-mode-map)
              (tool-bar-add-item-from-menu
@@ -2677,7 +2743,8 @@ The following commands are available:
   (make-local-variable 'minor-mode-alist)
   (use-local-map gnus-summary-mode-map)
   (buffer-disable-undo)
-  (setq buffer-read-only t)            ;Disable modification
+  (setq buffer-read-only t             ;Disable modification
+       show-trailing-whitespace nil)
   (setq truncate-lines t)
   (setq selective-display t)
   (setq selective-display-ellipses t)  ;Display `...'
@@ -3142,8 +3209,7 @@ buffer that was in action when the last article was fetched."
            (push (eval (car locals)) vlist))
          (setq locals (cdr locals)))
        (setq vlist (nreverse vlist)))
-      (save-excursion
-       (set-buffer gnus-group-buffer)
+      (with-current-buffer gnus-group-buffer
        (setq gnus-newsgroup-name name
              gnus-newsgroup-marked marked
              gnus-newsgroup-spam-marked spam
@@ -4088,8 +4154,7 @@ the id of the parent article (if any)."
            (setq article (read (current-buffer))
                  header (gnus-nov-parse-line article dependencies)))
          (when header
-           (save-excursion
-             (set-buffer gnus-summary-buffer)
+           (with-current-buffer gnus-summary-buffer
              (push header gnus-newsgroup-headers)
              (if (memq (setq article (mail-header-number header))
                        gnus-newsgroup-unselected)
@@ -5720,8 +5785,8 @@ The resulting hash table is returned, or nil if no Xrefs were found."
   (let ((cur nntp-server-buffer)
        (dependencies
         (or dependencies
-            (save-excursion (set-buffer gnus-summary-buffer)
-                            gnus-newsgroup-dependencies)))
+            (with-current-buffer gnus-summary-buffer
+              gnus-newsgroup-dependencies)))
        headers id end ref
        (mail-parse-charset gnus-newsgroup-charset)
        (mail-parse-ignored-charsets
@@ -5938,8 +6003,8 @@ Return a list of headers that match SEQUENCE (see
 (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'."
-  (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
-                                gnus-current-headers)))
+  (let ((headers (with-current-buffer gnus-summary-buffer
+                  gnus-current-headers)))
     (or (not gnus-use-cross-reference)
        (not headers)
        (and (mail-header-xref headers)
@@ -6111,8 +6176,7 @@ If optional argument BACKWARD is non-nil, search backward instead."
 (defun gnus-summary-best-group (&optional exclude-group)
   "Find the name of the best unread group.
 If EXCLUDE-GROUP, do not go to this group."
-  (save-excursion
-    (set-buffer gnus-group-buffer)
+  (with-current-buffer gnus-group-buffer
     (save-excursion
       (gnus-group-best-unread-group exclude-group))))
 
@@ -6484,8 +6548,7 @@ The prefix argument ALL means to select all articles."
          (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
        (let ((headers gnus-newsgroup-headers))
          ;; Set the new ranges of read articles.
-         (save-excursion
-           (set-buffer gnus-group-buffer)
+         (with-current-buffer gnus-group-buffer
            (gnus-undo-force-boundary))
          (gnus-update-read-articles
           group (gnus-sorted-union
@@ -6743,8 +6806,7 @@ The state which existed when entering the ephemeral is reset."
   ;; Kill any previous dead summary buffer.
   (when (and gnus-dead-summary
             (buffer-name gnus-dead-summary))
-    (save-excursion
-      (set-buffer gnus-dead-summary)
+    (with-current-buffer gnus-dead-summary
       (when gnus-dead-summary-mode
        (kill-buffer (current-buffer)))))
   ;; Make this the current dead summary.
@@ -6763,8 +6825,7 @@ The state which existed when entering the ephemeral is reset."
   (save-excursion
     (when (and (buffer-name buffer)
               (not gnus-single-article-buffer))
-      (save-excursion
-       (set-buffer buffer)
+      (with-current-buffer buffer
        (gnus-kill-buffer gnus-article-buffer)
        (gnus-kill-buffer gnus-original-article-buffer)))
     (cond
@@ -6804,7 +6865,7 @@ in."
     (when current-prefix-arg
       (completing-read
        "FAQ dir: " (and (listp gnus-group-faq-directory)
-                       (mapcar (lambda (file) (list file))
+                       (mapcar 'list
                                gnus-group-faq-directory))))))
   (let (gnus-faq-buffer)
     (when (setq gnus-faq-buffer
@@ -7130,8 +7191,7 @@ If BACKWARD, the previous article is selected instead of the next."
       (gnus-summary-jump-to-group gnus-newsgroup-name))
     (let ((cmd last-command-char)
          (point
-          (save-excursion
-            (set-buffer gnus-group-buffer)
+          (with-current-buffer gnus-group-buffer
             (point)))
          (group
           (if (eq gnus-keep-same-level 'best)
@@ -7589,10 +7649,9 @@ articles that are younger than AGE days."
        (if (numberp days)
           (progn
             (setq days-got t)
-            (if (< days 0)
-                (progn
-                  (setq younger (not younger))
-                  (setq days (* days -1)))))
+            (when (< days 0)
+              (setq younger (not younger))
+              (setq days (* days -1))))
         (message "Please enter a number.")
         (sleep-for 1)))
      (list days younger)))
@@ -8033,13 +8092,12 @@ fetch-old-headers verbiage, and so on."
            (and gnus-newsgroup-display
                 (not (funcall gnus-newsgroup-display)))
            ;; Check NoCeM things.
-           (if (and gnus-use-nocem
-                    (gnus-nocem-unwanted-article-p
-                     (mail-header-id (car thread))))
-               (progn
-                 (setq gnus-newsgroup-unreads
-                       (delq number gnus-newsgroup-unreads))
-                 t))))
+           (when (and gnus-use-nocem
+                      (gnus-nocem-unwanted-article-p
+                       (mail-header-id (car thread))))
+             (setq gnus-newsgroup-unreads
+                   (delq number gnus-newsgroup-unreads))
+             t)))
          ;; Nope, invisible article.
          0
        ;; Ok, this article is to be visible, so we add it to the limit
@@ -8251,8 +8309,7 @@ to guess what the document format is."
     (let* ((name (format "%s-%d"
                         (gnus-group-prefixed-name
                          gnus-newsgroup-name (list 'nndoc ""))
-                        (save-excursion
-                          (set-buffer gnus-summary-buffer)
+                        (with-current-buffer gnus-summary-buffer
                           gnus-current-article)))
           (ogroup gnus-newsgroup-name)
           (params (append (gnus-info-params (gnus-get-info ogroup))
@@ -8875,7 +8932,8 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
   (let ((articles (gnus-summary-work-articles n))
        (prefix (if (gnus-check-backend-function
                     'request-move-article gnus-newsgroup-name)
-                   (gnus-group-real-prefix gnus-newsgroup-name)
+                   (funcall gnus-move-group-prefix-function
+                            gnus-newsgroup-name)
                  ""))
        (names '((move "Move" "Moving")
                 (copy "Copy" "Copying")
@@ -9742,8 +9800,7 @@ ARTICLE can also be a list of articles."
   ;; (article-number . line-number-in-body).
   (push
    (cons article
-        (save-excursion
-          (set-buffer gnus-article-buffer)
+        (with-current-buffer gnus-article-buffer
           (count-lines
            (min (point)
                 (save-excursion
@@ -10998,8 +11055,7 @@ save those articles instead."
           (t
            (gnus-completing-read-with-default
             nil prom
-            (mapcar (lambda (el) (list el))
-                    (nreverse split-name))
+            (mapcar 'list (nreverse split-name))
             nil nil nil
             'gnus-group-history))))
         (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
@@ -11202,14 +11258,6 @@ If REVERSE, save parts that do not match TYPE."
             (not (gnus-summary-article-sparse-p (mail-header-number header))))
        ;; We have found the header.
        header
-      ;; If this is a sparse article, we have to nix out its
-      ;; previous entry in the thread hashtb.
-      (when (and header
-                (gnus-summary-article-sparse-p (mail-header-number header)))
-       (let* ((parent (gnus-parent-id (mail-header-references header)))
-              (thread (and parent (gnus-id-to-thread parent))))
-         (when thread
-           (delq (assq header thread) thread))))
       ;; We have to really fetch the header to this article.
       (save-excursion
        (set-buffer nntp-server-buffer)
@@ -11328,7 +11376,8 @@ If REVERSE, save parts that do not match TYPE."
         (default-high gnus-summary-default-high-score)
         (default-low gnus-summary-default-low-score)
         (uncached (and gnus-summary-use-undownloaded-faces
-                        (memq article gnus-newsgroup-undownloaded))))
+                        (memq article gnus-newsgroup-undownloaded)
+                        (not (memq article gnus-newsgroup-cached)))))
     (let ((face (funcall (gnus-summary-highlight-line-0))))
       (unless (eq face (get-text-property beg 'face))
        (gnus-put-text-property-excluding-characters-with-faces
@@ -11411,8 +11460,7 @@ UNREAD is a sorted list."
     (dolist (buffer (buffer-list))
       (when (and (setq buffer (buffer-name buffer))
                 (string-match "Summary" buffer)
-                (save-excursion
-                  (set-buffer buffer)
+                (with-current-buffer buffer
                   ;; We check that this is, indeed, a summary buffer.
                   (and (eq major-mode 'gnus-summary-mode)
                        ;; Also make sure this isn't bogus.
@@ -11712,4 +11760,5 @@ If ALL is a number, fetch this number of articles."
 ;; coding: iso-8859-1
 ;; End:
 
+;;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
 ;;; gnus-sum.el ends here