X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-topic.el;h=dbad79650c41f14882867ada37965a7bba54ceaa;hb=d35146fa43e9e2d8d346073c3c0692162abf4759;hp=b600fac353391b401cdcf1074fbd706fa7dd5c3b;hpb=a07fef39c45c3c3c77cafef422daca2460f34882;p=gnus diff --git a/lisp/gnus-topic.el b/lisp/gnus-topic.el index b600fac35..dbad79650 100644 --- a/lisp/gnus-topic.el +++ b/lisp/gnus-topic.el @@ -1,7 +1,6 @@ ;;; gnus-topic.el --- a folding minor mode for Gnus group buffers -;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1995-2013 Free Software Foundation, Inc. ;; Author: Ilja Weis ;; Lars Magne Ingebrigtsen @@ -146,13 +145,6 @@ See Info node `(gnus)Formatting Variables'." (setq alist (cdr alist))) out)) -(defun gnus-group-parent-topic (group) - "Return the topic GROUP is member of by looking at the group buffer." - (with-current-buffer gnus-group-buffer - (if (gnus-group-goto-group group) - (gnus-current-topic) - (gnus-group-topic group)))) - (defun gnus-topic-goto-topic (topic) (when topic (gnus-goto-char (text-property-any (point-min) (point-max) @@ -431,7 +423,7 @@ inheritance." regexp list-topic topic-level) "List all newsgroups with unread articles of level LEVEL or lower. Use the `gnus-group-topics' to sort the groups. -If PREDICTE is a function, list groups that the function returns non-nil; +If PREDICATE is a function, list groups that the function returns non-nil; if it is t, list groups that have no unread articles. If LOWEST is non-nil, list all newsgroups of level LOWEST or higher." (set-buffer gnus-group-buffer) @@ -583,7 +575,7 @@ articles in the topic and its subtopics." (or gnus-topic-display-empty-topics ;We want empty topics (not (zerop unread)) ;Non-empty tick ;Ticked articles - (/= point-max (point-max)))) ;Unactivated groups + (/= point-max (point-max)))) ;Inactive groups (gnus-extent-start-open (point)) (gnus-topic-insert-topic-line (car type) visiblep @@ -970,12 +962,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)))) @@ -990,7 +985,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)))) @@ -1255,6 +1252,8 @@ that group. If performed over a topic line, toggle folding the topic." (interactive "P") + (when (and (eobp) (not (gnus-group-group-name))) + (forward-line -1)) (if (gnus-group-topic-p) (let ((gnus-group-list-mode (if all (cons (if (numberp all) all 7) t) gnus-group-list-mode))) @@ -1296,13 +1295,15 @@ When used interactively, PARENT will be the topic under point." ;; 2. Can't process on several marked groups with a same name, ;; because gnus-group-marked only keeps one copy. +(defvar gnus-topic-history nil) + (defun gnus-topic-move-group (n topic &optional copyp) "Move the next N groups to TOPIC. If COPYP, copy the groups instead." (interactive (list current-prefix-arg (gnus-completing-read "Move to topic" (mapcar 'car gnus-topic-alist) t - 'gnus-topic-history))) + nil 'gnus-topic-history))) (let ((use-marked (and (not n) (not (gnus-region-active-p)) gnus-group-marked t)) (groups (gnus-group-process-prefix n)) @@ -1348,7 +1349,8 @@ If COPYP, copy the groups instead." "Copy the current group to a topic." (interactive (list current-prefix-arg - (gnus-completing-read "Copy to topic" (mapcar 'car gnus-topic-alist) t))) + (gnus-completing-read + "Copy to topic" (mapcar 'car gnus-topic-alist) t))) (gnus-topic-move-group n topic t)) (defun gnus-topic-kill-group (&optional n discard)