#!/bin/sh
# this is part 4 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file gnus.el continued
#
CurArch=4
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
sed 's/^X//' << 'SHAR_EOF' >> gnus.el
X  ;; Hidden thread subtrees must be searched for ,too.
X  (gnus-Subject-show-all-threads)
X  ;; We don't want to change current point nor window configuration.
X  (save-excursion
X    (save-window-excursion
X      (message "Executing %s..." (key-description command))
X      ;; We'd like to execute COMMAND interactively so as to give arguments.
X      (gnus-execute field regexp
X		    (` (lambda ()
X			 (call-interactively '(, (key-binding command)))))
X		    backward)
X      (message "Executing %s... done" (key-description command)))))
X
X(defun gnus-Subject-beginning-of-article ()
X  "Go to beginning of article body"
X  (interactive)
X  (gnus-Subject-select-article)
X  (gnus-eval-in-buffer-window gnus-Article-buffer
X    (widen)
X    (beginning-of-buffer)
X    (if gnus-break-pages
X	(gnus-narrow-to-page))
X    ))
X
X(defun gnus-Subject-end-of-article ()
X  "Go to end of article body"
X  (interactive)
X  (gnus-Subject-select-article)
X  (gnus-eval-in-buffer-window gnus-Article-buffer
X    (widen)
X    (end-of-buffer)
X    (if gnus-break-pages
X	(gnus-narrow-to-page))
X    ))
X
X(defun gnus-Subject-goto-article (article &optional all-headers)
X  "Read ARTICLE if exists.
XOptional argument ALL-HEADERS means all headers are shown."
X  (interactive
X   (list
X    (string-to-int
X     (completing-read "Article number: "
X		      (mapcar
X		       (function
X			(lambda (headers)
X			  (list
X			   (int-to-string (nntp-header-number headers)))))
X		       gnus-newsgroup-headers)
X		      nil 'require-match))))
X  (if (gnus-Subject-goto-subject article)
X      (gnus-Subject-display-article article all-headers)))
X
X(defun gnus-Subject-goto-last-article ()
X  "Go to last subject line."
X  (interactive)
X  (if gnus-last-article
X      (gnus-Subject-goto-article gnus-last-article)))
X
X(defun gnus-Subject-show-article ()
X  "Force to show current article."
X  (interactive)
X  ;; The following is a trick to force to read the current article again.
X  (setq gnus-have-all-headers (not gnus-have-all-headers))
X  (gnus-Subject-select-article (not gnus-have-all-headers) t))
X
X(defun gnus-Subject-toggle-header (arg)
X  "Show original header if pruned header currently shown, or vice versa.
XWith arg, show original header iff arg is positive."
X  (interactive "P")
X  ;; Variable gnus-show-all-headers must be NIL to toggle really.
X  (let ((gnus-show-all-headers nil)
X	(all-headers
X	 (if (null arg) (not gnus-have-all-headers)
X	   (> (prefix-numeric-value arg) 0))))
X    (gnus-Subject-select-article all-headers t)))
X
X(defun gnus-Subject-show-all-headers ()
X  "Show original article header."
X  (interactive)
X  (gnus-Subject-select-article t t))
X
X(defun gnus-Subject-stop-page-breaking ()
X  "Stop page breaking by linefeed temporary (Widen article buffer)."
X  (interactive)
X  (gnus-Subject-select-article)
X  (gnus-eval-in-buffer-window gnus-Article-buffer
X    (widen)
X    ))
X
X(defun gnus-Subject-kill-same-subject-and-select (unmark)
X  "Mark articles which has the same subject as read, and then select next.
XIf argument UNMARK is positive, remove any kinds of marks.
XIf argument UNMARK is negative, mark articles as unread instead."
X  (interactive "P")
X  (if unmark
X      (setq unmark (prefix-numeric-value unmark)))
X  (let ((count
X	 (gnus-Subject-mark-same-subject
X	  (gnus-Subject-subject-string) unmark)))
X    ;; Select next unread article. If auto-select-same mode, should
X    ;; select the first unread article.
X    (gnus-Subject-next-article t (and gnus-auto-select-same
X				      (gnus-Subject-subject-string)))
X    (message "%d articles are marked as %s"
X	     count (if unmark "unread" "read"))
X    ))
X
X(defun gnus-Subject-kill-same-subject (unmark)
X  "Mark articles which has the same subject as read. 
XIf argument UNMARK is positive, remove any kinds of marks.
XIf argument UNMARK is negative, mark articles as unread instead."
X  (interactive "P")
X  (if unmark
X      (setq unmark (prefix-numeric-value unmark)))
X  (let ((count
X	 (gnus-Subject-mark-same-subject
X	  (gnus-Subject-subject-string) unmark)))
X    ;; If marked as read, go to next unread subject.
X    (if (null unmark)
X	;; Go to next unread subject.
X	(gnus-Subject-next-subject 1 t))
X    (message "%d articles are marked as %s"
X	     count (if unmark "unread" "read"))
X    ))
X
X(defun gnus-Subject-mark-same-subject (subject &optional unmark)
X  "Mark articles with same SUBJECT as read, and return marked number.
XIf optional argument UNMARK is positive, remove any kinds of marks.
XIf optional argument UNMARK is negative, mark articles as unread instead."
X  (let ((count 1))
X    (save-excursion
X      (cond ((null unmark)
X	     (gnus-Subject-mark-as-read nil "K"))
X	    ((> unmark 0)
X	     (gnus-Subject-mark-as-unread nil t))
X	    (t
X	     (gnus-Subject-mark-as-unread)))
X      (while (and subject
X		  (gnus-Subject-search-forward nil subject))
X	(cond ((null unmark)
X	       (gnus-Subject-mark-as-read nil "K"))
X	      ((> unmark 0)
X	       (gnus-Subject-mark-as-unread nil t))
X	      (t
X	       (gnus-Subject-mark-as-unread)))
X	(setq count (1+ count))
X	))
X    ;; Hide killed thread subtrees.  Does not work properly always.
X    ;;(and (null unmark)
X    ;;     gnus-thread-hide-killed
X    ;;	   (gnus-Subject-hide-thread))
X    ;; Return number of articles marked as read.
X    count
X    ))
X
X(defun gnus-Subject-mark-as-unread-forward (count)
X  "Mark current article as unread, and then go forward.
XArgument COUNT specifies number of articles marked as unread."
X  (interactive "p")
X  (while (> count 0)
X    (gnus-Subject-mark-as-unread nil nil)
X    (gnus-Subject-next-subject 1 nil)
X    (setq count (1- count))))
X
X(defun gnus-Subject-mark-as-unread-backward (count)
X  "Mark current article as unread, and then go backward.
XArgument COUNT specifies number of articles marked as unread."
X  (interactive "p")
X  (while (> count 0)
X    (gnus-Subject-mark-as-unread nil nil)
X    (gnus-Subject-prev-subject 1 nil)
X    (setq count (1- count))))
X
X(defun gnus-Subject-mark-as-unread (&optional article clear-mark)
X  "Mark current article as unread.
XOptional 1st argument ARTICLE specifies article number to be marked as unread.
XOptional 2nd argument CLEAR-MARK remove any kinds of mark."
X  (save-excursion
X    (set-buffer gnus-Subject-buffer)
X    ;; First of all, show hidden thread subtrees.
X    (gnus-Subject-show-thread)
X    (let* ((buffer-read-only nil)
X	   (current (gnus-Subject-article-number))
X	   (article (or article current)))
X      (gnus-mark-article-as-unread article clear-mark)
X      (if (or (eq article current)
X	      (gnus-Subject-goto-subject article))
X	  (progn
X	    (beginning-of-line)
X	    (delete-char 1)
X	    (insert (if clear-mark " " "-"))))
X      )))
X
X(defun gnus-Subject-mark-as-read-forward (count)
X  "Mark current article as read, and then go forward.
XArgument COUNT specifies number of articles marked as read"
X  (interactive "p")
X  (while (> count 0)
X    (gnus-Subject-mark-as-read)
X    (gnus-Subject-next-subject 1 'unread-only)
X    (setq count (1- count))))
X
X(defun gnus-Subject-mark-as-read-backward (count)
X  "Mark current article as read, and then go backward.
XArgument COUNT specifies number of articles marked as read"
X  (interactive "p")
X  (while (> count 0)
X    (gnus-Subject-mark-as-read)
X    (gnus-Subject-prev-subject 1 'unread-only)
X    (setq count (1- count))))
X
X(defun gnus-Subject-mark-as-read (&optional article mark)
X  "Mark current article as read.
XOptional 1st argument ARTICLE specifies article number to be marked as read.
XOptional 2nd argument MARK specifies a string inserted at beginning of line.
XAny kind of string (length 1) except for a space and `-' is ok."
X  (save-excursion
X    (set-buffer gnus-Subject-buffer)
X    ;; First of all, show hidden thread subtrees.
X    (gnus-Subject-show-thread)
X    (let* ((buffer-read-only nil)
X	   (mark (or mark "D"))		;Default mark is `D'.
X	   (current (gnus-Subject-article-number))
X	   (article (or article current)))
X      (gnus-mark-article-as-read article)
X      (if (or (eq article current)
X	      (gnus-Subject-goto-subject article))
X	  (progn
X	    (beginning-of-line)
X	    (delete-char 1)
X	    (insert mark)))
X      )))
X
X(defun gnus-Subject-clear-mark-forward (count)
X  "Remove current article's mark, and go forward.
XArgument COUNT specifies number of articles unmarked"
X  (interactive "p")
X  (while (> count 0)
X    (gnus-Subject-mark-as-unread nil t)
X    (gnus-Subject-next-subject 1 nil)
X    (setq count (1- count))))
X
X(defun gnus-Subject-clear-mark-backward (count)
X  "Remove current article's mark, and go backward.
XArgument COUNT specifies number of articles unmarked"
X  (interactive "p")
X  (while (> count 0)
X    (gnus-Subject-mark-as-unread nil t)
X    (gnus-Subject-prev-subject 1 nil)
X    (setq count (1- count))))
X
X(defun gnus-Subject-delete-marked-as-read ()
X  "Delete lines which is marked as read."
X  (interactive)
X  (if gnus-newsgroup-unreads
X      (let ((buffer-read-only nil))
X	(save-excursion
X	  (goto-char (point-min))
X	  (delete-non-matching-lines "^[ ---]"))
X	;; Adjust point.
X	(if (eobp)
X	    (gnus-Subject-prev-subject 1)
X	  (beginning-of-line)
X	  (search-forward ":" nil t)))
X    ;; It is not so good idea to make the buffer empty.
X    (message "All articles are marked as read")
X    ))
X
X(defun gnus-Subject-delete-marked-with (marks)
X  "Delete lines which are marked with MARKS (e.g. \"DK\")."
X  (interactive "sMarks: ")
X  (let ((buffer-read-only nil))
X    (save-excursion
X      (goto-char (point-min))
X      (delete-matching-lines (concat "^[" marks "]")))
X    ;; Adjust point.
X    (or (zerop (buffer-size))
X	(if (eobp)
X	    (gnus-Subject-prev-subject 1)
X	  (beginning-of-line)
X	  (search-forward ":" nil t)))
X    ))
X
X;; Thread-based commands.
X
X(defun gnus-Subject-toggle-threads (arg)
X  "Toggle showing conversation threads.
XWith arg, turn showing conversation threads on iff arg is positive."
X  (interactive "P")
X  (let ((current (gnus-Subject-article-number)))
X    (setq gnus-show-threads
X	  (if (null arg) (not gnus-show-threads)
X	    (> (prefix-numeric-value arg) 0)))
X    (gnus-Subject-prepare)
X    (gnus-Subject-goto-subject current)
X    ))
X
X(defun gnus-Subject-show-all-threads ()
X  "Show all thread subtrees."
X  (interactive)
X  (if gnus-show-threads
X      (save-excursion
X	(let ((buffer-read-only nil))
X	  (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)
X	  ))))
X
X(defun gnus-Subject-show-thread ()
X  "Show thread subtrees."
X  (interactive)
X  (if gnus-show-threads
X      (save-excursion
X	(let ((buffer-read-only nil))
X	  (subst-char-in-region (progn
X				  (beginning-of-line) (point))
X				(progn
X				  (end-of-line) (point))
X				?\^M ?\n t)
X	  ))))
X
X(defun gnus-Subject-hide-all-threads ()
X  "Hide all thread subtrees."
X  (interactive)
X  (if gnus-show-threads
X      (save-excursion
X	;; Adjust cursor point.
X	(goto-char (point-min))
X	(search-forward ":" nil t)
X	(let ((level (current-column)))
X	  (gnus-Subject-hide-thread)
X	  (while (gnus-Subject-search-forward)
X	    (and (>= level (current-column))
X		 (gnus-Subject-hide-thread)))
X	  ))))
X
X(defun gnus-Subject-hide-thread ()
X  "Hide thread subtrees."
X  (interactive)
X  (if gnus-show-threads
X      (save-excursion
X	;; Adjust cursor point.
X	(beginning-of-line)
X	(search-forward ":" nil t)
X	(let ((buffer-read-only nil)
X	      (init (point))
X	      (last (point))
X	      (level (current-column)))
X	  (while (and (gnus-Subject-search-forward)
X		      (< level (current-column)))
X	    ;; Interested in lower levels.
X	    (if (< level (current-column))
X		(progn
X		  (setq last (point))
X		  ))
X	    )
X	  (subst-char-in-region init last ?\n ?\^M t)
X	  ))))
X
X(defun gnus-Subject-next-thread (n)
X  "Go to the same level next thread.
XArgument N specifies the number of threads."
X  (interactive "p")
X  ;; Adjust cursor point.
X  (beginning-of-line)
X  (search-forward ":" nil t)
X  (let ((init (point))
X	(last (point))
X	(level (current-column)))
X    (while (and (> n 0)
X		(gnus-Subject-search-forward)
X		(<= level (current-column)))
X      ;; We have to skip lower levels.
X      (if (= level (current-column))
X	  (progn
X	    (setq last (point))
X	    (setq n (1- n))
X	    ))
X      )
X    ;; Return non-nil if successfully move to the next.
X    (prog1 (not (= init last))
X      (goto-char last))
X    ))
X
X(defun gnus-Subject-prev-thread (n)
X  "Go to the same level previous thread.
XArgument N specifies the number of threads."
X  (interactive "p")
X  ;; Adjust cursor point.
X  (beginning-of-line)
X  (search-forward ":" nil t)
X  (let ((init (point))
X	(last (point))
X	(level (current-column)))
X    (while (and (> n 0)
X		(gnus-Subject-search-backward)
X		(<= level (current-column)))
X      ;; We have to skip lower levels.
X      (if (= level (current-column))
X	  (progn
X	    (setq last (point))
X	    (setq n (1- n))
X	    ))
X      )
X    ;; Return non-nil if successfully move to the previous.
X    (prog1 (not (= init last))
X      (goto-char last))
X    ))
X
X(defun gnus-Subject-down-thread (d)
X  "Go downward current thread.
XArgument D specifies the depth goes down."
X  (interactive "p")
X  ;; Adjust cursor point.
X  (beginning-of-line)
X  (search-forward ":" nil t)
X  (let ((last (point))
X	(level (current-column)))
X    (while (and (> d 0)
X		(gnus-Subject-search-forward)
X		(<= level (current-column))) ;<= can be <.  Which do you like?
X      ;; We have to skip the same levels.
X      (if (< level (current-column))
X	  (progn
X	    (setq last (point))
X	    (setq level (current-column))
X	    (setq d (1- d))
X	    ))
X      )
X    (goto-char last)
X    ))
X
X(defun gnus-Subject-up-thread (d)
X  "Go upward current thread.
XArgument D specifies the depth goes up."
X  (interactive "p")
X  ;; Adjust cursor point.
X  (beginning-of-line)
X  (search-forward ":" nil t)
X  (let ((last (point))
X	(level (current-column)))
X    (while (and (> d 0)
X		(gnus-Subject-search-backward))
X      ;; We have to skip the same levels.
X      (if (> level (current-column))
X	  (progn
X	    (setq last (point))
X	    (setq level (current-column))
X	    (setq d (1- d))
X	    ))
X      )
X    (goto-char last)
X    ))
X
X(defun gnus-Subject-kill-thread (unmark)
X  "Mark articles under current thread as read.
XIf argument UNMARK is positive, remove any kinds of marks.
XIf argument UNMARK is negative, mark articles as unread instead."
X  (interactive "P")
X  (if unmark
X      (setq unmark (prefix-numeric-value unmark)))
X  ;; Adjust cursor point.
X  (beginning-of-line)
X  (search-forward ":" nil t)
X  (save-excursion
X    (let ((level (current-column)))
X      ;; Mark current article.
X      (cond ((null unmark)
X	     (gnus-Subject-mark-as-read nil "K"))
X	    ((> unmark 0)
X	     (gnus-Subject-mark-as-unread nil t))
X	    (t
X	     (gnus-Subject-mark-as-unread))
X	    )
X      ;; Mark following articles.
X      (while (and (gnus-Subject-search-forward)
X		  (< level (current-column)))
X	(cond ((null unmark)
X	       (gnus-Subject-mark-as-read nil "K"))
X	      ((> unmark 0)
X	       (gnus-Subject-mark-as-unread nil t))
X	      (t
X	       (gnus-Subject-mark-as-unread))
X	      ))
X      ))
X  ;; Hide killed subtrees.
X  (and (null unmark)
X       gnus-thread-hide-killed
X       (gnus-Subject-hide-thread))
X  ;; If marked as read, go to next unread subject.
X  (if (null unmark)
X      ;; Go to next unread subject.
X      (gnus-Subject-next-subject 1 t))
X  )
X
X(defun gnus-Subject-toggle-truncation (arg)
X  "Toggle truncation of subject lines.
XWith arg, turn line truncation on iff arg is positive."
X  (interactive "P")
X  (setq truncate-lines
X	(if (null arg) (not truncate-lines)
X	  (> (prefix-numeric-value arg) 0)))
X  (redraw-display))
X
X(defun gnus-Subject-sort-by-number (reverse)
X  "Sort subject display buffer by article number.
XArgument REVERSE means reverse order."
X  (interactive "P")
X  (gnus-Subject-sort-subjects
X   (function
X    (lambda (a b)
X      (< (nntp-header-number a) (nntp-header-number b))))
X   reverse
X   ))
X
X(defun gnus-Subject-sort-by-author (reverse)
X  "Sort subject display buffer by author name alphabetically.
XIf case-fold-search is non-nil, case of letters is ignored.
XArgument REVERSE means reverse order."
X  (interactive "P")
X  (gnus-Subject-sort-subjects
X   (function
X    (lambda (a b)
X      (gnus-string-lessp (nntp-header-from a) (nntp-header-from b))))
X   reverse
X   ))
X
X(defun gnus-Subject-sort-by-subject (reverse)
X  "Sort subject display buffer by subject alphabetically. `Re:'s are ignored.
XIf case-fold-search is non-nil, case of letters is ignored.
XArgument REVERSE means reverse order."
X  (interactive "P")
X  (gnus-Subject-sort-subjects
X   (function
X    (lambda (a b)
X      (gnus-string-lessp
X       (gnus-simplify-subject (nntp-header-subject a) 're-only)
X       (gnus-simplify-subject (nntp-header-subject b) 're-only))))
X   reverse
X   ))
X
X(defun gnus-Subject-sort-by-date (reverse)
X  "Sort subject display buffer by posted date.
XArgument REVERSE means reverse order."
X  (interactive "P")
X  (gnus-Subject-sort-subjects
X   (function
X    (lambda (a b)
X      (gnus-date-lessp (nntp-header-date a) (nntp-header-date b))))
X   reverse
X   ))
X
X(defun gnus-Subject-sort-subjects (predicate &optional reverse)
X  "Sort subject display buffer by PREDICATE.
XOptional argument REVERSE means reverse order."
X  (let ((current (gnus-Subject-article-number)))
X    (gnus-sort-headers predicate reverse)
X    (gnus-Subject-prepare)
X    (gnus-Subject-goto-subject current)
X    ))
X
X(defun gnus-Subject-reselect-current-group (show-all)
X  "Once exit and then reselect the current newsgroup.
XPrefix argument SHOW-ALL means to select all articles."
X  (interactive "P")
X  (let ((current-subject (gnus-Subject-article-number)))
X    (gnus-Subject-exit t)
X    ;; We have to adjust the point of Group mode buffer because the
X    ;; current point was moved to the next unread newsgroup by
X    ;; exiting.
X    (gnus-Subject-jump-to-group gnus-newsgroup-name)
X    (gnus-Group-read-group show-all t)
X    (gnus-Subject-goto-subject current-subject)
X    ))
X
X(defun gnus-Subject-caesar-message (rotnum)
X  "Caesar rotates all letters of current message by 13/47 places.
XWith prefix arg, specifies the number of places to rotate each letter forward.
XCaesar rotates Japanese letters by 47 places in any case."
X  (interactive "P")
X  (gnus-Subject-select-article)
X  (gnus-overload-functions)
X  (gnus-eval-in-buffer-window gnus-Article-buffer
X    (save-restriction
X      (widen)
X      ;; We don't want to jump to the beginning of the message.
X      ;; `save-excursion' does not do its job.
X      (move-to-window-line 0)
X      (let ((last (point)))
X	(news-caesar-buffer-body rotnum)
X	(goto-char last)
X	(recenter 0)
X	))
X    ))
X
X(defun gnus-Subject-rmail-digest ()
X  "Run RMAIL on current digest article.
Xgnus-Select-digest-hook will be called with no arguments, if that
Xvalue is non-nil. It is possible to modify the article so that Rmail
Xcan work with it.
Xgnus-Rmail-digest-hook will be called with no arguments, if that value
Xis non-nil. The hook is intended to customize Rmail mode."
X  (interactive)
X  (gnus-Subject-select-article)
X  (require 'rmail)
X  (let ((artbuf gnus-Article-buffer)
X	(digbuf (get-buffer-create gnus-Digest-buffer))
X	(mail-header-separator ""))
X    (set-buffer digbuf)
X    (buffer-flush-undo (current-buffer))
X    (setq buffer-read-only nil)
X    (erase-buffer)
X    (insert-buffer-substring artbuf)
X    (run-hooks 'gnus-Select-digest-hook)
X    (gnus-convert-article-to-rmail)
X    (goto-char (point-min))
X    ;; Rmail initializations.
X    (rmail-insert-rmail-file-header)
X    (rmail-mode)
X    (rmail-set-message-counters)
X    (rmail-show-message)
X    (condition-case ()
X	(progn
X	  (undigestify-rmail-message)
X	  (rmail-expunge)		;Delete original message.
X	  ;; File name is meaningless but `save-buffer' requires it.
X	  (setq buffer-file-name "GNUS Digest")
X	  (setq mode-line-buffer-identification
X		(concat "Digest: "
X			(nntp-header-subject gnus-current-headers)))
X	  ;; There is no need to write this buffer to a file.
X	  (make-local-variable 'write-file-hooks)
X	  (setq write-file-hooks
X		(list (function
X		       (lambda ()
X			 (set-buffer-modified-p nil)
X			 (message "(No changes need to be saved)")
X			 'no-need-to-write-this-buffer))))
X	  ;; Default file name saving digest messages.
X	  (setq rmail-last-rmail-file
X		(funcall gnus-rmail-save-name
X			 gnus-newsgroup-name
X			 gnus-current-headers
X			 gnus-newsgroup-last-rmail
X			 ))
X	  (setq rmail-last-file
X		(funcall gnus-mail-save-name
X			 gnus-newsgroup-name
X			 gnus-current-headers
X			 gnus-newsgroup-last-mail
X			 ))
X	  ;; Prevent generating new buffer named ***<N> each time.
X	  (setq rmail-summary-buffer
X		(get-buffer-create gnus-Digest-summary-buffer))
X	  (run-hooks 'gnus-Rmail-digest-hook)
X	  ;; Take all windows safely.
X	  (gnus-configure-windows '(1 0 0))
X	  (pop-to-buffer gnus-Group-buffer)
X	  ;; Use Subject and Article windows for Digest summary and
X	  ;; Digest buffers.
X	  (if gnus-digest-show-summary
X	      (let ((gnus-Subject-buffer gnus-Digest-summary-buffer)
X		    (gnus-Article-buffer gnus-Digest-buffer))
X		(gnus-configure-windows 'SelectArticle)
X		(pop-to-buffer gnus-Digest-buffer)
X		(rmail-summary)
X		(pop-to-buffer gnus-Digest-summary-buffer)
X		(message (substitute-command-keys
X			  "Type \\[rmail-summary-quit] to return to GNUS")))
X	    (let ((gnus-Subject-buffer gnus-Digest-buffer))
X	      (gnus-configure-windows 'ExpandSubject)
X	      (pop-to-buffer gnus-Digest-buffer)
X	      (message (substitute-command-keys
X			"Type \\[rmail-quit] to return to GNUS")))
X	    )
X	  ;; Move the buffers to the end of buffer list.
X	  (bury-buffer gnus-Article-buffer)
X	  (bury-buffer gnus-Group-buffer)
X	  (bury-buffer gnus-Digest-summary-buffer)
X	  (bury-buffer gnus-Digest-buffer))
X      (error (set-buffer-modified-p nil)
X	     (kill-buffer digbuf)
X	     ;; This command should not signal an error because the
X	     ;; command is called from hooks.
X	     (ding) (message "Article is not a digest")))
X    ))
X
X(defun gnus-Subject-save-article ()
X  "Save this article using default saver function.
XVariable `gnus-default-article-saver' specifies the saver function."
X  (interactive)
X  (gnus-Subject-select-article
X   (not (null gnus-save-all-headers)) gnus-save-all-headers)
X  (if gnus-default-article-saver
X      (call-interactively gnus-default-article-saver)
X    (error "No default saver is defined.")))
X
X(defun gnus-Subject-save-in-rmail (&optional filename)
X  "Append this article to Rmail file.
XOptional argument FILENAME specifies file name.
XDirectory to save to is default to `gnus-article-save-directory' which
Xis initialized from the SAVEDIR environment variable."
X  (interactive)
X  (gnus-Subject-select-article
X   (not (null gnus-save-all-headers)) gnus-save-all-headers)
X  (gnus-eval-in-buffer-window gnus-Article-buffer
X    (save-excursion
X      (save-restriction
X	(widen)
X	(let ((default-name
X		(funcall gnus-rmail-save-name
X			 gnus-newsgroup-name
X			 gnus-current-headers
X			 gnus-newsgroup-last-rmail
X			 )))
X	  (or filename
X	      (setq filename
X		    (read-file-name
X		     (concat "Save article in Rmail file: (default "
X			     (file-name-nondirectory default-name)
X			     ") ")
X		     (file-name-directory default-name)
X		     default-name)))
X	  (gnus-make-directory (file-name-directory filename))
X	  (gnus-output-to-rmail filename)
X	  ;; Remember the directory name to save articles.
X	  (setq gnus-newsgroup-last-rmail filename)
X	  )))
X    ))
X
X(defun gnus-Subject-save-in-mail (&optional filename)
X  "Append this article to Unix mail file.
XOptional argument FILENAME specifies file name.
XDirectory to save to is default to `gnus-article-save-directory' which
Xis initialized from the SAVEDIR environment variable."
X  (interactive)
X  (gnus-Subject-select-article
X   (not (null gnus-save-all-headers)) gnus-save-all-headers)
X  (gnus-eval-in-buffer-window gnus-Article-buffer
X    (save-excursion
X      (save-restriction
X	(widen)
X	(let ((default-name
X		(funcall gnus-mail-save-name
X			 gnus-newsgroup-name
X			 gnus-current-headers
X			 gnus-newsgroup-last-mail
X			 )))
X	  (or filename
X	      (setq filename
X		    (read-file-name
X		     (concat "Save article in Unix mail file: (default "
X			     (file-name-nondirectory default-name)
X			     ") ")
X		     (file-name-directory default-name)
X		     default-name)))
X	  (gnus-make-directory (file-name-directory filename))
X	  (rmail-output filename)
X	  ;; Remember the directory name to save articles.
X	  (setq gnus-newsgroup-last-mail filename)
X	  )))
X    ))
X
X(defun gnus-Subject-save-in-file (&optional filename)
X  "Append this article to file.
XOptional argument FILENAME specifies file name.
XDirectory to save to is default to `gnus-article-save-directory' which
Xis initialized from the SAVEDIR environment variable."
X  (interactive)
X  (gnus-Subject-select-article
X   (not (null gnus-save-all-headers)) gnus-save-all-headers)
X  (gnus-eval-in-buffer-window gnus-Article-buffer
X    (save-excursion
X      (save-restriction
X	(widen)
X	(let ((default-name
X		(funcall gnus-file-save-name
X			 gnus-newsgroup-name
X			 gnus-current-headers
X			 gnus-newsgroup-last-file
X			 )))
X	  (or filename
X	      (setq filename
X		    (read-file-name
X		     (concat "Save article in file: (default "
X			     (file-name-nondirectory default-name)
X			     ") ")
X		     (file-name-directory default-name)
X		     default-name)))
X	  (gnus-make-directory (file-name-directory filename))
X	  (gnus-output-to-file filename)
X	  ;; Remember the directory name to save articles.
X	  (setq gnus-newsgroup-last-file filename)
X	  )))
X    ))
X
X(defun gnus-Subject-save-in-folder (&optional folder)
X  "Save this article to MH folder (using `rcvstore' in MH library).
XOptional argument FOLDER specifies folder name."
X  (interactive)
X  (gnus-Subject-select-article
X   (not (null gnus-save-all-headers)) gnus-save-all-headers)
X  (gnus-eval-in-buffer-window gnus-Article-buffer
X    (save-restriction
X      (widen)
X      ;; Thanks to yuki@flab.Fujitsu.JUNET and ohm@kaba.junet.
X      (mh-find-path)
X      (let ((folder
X	     (or folder
X		 (mh-prompt-for-folder "Save article in"
X				       (funcall gnus-folder-save-name
X						gnus-newsgroup-name
X						gnus-current-headers
X						gnus-newsgroup-last-folder
X						)
X				       t
X				       )))
X	    (errbuf (get-buffer-create " *GNUS rcvstore*")))
X	(unwind-protect
X	    (call-process-region (point-min) (point-max)
X				 (expand-file-name "rcvstore" mh-lib)
X				 nil errbuf nil folder)
X	  (set-buffer errbuf)
X	  (if (zerop (buffer-size))
X	      (message "Article saved in folder: %s" folder)
X	    (message "%s" (buffer-string)))
X	  (kill-buffer errbuf)
X	  (setq gnus-newsgroup-last-folder folder))
X	))
X    ))
X
X(defun gnus-Subject-pipe-output ()
X  "Pipe this article to subprocess."
X  (interactive)
X  ;; Ignore `gnus-save-all-headers' since this is not save command.
X  (gnus-Subject-select-article)
X  (gnus-eval-in-buffer-window gnus-Article-buffer
X    (save-restriction
X      (widen)
X      (let ((command (read-string "Shell command on article: "
X				  gnus-last-shell-command)))
X	(if (string-equal command "")
X	    (setq command gnus-last-shell-command))
X	(shell-command-on-region (point-min) (point-max) command nil)
X	(setq gnus-last-shell-command command)
X	))
X    ))
X
X(defun gnus-Subject-catch-up (all &optional quietly)
X  "Mark all articles not marked as unread in this newsgroup as read.
XIf prefix argument ALL is non-nil, all articles are marked as read."
X  (interactive "P")
X  (if (or quietly
X	  (y-or-n-p
X	   (if all
X	       "Do you really want to mark everything as read? "
X	     "Delete all articles not marked as unread? ")))
X      (let ((unmarked
X	     (gnus-set-difference gnus-newsgroup-unreads
X				  (if (not all) gnus-newsgroup-marked))))
X        (message "")			;Erase "Yes or No" question.
X	(while unmarked
X          (gnus-Subject-mark-as-read (car unmarked) "C")
X	  (setq unmarked (cdr unmarked))
X	  ))
X    ))
X
X(defun gnus-Subject-catch-up-all (&optional quietly)
X  "Mark all articles in this newsgroup as read."
X  (interactive)
X  (gnus-Subject-catch-up t quietly))
X
X(defun gnus-Subject-catch-up-and-exit (all &optional quietly)
X  "Mark all articles not marked as unread in this newsgroup as read, then exit.
XIf prefix argument ALL is non-nil, all articles are marked as read."
X  (interactive "P")
X  (if (or quietly
X	  (y-or-n-p
X	   (if all
X	       "Do you really want to mark everything as read? "
X	     "Delete all articles not marked as unread? ")))
X      (let ((unmarked
X             (gnus-set-difference gnus-newsgroup-unreads
X                                  (if (not all) gnus-newsgroup-marked))))
X        (message "")			;Erase "Yes or No" question.
X	(while unmarked
X          (gnus-mark-article-as-read (car unmarked))
X	  (setq unmarked (cdr unmarked)))
X	;; Select next newsgroup or exit.
X	(cond ((eq gnus-auto-select-next 'quietly)
X	       ;; Select next newsgroup quietly.
X	       (gnus-Subject-next-group nil))
X	      (t
X	       (gnus-Subject-exit)))
X	)))
X
X(defun gnus-Subject-catch-up-all-and-exit (&optional quietly)
X  "Mark all articles in this newsgroup as read, and then exit."
X  (interactive)
X  (gnus-Subject-catch-up-and-exit t quietly))
X
X(defun gnus-Subject-edit-global-kill ()
X  "Edit a global KILL file."
X  (interactive)
X  (setq gnus-current-kill-article (gnus-Subject-article-number))
X  (gnus-Kill-file-edit-file nil)	;Nil stands for global KILL file.
X  (message
X   (substitute-command-keys
X    "Editing a global KILL file (Type \\[gnus-Kill-file-exit] to exit)")))
X
X(defun gnus-Subject-edit-local-kill ()
X  "Edit a local KILL file applied to the current newsgroup."
X  (interactive)
X  (setq gnus-current-kill-article (gnus-Subject-article-number))
X  (gnus-Kill-file-edit-file gnus-newsgroup-name)
X  (message
X   (substitute-command-keys
X    "Editing a local KILL file (Type \\[gnus-Kill-file-exit] to exit)")))
X
X(defun gnus-Subject-exit (&optional temporary)
X  "Exit reading current newsgroup, and then return to group selection mode.
Xgnus-Exit-group-hook is called with no arguments if that value is non-nil."
X  (interactive)
X  (let ((updated nil)
X	(gnus-newsgroup-headers gnus-newsgroup-headers)
X	(gnus-newsgroup-unreads gnus-newsgroup-unreads)
X	(gnus-newsgroup-unselected gnus-newsgroup-unselected)
X	(gnus-newsgroup-marked gnus-newsgroup-marked))
X    ;; Important internal variables are save, so we can reenter
X    ;; Subject Mode buffer even if hook changes them.
X    (run-hooks 'gnus-Exit-group-hook)
X    (gnus-update-unread-articles gnus-newsgroup-name
X				 (append gnus-newsgroup-unselected
X					 gnus-newsgroup-unreads)
X				 gnus-newsgroup-marked)
X    ;; T means ignore unsubscribed newsgroups.
X    (if gnus-use-cross-reference
X	(setq updated
X	      (gnus-mark-as-read-by-xref gnus-newsgroup-name
X					 gnus-newsgroup-headers
X					 gnus-newsgroup-unreads
X					 (eq gnus-use-cross-reference t)
X					 )))
X    ;; Do not switch windows but change the buffer to work.
X    (set-buffer gnus-Group-buffer)
X    ;; Update cross referenced group info.
X    (while updated
X      (gnus-Group-update-group (car updated) t) ;Ignore invisible group.
X      (setq updated (cdr updated)))
X    (gnus-Group-update-group gnus-newsgroup-name))
X  ;; Make sure where I was, and go to next newsgroup.
X  (gnus-Group-jump-to-group gnus-newsgroup-name)
X  (gnus-Group-next-unread-group 1)
X  (if temporary
X      ;; If exiting temporary, caller should adjust Group mode
X      ;; buffer point by itself.
X      nil				;Nothing to do.
X    ;; Return to Group mode buffer.
X    (if (get-buffer gnus-Subject-buffer)
X	(bury-buffer gnus-Subject-buffer))
X    (if (get-buffer gnus-Article-buffer)
X	(bury-buffer gnus-Article-buffer))
X    (gnus-configure-windows 'ExitNewsgroup)
X    (pop-to-buffer gnus-Group-buffer)))
X
X(defun gnus-Subject-quit ()
X  "Quit reading current newsgroup without updating read article info."
X  (interactive)
X  (if (y-or-n-p "Do you really wanna quit reading this group? ")
X      (progn
X	(message "")			;Erase "Yes or No" question.
X	;; Return to Group selection mode.
X	(if (get-buffer gnus-Subject-buffer)
X	    (bury-buffer gnus-Subject-buffer))
X	(if (get-buffer gnus-Article-buffer)
X	    (bury-buffer gnus-Article-buffer))
X	(gnus-configure-windows 'ExitNewsgroup)
X	(pop-to-buffer gnus-Group-buffer)
X	(gnus-Group-jump-to-group gnus-newsgroup-name) ;Make sure where I was.
X	(gnus-Group-next-group 1)	;(gnus-Group-next-unread-group 1)
X	)))
X
X(defun gnus-Subject-describe-briefly ()
X  "Describe Subject mode commands briefly."
X  (interactive)
X  (message
X   (concat
X    (substitute-command-keys "\\[gnus-Subject-next-page]:Select  ")
X    (substitute-command-keys "\\[gnus-Subject-next-unread-article]:Forward  ")
X    (substitute-command-keys "\\[gnus-Subject-prev-unread-article]:Backward  ")
X    (substitute-command-keys "\\[gnus-Subject-exit]:Exit  ")
X    (substitute-command-keys "\\[gnus-Info-find-node]:Run Info  ")
X    (substitute-command-keys "\\[gnus-Subject-describe-briefly]:This help")
X    )))
X
X
X;;;
X;;; GNUS Article Mode
X;;;
X
X(if gnus-Article-mode-map
X    nil
X  (setq gnus-Article-mode-map (make-keymap))
X  (suppress-keymap gnus-Article-mode-map)
X  (define-key gnus-Article-mode-map " " 'gnus-Article-next-page)
X  (define-key gnus-Article-mode-map "\177" 'gnus-Article-prev-page)
X  (define-key gnus-Article-mode-map "r" 'gnus-Article-refer-article)
X  (define-key gnus-Article-mode-map "o" 'gnus-Article-pop-article)
X  (define-key gnus-Article-mode-map "h" 'gnus-Article-show-subjects)
X  (define-key gnus-Article-mode-map "s" 'gnus-Article-show-subjects)
X  (define-key gnus-Article-mode-map "?" 'gnus-Article-describe-briefly)
X  (define-key gnus-Article-mode-map "\C-c\C-i" 'gnus-Info-find-node))
X
X(defun gnus-Article-mode ()
X  "Major mode for browsing through an article.
XAll normal editing commands are turned off.
XInstead, these commands are available:
X\\{gnus-Article-mode-map}
X
XVarious hooks for customization:
X gnus-Article-mode-hook
X    Entry to this mode calls the value with no arguments, if that
X    value is non-nil.
X
X gnus-Article-prepare-hook
X    Called with no arguments after an article is prepared for reading,
X    if that value is non-nil."
X  (interactive)
X  (kill-all-local-variables)
X  ;; Gee.  Why don't you upgrade?
X  (cond ((boundp 'mode-line-modified)
X	 (setq mode-line-modified "--- "))
X	((listp (default-value 'mode-line-format))
X	 (setq mode-line-format
X	       (cons "--- " (cdr (default-value 'mode-line-format))))))
X  (make-local-variable 'global-mode-string)
X  (setq global-mode-string nil)
X  (setq major-mode 'gnus-Article-mode)
X  (setq mode-name "Article")
X  (gnus-Article-set-mode-line)
X  (use-local-map gnus-Article-mode-map)
X  (make-local-variable 'page-delimiter)
X  (setq page-delimiter gnus-page-delimiter)
X  (make-local-variable 'mail-header-separator)
X  (setq mail-header-separator "")	;For caesar function.
X  (buffer-flush-undo (current-buffer))
X  (setq buffer-read-only t)		;Disable modification
X  (run-hooks 'gnus-Article-mode-hook))
X
X(defun gnus-Article-setup-buffer ()
X  "Initialize Article mode buffer."
X  (or (get-buffer gnus-Article-buffer)
X      (save-excursion
X	(set-buffer (get-buffer-create gnus-Article-buffer))
X	(gnus-Article-mode))
X      ))
X
X(defun gnus-Article-prepare (article &optional all-headers)
X  "Prepare ARTICLE in Article mode buffer.
XIf optional argument ALL-HEADERS is non-nil, all headers are inserted."
X  (save-excursion
X    (set-buffer gnus-Article-buffer)
X    (let ((buffer-read-only nil))
X      (erase-buffer)
X      (if (gnus-request-article article)
X	  (progn
X	    ;; Prepare article buffer
X	    (insert-buffer-substring nntp-server-buffer)
X	    (setq gnus-have-all-headers (or all-headers gnus-show-all-headers))
X	    (if (and (numberp article)
X		     (not (eq article gnus-current-article)))
X		;; Seems me that a new article is selected.
X		(progn
X		  ;; gnus-current-article must be an article number.
X		  (setq gnus-last-article gnus-current-article)
X		  (setq gnus-current-article article)
X		  (setq gnus-current-headers
X			(gnus-find-header-by-number gnus-newsgroup-headers
X						    gnus-current-article))
X		  ;; Clear articles history only when articles are
X		  ;; retrieved by article numbers.
X		  (setq gnus-current-history nil)
X		  (run-hooks 'gnus-Mark-article-hook)
X		  ))
X	    ;; Hooks for modifying contents of the article. This hook
X	    ;; must be called before being narrowed.
X	    (run-hooks 'gnus-Article-prepare-hook)
X	    ;; Delete unnecessary headers.
X	    (or gnus-have-all-headers
X		(gnus-Article-delete-headers))
X	    ;; Do page break.
X	    (goto-char (point-min))
X	    (if gnus-break-pages
X		(gnus-narrow-to-page))
X	    ;; Next function must be called after setting
X	    ;;  `gnus-current-article' variable and narrowed to page.
X	    (gnus-Article-set-mode-line)
X	    )
X	(if (numberp article)
X	    (gnus-Subject-mark-as-read article))
X	(ding) (message "No such article (may be canceled)"))
X      )))
X
X(defun gnus-Article-show-all-headers ()
X  "Show all article headers in Article mode buffer."
X  (or gnus-have-all-headers
X      (gnus-Article-prepare gnus-current-article t)))
X
X;;(defun gnus-Article-set-mode-line ()
X;;  "Set Article mode line string."
X;;  (setq mode-line-buffer-identification
X;;	(list 17
X;;	      (format "GNUS: %s {%d-%d} %d"
X;;		      gnus-newsgroup-name
X;;		      gnus-newsgroup-begin
X;;		      gnus-newsgroup-end
X;;		      gnus-current-article
X;;                    )))
X;;  (set-buffer-modified-p t))
X
X(defun gnus-Article-set-mode-line ()
X  "Set Article mode line string."
X  (let ((unmarked
X	 (- (length gnus-newsgroup-unreads)
X	    (length (gnus-intersection
X		     gnus-newsgroup-unreads gnus-newsgroup-marked))))
X	(unselected
X	 (- (length gnus-newsgroup-unselected)
X	    (length (gnus-intersection
X		     gnus-newsgroup-unselected gnus-newsgroup-marked)))))
X    (setq mode-line-buffer-identification
X	  (list 17
X		(format "GNUS: %s{%d} %s"
X			gnus-newsgroup-name
X			gnus-current-article
X			;; This is proposed by tale@pawl.rpi.edu.
X			(cond ((and (zerop unmarked)
X				    (zerop unselected))
X			       "      ")
X			      ((zerop unselected)
X			       (format "%d more" unmarked))
X			      (t
X			       (format "%d(+%d) more" unmarked unselected)))
X			))))
X  (set-buffer-modified-p t))
X
X(defun gnus-Article-delete-headers ()
X  "Delete unnecessary headers."
X  (save-excursion
X    (save-restriction
X      (goto-char (point-min))
X      (narrow-to-region (point-min)
X			(progn (search-forward "\n\n" nil 'move) (point)))
X      (goto-char (point-min))
X      (and (stringp gnus-ignored-headers)
X	   (while (re-search-forward gnus-ignored-headers nil t)
X	     (beginning-of-line)
X	     (delete-region (point)
X			    (progn (re-search-forward "\n[^ \t]")
X				   (forward-char -1)
X				   (point)))))
X      )))
X
X;; Working on article's buffer
X
X(defun gnus-Article-next-page (lines)
X  "Show next page of current article.
XIf end of article, return non-nil. Otherwise return nil.
XArgument LINES specifies lines to be scrolled up."
X  (interactive "P")
X  (move-to-window-line -1)
X  ;; Fixed by enami@ptgd.sony.co.jp (enami tsugutomo)
X  (if (save-excursion
X	(end-of-line)
X	(and (pos-visible-in-window-p)	;Not continuation line.
X	     (eobp)))
X      ;; Nothing in this page.
X      (if (or (not gnus-break-pages)
X	      (save-excursion
X		(save-restriction
X		  (widen) (forward-line 1) (eobp)))) ;Real end-of-buffer?
X	  t				;Nothing more.
X	(gnus-narrow-to-page 1)		;Go to next page.
X	nil
X	)
X    ;; More in this page.
X    (condition-case ()
X	(scroll-up lines)
X      (end-of-buffer
X       ;; Long lines may cause an end-of-buffer error.
X       (goto-char (point-max))))
X    nil
X    ))
X
X(defun gnus-Article-prev-page (lines)
X  "Show previous page of current article.
XArgument LINES specifies lines to be scrolled down."
X  (interactive "P")
X  (move-to-window-line 0)
X  (if (and gnus-break-pages
X	   (bobp)
X	   (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer?
X      (progn
X	(gnus-narrow-to-page -1) ;Go to previous page.
X	(goto-char (point-max))
X	(recenter -1))
X    (scroll-down lines)))
X
X(defun gnus-Article-next-digest (nth)
X  "Move to head of NTH next digested message.
XSet mark at end of digested message."
X  ;; Stop page breaking in digest mode.
X  (widen)
X  (end-of-line)
X  ;; Skip NTH - 1 digest.
X  ;; Suggested by Khalid Sattar <admin@cs.exeter.ac.uk>.
X  ;; Digest separator is customizable.
X  ;; Suggested by Skip Montanaro <montanaro@sprite.crd.ge.com>.
X  (while (and (> nth 1)
X	      (re-search-forward gnus-digest-separator nil 'move))
X    (setq nth (1- nth)))
X  (if (re-search-forward gnus-digest-separator nil t)
X      (let ((begin (point)))
X	;; Search for end of this message.
X	(end-of-line)
X	(if (re-search-forward gnus-digest-separator nil t)
X	    (progn
X	      (search-backward "\n\n")	;This may be incorrect.
X	      (forward-line 1))
X	  (goto-char (point-max)))
X	(push-mark)			;Set mark at end of digested message.
X	(goto-char begin)
X	(beginning-of-line)
X	;; Show From: and Subject: fields.
X	(recenter 1))
X    (message "End of message")
X    ))
X
X(defun gnus-Article-prev-digest (nth)
X  "Move to head of NTH previous digested message."
X  ;; Stop page breaking in digest mode.
X  (widen)
X  (beginning-of-line)
X  ;; Skip NTH - 1 digest.
X  ;; Suggested by Khalid Sattar <admin@cs.exeter.ac.uk>.
X  ;; Digest separator is customizable.
X  ;; Suggested by Skip Montanaro <montanaro@sprite.crd.ge.com>.
X  (while (and (> nth 1)
X	      (re-search-backward gnus-digest-separator nil 'move))
X    (setq nth (1- nth)))
X  (if (re-search-backward gnus-digest-separator nil t)
X      (let ((begin (point)))
X	;; Search for end of this message.
X	(end-of-line)
X	(if (re-search-forward gnus-digest-separator nil t)
X	    (progn
X	      (search-backward "\n\n")	;This may be incorrect.
X	      (forward-line 1))
X	  (goto-char (point-max)))
X	(push-mark)			;Set mark at end of digested message.
X	(goto-char begin)
X	;; Show From: and Subject: fields.
X	(recenter 1))
X    (goto-char (point-min))
X    (message "Top of message")
X    ))
X
X(defun gnus-Article-refer-article ()
X  "Read article specified by message-id around point."
X  (interactive)
X  (save-window-excursion
X    (save-excursion
X      (re-search-forward ">" nil t)	;Move point to end of "<....>".
X      (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t)
X	  (let ((message-id
X		 (buffer-substring (match-beginning 1) (match-end 1))))
X	    (set-buffer gnus-Subject-buffer)
X	    (gnus-Subject-refer-article message-id))
X	(error "No references around point"))
X      )))
X
X(defun gnus-Article-pop-article ()
X  "Pop up article history."
X  (interactive)
X  (save-window-excursion
X    (set-buffer gnus-Subject-buffer)
X    (gnus-Subject-refer-article nil)))
X
X(defun gnus-Article-show-subjects ()
X  "Reconfigure windows to show headers."
X  (interactive)
X  (gnus-configure-windows 'SelectArticle)
X  (pop-to-buffer gnus-Subject-buffer)
X  (gnus-Subject-goto-subject gnus-current-article))
X
X(defun gnus-Article-describe-briefly ()
X  "Describe Article mode commands briefly."
X  (interactive)
X  (message
X   (concat
X    (substitute-command-keys "\\[gnus-Article-next-page]:Next page  ")
X    (substitute-command-keys "\\[gnus-Article-prev-page]:Prev page  ")
X    (substitute-command-keys "\\[gnus-Article-show-subjects]:Show headers  ")
X    (substitute-command-keys "\\[gnus-Info-find-node]:Run Info  ")
X    (substitute-command-keys "\\[gnus-Article-describe-briefly]:This help")
X    )))
X
X
X;;;
X;;; GNUS KILL-File Mode
X;;;
X
X(if gnus-Kill-file-mode-map
X    nil
X  (setq gnus-Kill-file-mode-map (copy-keymap emacs-lisp-mode-map))
X  (define-key gnus-Kill-file-mode-map "\C-c\C-k\C-s" 'gnus-Kill-file-kill-by-subject)
X  (define-key gnus-Kill-file-mode-map "\C-c\C-k\C-a" 'gnus-Kill-file-kill-by-author)
X  (define-key gnus-Kill-file-mode-map "\C-c\C-a" 'gnus-Kill-file-apply-buffer)
X  (define-key gnus-Kill-file-mode-map "\C-c\C-e" 'gnus-Kill-file-apply-last-sexp)
X  (define-key gnus-Kill-file-mode-map "\C-c\C-c" 'gnus-Kill-file-exit)
X  (define-key gnus-Kill-file-mode-map "\C-c\C-i" 'gnus-Info-find-node))
X
X(defun gnus-Kill-file-mode ()
X  "Major mode for editing KILL file.
X
XIn addition to Emacs-Lisp Mode, the following commands are available:
X
X\\[gnus-Kill-file-kill-by-subject]	Insert KILL command for current subject.
X\\[gnus-Kill-file-kill-by-author]	Insert KILL command for current author.
X\\[gnus-Kill-file-apply-buffer]	Apply current buffer to selected newsgroup.
X\\[gnus-Kill-file-apply-last-sexp]	Apply sexp before point to selected newsgroup.
X\\[gnus-Kill-file-exit]	Save file and exit editing KILL file.
X\\[gnus-Info-find-node]	Read Info about KILL file.
X
X  A KILL file contains lisp expressions to be applied to a selected
Xnewsgroup. The purpose is to mark articles as read on the basis of
Xsome set of regexps. A global KILL file is applied to every newsgroup,
Xand a local KILL file is applied to a specified newsgroup. Since a
Xglobal KILL file is applied to every newsgroup, for better performance
Xuse a local one.
X
X  A KILL file can contain any kind of Emacs lisp expressions expected
Xto be evaluated in the Subject buffer. Writing lisp programs for this
Xpurpose is not so easy because the internal working of GNUS must be
Xwell-known. For this reason, GNUS provides a general function which
Xdoes this easily for non-Lisp programmers.
X
X  The `gnus-kill' function executes commands available in Subject Mode
Xby their key sequences. `gnus-kill' should be called with FIELD,
XREGEXP and optional COMMAND and ALL. FIELD is a string representing
Xthe header field or an empty string. If FIELD is an empty string, the
Xentire article body is searched for. REGEXP is a string which is
Xcompared with FIELD value. COMMAND is a string representing a valid
Xkey sequence in Subject Mode or Lisp expression. COMMAND is default to
X'(gnus-Subject-mark-as-read nil \"X\"). Make sure that COMMAND is
Xexecuted in the Subject buffer.  If the second optional argument ALL
Xis non-nil, the COMMAND is applied to articles which are already
Xmarked as read or unread.  Articles which are marked are skipped over
Xby default.
X
X  For example, if you want to mark articles of which subjects contain
Xthe string `AI' as read, a possible KILL file may look like:
X
X	(gnus-kill \"Subject\" \"AI\")
X
X  If you want to mark articles with `D' instead of `X', you can use
Xthe following expression:
X
X	(gnus-kill \"Subject\" \"AI\" \"d\")
X
XIn this example it is assumed that the command
X`gnus-Subject-mark-as-read-forward' is assigned to `d' in Subject Mode.
X
X  It is possible to delete unnecessary headers which are marked with
X`X' in a KILL file as follows:
X
X	(gnus-expunge \"X\")
X
X  If the Subject buffer is empty after applying KILL files, GNUS will
Xexit the selected newsgroup normally.  If headers which are marked
Xwith `D' are deleted in a KILL file, it is impossible to read articles
Xwhich are marked as read in the previous GNUS sessions.  Marks other
Xthan `D' should be used for articles which should really be deleted.
X
XEntry to this mode calls emacs-lisp-mode-hook and
Xgnus-Kill-file-mode-hook with no arguments, if that value is non-nil."
X  (interactive)
X  (kill-all-local-variables)
X  (use-local-map gnus-Kill-file-mode-map)
X  (set-syntax-table emacs-lisp-mode-syntax-table)
X  (setq major-mode 'gnus-Kill-file-mode)
X  (setq mode-name "KILL-File")
X  (lisp-mode-variables nil)
X  (run-hooks 'emacs-lisp-mode-hook 'gnus-Kill-file-mode-hook))
X
X(defun gnus-Kill-file-edit-file (newsgroup)
X  "Begin editing a KILL file of NEWSGROUP.
XIf NEWSGROUP is nil, the global KILL file is selected."
X  (interactive "sNewsgroup: ")
X  (let ((file (gnus-newsgroup-kill-file newsgroup)))
X    (gnus-make-directory (file-name-directory file))
X    ;; Save current window configuration if this is first invocation.
X    (or (and (get-file-buffer file)
X	     (get-buffer-window (get-file-buffer file)))
X	(setq gnus-winconf-kill-file (current-window-configuration)))
X    ;; Hack windows.
X    (let ((buffer (find-file-noselect file)))
X      (cond ((get-buffer-window buffer)
SHAR_EOF
echo "End of part 4, continue with part 5"
echo "5" > s2_seq_.tmp
exit 0
--
Masanobu UMEDA
umerin@tc.Nagasaki.GO.JP
