Gnus development mailing list
 help / color / mirror / Atom feed
* Topic group parameter fix.
@ 2002-05-06 16:17 Matt Armstrong
  0 siblings, 0 replies; only message in thread
From: Matt Armstrong @ 2002-05-06 16:17 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1619 bytes --]

Hello Gnus hackers, please consider this patch:

It turns out that topic parameters are broken for any group that isn't
currently visible in the group buffer.

Why?  Because gnus-topic.el's gnus-group-topic-parameters does this
logic to find a group's topic:

    gnus-group-goto-group -> moves point to where the group is
                             or leaves point where it is if the group
                             isn't visible
    gnus-current-topic -> determines the current topic based on where
                          point is.                                  

This is clearly flawed when the given group isn't visible in the group
buffer.  gnus-current-topic will end up returning whatever topic is
active under point, which may not be correct for the given group.

I think the reason gnus-group-goto-group + gnus-current-topic is used
is to cope with groups that might be in multiple topics.  In those
cases, the current topic is the one the user has last stuck point
near.

This breaks down when the user isn't in the picture: during group
buffer creation, during gnus-group-get-new-news, or, as Lars points
out in the manual during, gnus-expire-all-expirable-groups.

The attached patch "fixes" this problem by detecting when
gnus-group-goto-group fails and falling back to gnus-group-topic.
This will guarantee that gnus-group-topic-parameters actually returns
a topic the group is a member of instead of some random topic.

I'd appreciate it if this patch or something similar were committed.
:-)

-- 
Don't send mail to Walter.Heiss@hole.lickey.com
The address is there for spammers to harvest.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: topic-param-patch.patch --]
[-- Type: text/x-patch, Size: 1232 bytes --]

Index: gnus-topic.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-topic.el,v
retrieving revision 6.25
diff -u -u -r6.25 gnus-topic.el
--- gnus-topic.el	2002/02/20 00:15:31	6.25
+++ gnus-topic.el	2002/05/06 16:22:55
@@ -380,9 +381,17 @@
   "Compute the group parameters for GROUP taking into account inheritance from topics."
   (let ((params-list (copy-sequence (gnus-group-get-parameter group))))
     (save-excursion
-      (gnus-group-goto-group group)
       (nconc params-list
-	     (gnus-topic-hierarchical-parameters (gnus-current-topic))))))
+	     (gnus-topic-hierarchical-parameters
+	      ;; First we try to go to the group within the group
+	      ;; buffer and find the topic for the group that way.
+	      ;; This hopefully copes well with groups that are in
+	      ;; more than one topic.  Failing that (i.e. when the
+	      ;; group isn't visible in the group buffer) we find a
+	      ;; topic for the group via gnus-group-topic.
+	      (or (and (gnus-group-goto-group group)
+		       (gnus-current-topic))
+		  (gnus-group-topic group)))))))
 
 (defun gnus-topic-hierarchical-parameters (topic)
   "Return a topic list computed for TOPIC."

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-06 16:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-06 16:17 Topic group parameter fix Matt Armstrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).