[gnu.emacs.gnus] Retaining marked articles

tale@its.rpi.edu (David C Lawrence) (02/22/89)

This is just a quick note to find out how other people feel about
this; I can see a disagreement is possible here about how the commands
in question should behave.
 
Basically, my situation is this: when I mark an article with
gnus-Subject-mark-as-unread-forward (typically key "u"), I want that
mark to stay until I explicity clear it.  This is not the case in two
situations, however. If I apply my kill file to a group or use
gnus-Subject-catch-up[-and-exit], the mark can be cleared.  Some
people will probably say that it is their proper function to do so; it
is not, however, the behaviour which I desire.  In case the kill file
one is a little confusing, here is a quick sample for news.groups.KILL:

(gnus-kill "Subject" "[Rr]e\:")    ;; regexp is case-sensitive (can we
                                   ;; make it not so?)
(gnus-kill "Subject" "gnu" '(gnus-Subject-mark-as-unread nil t))

gnus-Subject-mark-as-unread is providing its advertised function:
clearing any sort of mark.  This is exactly what I want it to do for
articles I have not seen yet; it is not what I want it to do for
articles I have previously marked as unread.
 
The fixes that I can see simply involve adding a step in catch-up and
gnus-kill that skip already marked articles.  If people think that the
behaviour is as it should be already, perhaps the step could only be
executed if an &optional arg was non-nil.

I'll be expecting a from letter from Japan on this in about two days,
Masanobu.  (Can we ask about your gateway yet? |:-)

Dave
--
      tale@rpitsmts.bitnet, tale%mts@rpitsgw.rpi.edu, tale@pawl.rpi.edu

tale@pawl.rpi.edu (David C Lawrence) (02/27/89)

In article <MCGRATH.89Feb18160343@paris.Berkeley.EDU> 
mcgrath@paris.Berkeley.EDU (Roland McGrath) wrote:
rmg> A GNUS-specific poster would be very nice.

In <TALE.89Feb19204456@pawl15.pawl.rpi.edu>, I responded:
Tale> Why?   Is there any need to reinvent the wheel and add even more
Tale> memory usage into the picture that way?

Looking at it a second time, I think I now understood what was
originally meant here.  I had thought that Roland wanted inews (or
whatever poster) to be remade; it is infinitely more logical and
reasonable to see that what he meant was, roughly, "Why all of this
rnews stuff?"  This of course would most likely cut down on memory
usage and not increase it.

Now, so as not to make this posting just some sort of self-indulgent
realization account, I might as well make it a little useful.  In
<TALE.89Feb21135053@consult1.its.rpi.edu>, I voiced my desire to have
two functions (gnus-kill and gnus-Subject-catch-up-and-exit) not blast
away articles marked as unread.  I've been keeping a separate file
(gnus-etc.el) which both defines some functions I'd like to behave
differently and adds some new ones.  Included here are the four
functions (two originals, but renamed) I use for "catch-up"; I still
haven't done the kill-file change yet or even looked to see how
feasible it is.
 
I'll be posting some other routines from it, but rather than just
throw out the whole file, I'll group them according to function so it
is easier to just snarf up what you find useful.
 
(By the way, while making documentation strings and prompts it
occurred to me that saying something is "marked as -unread-" could be
confusing to novice users.  (In fact, it is a little confusing at times
in the code to me.  I'll be working on something and have to ask
myself whether gnus-newsgroup-unreads includes articles with marks.
(It does.))  Would it be perhaps somewhat clearer/better to say that
an article is marked as "preserved" or such?)

Dave

--- Cut here 8<--- (and cut the .signature)
(define-key gnus-Group-mode-map "C" 'gnus-Group-catch-up-all)
(defun gnus-Group-catch-up-all (&optional quietly)
  "Mark all articles in current newsgroup as read.
If optional NO-CONFIRM is non-nil, do without confirmation.
Cross references (Xref: field) of articles are ignored."
  ; Renamed from gnus-Group-catch-up.  NO-CONFIRM changed to &optional
  ; QUIETLY for consistency with gnus-Subject-catch-up[-all]-and-exit
  (interactive "P")
  (let ((group (gnus-Group-group-name)))
    (if (and group
	     (or quietly
		 (y-or-n-p "Mark all articles as read? ")))
	(progn
	  (message "")			;Erase "Yes or No" question.
	  (gnus-update-unread-articles group nil nil)
	  (gnus-Group-update-group group)
	  (gnus-Group-next-group 1)))))

(defun gnus-Group-catch-up (&optional quietly)
  "Mark all articles not marked as unread in current newsgroup as read.
If optional NO-CONFIRM is non-nil, do without confirmations.
Cross references (Xref: field) of articles are ignored."
  (interactive "P")
  (let* ((group (gnus-Group-group-name))
         (marked (cdr (assoc group gnus-marked-assoc))))
    (if (and group
	     (or quietly
		 (y-or-n-p "Delete all articles not marked as read? ")))
	(progn
	  (message "")			;Erase "Yes or No" question.
          ; Any marked articles will be preserved.
          (gnus-update-unread-articles group marked marked)
          (gnus-Group-update-group group)
          (gnus-Group-next-group 1)))))

(define-key gnus-Subject-mode-map "C" 'gnus-Subject-catch-up-all-and-exit)
(defun gnus-Subject-catch-up-all-and-exit (&optional quietly)
  "Mark all articles in this newsgroup as read, and then exit."
  ; Renamed from gnus-Subject-catch-up-and-exit
  (interactive "P")
  (if (or quietly
	  (y-or-n-p "Mark all articles as read? "))
      (let ((unreads gnus-newsgroup-unreads))
	(message "")			;Erase "Yes or No" question.
	(while unreads
	  (gnus-mark-article-as-read (car unreads))
	  (setq unreads (cdr unreads)))
	(gnus-Subject-exit))))

(defun gnus-Subject-catch-up-and-exit (&optional quietly)
  "Mark all articles not marked as unread in this newsgroup as read,
and then exit."
  (interactive "P")
  (if (or quietly
	  (y-or-n-p "Delete all articles not marked as unread? "))
      (let ((unmarked
             (gnus-set-difference gnus-newsgroup-unreads
                                  gnus-newsgroup-marked)))
        (message "")
	(while unmarked
          (gnus-mark-article-as-read (car unmarked))
	  (setq unmarked (cdr unmarked)))
	(gnus-Subject-exit))))
--- Cut here 8<----------------------------------------------------------------
--
      tale@rpitsmts.bitnet, tale%mts@rpitsgw.rpi.edu, tale@pawl.rpi.edu