From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/47710 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.gnus.general Subject: summary rescan and cancelled articles Date: Mon, 18 Nov 2002 08:33:48 +1000 Sender: owner-ding@hpc.uh.edu Message-ID: <87u1ifaks3.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1037572545 25777 80.91.224.249 (17 Nov 2002 22:35:45 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 17 Nov 2002 22:35:45 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18DY12-0006hd-00 for ; Sun, 17 Nov 2002 23:35:44 +0100 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 18DY15-0000AQ-00; Sun, 17 Nov 2002 16:35:47 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sun, 17 Nov 2002 16:36:34 -0600 (CST) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id QAA22704 for ; Sun, 17 Nov 2002 16:36:18 -0600 (CST) Original-Received: (qmail 18648 invoked by alias); 17 Nov 2002 22:35:22 -0000 Original-Received: (qmail 18642 invoked from network); 17 Nov 2002 22:35:20 -0000 Original-Received: from sunny.pacific.net.au (203.25.148.40) by gnus.org with SMTP; 17 Nov 2002 22:35:20 -0000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id gAHMZDp4028220 for ; Mon, 18 Nov 2002 09:35:13 +1100 (EST) Original-Received: from localhost (ppp90.dyn228.pacific.net.au [203.143.228.90]) by wisma.pacific.net.au with ESMTP id JAA19259 for ; Mon, 18 Nov 2002 09:35:08 +1100 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 18DXzB-0000ho-00; Mon, 18 Nov 2002 08:33:49 +1000 Original-To: ding@gnus.org Mail-Copies-To: never User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.1 (i386-debian-linux-gnu) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:47710 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:47710 --=-=-= I like the way gnus-summary-rescan-group keeps point on the current article, but I notice it goes back to the start of the buffer if the current article has been cancelled. I strike this when going though old mail moving or deleting stuff. I'd like to propose the change below to look for an uncancelled article to preserve the position. Maybe the search loop could be written better, this was the best I could come up with. * gnus-sum.el (gnus-summary-find-uncancelled): New function. (gnus-summary-reselect-current-group): Use it. --=-=-= Content-Disposition: attachment; filename=gnus-sum.el.rescan-uncancelled.diff --- gnus-sum.el.~6.233.~ 2002-11-18 06:06:19.000000000 +1000 +++ gnus-sum.el 2002-11-18 08:18:14.000000000 +1000 @@ -6151,13 +6151,28 @@ (> (prefix-numeric-value arg) 0))) (redraw-display)) +(defun gnus-summary-find-uncancelled () + "Return the number of an uncancelled article. +The current article is considered, then following articles, then previous +articles. If all articles are cancelled then return a dummy 0." + (let (found) + (dolist (rev '(nil t)) + (unless found ; don't demand the reverse list if we don't need it + (let ((data (gnus-data-find-list + (gnus-summary-article-number) (gnus-data-list rev)))) + (while (and data (not found)) + (if (not (eq gnus-canceled-mark (gnus-data-mark (car data)))) + (setq found (gnus-data-number (car data)))) + (setq data (cdr data)))))) + (or found 0))) + (defun gnus-summary-reselect-current-group (&optional all rescan) "Exit and then reselect the current newsgroup. The prefix argument ALL means to select all articles." (interactive "P") (when (gnus-ephemeral-group-p gnus-newsgroup-name) (error "Ephemeral groups can't be reselected")) - (let ((current-subject (gnus-summary-article-number)) + (let ((current-subject (gnus-summary-find-uncancelled)) (group gnus-newsgroup-name)) (setq gnus-newsgroup-begin nil) (gnus-summary-exit) --=-=-=--