Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ames!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!kddlab!titcca!fgw!flab!umerin
From: umerin@flab.flab.fujitsu.JUNET (Masanobu UMEDA)
Newsgroups: comp.emacs,fj.editor.emacs
Subject: GNUS 3.8: a NNTP-base news reader for GNU Emacs (1 of 4)
Message-ID: <4126@flab.flab.fujitsu.JUNET>
Date: 19 Sep 88 03:16:04 GMT
Reply-To: umerin@flab.flab.fujitsu.JUNET (Masanobu UMEDA)
Organization: Fujitsu Laboratories Ltd., Kawasaki, Japan
Lines: 1305

This is a new release of GNUS, a NNTP-base network news reader for GNU
Emacs. Bug fixes reported and recommended extensions are almost
included in this release.

New features of GNUS 3.8 are:

(1) KILL file (like rn)
(2) ROT13/47 (47 is for Japanese)
(3) Sorting of subject buffer
(4) Selecting same subject (like rn -S)
(5) Real marking as unread
(6) Page breaking
(7) Hierarchical directory of ~/News/*
(8) Saving article in MH format
(9) Many hooks (useful examples are documented)

Please unpack 4 shell archives, and then byte-compile-file nntp.el,
nnspool.el, and gnus.el in *THIS* order. Read gnus.el for more
information about installation.

Anyway, mailing list for GNUS lover is started. The list is intended
to exchange valuable information about GNUS, such as bugs information,
useful hooks, and extensions of GNUS. English and Japanese are
official language of the list. If you are interested in it and don't
worry about Japanese (or English :-), send request to

	info-gnus-request%flab.Fujitsu.JUNET@uunet.UU.NET

Send contributions to the list to

	info-gnus%flab.Fujitsu.JUNET@uunet.UU.NET

Masanobu UMEDA
umerin%flab.flab.Fujitsu.JUNET@uunet.uu.NET
---- Cut Here and unpack ----
#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  gnus.el
#	  nnspool.el
#	  nntp.el
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
sed 's/^X//' << 'SHAR_EOF' > gnus.el &&
X;;; GNUS: NNTP-based News Reader for GNU Emacs
X;; Copyright (C) 1987, 1988 Fujitsu Laboratoris LTD.
X;; Copyright (C) 1987, 1988 Masanobu UMEDA (umerin@flab.flab.Fujitsu.JUNET)
X;; $Header: gnus.el,v 3.8 88/09/19 11:04:30 umerin Exp $
X
X;; This file is part of GNU Emacs.
X
X;; GNU Emacs is distributed in the hope that it will be useful,
X;; but WITHOUT ANY WARRANTY.  No author or distributor
X;; accepts responsibility to anyone for the consequences of using it
X;; or for whether it serves any particular purpose or works at all,
X;; unless he says so in writing.  Refer to the GNU Emacs General Public
X;; License for full details.
X
X;; Everyone is granted permission to copy, modify and redistribute
X;; GNU Emacs, but only under the conditions described in the
X;; GNU Emacs General Public License.   A copy of this license is
X;; supposed to have been given to you along with GNU Emacs so you
X;; can know your rights and responsibilities.  It should be in a
X;; file named COPYING.  Among other things, the copyright notice
X;; and this notice must be preserved on all copies.
X
X;; How to Install GNUS:
X;; (1) Unshar gnus.el, nntp.el, and nnspool.el.
X;; (2) byte-compile-file nntp.el, nnspool.el, and gnus.el in THIS ORDER.
X;; (3) Define three environment variables in .login file as follows:
X;;
X;;     setenv	NNTPSERVER	flab
X;;     setenv	DOMAINNAME	"stars.flab.Fujitsu.JUNET"
X;;     setenv	ORGANIZATION	"Fujitsu Laboratories Ltd., Kawasaki, Japan."
X;;
X;;     Or instead define lisp variables in your .emacs, site-init.el,
X;;     or default.el as follows:
X;;
X;;     (setq gnus-server-host "flab")
X;;     (setq gnus-your-domain "stars.flab.Fujitsu.JUNET")
X;;     (setq gnus-your-organization "Fujitsu Laboratories Ltd., ...")
X;;
X;;     If lisp function (system-name) returns full internet name, you
X;;     don't have to define domain name.
X;;
X;; (4) If you'd like to use GENERICFROM feature like Bnews, define
X;;     lisp variable as follows:
X;;
X;;     (setq gnus-use-generic-from t)
X;;
X;; (5) Define autoload entries in .emacs file as follows:
X;;
X;;     (autoload 'gnus "gnus" "Read network news." t)
X;;     (autoload 'gnus-post-news "gnus"	"Post a news." t)
X;;
X;; (6) Read nntp.el if you have any trouble with NNTP or Kanji handling.
X
X;; GNUS Mailing List:
X;; There is a mailing list for GNUS lovers, which is intended to
X;; exchange valuable information about GNUS, such as bugs information,
X;; useful hooks, and extensions of GNUS. English and Japanese are
X;; official language of the list. If you are interested in it and
X;; don't worry about Japanese (or English :-), send request to the
X;; following:
X;;
X;; 	info-gnus-request@flab.Fujitsu.JUNET, or
X;; 	info-gnus-request%flab.Fujitsu.JUNET@uunet.UU.NET
X;;
X;; Send contributions to the list to:
X;;
X;; 	info-gnus@flab.Fujitsu.JUNET, or
X;; 	info-gnus%flab.Fujitsu.JUNET@uunet.UU.NET
X
X;; TO DO:
X;; (1) Stop using replace-regexp in format conversion because it is
X;;     too slow.
X;; (2) Incremental update of active info.
X;; (3) GNUS own poster and programmable interface to various mailers.
X;; (4) Multi-GNUS (Talking to many hosts same time).
X
X(provide 'gnus)
X(require 'nntp)
X(require 'mail-utils)
X;; Function `news-inews' overrides the function defined in
X;;  `rnewspost.el'. So, rnewspost.el must be loaded before it is
X;;  defined.
X(if (not (fboundp 'news-inews))
X    (load-library "rnewspost"))
X
X(defvar gnus-server-host (getenv "NNTPSERVER")
X  "*Host the NNTP server is running.
XInitialized from the NNTPSERVER environment variable.")
X
X(defvar gnus-startup-file "~/.newsrc"
X  "*Your .newsrc file. Use `.newsrc-HOST' instead if it exists.")
X
X(defvar gnus-subject-lines-height 4
X  "*Number of subject lines displayed at once.
XIf you'd like to set the height of subject window according to that of
XEmacs window, set the value in gnus-Subject-mode-hook as follows:
X
X(setq gnus-Subject-mode-hook
X      '(lambda ()
X	 (setq gnus-subject-lines-height (/ (window-height) 5))))")
X
X(defvar gnus-author-copy-file (getenv "AUTHORCOPY")
X  "*File name saving copy of posted article in Unix mail format.
XInitialized from the AUTHORCOPY environment variable.
X
XIf the first character of the name is `|', the article is piped out to
Xthe named program. It is possible to save an article in MH folder by
Xthe following:
X
X(setq gnus-author-copy-file \"|/usr/local/lib/mh/rcvstore +Article\")")
X
X(defvar gnus-use-long-file-name t
X  "*Do not use hierarchical file name (directory form of newsgroup),
Xbut use newsgroup name itself for the name of an article to be saved
Xor local KILL file if non-nil.")
X
X(defvar gnus-article-default-saver (function gnus-Subject-save-in-mail)
X  "*Function saving an article in your favorite format.
XThe function must be interactively callable (in other words, it must
Xbe a emacs command).
X
XGNUS provides following three functions:
X	gnus-Subject-save-in-mail (in Unix mail format)
X	gnus-Subject-save-in-folder (in MH folder)
X	gnus-Subject-save-in-file (in plain file).")
X
X(defvar gnus-article-save-directory (getenv "SAVEDIR")
X  "*Directory name to save an article to (default to ~/News).
XInitialized from the SAVEDIR environment variable.")
X
X(defvar gnus-article-mh-folder "+News"
X  "*MH folder name saving an article in by \\[gnus-Subject-save-in-folder].")
X
X(defvar gnus-enable-kill-file nil
X  "*Enable KILL file if non-nil.
XKILL file is initially disabled since it makes GNUS slower. It can be
Xenabled temporary by editing the KILL file.")
X
X(defvar gnus-kill-file-name "KILL"
X  "*File name of a KILL file.")
X
X(defvar gnus-default-distribution "local"
X  "*Use the value as distribution if no distribution is specified.")
X
X(defvar gnus-novice-user t
X  "*A little bit verbose in posting mode if non-nil.
XAsk newsgroup name, subject, and distribution.")
X
X(defvar gnus-user-full-name (or (getenv "NAME") (user-full-name))
X  "*The full name of the user.
XInitialized from the NAME environment variable if defined.")
X
X(defvar gnus-auto-select-next t
X  "*Select next newsgroup automagically if non-nil.
XIf the value is not nil nor t, GNUS won't exit subject display mode
Xeven if next newsgroup is empty.")
X
X(defvar gnus-auto-select-same nil
X  "*Select next article with same subject automagically if non-nil.")
X
X(defvar gnus-break-pages nil
X  "*Break pages of news article if non-nil.
XPage delimiter is specified by variable `gnus-page-delimiter'.
XExperimental feature. Drop me your comments.")
X
X(defvar gnus-page-delimiter "^\^L"
X  "*Regexp describing line-beginnings that separate pages of news article.")
X
X(defvar gnus-force-nntp nil
X  "*Use NNTP even if local news spool is available if non-nil.")
X
X(defvar gnus-digest-temp-directory "/usr/tmp"
X  "*Directory name placing RMAIL digest message.")
X
X(defvar gnus-Group-mode-hook nil
X  "*Hooks for GNUS Group mode.")
X
X(defvar gnus-Subject-mode-hook nil
X  "*Hooks for GNUS Subject mode.")
X
X(defvar gnus-Article-mode-hook nil
X  "*Hooks for GNUS Article mode.")
X
X(defvar gnus-Kill-file-mode-hook nil
X  "*Hooks for GNUS Kill file mode.")
X
X(defvar gnus-Save-newsrc-hook nil
X  "*Hooks for saving the newsrc file.
XThis hook is called before writing to .newsrc file.")
X
X(defvar gnus-Subject-prepare-hook nil
X  "*Hooks called after subject list is created.
XIf you'd like to modify the buffer, you can use this.")
X
X(defvar gnus-Article-prepare-hook nil
X  "*Hooks called after an article is prepared for reading.")
X
X(defvar gnus-Select-group-hook nil
X  "*Hooks called when a newsgroup is selected.
XIf you'd like to sort subjects by posted date, you can use the
Xfollowing hook:
X
X(setq gnus-Select-group-hook
X      '(lambda ()
X	 (setq gnus-current-group-headers
X	       (sort gnus-current-group-headers
X		     '(lambda (a b)
X			(gnus-date-lessp (nntp-header-date a)
X					 (nntp-header-date b)))))))
X
XIf you'd like to simplify subjects like the
X`gnus-Subject-next-same-subject' command does, you can use the
Xfollowing hook:
X
X(setq gnus-Select-group-hook
X      '(lambda ()
X	 (mapcar (function
X		  (lambda (header)
X		    (nntp-set-header-subject
X		     header
X		     (gnus-simplify-subject (nntp-header-subject header)))))
X		 gnus-current-group-headers)))")
X
X(defvar gnus-Select-article-hook nil
X  "*Hooks called when an article is selected.
XIf you don't like to be marked as read automagically, you can use the 
Xfollowing hook:
X
X(setq gnus-Select-article-hook
X      '(lambda ()
X	 (gnus-Subject-mark-as-unread)))
X
XIf you'd like to run RMAIL on a digest message automagically, you can
Xuse the following hook:
X
X(setq gnus-Select-article-hook
X      '(lambda ()
X	 (if (string-match \"Digest\"
X			   (nntp-header-subject
X			    (nntp-find-header-by-number
X			     gnus-current-group-headers gnus-current-article)))
X	     (gnus-Subject-rmail-digest))))")
X
X(defvar gnus-Exit-gnus-hook nil
X  "*Hooks called when exiting gnus.")
X
X;; Site dependent variables. You have to define these variables in
X;;  site-init.el, default.el or your .emacs.
X
X(defvar gnus-your-domain "stars.flab.Fujitsu.JUNET"
X  "*Your domain name without your host name.
XIf environment variable `DOMAINNAME' is defined, it's instead used.
XIf lisp function (system-name) returns full internet name, there is no
Xneed to define the name.")
X
X(defvar gnus-your-organization "Fujitsu Laboratories Ltd., Kawasaki, Japan."
X  "*Your organization.
XIf environment variable `ORGANIZATION' is defined, it's instead used.")
X
X(defvar gnus-use-generic-from nil
X  "*Don't insert local host name to From: field if non-nil.")
X
X;; Internal variables.
X
X(defvar gnus-ignored-headers
X  "^Path:\\|^Posting-Version:\\|^Article-I.D.:\\|^Expires:\\|^Date-Received:\\|^References:\\|^Control:\\|^Xref:\\|^Lines:\\|^Posted:\\|^Relay-Version:\\|^Message-ID:\\|^Nf-ID:\\|^Nf-From:\\|^Approved:\\|^Sender:"
X  "All random fields within the header of a message.")
X
X(defvar gnus-newsrc-options nil
X  "Options line in .newsrc file.")
X
X(defvar gnus-newsrc-assoc nil
X  "Assoc list of read articles.")
X
X(defvar gnus-marked-assoc nil
X  "Assoc list of articles marked as unread.")
X
X(defvar gnus-unread-hashtb nil
X  "Hashtable of unread articles.")
X
X(defvar gnus-active-hashtb nil
X  "Hashtable of active articles.")
X
X(defvar gnus-octive-hashtb nil
X  "Hashtable of OLD active articles.")
X
X(defvar gnus-Group-buffer "*Newsgroup*")
X(defvar gnus-Subject-buffer "*Subject*")
X(defvar gnus-Article-buffer "*Article*")
X
X(defvar gnus-current-startup-file nil)
X(defvar gnus-current-group-name nil)
X
X(defvar gnus-current-group-unreads nil
X  "List of unread articles in current newsgroup.")
X
X(defvar gnus-current-group-marked nil
X  "List of marked articles in current newsgroup.")
X
X(defvar gnus-current-group-headers nil
X  "List of article headers in current newsgroup.")
X
X(defvar gnus-current-article nil)
X(defvar gnus-previous-article nil)
X(defvar gnus-have-all-headers nil)
X
X(defvar gnus-Group-mode-map nil)
X(defvar gnus-Subject-mode-map nil)
X(defvar gnus-Article-mode-map nil)
X(defvar gnus-Kill-file-mode-map nil)
X
X(defvar rmail-last-file (expand-file-name "~/XMBOX"))
X(defvar rmail-last-rmail-file (expand-file-name "~/XNEWS"))
X
X(autoload 'rmail-output "rmailout"
X	  "Append this message to Unix mail file named FILE-NAME." t)
X(autoload 'mh-prompt-for-folder "mh-e")
X
X(put 'gnus-Group-mode 'mode-class 'special)
X(put 'gnus-Subject-mode 'mode-class 'special)
X(put 'gnus-Article-mode 'mode-class 'special)
X
X;;(put 'eval-in-buffer-window 'lisp-indent-hook 1)
X
X(defmacro eval-in-buffer-window (buffer &rest forms)
X  "Pop to BUFFER, evaluate FORMS, and then returns to original window."
X  (` (let ((StartBufferWindow (selected-window)))
X       (unwind-protect
X	   (progn
X	     (pop-to-buffer (, buffer))
X	     (,@ forms))
X	 (select-window StartBufferWindow)))))
X
X(defmacro gnus-make-hashtable ()
X  '(make-abbrev-table))
X
X(defmacro gnus-gethash (string hashtable)
X  "Get hash value of STRING in HASHTABLE."
X  ;;(` (symbol-value (abbrev-symbol (, string) (, hashtable))))
X  (` (abbrev-expansion (, string) (, hashtable))))
X
X(defmacro gnus-sethash (string value hashtable)
X  "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
X  ;; We cannot use define-abbrev since it only accepts string as value.
X  (` (set (intern (, string) (, hashtable)) (, value))))
X
X
X;;;
X;;; GNUS Group display mode
X;;;
X
X(if gnus-Group-mode-map
X    nil
X  (setq gnus-Group-mode-map (make-keymap))
X  (suppress-keymap gnus-Group-mode-map)
X  (define-key gnus-Group-mode-map " " 'gnus-Group-select-group)
X  (define-key gnus-Group-mode-map "=" 'gnus-Group-select-group-no-article)
X  (define-key gnus-Group-mode-map "j" 'gnus-Group-jump-to-group)
X  (define-key gnus-Group-mode-map "n" 'gnus-Group-next-unread-group)
X  (define-key gnus-Group-mode-map "p" 'gnus-Group-prev-unread-group)
X  (define-key gnus-Group-mode-map "\177" 'gnus-Group-prev-unread-group)
X  (define-key gnus-Group-mode-map "N" 'gnus-Group-next-group)
X  (define-key gnus-Group-mode-map "P" 'gnus-Group-prev-group)
X  (define-key gnus-Group-mode-map "\C-n" 'gnus-Group-next-group)
X  (define-key gnus-Group-mode-map "\C-p" 'gnus-Group-prev-group)
X  (define-key gnus-Group-mode-map "/" 'isearch-forward)
X  (define-key gnus-Group-mode-map "<" 'beginning-of-buffer)
X  (define-key gnus-Group-mode-map ">" 'end-of-buffer)
X  (define-key gnus-Group-mode-map "u" 'gnus-Group-unsubscribe-current-group)
X  (define-key gnus-Group-mode-map "U" 'gnus-Group-unsubscribe-group)
X  (define-key gnus-Group-mode-map "c" 'gnus-Group-catch-up)
X  (define-key gnus-Group-mode-map "l" 'gnus-Group-list-groups)
X  (define-key gnus-Group-mode-map "L" 'gnus-Group-list-all-groups)
X  (define-key gnus-Group-mode-map "g" 'gnus-Group-get-new-news)
X  (define-key gnus-Group-mode-map "b" 'gnus-Group-check-bogus-groups)
X  (define-key gnus-Group-mode-map "a" 'gnus-Group-post-news)
X  (define-key gnus-Group-mode-map "K" 'gnus-Kill-file-edit-global)
X  (define-key gnus-Group-mode-map "?" 'describe-mode)
X  (define-key gnus-Group-mode-map "x" 'gnus-Group-force-update)
X  (define-key gnus-Group-mode-map "s" 'gnus-Group-force-update)
X  (define-key gnus-Group-mode-map "q" 'gnus-Group-exit)
X  (define-key gnus-Group-mode-map "Q" 'gnus-Group-quit))
X
X(defun gnus-Group-mode ()
X  "Major mode for reading news using NNTP server.
XAll normal editing commands are turned off.
XInstead, these commands are available:
X
X\\[gnus-Group-select-group]	Select this newsgroup.
X\\[gnus-Group-select-group-no-article]	List subjects in this newsgroup.
X\\[gnus-Group-jump-to-group]	Move to specified newsgroup.
X\\[gnus-Group-next-unread-group]	Move to Next unread newsgroup.
X\\[gnus-Group-prev-unread-group]	Move to Previous unread newsgroup.
X\\[gnus-Group-next-group]	Move to Next newsgroup.
X\\[gnus-Group-prev-group]	Move to Previous newsgroup.
X\\[isearch-forward]	Do incremental search forward.
X\\[beginning-of-buffer]	Move point to beginning of this buffer.
X\\[end-of-buffer]	Move point to end of this buffer.
X\\[gnus-Group-unsubscribe-current-group]	Toggle this newsgroup unsubscribe from/to subscribe.
X\\[gnus-Group-unsubscribe-group]	Toggle newsgroup unsubscribe from/to subscribe.
X\\[gnus-Group-catch-up]	Mark all articles in this newsgroup as read.
X\\[gnus-Group-list-groups]	Revert this buffer.
X\\[gnus-Group-list-all-groups]	List all of newsgroups.
X\\[gnus-Group-get-new-news]	Get new news.
X\\[gnus-Group-check-bogus-groups]	Check bogus newsgroups.
X\\[gnus-Group-post-news]	Post an article to JUNET (USENET).
X\\[gnus-Kill-file-edit-global]	Edit global KILL file.
X\\[describe-mode]	Describe this mode.
X\\[gnus-Group-force-update]	Save .newsrc file.
X\\[gnus-Group-exit]	Quit reading news.
X\\[gnus-Group-quit]	Quit reading news without saving .newsrc file.
X
XName of the host NNTP server is running is asked if no default host is
Xdefined. It is also possible to choose some other host even when
Xdefault host is defined by giving an argument to command `\\[gnus]'.
X
XIf there exists a file named `~/.newsrc-HOST', it is used as startup
Xfile instead of standard one when talking to a NNTP server on HOST.
XIt is possible to talk to hosts more than one by using different
Xstartup files for each.
X
XIf there exists a file named `~/.signature-DISTRIBUTION', it is used
Xas signature file instead of standard one when posting a news in
XDISTRIBUTION.
X
XUser customizable variables:
X gnus-server-host
X    Specifies host name NNTP server is running. The variable is
X    initialized from the NNTPSERVER environment variable.
X
X gnus-author-copy-file
X    An article posted by GNUS will be saved to a file specified by its
X    value.  If the first character of the value is `|', contents of
X    the article will be piped out to a program specified by the rest
X    of the value. The variable is initialized from the AUTHORCOPY
X    environment variable.
X
X gnus-enable-kill-file
X    Non-nil means KILL file is enabled. KILL file is initially
X    disabled since it makes GNUS slower. Editing a KILL file will
X    enables it temporary during current GNUS session.
X
X gnus-kill-file-name
X    Use specified file name as KILL file (default to `KILL').
X
X gnus-novice-user
X    Non-nil means newsgroup, subject and distribution are asked
X    interactively when posting a new news. It is recommended to set it
X    to non-nil, if you are novice to network news.
X
X gnus-force-nntp
X    Non-nil lets GNUS use NNTP even if local news spool is available.
X    If local host has a news spool, GNUS won't use NNTP but go to the
X    spool directly using `nnspool' library if that value is nil.
X
XVarious hooks for customization:
X gnus-Group-mode-hook
X    Entry to this mode calls the value with no arguments, if that
X    value is non-nil. This hook is called before connecting to NNTP
X    server. So, you can change or define NNTP server host in it.
X
X gnus-Save-newsrc-hook
X    Called with no arguments when saving newsrc file if that value is
X    non-nil.
X
X gnus-Exit-gnus-hook
X    Called with no arguments when exiting GNUS, if that value is
X    non-nil."
X  (interactive)
X  (kill-all-local-variables)
X  (setq major-mode 'gnus-Group-mode)
X  (setq mode-name "GNUS Newsgroup")
X  (setq mode-line-buffer-identification	"GNUS: List of Newsgroups")
X  (setq mode-line-process nil)
X  (use-local-map gnus-Group-mode-map)
X  (setq buffer-read-only t)		;Disable modification
X  (run-hooks 'gnus-Group-mode-hook))
X
X(defun gnus (&optional confirm)
X  "Read network news.
XIf optional argument CONFIRM is non-nil, ask host NNTP server is running."
X  (interactive "P")
X  (unwind-protect
X      (progn
X	(switch-to-buffer (get-buffer-create gnus-Group-buffer))
X	(gnus-Group-mode)
X	(gnus-start-news-server confirm))
X    (if (not (nntp-server-opened))
X	(gnus-Group-quit)
X      ;; NNTP server is successfully open. 
X      (setq mode-line-process (format " [%s]" gnus-server-host))
X      (let ((buffer-read-only nil))
X	(erase-buffer)
X	(gnus-Group-startup-message)
X	(sit-for 0)
X	(gnus-setup-news-info))
X      (gnus-Group-list-groups nil))
X    ))
X
X(defun gnus-Group-startup-message ()
X  (insert "\n\n\n\n
X			   GNUS Version 3.8
X
X		 NNTP-based News Reader for GNU Emacs
X
X
X	If you have any trouble with this software, please let me
X	know. I will fix your problems in the next release.
X
X	Comments, suggestions, and bug fixes are welcome.
X
X	Masanobu UMEDA
X	umerin@flab.Fujitsu.JUNET
X	umerin%flab.Fujitsu.JUNET@uunet.UU.NET"))
X
X(defun gnus-Group-list-groups (show-all)
X  "List newsgroups in group selection buffer.
XIf argument SHOW-ALL is non-nil, unsubscribed groups are also listed."
X  (interactive "P")
X  (gnus-Group-prepare show-all)
X  (if (zerop (buffer-size))
X      (message "No news is good news.")
X    ;; Adjust cursor point.
X    (goto-char (point-min))
X    (search-forward ":" nil t)
X    ))
X
X(defun gnus-Group-prepare (&optional all)
X  "Prepare list of newsgroups in current buffer.
XIf optional argument ALL is non-nil, unsubscribed groups are also listed."
X  (let ((buffer-read-only nil)
X	(newsrc gnus-newsrc-assoc)
X	(group-info nil)
X	(group-name nil)
X	(unread-count 0)
X	;; This specifies format of Group display buffer.
X	(cntl "%s%s%5d: %s\n"))
X    (erase-buffer)
X    ;; List newsgroups.
X    (while newsrc
X      (setq group-info (car newsrc))
X      (setq group-name (car group-info))
X      (setq unread-count (nth 1 (gnus-gethash group-name gnus-unread-hashtb)))
X      (if (or all
X	      (and (nth 1 group-info)	;Subscribed.
X		   (> unread-count 0)))	;There are unread articles.
X	  (insert
X	   (format cntl
X		   ;; Subscribed or not.
X		   (if (nth 1 group-info) " " "U")
X		   ;; Exists new news?
X		   (if (and (> unread-count 0)
X			    (>= 0
X				(- unread-count
X				   (length
X				    (cdr (assoc group-name
X						gnus-marked-assoc))))))
X		       "*" " ")
X		   ;; Number of unread articles.
X		   unread-count
X		   ;; Newsgroup name.
X		   group-name))
X	)
X      (setq newsrc (cdr newsrc))
X      )))
X
X(defun gnus-Group-update-group (group &optional visible-only)
X  "Update newsgroup info of GROUP.
XIf optional argument VISIBLE-ONLY is non-nil, non displayed group is ignored."
X  ;; At first update .newsrc buffer
X  (gnus-update-newsrc-buffer group)
X  ;; Then update group display buffer.
X  (let ((buffer-read-only nil)
X	(modified nil)
X	(visible nil)
X	(unread-count 0)
X	;; This specifies format of Group display buffer.
X	(cntl "%s%s%5d: %s\n"))
X    (save-excursion
X      (set-buffer (get-buffer gnus-Group-buffer))
X      ;; Search point to modify.
X      (goto-char (point-min))
X      (if (re-search-forward (concat "^.+: " (regexp-quote group) "$") nil t)
X	  ;; GROUP is listed in current buffer.
X	  (progn
X	    (setq visible t)
X	    (beginning-of-line)
X	    (kill-line 1)		;Delete old line.
X	    ))
X      (if (or visible (not visible-only))
X	  (progn
X	    (setq modified (point))
X	    (setq unread-count (nth 1 (gnus-gethash group gnus-unread-hashtb)))
X	    (insert
X	     (format cntl
X		     ;; Subscribed or not.
X		     (if (nth 1 (assoc group gnus-newsrc-assoc)) " " "U")
X		     ;; Exists new news?
X		     (if (and (> unread-count 0)
X			      (>= 0
X				  (- unread-count
X				     (length
X				      (cdr (assoc group gnus-marked-assoc))))))
X			 "*" " ")
X		     ;; Number of unread articles.
X		     (nth 1 (gnus-gethash group gnus-unread-hashtb))
X		     ;; Newsgroup name.
X		     group))
X	    ))
X      )
X    ;; Move point of group display buffer to GROUP.
X    (if (not visible-only)
X	(let ((buffer (current-buffer)))
X	  (set-buffer (get-buffer gnus-Group-buffer))
X	  (goto-char modified)
X	  (set-buffer buffer)))
X    ))
X
X;; GNUS Group mode command
X
X(defun gnus-Group-group-name ()
X  "Get newsgroup name around point."
X  (save-excursion
X    (beginning-of-line)
X    (if (re-search-forward "^.[* \t]*[0-9]+:[ \t]+\\([^ \t\n]+\\)$" nil t)
X	(buffer-substring (match-beginning 1)
X			  (match-end 1))
X      )))
X
X(defun gnus-Group-select-group (all &optional no-article)
X  "Select newsgroup to read at current line.
XIf argument ALL is non-nil, already read articles become readable.
XIf optional argument NO-ARTICLE is non-nil, no article body is displayed."
X  (interactive "P")
X  (let ((group (gnus-Group-group-name))) ;Newsgroup name to read.
X    (if group
X	(gnus-Subject-read-group
X	 group
X	 (or all
X	     ;;(not (nth 1 (assoc group gnus-newsrc-assoc)))	;Unsubscribed
X	     (zerop
X	      (nth 1 (gnus-gethash group gnus-unread-hashtb))))	;No unread
X	 no-article
X	 ))
X    ))
X
X(defun gnus-Group-select-group-no-article (all)
X  "Select newsgroup to read at current line.
XNo article is selected automatically.
XIf argument ALL is non-nil, already read articles become readable."
X  (interactive "P")
X  (gnus-Group-select-group all t))
X
X(defun gnus-Group-jump-to-group (group)
X  "Jump to newsgroup GROUP."
X  (interactive
X   (list (completing-read "Newsgroup: " gnus-newsrc-assoc nil 'require-match)))
X  (if (assoc group gnus-newsrc-assoc)
X      (progn
X	(goto-char (point-min))
X	(or (re-search-forward (concat "^.+: " (regexp-quote group) "$") nil t)
X	    ;; Add GROUP entry, then seach again.
X	    (gnus-Group-update-group group))
X	;; Adjust cursor point.
X	(beginning-of-line)
X	(search-forward ":" nil t))
X    ))
X
X(defun gnus-Group-search-forward (backward any-group)
X  "Search for newsgroup forward.
XIf 1st argument BACKWARD is non-nil, search backward instead.
XIf 2nd argument ANY-GROUP is non-nil, unsubscribed or empty group
Xmay be selected."
X  (let ((func (if backward 're-search-backward 're-search-forward))
X	(regexp 
X	 (format "^%s[ \t]*\\(%s\\):"
X		 (if any-group ".." " [ \t]")
X		 (if any-group "[0-9]+" "[1-9][0-9]*")))
X	(found nil))
X    (if backward
X	(beginning-of-line)
X      (end-of-line))
X    (if (funcall func regexp nil t)
X	(setq found t))
X    ;; Adjust cursor point.
X    (beginning-of-line)
X    (search-forward ":" nil t)
X    ;; Return T if found.
X    found
X    ))
X
X(defun gnus-Group-next-group (n)
X  "Go to next N'th newsgroup."
X  (interactive "p")
X  (while (and (> n 1)
X	      (gnus-Group-search-forward nil t))
X    (setq n (1- n)))
X  (or (gnus-Group-search-forward nil t)
X      (message "No more newsgroup.")))
X
X(defun gnus-Group-next-unread-group (n)
X  "Go to next N'th unread newsgroup."
X  (interactive "p")
X  (while (and (> n 1)
X	      (gnus-Group-search-forward nil nil))
X    (setq n (1- n)))
X  (or (gnus-Group-search-forward nil nil)
X      (message "No more unread newsgroup.")))
X
X(defun gnus-Group-prev-group (n)
X  "Go to previous N'th newsgroup."
X  (interactive "p")
X  (while (and (> n 1)
X	      (gnus-Group-search-forward t t))
X    (setq n (1- n)))
X  (or (gnus-Group-search-forward t t)
X      (message "No more newsgroup.")))
X
X(defun gnus-Group-prev-unread-group (n)
X  "Go to previous N'th unread newsgroup."
X  (interactive "p")
X  (while (and (> n 1)
X	      (gnus-Group-search-forward t nil))	      
X    (setq n (1- n)))
X  (or (gnus-Group-search-forward t nil)
X      (message "No more unread newsgroup.")))
X
X(defun gnus-Group-catch-up (no-confirm)
X  "Mark all articles in this newsgroup as read.
XIf argument NO-CONFIRM is non-nil, do without confirmations.
XCross references (Xref: field) of articles are ignored."
X  (interactive "P")
X  (let ((group (gnus-Group-group-name)))
X    (if (and group
X	     (or no-confirm
X		 (y-or-n-p "Do you really want to mark everything as read? ")))
X	(progn
X	  (gnus-update-unread-articles group nil nil)
X	  (gnus-Group-update-group group)
X	  (gnus-Group-next-group 1))
X      )))
X
X(defun gnus-Group-unsubscribe-current-group ()
X  "Toggle subscribe from/to unsubscribe this group."
X  (interactive)
X  (gnus-Group-unsubscribe-group (gnus-Group-group-name)))
X
X(defun gnus-Group-unsubscribe-group (group)
X  "Toggle subscribe from/to unsubscribe GROUP."
X  (interactive
X   (list (completing-read "Newsgroup: " gnus-newsrc-assoc nil 'require-match)))
X  (let ((newsrc (assoc group gnus-newsrc-assoc)))
X    (if newsrc
X	(progn
X	  (setcar (nthcdr 1 newsrc)
X		  (not (nth 1 newsrc)))
X	  (gnus-Group-update-group group)
X	  (gnus-Group-next-group 1)
X	  ))
X    ))
X
X(defun gnus-Group-list-all-groups ()
X  "List all of newsgroups in group selection buffer."
X  (interactive)
X  (gnus-Group-list-groups t))
X
X(defun gnus-Group-get-new-news (all)
X  "Re-read active file.
XIf argument ALL is non-nil, unsubscribed or empty group is also listed."
X  (interactive "P")
X  (gnus-setup-news-info)
X  (gnus-Group-list-groups all))
X
X(defun gnus-Group-check-bogus-groups ()
X  "Check bogus newsgroup."
X  (interactive)
X  (gnus-delete-bogus-news-group t)	;Require confirmation.
X  (gnus-Group-list-groups nil))
X
X(defun gnus-Group-post-news ()
X  "Post an article."
X  (interactive)
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-post-news))
X
X(defun gnus-Group-force-update ()
X  "Update .newsrc file."
X  (interactive)
X  (gnus-save-newsrc-file))
X
X(defun gnus-Group-exit ()
X  "Quit reading news after updating .newsrc."
X  (interactive)
X  (if (or (not (nntp-server-opened))
X	  (y-or-n-p "Are you sure you want to quit reading news? "))
X      (progn
X	(gnus-save-newsrc-file)
X	(gnus-clear-system)
X	(nntp-close-server)
X	(run-hooks 'gnus-Exit-gnus-hook))
X    ))
X
X(defun gnus-Group-quit ()
X  "Quit reading news without updating .newsrc."
X  (interactive)
X  (if (or (not (nntp-server-opened))
X	  (yes-or-no-p
X	   (format "Quit reading news without saving %s? "
X		   (file-name-nondirectory gnus-current-startup-file))))
X      (progn
X	(gnus-clear-system)
X	(nntp-close-server)
X	(run-hooks 'gnus-Exit-gnus-hook))
X    ))
X
X
X;;;
X;;; GNUS Subject display mode
X;;;
X
X(if gnus-Subject-mode-map
X    nil
X  (setq gnus-Subject-mode-map (make-keymap))
X  (suppress-keymap gnus-Subject-mode-map)
X  (define-key gnus-Subject-mode-map " " 'gnus-Subject-next-page)
X  (define-key gnus-Subject-mode-map "\177" 'gnus-Subject-prev-page)
X  (define-key gnus-Subject-mode-map "n" 'gnus-Subject-next-unread-article)
X  (define-key gnus-Subject-mode-map "p" 'gnus-Subject-prev-unread-article)
X  (define-key gnus-Subject-mode-map "N" 'gnus-Subject-next-article)
X  (define-key gnus-Subject-mode-map "P" 'gnus-Subject-prev-article)
X  (define-key gnus-Subject-mode-map "\e\C-n" 'gnus-Subject-next-same-subject)
X  (define-key gnus-Subject-mode-map "\e\C-p" 'gnus-Subject-prev-same-subject)
X  ;;(define-key gnus-Subject-mode-map "\e\C-n" 'gnus-Subject-next-unread-same-subject)
X  ;;(define-key gnus-Subject-mode-map "\e\C-p" 'gnus-Subject-prev-unread-same-subject)
X  (define-key gnus-Subject-mode-map "\C-c\C-n" 'gnus-Subject-next-digest)
X  (define-key gnus-Subject-mode-map "\C-c\C-p" 'gnus-Subject-prev-digest)
X  (define-key gnus-Subject-mode-map "\C-n" 'gnus-Subject-next-subject)
X  (define-key gnus-Subject-mode-map "\C-p" 'gnus-Subject-prev-subject)
X  (define-key gnus-Subject-mode-map "\en" 'gnus-Subject-next-unread-subject)
X  (define-key gnus-Subject-mode-map "\ep" 'gnus-Subject-prev-unread-subject)
X  (define-key gnus-Subject-mode-map "." 'gnus-Subject-first-unread-article)
X  (define-key gnus-Subject-mode-map "/" 'isearch-forward)
X  (define-key gnus-Subject-mode-map "s" 'gnus-Subject-search-article-body)
X  (define-key gnus-Subject-mode-map "<" 'gnus-Subject-beginning-of-article)
X  (define-key gnus-Subject-mode-map ">" 'gnus-Subject-end-of-article)
X  (define-key gnus-Subject-mode-map "j" 'gnus-Subject-goto-subject)
X  (define-key gnus-Subject-mode-map "J" 'gnus-Subject-goto-article)
X  (define-key gnus-Subject-mode-map "^" 'gnus-Subject-goto-parent-article)
X  (define-key gnus-Subject-mode-map "l" 'gnus-Subject-goto-last-article)
X  (define-key gnus-Subject-mode-map "u" 'gnus-Subject-mark-unread-forward)
X  (define-key gnus-Subject-mode-map "U" 'gnus-Subject-mark-unread-backward)
X  (define-key gnus-Subject-mode-map "d" 'gnus-Subject-mark-read-forward)
X  (define-key gnus-Subject-mode-map "D" 'gnus-Subject-mark-read-backward)
X  (define-key gnus-Subject-mode-map "k" 'gnus-Subject-kill-same-subject)
X  (define-key gnus-Subject-mode-map "\C-k" 'gnus-Subject-kill-same-subject-without-reading)
X  ;;(define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up)
X  (define-key gnus-Subject-mode-map "c" 'gnus-Subject-catch-up-and-exit)
X  (define-key gnus-Subject-mode-map "\C-t" 'gnus-Subject-toggle-truncation)
X  (define-key gnus-Subject-mode-map "\C-c\C-sn" 'gnus-Subject-sort-by-number)
X  (define-key gnus-Subject-mode-map "\C-c\C-sa" 'gnus-Subject-sort-by-author)
X  (define-key gnus-Subject-mode-map "\C-c\C-ss" 'gnus-Subject-sort-by-subject)
X  (define-key gnus-Subject-mode-map "\C-c\C-sd" 'gnus-Subject-sort-by-date)
X  (define-key gnus-Subject-mode-map "=" 'delete-other-windows)
X  (define-key gnus-Subject-mode-map "G" 'gnus-Subject-show-all-subjects)
X  (define-key gnus-Subject-mode-map "w" 'gnus-Subject-stop-page-breaking)
X  (define-key gnus-Subject-mode-map "X" 'gnus-Subject-caesar-message)
X  (define-key gnus-Subject-mode-map "t" 'gnus-Subject-toggle-header)
X  (define-key gnus-Subject-mode-map "v" 'gnus-Subject-show-all-headers)
X  (define-key gnus-Subject-mode-map "\C-d" 'gnus-Subject-rmail-digest)
X  (define-key gnus-Subject-mode-map "a" 'gnus-Subject-post-news)
X  (define-key gnus-Subject-mode-map "f" 'gnus-Subject-post-reply)
X  (define-key gnus-Subject-mode-map "C" 'gnus-Subject-cancel)
X  (define-key gnus-Subject-mode-map "r" 'gnus-Subject-mail-reply)
X  (define-key gnus-Subject-mode-map "m" 'gnus-Subject-mail-other-window)
X  (define-key gnus-Subject-mode-map "o" 'gnus-Subject-save-article)
X  (define-key gnus-Subject-mode-map "\C-o" 'gnus-Subject-save-in-mail)
X  (define-key gnus-Subject-mode-map "|" 'gnus-Subject-pipe-output)
X  (define-key gnus-Subject-mode-map "K" 'gnus-Kill-file-edit-local)
X  (define-key gnus-Subject-mode-map "?" 'describe-mode)
X  (define-key gnus-Subject-mode-map "q" 'gnus-Subject-exit)
X  (define-key gnus-Subject-mode-map "Q" 'gnus-Subject-quit))
X
X(defun gnus-Subject-mode ()
X  "Major mode for reading news in this newsgroup.
XAll normal editing commands are turned off.
XInstead, these commands are available:
X
X\\[gnus-Subject-next-page]	Scroll to next page of current article. (Select next unread article \n\tat the end of the article.)
X\\[gnus-Subject-prev-page]	Scroll to previous page of current article.
X\\[gnus-Subject-next-unread-article]	Move to next unread article.
X\\[gnus-Subject-prev-unread-article]	Move to previous unread article.
X\\[gnus-Subject-next-article]	Move to next article whether read or not.
X\\[gnus-Subject-prev-article]	Move to previous article whether read or not.
X\\[gnus-Subject-next-same-subject]	Move to next article which has same subject as current article.
X\\[gnus-Subject-prev-same-subject]	Move to previous article which has same subject as current article.
X\\[gnus-Subject-next-unread-same-subject]	Move to next unread article which has same subject as current article.
X\\[gnus-Subject-prev-unread-same-subject]	Move to previous unread article which has same subject as current article.
X\\[gnus-Subject-next-digest]	Scroll to next digested message of current article.
X\\[gnus-Subject-prev-digest]	Scroll to previous digested message of current article.
X\\[gnus-Subject-next-subject]	Move to next subject line.
X\\[gnus-Subject-prev-subject]	Move to previous subject line.
X\\[gnus-Subject-next-unread-subject]	Move to next unread article's subject.
X\\[gnus-Subject-prev-unread-subject]	Move to previous unread article's subject.
X\\[gnus-Subject-first-unread-article]	Jump to first unread article in current newsgroup.
X\\[isearch-forward]	Do incremental search forward on subjects.
X\\[gnus-Subject-search-article-body]	Do incremental search forward on current article.
X\\[gnus-Subject-beginning-of-article]	Move point to beginning of current article.
X\\[gnus-Subject-end-of-article]	Move point to end of current article.
X\\[gnus-Subject-goto-subject]	Jump to article specified by numeric article ID.
X\\[gnus-Subject-goto-article]	Jump to article specified by numeric article ID, then read it.
X\\[gnus-Subject-goto-parent-article]	Jump to parent article of current article.
X\\[gnus-Subject-goto-last-article]	Jump to article you read last.
X\\[gnus-Subject-mark-unread-forward]	Mark current article as unread, and go forward.
X\\[gnus-Subject-mark-unread-backward]	Mark current article as unread, and go backward.
X\\[gnus-Subject-mark-read-forward]	Mark current article as read, and go forward.
X\\[gnus-Subject-mark-read-backward]	Mark current article as read, and go backward.
X\\[gnus-Subject-kill-same-subject]	Mark articles which has same subject as current article as read.
X\\[gnus-Subject-kill-same-subject-without-reading]	Mark articles which has same subject as current article as read.
X	Next unread article won't be selected automagically.
X\\[gnus-Subject-catch-up]	Mark all of articles of current newsgroup as read.
X\\[gnus-Subject-catch-up-and-exit]	Catch up and then exit current newsgroup.
X\\[gnus-Subject-toggle-truncation]	Toggle truncation of subject lines.
X\\[gnus-Subject-sort-by-number]	Sort subjects by article number.
X\\[gnus-Subject-sort-by-author]	Sort subjects by article author name.
X\\[gnus-Subject-sort-by-subject]	Sort subjects alphabetically.
X\\[gnus-Subject-sort-by-date]	Sort subjects by posted date.
X\\[delete-other-windows]	Show subjects (delete article display window).
X\\[gnus-Subject-show-all-subjects]	Show all subjects of current newsgroup.
X\\[gnus-Subject-stop-page-breaking]	Stop page breaking by linefeed.
X\\[gnus-Subject-caesar-message]	Caesar rotates letters by 13/47 places.
X\\[gnus-Subject-toggle-header]	Show original article header if pruned header currently shown, or vice versa.
X\\[gnus-Subject-show-all-headers]	Show original article header.
X\\[gnus-Subject-rmail-digest]	RMAIL a digest article.
X\\[gnus-Subject-post-news]	Post an article.
X\\[gnus-Subject-post-reply]	Post a reply article.
X\\[gnus-Subject-cancel]	Cancel current article. (The article must be yours).
X\\[gnus-Subject-mail-reply]	Mail a message to the author.
X\\[gnus-Subject-mail-other-window]	Mail a message in other window.
X\\[gnus-Subject-save-article]	Save current article in your favorite format.
X\\[gnus-Subject-save-in-mail]	Append current article to file in Unix mail format.
X\\[gnus-Subject-pipe-output]	Pipe contents of current article to subprocess.
X\\[gnus-Kill-file-edit-local]	Edit local KILL file.
X\\[describe-mode]	Describe this mode.
X\\[gnus-Subject-exit]	Quit reading news in current newsgroup.
X\\[gnus-Subject-quit]	Quit reading news without updating read articles information.
X
XUser customizable variables:
X gnus-subject-lines-height
X    Height of subject display window.
X
X gnus-article-default-saver
X    Specifies your favorite article saver which is interactively
X    funcallable. Currently following three functions are available:
X
X	gnus-Subject-save-in-mail (in Unix mail format)
X	gnus-Subject-save-in-folder (in MH folder)
X	gnus-Subject-save-in-file (in plain file).
X
X gnus-article-save-directory
X    Directory name to save an article to using the command
X    gnus-Subject-save-in-mail and gnus-Subject-save-in-file. The
X    variable is initialized from the SAVEDIR environment variable.
X
X gnus-use-long-file-name
X    Non-nil means newsgroup name of an article to be saved is used as
X    file name. Directory form of the newsgroup is used instead if nil.
X
X gnus-article-mh-folder
X    MH folder name saving an article in using the command
X    gnus-Subject-save-in-folder.
X
X gnus-auto-select-next
X    Non-nil means next newsgroup is selected automagically at the end
X    of the newsgroup. You don't have to exit subject selection mode
X    explicitly. If the value is not nil nor t, GNUS won't exit subject
X    display mode even if the next newsgroup is empty.
X
X gnus-auto-select-same
X    Non-nil means an article with same subject as current article is
X    selected automagically like `rn -S'.
X
X gnus-break-pages
X    Non-nil means an article is broken in pages at page delimiter.
X    This may not work some version of GNU Emacs before 18.50.
X
X gnus-page-delimiter
X    Regexp describing line-beginnings that separate pages of news
X    article.
X
XVarious hooks for customization:
X gnus-Subject-mode-hook
X    Entry to this mode calls the value with no arguments, if that
X    value is non-nil.
X
X gnus-Select-group-hook
X    Called with no arguments when newsgroup is selected, if that value
X    is non-nil. It is possible to sort subjects in this hook. See
X    documentation of this variable for more information.
X
X gnus-Subject-prepare-hook
X    Called with no arguments after subject list is created, if that
X    value is non-nil. If you'd like to modify the buffer, you can use
X    this hook.
X
X gnus-Select-article-hook
X    Called with no arguments when article is selected, if that value
X    is non-nil. See documentation of this variable for more
X    information."
X  (interactive)
X  (kill-all-local-variables)
X  (setq major-mode 'gnus-Subject-mode)
X  (setq mode-name "GNUS Subject")
X  (gnus-Subject-set-mode-line)
X  (use-local-map gnus-Subject-mode-map)
X  (setq buffer-read-only t)		;Disable modification
X  (setq truncate-lines t)		;Stop folding of lines.
X  (run-hooks 'gnus-Subject-mode-hook))
X
X(defun gnus-Subject-setup-buffer ()
X  "Initialize subject display buffer."
X  (if (get-buffer gnus-Subject-buffer)
X      (set-buffer gnus-Subject-buffer)
X    (set-buffer (get-buffer-create gnus-Subject-buffer))
X    (gnus-Subject-mode)
X    ))
X
X(defun gnus-Subject-read-group (group &optional show-all no-article)
X  "Start reading news in newsgroup GROUP.
XIf optional 1st argument SHOW-ALL is non-nil, already read articles are
Xalso listed.
XIf optional 2nd argument NO-ARTICLE is non-nil, no article body is displayed."
X  (message "Retrieving newsgroup: %s..." group)
X  (if (gnus-select-news-group group show-all)
X      (progn
X	;; Don't switch-to-buffer to prevent displaying old contents
X	;;  of the buffer until new subjects list is created.
X	;; Suggested by Juha Heinanen 
X	(gnus-Subject-setup-buffer)
X	;; You can change the order of subjects in this hook.
X	(run-hooks 'gnus-Select-group-hook)
X	(gnus-Subject-prepare)
X	(if (zerop (buffer-size))
X	    ;; This newsgroup is empty.
X	    (progn
X	      (setq gnus-current-group-unreads nil)
X	      (gnus-Subject-exit)
X	      (message "No unread news."))
X	  ;; Apply KILL files.
X	  (if gnus-enable-kill-file
X	      (gnus-Kill-file-mark-as-read))
X	  ;; Show first unread article if requested.
X	  (goto-char (point-min))
X	  (if (and (not no-article)
X		   (gnus-Subject-first-unread-article))
X	      nil			;Window is configured automatically.
X	    (switch-to-buffer gnus-Subject-buffer)
X	    (gnus-Subject-set-mode-line)
X	    ;; Kill article display buffer because I sometime get
X	    ;;  confused by old article buffer.
X	    (if (get-buffer gnus-Article-buffer)
X		(let ((article-window
X		       (get-buffer-window gnus-Article-buffer)))
X		  (if article-window
X		      (delete-window article-window))
X		  (kill-buffer gnus-Article-buffer))
X	      ))
X	  ;; Adjust cursor point.
X	  (beginning-of-line)
X	  (search-forward ":" nil t)
X	  ))
X    ;; Cannot select newsgroup GROUP.
X    (message "No such newsgroup: %s" group)
X    (sit-for 0)
X    ;; Run checking bogus newsgroups.
X    (gnus-delete-bogus-news-group t)	;Confirm
X    ))
X
X(defun gnus-Subject-prepare ()
X  "Prepare subject list of current newsgroup in subject display buffer."
X  (let* ((buffer-read-only nil)
X	 (id 0)
X	 (headers gnus-current-group-headers)
X	 (header nil)
X	 ;; These define format of subject display buffer.
X	 (name-length (length "umerin@photon"))
X	 (cntl
X	  (format "%%s %%%ds: [%%3d:%%s] %%s\n"
X		  (length (prin1-to-string gnus-current-group-end)))))
X    ;; Newsgroup must be selected before calling me.
X    (erase-buffer)
X    (while headers
X      (setq header (car headers))
X      (setq id (nntp-header-number header))
X      (insert
X       (format cntl
X	       ;; Read or not.
X	       (cond ((memq id gnus-current-group-marked)  "-")
X		     ((memq id gnus-current-group-unreads) " ")
X		     (t "D"))
X	       id			;Article ID.
X	       ;; Lines of the article.
X	       ;; Suggested by dana@bellcore.com.
X	       (nntp-header-lines header)
X	       ;; Its author.
X	       (substring (concat (mail-strip-quoted-names
X				   (nntp-header-from header))
X				  (make-string name-length ? ))
X			  0 name-length)
X	       ;; Its subject.
X	       (nntp-header-subject header)))
X      (setq headers (cdr headers))
X      )
X    ;; Erase header retrieval message.
X    (message "")
X    ;; Call hooks for modifying subject buffer.
X    ;; Suggested by sven@tde.LTH.Se (Sven Mattisson).
X    (run-hooks 'gnus-Subject-prepare-hook)
X    ))
X
X(defun gnus-Subject-set-mode-line ()
X  "Set Subject mode line string."
X  (let ((subject gnus-current-group-name))
X    (if gnus-current-article
X	(setq subject
X	      (nntp-header-subject
X	       (nntp-find-header-by-number gnus-current-group-headers
X					   gnus-current-article))))
X    (setq mode-line-process (concat " " gnus-current-group-name))
X    (setq mode-line-buffer-identification
X	  (concat "GNUS: "
X		  subject
X		  ;; Enough spaces to pad subject to 17 positions.
X		  (substring "                 "
X			     0 (max 0 (- 17 (length subject))))))
X    (set-buffer-modified-p t)
X    (sit-for 0)
X    ))
X
X;; GNUS Subject display mode command.
X
X(defun gnus-Subject-search-subject (backward unread subject)
X  "Search for article forward.
XIf 1st argument BACKWARD is non-nil, search backward.
XIf 2nd argument UNREAD is non-nil, only unread article is selected.
XIf 3rd argument SUBJECT is non-nil, the article which has
Xthe same subject will be searched for."
X  (let ((func (if backward 're-search-backward 're-search-forward))
X	(article nil)
X	(case-fold-search nil)		;Don't ignore case.
X	(regexp 
X	 (format "^%s[ \t]+\\([0-9]+\\):[ \t]+\\[.*\\][ \t]+%s"
X		 ;;(if unread " " ".")
X		 (cond ((eq unread t) " ") (unread "[^D]") (t "."))
X		 (if subject
X		     (concat "\\([Rr][Ee]:[ \t]+\\)*"
X			     (regexp-quote (gnus-simplify-subject subject))
X			     ;; Ignore words in parentheses.
X			     "\\([ \t]*(.*)\\)*[ \t]*$")
X		   "")
X		 )))
X    (if backward
X	(beginning-of-line)
X      (end-of-line))
X    (if (funcall func regexp nil t)
X	(setq article
X	      (string-to-int
X	       (buffer-substring (match-beginning 1) (match-end 1)))))
X    ;; Adjust cursor point.
X    (beginning-of-line)
X    (search-forward ":" nil t)
X    ;; This is the result.
X    article
X    ))
X
X(defun gnus-Subject-search-forward (&optional unread subject)
X  "Search for article forward.
XIf 1st optional argument UNREAD is non-nil, only unread article is selected.
XIf 2nd optional argument SUBJECT is non-nil, the article which has
Xthe same subject will be searched for."
X  (gnus-Subject-search-subject nil unread subject))
X
X(defun gnus-Subject-search-backward (&optional unread subject)
X  "Search for article backward.
XIf 1st optional argument UNREAD is non-nil, only unread article is selected.
XIf 2nd optional argument SUBJECT is non-nil, the article which has
Xthe same subject will be searched for."
X  (gnus-Subject-search-subject t unread subject))
X
X(defun gnus-Subject-article-number ()
X  "Article number around point. If nothing, return current number."
X  (save-excursion
X    (beginning-of-line)
X    (if (re-search-forward "^.[ \t]+\\([0-9]+\\):" nil t)
X	(string-to-int
X	 (buffer-substring (match-beginning 1) (match-end 1)))
X      ;; If search fail, return current article number.
X      gnus-current-article
X      )))
X
X(defun gnus-Subject-subject-string ()
X  "Return current subject string or nil if non."
X  (save-excursion
X    ;; It is possible to implement this function using
X    ;;  `gnus-Subject-article-number' and `gnus-current-group-headers'.
X    (beginning-of-line)
X    (if (re-search-forward "^.[ \t]+[0-9]+:[ \t]+\\[.*\\][ \t]+\\(.*\\)$"
X			   nil t)
X	(let ((subject (buffer-substring (match-beginning 1) (match-end 1))))
X	  ;; Trim spaces of subject.
X	  (if (string-match "^[ \t]+\\([^ \t].*\\)$" subject)
X	      (setq subject (substring subject (match-beginning 1))))
X	  ;; Return subject string.
X	  subject
X	  )
X      nil
X      )))
X
X(defun gnus-Subject-goto-subject (article)
X  "Move point to ARTICLE's subject."
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-current-group-headers)
X		      nil 'require-match))))
X  (let ((current (point)))
X    (goto-char (point-min))
X    (or (re-search-forward (format "^.[ \t]+%d:" article) nil t)
X	(progn (goto-char current) nil))
X    ))
X
X(defun gnus-Subject-recenter ()
X  "Center point in subject window."
X  ;; Scroll window so as to cursor comes center of subject window
X  ;;  only when article is displayed.
X  ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
X  (and (get-buffer-window gnus-Article-buffer)
X       (< (/ (- (window-height) 1) 2)
SHAR_EOF
echo "End of part 1, continue with part 2"
echo "2" > s2_seq_.tmp
exit 0
-- 
Masanobu UMEDA
umerin@flab.flab.Fujitsu.JUNET
umerin%flab.flab.Fujitsu.JUNET@uunet.uu.NET