Allow setting the partial fetch per server instead of globally.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Mon, 27 Sep 2010 18:34:52 +0000 (20:34 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Mon, 27 Sep 2010 18:34:52 +0000 (20:34 +0200)
lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus-sum.el
lisp/nnimap.el

index cbbaff3..69f68fc 100644 (file)
@@ -1,5 +1,13 @@
 2010-09-27  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-sum.el (gnus-summary-show-complete-article): Bind the server
+       variable instead of the Gnus variable.
+
+       * nnimap.el (nnimap-find-wanted-parts-1): Use it.
+
+       * gnus-art.el (gnus-fetch-partial-articles): Moved back to nnimap
+       again.
+
        * nnimap.el (nnimap-request-accept-article): Remove the "." at the end,
        since some servers don't like it.
        (nnimap-open-connection): Forget credentials if the server says the
index 221af8c..6e5cd4d 100644 (file)
@@ -257,22 +257,6 @@ This can also be a list of the above values."
                 (regexp :value ".*"))
   :group 'gnus-article-signature)
 
-(defcustom gnus-fetch-partial-articles nil
-  "If non-nil, Gnus will fetch partial articles.
-If t, nnimap will fetch only the first part.  If a string, it
-will fetch all parts that have types that match that string.  A
-likely value would be \"text/\" to automatically fetch all
-textual parts.
-
-Currently only the nnimap backend actually supports partial
-article fetching.  If the backend doesn't support it, it has no
-effect."
-  :version "24.1"
-  :type '(choice (const nil)
-                (const t)
-                (regexp))
-  :group 'gnus-article)
-
 (defcustom gnus-hidden-properties '(invisible t intangible t)
   "Property list to use for hiding text."
   :type 'sexp
index fbda260..02a098e 100644 (file)
@@ -9360,9 +9360,17 @@ article currently."
   (let ((gnus-keep-backlog nil)
        (gnus-use-cache nil)
        (gnus-agent nil)
-       (gnus-fetch-partial-articles nil))
-    (gnus-flush-original-article-buffer)
-    (gnus-summary-show-article)))
+       (variable (format "%s-fetch-partial-articles"
+                         (car (gnus-find-method-for-group
+                               gnus-newsgroup-name))))
+       old-val)
+    (unwind-protect
+       (progn
+         (setq old-val (symbol-value variable))
+         (set variable nil)
+         (gnus-flush-original-article-buffer)
+         (gnus-summary-show-article))
+      (set variable old-val))))
 
 (defun gnus-summary-show-article (&optional arg)
   "Force redisplaying of the current article.
index 7a065cc..a78300a 100644 (file)
@@ -85,6 +85,13 @@ some servers.")
 
 (defvoo nnimap-current-infos nil)
 
+(defvoo nnimap-fetch-partial-articles nil
+  "If non-nil, Gnus will fetch partial articles.
+If t, nnimap will fetch only the first part.  If a string, it
+will fetch all parts that have types that match that string.  A
+likely value would be \"text/\" to automatically fetch all
+textual parts.")
+
 (defvar nnimap-process nil)
 
 (defvar nnimap-status-string "")
@@ -414,8 +421,8 @@ some servers.")
        (erase-buffer)
        (with-current-buffer (nnimap-buffer)
          (erase-buffer)
-         (when gnus-fetch-partial-articles
-           (if (eq gnus-fetch-partial-articles t)
+         (when nnimap-fetch-partial-articles
+           (if (eq nnimap-fetch-partial-articles t)
                (setq parts '(1))
              (nnimap-command "UID FETCH %d (BODYSTRUCTURE)" article)
              (goto-char (point-min))
@@ -544,7 +551,7 @@ some servers.")
                        (number-to-string num)
                      (format "%s.%s" prefix num))))
            (setcar (nthcdr 9 sub) id)
-           (when (string-match gnus-fetch-partial-articles type)
+           (when (string-match nnimap-fetch-partial-articles type)
              (push id parts))))
        (incf num)))
     (nreverse parts)))