Gnus development mailing list
 help / color / mirror / Atom feed
* summary rescan and cancelled articles
@ 2002-11-17 22:33 Kevin Ryde
  2002-11-27  1:52 ` ShengHuo ZHU
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Ryde @ 2002-11-17 22:33 UTC (permalink / raw)


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

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.


[-- Attachment #2: gnus-sum.el.rescan-uncancelled.diff --]
[-- Type: text/plain, Size: 1419 bytes --]

--- 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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: summary rescan and cancelled articles
  2002-11-17 22:33 summary rescan and cancelled articles Kevin Ryde
@ 2002-11-27  1:52 ` ShengHuo ZHU
  2003-03-24  0:36   ` Kevin Ryde
  0 siblings, 1 reply; 4+ messages in thread
From: ShengHuo ZHU @ 2002-11-27  1:52 UTC (permalink / raw)


Kevin Ryde <user42@zip.com.au> writes:

> 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.

Installed.

ShengHuo



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: summary rescan and cancelled articles
  2002-11-27  1:52 ` ShengHuo ZHU
@ 2003-03-24  0:36   ` Kevin Ryde
  2003-03-26 20:52     ` ShengHuo ZHU
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Ryde @ 2003-03-24  0:36 UTC (permalink / raw)


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

A bit more to help M-g keep point in the same location,

	* gnus-sum.el (gnus-summary-find-for-reselect): Renamed from
	gnus-summary-find-uncancelled, skip temporary articles inserted by
	"refer" functions.


[-- Attachment #2: gnus-sum.el.more-reselect.diff --]
[-- Type: text/plain, Size: 1941 bytes --]

CVS_RSH not defined
/usr/bin/cvs -d :pserver:gnus@cvs.gnus.org:/usr/local/cvsroot diff gnus-sum.el
Index: gnus-sum.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-sum.el,v
retrieving revision 6.322
diff -u -r6.322 gnus-sum.el
--- gnus-sum.el	21 Mar 2003 07:18:25 -0000	6.322
+++ gnus-sum.el	24 Mar 2003 00:34:16 -0000
@@ -6317,17 +6317,19 @@
 	  (> (prefix-numeric-value arg) 0)))
   (redraw-display))
 
-(defun gnus-summary-find-uncancelled ()
-  "Return the number of an uncancelled article.
+(defun gnus-summary-find-for-reselect ()
+  "Return the number of an article to stay on across a reselect.
 The current article is considered, then following articles, then previous
-articles.  If all articles are cancelled then return a dummy 0."
+articles.  An article is sought which is not cancelled and isn't a temporary
+insertion from another group.  If there's no such 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))))
+            (if (and (< 0 (gnus-data-number (car data)))
+                     (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
                 (setq found (gnus-data-number (car data))))
             (setq data (cdr data))))))
     (or found 0)))
@@ -6338,7 +6340,7 @@
   (interactive "P")
   (when (gnus-ephemeral-group-p gnus-newsgroup-name)
     (error "Ephemeral groups can't be reselected"))
-  (let ((current-subject (gnus-summary-find-uncancelled))
+  (let ((current-subject (gnus-summary-find-for-reselect))
 	(group gnus-newsgroup-name))
     (setq gnus-newsgroup-begin nil)
     (gnus-summary-exit)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: summary rescan and cancelled articles
  2003-03-24  0:36   ` Kevin Ryde
@ 2003-03-26 20:52     ` ShengHuo ZHU
  0 siblings, 0 replies; 4+ messages in thread
From: ShengHuo ZHU @ 2003-03-26 20:52 UTC (permalink / raw)


Kevin Ryde <user42@zip.com.au> writes:

> A bit more to help M-g keep point in the same location,
>
> 	* gnus-sum.el (gnus-summary-find-for-reselect): Renamed from
> 	gnus-summary-find-uncancelled, skip temporary articles inserted by
> 	"refer" functions.

Installed.

ShengHuo



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-26 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-17 22:33 summary rescan and cancelled articles Kevin Ryde
2002-11-27  1:52 ` ShengHuo ZHU
2003-03-24  0:36   ` Kevin Ryde
2003-03-26 20:52     ` ShengHuo ZHU

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).