Allow reading ephemeral groups without starting Gnus
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 12 Apr 2012 16:40:27 +0000 (18:40 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 12 Apr 2012 16:51:02 +0000 (18:51 +0200)
* gnus-sum.el (gnus-set-global-variables): Don't assume that the group
buffer exists, which it doesn't if we haven't started Gnus.

lisp/ChangeLog
lisp/gnus-group.el
lisp/gnus-sum.el

index cbe96c0..e79a9b3 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-12  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-sum.el (gnus-set-global-variables): Don't assume that the group
+       buffer exists, which it doesn't if we haven't started Gnus.
+
 2012-04-11  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        pgg-def.el, pgg-gpg.el, pgg-parse.el, pgg-pgp.el, pgg-pgp5.el, pgg.el:
index 0c3346a..8ce04eb 100644 (file)
@@ -2290,9 +2290,9 @@ Return the name of the group if selection was successful."
     ;; (gnus-read-group "Group name: ")
     (gnus-group-completing-read)
     (gnus-read-method "From method")))
-  ;; Transform the select method into a unique server.
   (unless (gnus-alive-p)
-    (gnus-no-server))
+    (setq gnus-newsrc-hashtb (gnus-make-hashtable)))
+  ;; Transform the select method into a unique server.
   (when (stringp method)
     (setq method (gnus-server-to-method method)))
   (let ((address-slot
@@ -2323,7 +2323,8 @@ Return the name of the group if selection was successful."
                 parameters)))
      gnus-newsrc-hashtb)
     (push method gnus-ephemeral-servers)
-    (set-buffer gnus-group-buffer)
+    (when (buffer-live-p gnus-group-buffer)
+      (set-buffer gnus-group-buffer))
     (unless (gnus-check-server method)
       (error "Unable to contact server: %s" (gnus-status-message method)))
     (when activate
index 9ce9142..95b13da 100644 (file)
@@ -3558,7 +3558,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)))
-      (with-current-buffer gnus-group-buffer
+      (with-temp-buffer
        (setq gnus-newsgroup-name name
              gnus-newsgroup-marked marked
              gnus-newsgroup-spam-marked spam
@@ -5673,7 +5673,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
        (setq gnus-newsgroup-unselected
              (gnus-sorted-difference gnus-newsgroup-unreads articles))
       (setq articles (gnus-articles-to-read group read-all)))
-    
+
     (cond
      ((null articles)
       ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
@@ -5683,7 +5683,9 @@ If SELECT-ARTICLES, only select those articles from GROUP."
       ;; Init the dependencies hash table.
       (setq gnus-newsgroup-dependencies
            (gnus-make-hashtable (length articles)))
-      (gnus-set-global-variables)
+      (if (buffer-live-p gnus-group-buffer)
+         (gnus-set-global-variables)
+       (set-default 'gnus-newsgroup-name gnus-newsgroup-name))
       ;; Retrieve the headers and read them in.
 
       (setq gnus-newsgroup-headers (gnus-fetch-headers articles))