[gnu.emacs.gnus] subject mode enhancement

jeff1@garfield.MUN.EDU (Jeff Sparkes) (07/12/89)

	Here's a little subject mode enhancement that I whipped up.
The basic idea is that you pop into subject mode, and either kill
articles or mark them as interesting.  Kill them with C-k, and mark
them interesting with C-i (which puts an I at the beginning of the line)
This allows you to skip subjects already marked interesting.
Whenever an article is displayed, all the "I" markers are removed.
(This is the basic weakness of this scheme.  You may end up marking
subjects as interesting again... Some more intrepid elisp
hacker needs to make GNUS understand that "I" means unread too.)

I find this great for newsgroups in which I don't read most of the
articles.  I also have gnus-auto-select-first to nil.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	gnus-jds.el
# This archive created: Tue Jul 11 19:14:32 1989
export PATH; PATH=/bin:$PATH
if test -f 'gnus-jds.el'
then
	echo shar: will not over-write existing file "'gnus-jds.el'"
else
cat << \SHAR_EOF > 'gnus-jds.el'
; Mark interesting articles in GNUS subject mode.
; Jeff Sparkes,  Memorial University of Newfoundland, jeff1@garfield.mun.edu
; July 11, 1989
; Distributable under the GNU General Public License

(provide 'gnus-jds)

(defvar gnus-interest nil "Have any articles been marked as interesting?")

; Change: call original hook before? mine
(setq gnus-Startup-hook
      '(lambda ()
	 (define-key gnus-Subject-mode-map "\C-I" 'gnus-Subject-interesting-subject)
	 ))

(defun gnus-Subject-interesting-subject ()
  "Mark articles with this subject as interesting."
  (interactive)
  (gnus-Subject-mark-as-read nil "I")
  (save-excursion
    (let ((subject (gnus-Subject-subject-string)))
      (while (gnus-Subject-search-forward nil subject)
	(gnus-Subject-mark-as-read nil "I"))
      ))
  (gnus-Subject-next-subject 1 t)
  (setq gnus-interest t)
  )

(defun gnus-Subject-mark-interesting ()
  "Find all interesting subjects (marked with \"I\") and mark them as unread."
  (save-excursion
    ; Note: we are called from display-article, and are in Subject-buffer
    (goto-char (point-min))
    (let ((end (point-max)))
      (while (re-search-forward "^I" end t)
	(gnus-Subject-mark-as-unread nil t)))
    ))

; A modified version that mark all interesting articles (marked with "I")
; as unread if necessary
(defun gnus-Subject-display-article (article &optional all-header)
  "Display ARTICLE in Article buffer."
  (if (null article)
      nil
    (gnus-configure-windows 'SelectArticle)
    (pop-to-buffer gnus-Subject-buffer)
    (if gnus-interest
	(gnus-Subject-mark-interesting))
    (gnus-Article-prepare article all-header)
    (gnus-Subject-recenter)
    (gnus-Subject-set-mode-line)
    (run-hooks 'gnus-Select-article-hook)
    ;; Successfully display article.
    t
    ))
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0
-- 
Jeff Sparkes	jeff1@garfield.mun.edu || uunet!garfield!jeff1