* gnus-topic.el (gnus-topic-goto-next-group): Don't move point around when opening...
authorLeo <sdl.web@gmail.com>
Tue, 3 Jan 2012 19:06:34 +0000 (20:06 +0100)
committerLars Magne Ingebrigtsen <larsi@stories.(none)>
Tue, 3 Jan 2012 19:06:34 +0000 (20:06 +0100)
lisp/ChangeLog
lisp/gnus-topic.el

index 06ffc4c..fdf8b5a 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-03  Leo  <sdl.web@gmail.com>  (tiny change)
+
+       * gnus-topic.el (gnus-topic-goto-next-group): Don't move point around
+       when opening topics (bug#10407).
+
 2011-12-30  Paul Eggert  <eggert@cs.ucla.edu>
 
        * gnus-cus.el (gnus-score-customize):
index 87ca27a..1b4d75e 100644 (file)
@@ -969,12 +969,15 @@ articles in the topic and its subtopics."
   (if (not group)
       (if (not (memq 'gnus-topic props))
          (goto-char (point-max))
-       (gnus-topic-goto-topic (symbol-name (cadr (memq 'gnus-topic props)))))
+       (let ((topic (symbol-name (cadr (memq 'gnus-topic props)))))
+         (or (gnus-topic-goto-topic topic)
+             (gnus-topic-goto-topic (gnus-topic-next-topic topic)))))
     (if (gnus-group-goto-group group)
        t
       ;; The group is no longer visible.
       (let* ((list (assoc (gnus-group-topic group) gnus-topic-alist))
-            (after (cdr (member group (cdr list)))))
+            (topic-visible (save-excursion (gnus-topic-goto-topic (car list))))
+            (after (and topic-visible (cdr (member group (cdr list))))))
        ;; First try to put point on a group after the current one.
        (while (and after
                    (not (gnus-group-goto-group (car after))))
@@ -989,7 +992,9 @@ articles in the topic and its subtopics."
        (if (not (car list))
            (goto-char (point-min))
          (unless after
-           (gnus-topic-goto-topic (car list))
+           (if topic-visible
+               (gnus-goto-char topic-visible)
+             (gnus-topic-goto-topic (gnus-topic-next-topic (car list))))
            (setq after nil)))
        t))))