gnus-int: add to-buffer parameter to gnus-request-head
authorJulien Danjou <julien@danjou.info>
Mon, 6 Aug 2012 00:34:07 +0000 (02:34 +0200)
committerJulien Danjou <julien@danjou.info>
Mon, 6 Aug 2012 00:34:07 +0000 (02:34 +0200)
Signed-off-by: Julien Danjou <julien@danjou.info>
lisp/ChangeLog
lisp/gnus-int.el

index 1bf8444..1fb9e88 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-06  Julien Danjou  <julien@danjou.info>
+
+       * gnus-int.el (gnus-request-head): Add an optional to-buffer parameter
+       to mimic `gnus-request-article' and enjoy backends the nn*-request-head
+       to-buffer argument that is already supported.
+
 2012-08-05  Julien Danjou  <julien@danjou.info>
 
        * gnus-demon.el (gnus-demon-add-handler, gnus-demon-remove-handler):
index 339e3d9..9898060 100644 (file)
@@ -581,8 +581,9 @@ real group. Does nothing on a real group."
        (and (bound-and-true-p gnus-registry-enabled)
             (gnus-try-warping-via-registry))))))
 
-(defun gnus-request-head (article group)
-  "Request the head of ARTICLE in GROUP."
+(defun gnus-request-head (article group &optional to-buffer)
+  "Request the head of ARTICLE in GROUP.
+If TO-BUFFER, insert the article in that buffer."
   (let* ((gnus-command-method (gnus-find-method-for-group group))
         (head (gnus-get-function gnus-command-method 'request-head t))
         res clean-up)
@@ -600,13 +601,15 @@ real group. Does nothing on a real group."
      ;; Use `head' function.
      ((fboundp head)
       (setq res (funcall head article (gnus-group-real-name group)
-                        (nth 1 gnus-command-method))))
+                        (nth 1 gnus-command-method)
+                         to-buffer)))
      ;; Use `article' function.
      (t
-      (setq res (gnus-request-article article group)
+      (setq res (gnus-request-article article group to-buffer)
            clean-up t)))
     (when clean-up
-      (with-current-buffer nntp-server-buffer
+      (with-current-buffer (or to-buffer
+                               nntp-server-buffer)
        (goto-char (point-min))
        (when (search-forward "\n\n" nil t)
          (delete-region (1- (point)) (point-max)))