Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!kddlab!ccut!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 (3 of 4) Message-ID: <4128@flab.flab.fujitsu.JUNET> Date: 19 Sep 88 03:21:51 GMT Reply-To: umerin@flab.flab.fujitsu.JUNET (Masanobu UMEDA) Organization: Fujitsu Laboratories Ltd., Kawasaki, Japan Lines: 1462 ---- Cut Here and unpack ---- #!/bin/sh # this is part 3 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file gnus.el continued # CurArch=3 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 (if (= (aref group idx) ?.) X (aset group idx ?/)) X (setq idx (1+ idx))) X group X )) X X(defun gnus-make-directory (directory) X "Make DIRECTORY recursively." X (let ((directory (expand-file-name directory default-directory))) X (or (file-exists-p directory) X (gnus-make-directory-1 "" directory)) X )) X X(defun gnus-make-directory-1 (head tail) X (cond ((string-match "^/\\([^/]+\\)" tail) X (setq head X (concat (file-name-as-directory head) X (substring tail (match-beginning 1) (match-end 1)))) X (if (not (file-exists-p head)) X (call-process "mkdir" nil nil nil head)) X (gnus-make-directory-1 head (substring tail (match-end 1)))) X ((string-equal tail "") t) X )) X X;;; caesar-region written by phr@prep.ai.mit.edu Nov 86 X;;; modified by tower@prep Nov 86 X;;; Modified by umerin@flab.flab.Fujitsu.JUNET for ROT47. X X(defun caesar-region (&optional n) X "Caesar rotation of region by N, default 13, for decrypting netnews. XROT47 will be performed for Japanese text in any case." X (interactive (if current-prefix-arg ; Was there a prefix arg? X (list (prefix-numeric-value current-prefix-arg)) X (list nil))) X (cond ((not (numberp n)) (setq n 13)) X ((< n 0) (setq n (- 26 (% (- n) 26)))) X (t (setq n (% n 26)))) ;canonicalize N X (if (not (zerop n)) ; no action needed for a rot of 0 X (progn X (if (or (not (boundp 'caesar-translate-table)) X (/= (aref caesar-translate-table ?a) (+ ?a n))) X (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper) X (message "Building caesar-translate-table...") X (setq caesar-translate-table (make-vector 256 0)) X (while (< i 256) X (aset caesar-translate-table i i) X (setq i (1+ i))) X (setq lower (concat lower lower) upper (upcase lower) i 0) X (while (< i 26) X (aset caesar-translate-table (+ ?a i) (aref lower (+ i n))) X (aset caesar-translate-table (+ ?A i) (aref upper (+ i n))) X (setq i (1+ i))) X ;; ROT47 for Japanese text. X ;; Thanks to ichikawa@flab.fujitsu.junet. X (setq i 161) X (let ((t1 (logior ?O 128)) X (t2 (logior ?! 128)) X (t3 (logior ?~ 128))) X (while (< i 256) X (aset caesar-translate-table i X (let ((v (aref caesar-translate-table i))) X (if (<= v t1) (if (< v t2) v (+ v 47)) X (if (<= v t3) (- v 47) v)))) X (setq i (1+ i)))) X (message "Building caesar-translate-table... done"))) X (let ((from (region-beginning)) X (to (region-end)) X (i 0) str len) X (setq str (buffer-substring from to)) X (setq len (length str)) X (while (< i len) X (aset str i (aref caesar-translate-table (aref str i))) X (setq i (1+ i))) X (goto-char from) X (kill-region from to) X (insert str))))) X X X;;; X;;; Get information about active articles, already read articles, and X;;; still unread articles. X;;; X X;; GNUS internal format of gnus-newsrc-assoc: X;; (("general" t (1 . 1)) X;; ("misc" t (1 . 10) (12 . 15)) X;; ("test" nil (1 . 99)) ...) X;; GNUS internal format of gnus-marked-assoc: X;; (("general" 1 2 3) X;; ("misc" 2) ...) X;; GNUS internal format of gnus-active-hashtb: X;; (("general" t (1 . 1)) X;; ("misc" t (1 . 10)) X;; ("test" nil (1 . 99)) ...) X;; GNUS internal format of gnus-unread-hashtb: X;; (("general" 1 (1 . 1)) X;; ("misc" 14 (1 . 10) (12 . 15)) X;; ("test" 99 (1 . 99)) ...) X X(defun gnus-setup-news-info (&optional force) X "Setup news information. XIf optional argument FORCE is non-nil, initialize completely." X (let ((init (not (and gnus-newsrc-assoc X gnus-active-hashtb X gnus-unread-hashtb X (not force))))) X (if init X (gnus-read-newsrc-file)) X (gnus-read-active-file) X (if init X (gnus-add-new-news-group)) X (gnus-get-unread-articles) X )) X X(defun gnus-make-newsrc-file (file) X "Make site dependent file name by catenating FILE and server host name." X (let* ((file (expand-file-name file nil)) X (real-file (concat file "-" gnus-server-host))) X (if (file-exists-p real-file) X real-file file) X )) X X(defun gnus-get-unread-articles () X "Compute diffs between active and read articles." X (let ((read gnus-newsrc-assoc) X (group-info nil) X (group-name nil) X (active nil) X (range nil)) X (message "Checking new news...") X (or gnus-unread-hashtb X (setq gnus-unread-hashtb (gnus-make-hashtable))) X (while read X (setq group-info (car read)) ;About one newsgroup X (setq group-name (car group-info)) X (setq active (nth 2 (gnus-gethash group-name gnus-active-hashtb))) X (if (and gnus-octive-hashtb X (equal active X (nth 2 (gnus-gethash group-name gnus-octive-hashtb)))) X nil ;Nothing changed. X (setq range (gnus-difference-of-range active (nthcdr 2 group-info))) X (gnus-sethash group-name X (cons group-name ;Group name X (cons (gnus-number-of-articles range) X range)) ;Range of unread articles X gnus-unread-hashtb) X ) X (setq read (cdr read)) X ) X (message "Checking new news... Done.") X )) X X(defun gnus-mark-as-read-by-xref (group headers unreads) X "Mark as read using cross reference info. of GROUP with HEADERS and UNREADS. XReturn list of updated newsgroup." X (let ((xref-list nil) X (header nil) X (xrefs nil)) ;One Xref: field info. X (while headers X (setq header (car headers)) X (if (memq (nntp-header-number header) unreads) X ;; This article is not yet marked as read. X nil X (setq xrefs (gnus-parse-xref-field (nntp-header-xref header))) X ;; For each cross reference info. on one Xref: field. X (while xrefs X (let* ((xref (car xrefs)) X (group-xref (assoc (car xref) xref-list))) X (if (string-equal group (car xref)) X ;; Ignore this group. X nil X (if group-xref X (if (memq (cdr xref) (cdr group-xref)) X nil ;Alread marked. X (setcdr group-xref (cons (cdr xref) (cdr group-xref)))) X ;; Create new assoc entry for GROUP. X (setq xref-list X (cons (list (car xref) (cdr xref)) X xref-list))) X )) X (setq xrefs (cdr xrefs)) X )) X (setq headers (cdr headers))) X ;; Mark cross referenced articles as read. X (gnus-mark-xref-as-read xref-list) X ;;(message "%s %s" (prin1-to-string unreads) (prin1-to-string xref-list)) X ;; Return list of updated group name. X (mapcar (function car) xref-list) X )) X X(defun gnus-parse-xref-field (xref-value) X "Parse Xref: field value, and return list of `(group . article-id)'." X (let ((xref-list nil) X (xref-value (or xref-value ""))) X ;; Remove server host name. X (if (string-match "^[ \t]*[^ \t,]+[ \t,]+\\(.*\\)$" xref-value) X (setq xref-value (substring xref-value (match-beginning 1))) X (setq xref-value nil)) X ;; Process each xref info. X (while xref-value X (if (string-match X "^[ \t,]*\\([^ \t,]+\\):\\([0-9]+\\)[^0-9]*" xref-value) X (progn X (setq xref-list X (cons X (cons X ;; Group name X (substring xref-value (match-beginning 1) (match-end 1)) X ;; Article-ID X (string-to-int X (substring xref-value (match-beginning 2) (match-end 2)))) X xref-list)) X (setq xref-value (substring xref-value (match-end 2)))) X (setq xref-value nil))) X ;; Return alist. X xref-list X )) X X(defun gnus-mark-xref-as-read (xrefs) X "Update unread article information using XREFS alist." X (let ((group nil) X (idlist nil) X (unread nil)) X (while xrefs X (setq group (car (car xrefs))) X (setq idlist (cdr (car xrefs))) X (setq unread (gnus-uncompress-sequence X (nthcdr 2 (gnus-gethash group gnus-unread-hashtb)))) X (while idlist X (setq unread (delq (car idlist) unread)) X (setq idlist (cdr idlist))) X (gnus-update-unread-articles group unread 'ignore) X (setq xrefs (cdr xrefs)) X ))) X X(defun gnus-update-unread-articles (group unread-list marked-list) X "Update unread articles of GROUP using UNREAD-LIST and MARKED-LIST." X (let ((active (nth 2 (gnus-gethash group gnus-active-hashtb))) X (unread (gnus-gethash group gnus-unread-hashtb))) X (if (null unread) X (progn X ;; New newsgroup must be added during this GNUS session. X (message "It seems me that new newsgroup is added.") X (gnus-add-new-news-group) X (gnus-get-unread-articles) X (setq unread (gnus-gethash group gnus-unread-hashtb)) X )) X ;; Update gnus-unread-hashtb. X (if unread-list X (setcdr (cdr unread) X (gnus-compress-sequence unread-list)) X ;; All of the articles are read. X (setcdr (cdr unread) '((0 . 0)))) X ;; Number of unread articles. X (setcar (cdr unread) X (gnus-number-of-articles (nthcdr 2 unread))) X ;; Update gnus-newsrc-assoc. X (if (> (car active) 0) X ;; Articles from 1 to N are not active. X (setq active (cons 1 (cdr active)))) X (setcdr (cdr (assoc group gnus-newsrc-assoc)) X (gnus-difference-of-range active (nthcdr 2 unread))) X ;; Update gnus-marked-assoc. X (if (listp marked-list) ;Includes NIL. X (let ((marked (assoc group gnus-marked-assoc))) X (cond (marked X (setcdr marked marked-list)) X (marked-list ;Non-NIL. X (setq gnus-marked-assoc X (cons (cons group marked-list) gnus-marked-assoc))) X ))) X )) X X(defun gnus-compress-sequence (numbers) X "Convert list of sorted numbers to ranges." X (let* ((numbers (sort (copy-sequence numbers) (function <))) X (first (car numbers)) X (last (car numbers)) X (result nil)) X (while numbers X (cond ((= last (car numbers)) nil) ;Omit duplicated number X ((= (1+ last) (car numbers)) ;Still in sequence X (setq last (car numbers))) X (t ;End of one sequence X (setq result (cons (cons first last) result)) X (setq first (car numbers)) X (setq last (car numbers))) X ) X (setq numbers (cdr numbers)) X ) X (nreverse (cons (cons first last) result)) X )) X X(defun gnus-uncompress-sequence (ranges) X "Expand compressed format of sequence." X (let ((first nil) X (last nil) X (result nil)) X (while ranges X (setq first (car (car ranges))) X (setq last (cdr (car ranges))) X (while (< first last) X (setq result (cons first result)) X (setq first (1+ first))) X (setq result (cons first result)) X (setq ranges (cdr ranges)) X ) X (nreverse result) X )) X X(defun gnus-number-of-articles (range) X "Compute number of articles from RANGE `((beg1 . end1) (beg2 . end2) ...)'." X (let ((count 0)) X (while range X (if (/= (cdr (car range)) 0) X ;; If end1 is 0, it must be skipped. Usually no articles in X ;; this group. X (setq count (+ count 1 (- (cdr (car range)) (car (car range)))))) X (setq range (cdr range)) X ) X count ;Result X )) X X(defun gnus-difference-of-range (src obj) X "Compute (SRC - OBJ) on range. XRange of SRC is expressed as `(beg . end)'. XRange of OBJ is expressed as `((beg1 . end1) (beg2 . end2) ...)." X (let ((beg (car src)) X (end (cdr src)) X (range nil)) ;This is result. X ;; Src may be nil. X (while (and src obj) X (let ((beg1 (car (car obj))) X (end1 (cdr (car obj)))) X (cond ((> beg end) X (setq obj nil)) ;Terminate loop X ((< beg beg1) X (setq range (cons (cons beg (min (1- beg1) end)) range)) X (setq beg (1+ end1))) X ((>= beg beg1) X (setq beg (max beg (1+ end1)))) X ) X (setq obj (cdr obj)) ;Next OBJ X )) X ;; Src may be nil. X (if (and src (<= beg end)) X (setq range (cons (cons beg end) range))) X ;; Result X (if range X (nreverse range) X (list (cons 0 0))) X )) X X(defun gnus-add-new-news-group () X "Add new newsgroup to gnus-newsrc-assoc." X (let ((group nil)) X (mapatoms X (function X (lambda (sym) X (setq group (symbol-name sym)) X (if (null (assoc group gnus-newsrc-assoc)) X ;; Find new newsgroup. X (let ((subscribe (not (or (string-equal group "control") X (string-equal group "junk"))))) X (setq gnus-newsrc-assoc X (cons (list group subscribe) gnus-newsrc-assoc)) X (gnus-update-newsrc-buffer group) X (if subscribe X (message "New newsgroup: %s is subscribed." group)) X )))) X gnus-active-hashtb) X )) X X(defun gnus-delete-bogus-news-group (&optional confirm) X "Delete bogus newsgroup. XIf optional argument CONFIRM is non-nil, confirm deletion of newsgroups." X (let ((group nil) X (oldrc gnus-newsrc-assoc) X (newsrc nil) X (marked gnus-marked-assoc) X (newmarked nil)) X (message "Checking bogus newsgroups...") X ;; Update gnus-newsrc-assoc. X (while oldrc X (setq group (car (car oldrc))) X (if (or (gnus-gethash group gnus-active-hashtb) X (and confirm X (not (y-or-n-p X (format "Delete bogus newsgroup: %s " group))))) X ;; Active newsgroup. X (setq newsrc (cons (car oldrc) newsrc)) X ;; Found bogus newsgroup. X (gnus-update-newsrc-buffer group 'delete)) X (setq oldrc (cdr oldrc)) X ) X (setq gnus-newsrc-assoc (nreverse newsrc)) X ;; Update gnus-marked-assoc. X (while marked X (setq group (car (car marked))) X (if (and (cdr (car marked)) ;Non-empty? X (assoc group gnus-newsrc-assoc)) ;Not bogus? X (setq newmarked (cons (car marked) newmarked))) X (setq marked (cdr marked))) X (setq gnus-marked-assoc newmarked) X (message "Checking bogus newsgroups... Done.") X )) X X(defun gnus-read-active-file () X "Get active file from NNTP server." X (save-excursion X (message "Reading active file...") X (if (nntp-request-list) ;Get active file from server X (progn X ;; Take care of unexpected situations. X ;;(gnus-copy-to-buffer " *GNUS-active*") X (set-buffer nntp-server-buffer) X ;; Save OLD active info. X (setq gnus-octive-hashtb gnus-active-hashtb) X (setq gnus-active-hashtb (gnus-make-hashtable)) X (gnus-active-to-gnus-format) X ;;(kill-buffer (current-buffer)) X (message "Reading active file... Done.") X ) X (error "Cannot read active file from NNTP server.")) X )) X X(defun gnus-active-to-gnus-format () X "Convert active file format to internal format." X ;; Delete unnecessary lines. X (goto-char (point-min)) X (delete-matching-lines "^to\\..*$") X ;; Store active file in hashtable. X (goto-char (point-min)) X (while X (re-search-forward X "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([ymn]\\).*$" X nil t) X (gnus-sethash X (buffer-substring (match-beginning 1) (match-end 1)) X (list (buffer-substring (match-beginning 1) (match-end 1)) X (string-equal X "y" (buffer-substring (match-beginning 4) (match-end 4))) X (cons (string-to-int X (buffer-substring (match-beginning 3) (match-end 3))) X (string-to-int X (buffer-substring (match-beginning 2) (match-end 2))))) X gnus-active-hashtb) X )) X X(defun gnus-read-newsrc-file () X "Read in .newsrc FILE." X (setq gnus-current-startup-file (gnus-make-newsrc-file gnus-startup-file)) X ;; Reset variables. X (setq gnus-newsrc-options nil) X (setq gnus-newsrc-assoc nil) X (setq gnus-marked-assoc nil) X (if (file-exists-p gnus-current-startup-file) X (let* ((newsrc-file gnus-current-startup-file) X (quick-file (concat newsrc-file ".el")) X (quick-loaded nil) X (newsrc-mod (nth 5 (file-attributes newsrc-file))) X (quick-mod (nth 5 (file-attributes quick-file)))) X ;; Load quick .newsrc to restore gnus-marked-assoc even if X ;; gnus-newsrc-assoc is out of date. X (condition-case nil X (progn (load-file quick-file) X (message "") X (setq quick-loaded t)) X (error nil)) X (cond ((and newsrc-mod quick-mod X ;; .newsrc.el is newer than .newsrc. X ;; Some older version does not support function X ;; `file-newer-than-file-p'. X (or (< (car newsrc-mod) (car quick-mod)) X (and (= (car newsrc-mod) (car quick-mod)) X (<= (nth 1 newsrc-mod) (nth 1 quick-mod)))) X quick-loaded X gnus-newsrc-assoc X )) X (t X (save-excursion X (message "Reading %s..." newsrc-file) X (set-buffer (get-buffer-create " *GNUS-newsrc*")) X (erase-buffer) X (insert-file-contents newsrc-file) X (gnus-newsrc-to-gnus-format) X ;; Define variable gnus-newsrc-assoc. X (condition-case nil X (eval-current-buffer) X (error X (error "Too long or invalid lines in %s" newsrc-file))) X (kill-buffer (current-buffer)) X (message "Reading %s... Done." newsrc-file))) X )) X )) X X(defun gnus-newsrc-to-gnus-format () X "Convert newsrc format to gnus internal format. XBuffer becomes evaluable as lisp expression." X ;; Make it easy to edit. X (goto-char (point-min)) X (replace-regexp "$" " ") X (goto-char (point-min)) X (replace-string "," " , ") X ;; Make sure .newsrc file is formated in standard way. X (goto-char (point-min)) X (replace-string ":" ": ") X (goto-char (point-min)) X (replace-string "!" "! ") X ;; Save options line to variable. X (goto-char (point-min)) X (if (re-search-forward "^options[ \t]*\\(.*[^ \t]\\)[ \t]*$" nil t) X (progn X (setq gnus-newsrc-options (buffer-substring (match-beginning 1) X (match-end 1))) X ;; Delete options line. X (beginning-of-line) X (kill-line 1) ;Kill just one line. X )) X ;; num -> (num . num) X (goto-char (point-min)) X (replace-regexp "[ \t]\\([0-9]+\\)[ \t]" "(\\1 . \\1)") X ;; num1-num2 -> (num1 . num2) X (goto-char (point-min)) X (while (re-search-forward "[ \t]\\([0-9]+\\)-\\([0-9]+\\)[ \t]" nil t) X (replace-match "(\\1 . \\2)") X ;; Need retry on this line. X (beginning-of-line)) X ;; Delete ','. X (goto-char (point-min)) X (replace-string "," " ") X ;; Put range of read article in list form. X (goto-char (point-min)) X (replace-regexp "\\(^.*[!:][ ]*\\)\\(.*\\)$" "\\1(\\2)") X ;; Process Subscribed newsgroup. X (goto-char (point-min)) X (replace-regexp "\\(^.*\\):\\(.*\\)$" "(\"\\1\" t . \\2)") X ;; Process UnSubscribed newsgroup. X (goto-char (point-min)) X (replace-regexp "\\(^.*\\)!\\(.*\\)$" "(\"\\1\" nil . \\2)") X ;; Make the buffer evaluable. X (goto-char (point-min)) X (insert "(setq gnus-newsrc-assoc '(\n") X (goto-char (point-max)) X (insert "))\n") X ) X X(defun gnus-save-newsrc-file () X "Save to .newsrc FILE." X (if gnus-newsrc-assoc X (save-excursion X (set-buffer (find-file-noselect gnus-current-startup-file)) X (if (not (buffer-modified-p)) X (message "(No changes need to be saved)") X (message "Saving %s..." gnus-current-startup-file) X (let ((make-backup-files t) X (version-control nil) X (require-final-newline t)) ;Don't ask even if requested. X ;; Make backup file of master newsrc. X ;; You can stop or change version control of backup file. X ;; Suggested by jason@violet.berkeley.edu. X (run-hooks 'gnus-Save-newsrc-hook) X (save-buffer)) X ;; Quickly accessible .newsrc. X (set-buffer (get-buffer-create " *GNUS-newsrc*")) X (erase-buffer) X (gnus-gnus-to-quick-newsrc-format) X (let ((make-backup-files nil) X (version-control nil) X (require-final-newline t)) ;Don't ask even if requested. X (write-file (concat gnus-current-startup-file ".el"))) X (kill-buffer (current-buffer)) X (message "Saving %s... Done." gnus-current-startup-file) X )) X )) X X(defun gnus-update-newsrc-buffer (group &optional delete) X "Incrementally update .newsrc buffer about GROUP. XIf optional argument DELETE is non-nil, delete the group." X (save-excursion X (set-buffer (find-file-noselect gnus-current-startup-file)) X (goto-char (point-min)) X (if (re-search-forward (concat "^" (regexp-quote group) "[:!]") nil t) X (progn X ;; Delete old info. X (beginning-of-line) X (kill-line 1) X )) X (if (not delete) X (let ((newsrc (assoc group gnus-newsrc-assoc))) X ;; Insert after options line. X (if (looking-at "^options[ \t]") X (forward-line 1)) X (insert group ;Group name X (if (nth 1 newsrc) ;Subscribed? X ": " "! ")) X (gnus-ranges-to-newsrc-format (nthcdr 2 newsrc)) ;Read articles X (insert "\n") X )) X )) X X(defun gnus-gnus-to-quick-newsrc-format () X "Insert gnus-newsrc-assoc as evaluable format." X (insert ";; DON'T DELETE ME.\n") X ;; Save options line. X (if gnus-newsrc-options X (insert "(setq gnus-newsrc-options \"" gnus-newsrc-options "\")\n")) X ;; Save newsrc assoc list. X (insert "(setq gnus-newsrc-assoc '") X (insert (prin1-to-string gnus-newsrc-assoc)) X (insert ")\n") X ;; Save marked assoc list. X (insert "(setq gnus-marked-assoc '") X (insert (prin1-to-string gnus-marked-assoc)) X (insert ")\n") X ) X X(defun gnus-ranges-to-newsrc-format (ranges) X "Insert ranges of read articles." X (let ((range nil)) ;Range is a pair of BEGIN and END. X (while ranges X (setq range (car ranges)) X (setq ranges (cdr ranges)) X (cond ((= (car range) (cdr range)) X (if (= (car range) 0) X (setq ranges nil) ;No unread articles. X (insert (int-to-string (car range))) X (if ranges (insert ",")) X )) X (t X (insert (int-to-string (car range)) X "-" X (int-to-string (cdr range))) X (if ranges (insert ",")) X )) X ))) X X X;;; X;;; Post A News using NNTP X;;; X X(defun gnus-news-reply () X "Compose and post a reply (aka a followup) to the current article on USENET. XWhile composing the followup, use \\[news-reply-yank-original] to yank the Xoriginal message into it." X (interactive) X (if (y-or-n-p "Are you sure you want to followup to all of USENET? ") X (let (from cc subject date to followup-to newsgroups message-of X references distribution message-id X (buffer (current-buffer))) X (save-restriction X (and (not (zerop (buffer-size))) X ;;(equal major-mode 'news-mode) X (equal major-mode 'gnus-Article-mode) X (progn X ;; (news-show-all-headers) X (gnus-Article-show-all-headers) X (narrow-to-region (point-min) (progn (goto-char (point-min)) X (search-forward "\n\n") X (- (point) 2))))) X (setq from (mail-fetch-field "from") X news-reply-yank-from from X subject (mail-fetch-field "subject") X date (mail-fetch-field "date") X followup-to (mail-fetch-field "followup-to") X newsgroups (or followup-to X (mail-fetch-field "newsgroups")) X references (mail-fetch-field "references") X distribution (mail-fetch-field "distribution") X message-id (mail-fetch-field "message-id") X news-reply-yank-message-id message-id)) X (pop-to-buffer "*post-news*") X (news-reply-mode) X (erase-buffer) X (and subject X (progn (if (string-match "^Re: " subject) X (while (string-match "^Re: " subject) X (setq subject (substring subject 4)))) X (setq subject (concat "Re: " subject)))) X (and from X (progn X (let ((stop-pos X (string-match " *at \\| *@ \\| *(\\| *<" from))) X (setq message-of X (concat X (if stop-pos (substring from 0 stop-pos) from) X "'s message of " X date))))) X (news-setup nil subject message-of newsgroups buffer) X (if followup-to X (progn (news-reply-followup-to) X (insert followup-to))) X (mail-position-on-field "References") X (if references X (insert references)) X (if (and references message-id) X (insert " ")) X (if message-id X (insert message-id)) X ;; Make sure the article is posted by GNUS. X ;;(mail-position-on-field "Posting-Software") X ;;(insert "GNUS: NNTP-based News Reader for GNU Emacs") X ;; Insert Distribution: field. X ;; Suggested by ichikawa@flab.fujitsu.junet. X (mail-position-on-field "Distribution") X (insert (or distribution gnus-default-distribution "")) X (goto-char (point-max))) X (message ""))) X X(defun gnus-post-news () X "Begin editing a new USENET news article to be posted. X XType \\[describe-mode] once editing the article to get a list of commands." X (interactive) X (if (y-or-n-p "Are you sure you want to post to all of USENET? ") X (let ((buffer (current-buffer)) X (subject nil) X (newsgroups nil) X (distribution nil)) X (save-restriction X (and (not (zerop (buffer-size))) X ;;(equal major-mode 'news-mode) X (equal major-mode 'gnus-Article-mode) X (progn X ;;(news-show-all-headers) X (gnus-Article-show-all-headers) X (narrow-to-region (point-min) (progn (goto-char (point-min)) X (search-forward "\n\n") X (- (point) 2))))) X (setq news-reply-yank-from (mail-fetch-field "from") X news-reply-yank-message-id (mail-fetch-field "message-id"))) X (pop-to-buffer "*post-news*") X (news-reply-mode) X (erase-buffer) X ;; Ask newsgroups, subject and distribution if you are a X ;; novice user. X ;; Suggested by yuki@flab.fujitsu.junet. X (if gnus-novice-user X (progn X ;; Subscribed newsgroup names are required for X ;; completing read of newsgroup. X (or gnus-newsrc-assoc X (gnus-read-newsrc-file)) X ;; Which do you like? (UMERIN) X ;; (setq newsgroups (read-string "Newsgroups: " "general")) X (setq newsgroups X (completing-read "Newsgroup: " gnus-newsrc-assoc X nil 'require-match)) X (setq subject (read-string "Subject: ")) X (setq distribution (substring newsgroups 0 X (string-match "\\." newsgroups))) X (if (string-equal distribution newsgroups) X ;; Newsgroup may be general or control. In this X ;; case, use default distribution. X (setq distribution gnus-default-distribution)) X (setq distribution X (read-string "Distribution: " distribution)) X (if (string-equal distribution "") X (setq distribution nil)) X )) X (news-setup () subject () newsgroups buffer) X ;; Make sure the article is posted by GNUS. X ;;(mail-position-on-field "Posting-Software") X ;;(insert "GNUS: NNTP-based News Reader for GNU Emacs") X ;; Insert Distribution: field. X ;; Suggested by ichikawa@flab.fujitsu.junet. X (mail-position-on-field "Distribution") X (insert (or distribution gnus-default-distribution "")) X (goto-char (point-max)) X ) X (message ""))) X X;; `news-inews' in `newspost.el' is re-defined. X X(defun news-inews () X "Send a news message using NNTP." X (interactive) X (let* (newsgroups X subject X (case-fold-search nil) X (server-running (nntp-server-opened))) X (save-excursion X ;; It is possible to post a news without reading news using X ;; `gnus' before. X ;; Suggested by yuki@flab.fujitsu.junet. X (gnus-start-news-server) ;Use default NNTP server. X ;; NNTP server must be opened before current buffer is modified. X (save-restriction X (goto-char (point-min)) X (search-forward (concat "\n" mail-header-separator "\n")) X (narrow-to-region (point-min) (point)) X (setq newsgroups (mail-fetch-field "newsgroups") X subject (mail-fetch-field "subject"))) X (widen) X (goto-char (point-min)) X (search-forward (concat "\n" mail-header-separator "\n")) X (replace-match "\n\n") X (goto-char (point-max)) X ;; require a newline at the end for inews to append .signature to X (or (= (preceding-char) ?\n) X (insert ?\n)) X (message "Posting to USENET...") X ;; Call inews. X ;;(call-process-region (point-min) (point-max) X ;; news-inews-program nil 0 nil X ;; "-h" ; take all header lines! X ;; "-t" subject X ;; "-n" newsgroups) X ;; Post to NNTP server. X (if (gnus-inews) X (message "Posting to USENET... done.") X (ding) (message "Article's rejected: %s" (nntp-status-message))) X (goto-char (point-min)) ;restore internal header separator X (search-forward "\n\n") X (replace-match (concat "\n" mail-header-separator "\n")) X (set-buffer-modified-p nil)) X ;; If NNTP server is opened by `news-inews', close it by myself. X (or server-running X (nntp-close-server)) X (and (fboundp 'bury-buffer) (bury-buffer)))) X X(defun gnus-inews () X "NNTP inews interface." X (let ((signature (expand-file-name "~/.signature" nil)) X (distribution nil)) X (save-excursion X (copy-to-buffer " *GNUS-posting*" (point-min) (point-max)) X (set-buffer " *GNUS-posting*") X ;; Get distribution. X (save-restriction X (goto-char (point-min)) X (search-forward "\n\n") X (narrow-to-region (point-min) (point)) X (setq distribution (mail-fetch-field "distribution"))) X (widen) X ;; Change signature file by distribution. X ;; Suggested by hyoko@flab.fujitsu.junet. X (if (file-exists-p (concat signature "-" distribution)) X (setq signature (concat signature "-" distribution))) X ;; Insert signature. X (if (file-exists-p signature) X (progn X (goto-char (point-max)) X (insert "--\n") X (insert-file-contents signature))) X ;; Prepare article headers. X (save-restriction X (goto-char (point-min)) X (search-forward "\n\n") X (narrow-to-region (point-min) (point)) X (gnus-inews-insert-headers)) X (widen) X ;; Save author copy of posted article. The article must be X ;; copied before being posted because `nntp-request-post' X ;; modifies the buffer. X (cond ((and (stringp gnus-author-copy-file) X (string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" X gnus-author-copy-file)) X (let ((program (substring gnus-author-copy-file X (match-beginning 1) X (match-end 1)))) X ;; Suggested by yuki@flab.fujitsu.junet. X ;; Pipe out article to named program. X (call-process-region (point-min) (point-max) shell-file-name X nil nil nil "-c" program) X )) X ((stringp gnus-author-copy-file) X ;; Suggested by hyoko@flab.fujitsu.junet. X ;; Save article in Unix mail format. X ;; This is much convenient for Emacs user. X (rmail-output gnus-author-copy-file))) X ;; Post article to NNTP server. X ;; Return NIL if post failed. X (prog1 X (nntp-request-post) X (kill-buffer (current-buffer))) X ))) X X(defun gnus-inews-control-cancel () X "Cancel an article you posted." X (let ((from nil) X (newsgroups nil) X (message-id nil) X (distribution nil)) X (save-excursion X ;; Get header info. from original article. X (save-restriction X (gnus-Article-show-all-headers) X (goto-char (point-min)) X (search-forward "\n\n") X (narrow-to-region (point-min) (point)) X (setq from (mail-fetch-field "from")) X (setq newsgroups (mail-fetch-field "newsgroups")) X (setq message-id (mail-fetch-field "message-id")) X (setq distribution (mail-fetch-field "distribution"))) X ;; Verify the article is absolutely user's by comparing user id X ;; with value of its From: field. X (if (not (string-equal (downcase (mail-strip-quoted-names from)) X (downcase (gnus-inews-user-name)))) X (message "The article's not yours.") X ;; Make control article. X (set-buffer (get-buffer-create " *GNUS-posting*")) X (erase-buffer) X (insert "Newsgroups: " newsgroups "\n" X "Subject: cancel " message-id "\n" X "Control: cancel " message-id "\n" X ;; We should not use the value of X ;; `gnus-default-distribution' as default value, X ;; because distribution must be as same as original X ;; article. X "Distribution: " (or distribution "") "\n" X ) X ;; Prepare article headers. X (gnus-inews-insert-headers) X (goto-char (point-max)) X ;; Insert empty line. X (insert "\n") X ;; Post control article to NNTP server. X (message "Canceling your article...") X (if (nntp-request-post) X (message "Canceling your article... Done.") X (message "Failed to cancel your article.")) X (kill-buffer (current-buffer)) X )) X )) X X(defun gnus-inews-insert-headers () X "Prepare article headers. XPath:, From:, Subject:, Message-ID: and Distribution: are generated. XOrganization: is optional." X (save-excursion X (let* ((login-name (gnus-inews-login-name)) X (domain-name (gnus-inews-domain-name)) X ;; Message-ID should not contain slash `/' and should be X ;; terminated by a number. I don't know the reason why it X ;; is so. (UMERIN@flab) X (id (gnus-inews-message-id login-name)) X (organization (or (getenv "ORGANIZATION") gnus-your-organization))) X ;; Insert from top of headers. X (goto-char (point-min)) X (insert "Path: " gnus-server-host "!" login-name "\n" X "From: " (gnus-inews-user-name) X (if (or (string-equal gnus-user-full-name "") X (string-equal gnus-user-full-name "&")) X "\n" X (concat " (" gnus-user-full-name ")\n")) X ) X ;; If there is no subject, make Subject: field. X (or (mail-fetch-field "subject") X (insert "Subject: \n")) X ;; Insert random headers. X (insert "Message-ID: <" id "@" domain-name ">\n") X ;; Insert buggy date (time zone is ignored), but I don't worry X ;; about it since inews will rewrite it. X (insert "Date: " (gnus-inews-date) "\n") X (if organization X (insert "Organization: " organization "\n")) X (or (mail-fetch-field "distribution") X (insert "Distribution: \n")) X ))) X X(defun gnus-inews-user-name () X "Return user's network address." X (concat (gnus-inews-login-name) X "@" X (gnus-inews-domain-name gnus-use-generic-from))) X X(defun gnus-inews-login-name () X "Return user's login name." X (or (getenv "USER") X (getenv "LOGNAME") X (user-login-name))) X X(defun gnus-inews-domain-name (&optional genericfrom) X "Return user's domain name. XIf optional argument GENERICFROM is non-nil, don't insert local host Xname to the domain name." X (let ((domain (or (getenv "DOMAINNAME") gnus-your-domain))) X (if (and (null domain) X (not (string-match "\\." (system-name)))) X (progn X (setq domain (read-string "Your domain name (no host): ")) X (setq gnus-your-domain domain))) X (if (string-equal "." (substring domain 0 1)) X (setq domain (substring domain 1))) X (if genericfrom X ;; Support GENERICFROM as same as standard Bnews system. X ;; Suggested by ohm@kaba.junet. X (if (string-match "^[^.]+\\.\\(.+\\)" (system-name)) X ;; Remove host name from full internet name. X (substring (system-name) (match-beginning 1)) X domain X ) X (if (or (string-equal domain "") X (string-match "\\." (system-name))) ;Full internet name. X ;; Assume function `system-name' returns full internet name. X ;; Suggested by Mike DeCorte. X (system-name) X (concat (system-name) X ;; Host name and domain name must be separated by X ;; one period `.'. X "." domain X ) X )) X )) X X(defun gnus-inews-message-id (name) X "Generate unique message-ID for NAMEd user." X (let ((date (current-time-string))) X (if (string-match "^[^ ]+ \\([^ ]+\\)[ ]+\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) [0-9][0-9]\\([0-9][0-9]\\)" X date) X (concat (upcase name) "." X (substring date (match-beginning 6) (match-end 6)) ;Year X (substring date (match-beginning 1) (match-end 1)) ;Month X (substring date (match-beginning 2) (match-end 2)) ;Day X (substring date (match-beginning 3) (match-end 3)) ;Hour X (substring date (match-beginning 4) (match-end 4)) ;Minute X (substring date (match-beginning 5) (match-end 5)) ;Second X ) X (error "Cannot understand current-time-string: %s." date)) X )) X X(defun gnus-inews-date () X "Bnews date format string of today. Time zone is ignored." X (let ((date (current-time-string))) X (if (string-match "^[^ ]+ \\([^ ]+\\)[ ]+\\([0-9]+\\) \\([0-9:]+\\) [0-9][0-9]\\([0-9][0-9]\\)" X date) X (concat (substring date (match-beginning 2) (match-end 2)) ;Day X " " X (substring date (match-beginning 1) (match-end 1)) ;Month X " " X (substring date (match-beginning 4) (match-end 4)) ;Year X " " X (substring date (match-beginning 3) (match-end 3))) ;Time X (error "Cannot understand current-time-string: %s." date)) X )) X X X;;Local variables: X;;eval: (put 'eval-in-buffer-window 'lisp-indent-hook 1) X;;end: SHAR_EOF chmod 0444 gnus.el || echo "restore of gnus.el fails" set `wc -c gnus.el`;Sum=$1 if test "$Sum" != "129600" then echo original size 129600, current size $Sum;fi sed 's/^X//' << 'SHAR_EOF' > nnspool.el && X;;; Spool patches to NNTP package for GNU Emacs X;; Copyright (C) 1988 Fujitsu Laboratoris LTD. X;; Copyright (C) 1988 Masanobu UMEDA (umerin@flab.flab.Fujitsu.JUNET) X;; $Header: nnspool.el,v 1.5 88/09/19 11:03:43 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(provide 'nnspool) X(require 'nntp) X X(defvar nnspool-inews-program news-inews-program X "Program to post news.") X X(defvar nnspool-spool-directory news-path X "Local news spool directory.") X X(defvar nnspool-active-file "/usr/lib/news/active" X "Local news active file.") X X(defvar nnspool-current-directory nil X "Current news group directory.") X X;;; X;;; Replacement of Extended Command for retrieving many headers. X;;; X X(defun nntp-retrieve-headers (sequence) X "Return list of article headers specified by SEQUENCE of article id. XThe format of list is `([NUMBER SUBJECT FROM XREF LINES DATE MESSAGE-ID] ...)'. XReader macros for the vector are defined as `nntp-header-FIELD'. XWriter macros for the vector are defined as `nntp-set-header-FIELD'. XNews group must be selected before calling me." X (save-excursion X (set-buffer nntp-server-buffer) X ;;(erase-buffer) X (let ((file nil) X (number (length sequence)) X (count 0) X (headers nil) ;Result list. X (article 0) X (subject nil) X (message-id nil) X (from nil) X (xref nil) X (lines 0) X (date nil)) X (while sequence X ;;(nntp-send-strings-to-server "HEAD" (car sequence)) X (setq article (car sequence)) X (setq file (concat nnspool-current-directory X (prin1-to-string article))) X (if (and (file-exists-p file) X (not (file-directory-p file))) X (progn X (erase-buffer) X (insert-file-contents file) X (goto-char (point-min)) X (search-forward "\n\n" nil 'move) X (narrow-to-region (point-min) (point)) X ;; Extract From: X (goto-char (point-min)) X (if (search-forward "\nFrom: " nil t) X (setq from (buffer-substring X (point) X (save-excursion (end-of-line) (point)))) X (setq from "Unknown User")) X ;; Extract Subject: X (goto-char (point-min)) X (if (search-forward "\nSubject: " nil t) X (setq subject (buffer-substring X (point) X (save-excursion (end-of-line) (point)))) X (setq subject "(None)")) X ;; Extract Message-ID: X (goto-char (point-min)) X (if (search-forward "\nMessage-ID: " nil t) X (setq message-id (buffer-substring X (point) X (save-excursion (end-of-line) (point)))) X (setq message-id nil)) X ;; Extract Date: X (goto-char (point-min)) X (if (search-forward "\nDate: " nil t) X (setq date (buffer-substring X (point) X (save-excursion (end-of-line) (point)))) X (setq date nil)) X ;; Extract Lines: X (goto-char (point-min)) X (if (search-forward "\nLines: " nil t) X (setq lines (string-to-int X (buffer-substring X (point) X (save-excursion (end-of-line) (point))))) X (setq lines 0)) X ;; Extract Xref: X (goto-char (point-min)) X (if (search-forward "\nXref: " nil t) X (setq xref (buffer-substring X (point) X (save-excursion (end-of-line) (point)))) X (setq xref nil)) X (setq headers X (cons (vector article subject from X xref lines date message-id) X headers)) X )) X (setq sequence (cdr sequence)) X (setq count (1+ count)) X (if (and (> number 100) X (zerop (% count 20))) X (message "NNSPOOL: %d%% of headers received." X (/ (* count 100) number))) X ) X (if (> number 100) X (message "NNSPOOL: 100%% of headers received.")) X (nreverse headers) X ))) X X X;;; X;;; Replacement of NNTP Raw Interface. X;;; X X(defun nntp-open-server (host &optional service) X "Open news server on HOST. XIf HOST is nil, use value of environment variable `NNTPSERVER'. XIf optional argument SERVICE is non-nil, open by the service name." X (let ((host (or host X (getenv "NNTPSERVER") X (error "NNSPOOL: no server host is specified.")))) X (setq nntp-status-message-string "") X (if (and (file-directory-p nnspool-spool-directory) X (file-exists-p nnspool-active-file)) X (nntp-open-server-internal host service) X (setq nntp-status-message-string X (format "%s has no news spool. Goodbye." host)) X nil X ) X )) X X(defun nntp-close-server () X "Close news server." X (nntp-close-server-internal)) X X(fset 'nntp-request-quit (symbol-function 'nntp-close-server)) X X(defun nntp-server-opened () X "Return server process status, T or NIL. XIf the stream is opened, return T, otherwise return NIL." X (and nntp-server-buffer X (get-buffer nntp-server-buffer))) X X(defun nntp-status-message () X "Return server status response as string." X nntp-status-message-string X ) X X(defun nntp-request-article (id) X "Select article by message ID (or number)." X (let ((file (concat nnspool-current-directory (prin1-to-string id)))) X (if (and (file-exists-p file) X (not (file-directory-p file))) X (save-excursion X (nnspool-find-file file))) X )) X X(defun nntp-request-body (id) X "Select article body by message ID (or number)." X (if (nntp-request-article id) X (save-excursion X (set-buffer nntp-server-buffer) X (goto-char (point-min)) X (if (search-forward "\n\n" nil t) X (delete-region (point-min) (point))) X t X ) X )) X X(defun nntp-request-head (id) X "Select article head by message ID (or number)." X (if (nntp-request-article id) X (save-excursion X (set-buffer nntp-server-buffer) X (goto-char (point-min)) X (if (search-forward "\n\n" nil t) X (delete-region (1- (point)) (point-max))) X t X ) X )) X X(defun nntp-request-stat (id) X "Select article by message ID (or number)." X (error "NNSPOOL: STAT is not implemented.")) X X(defun nntp-request-group (group) X "Select news GROUP." X (let ((pathname (nnspool-article-pathname group))) X (if (file-directory-p pathname) X (setq nnspool-current-directory pathname)) X )) X X(defun nntp-request-list () X "List valid newsgoups." X (save-excursion X (nnspool-find-file nnspool-active-file))) X X(defun nntp-request-last () X "Set current article pointer to the previous article Xin the current news group." X (error "NNSPOOL: LAST is not implemented.")) X X(defun nntp-request-next () X "Advance current article pointer." X (error "NNSPOOL: NEXT is not implemented.")) X X(defun nntp-request-post () X "Post a new news in current buffer." X (save-excursion X ;; We have to work in the server buffer because of NEmacs hack. X (copy-to-buffer nntp-server-buffer (point-min) (point-max)) X (set-buffer nntp-server-buffer) X (call-process-region (point-min) (point-max) X nnspool-inews-program 'delete t nil X "-h") X (prog1 X (or (zerop (buffer-size)) X ;; If inews returns strings, it must be error message X ;; unless SPOOLNEWS is defined. X ;; This condition is very week, but there is no good rule X ;; identifying errors when SPOOLNEWS is defined. X ;; Suggested by ohm@kaba.junet. X (string-match "spooled" X (buffer-substring (point-min) (point-max)))) X ;; Make status message by unfolding lines. X (subst-char-in-region (point-min) (point-max) ?\n ?\\ 'noundo) X (setq nntp-status-message-string X (buffer-substring (point-min) (point-max))) X (erase-buffer)) X )) X X X;;; X;;; Replacement of Low-Level Interface to NNTP Server. X;;; X X(defun nntp-open-server-internal (host &optional service) X "Open connection to news server on HOST by SERVICE (default is nntp)." X (save-excursion X (if (not (string-equal host (system-name))) X (error "NNSPOOL: Load `nntp' again if you'd like to talk to %s." host)) X ;; Initialize communication buffer. X (setq nntp-server-buffer (get-buffer-create " *nntpd*")) X (set-buffer nntp-server-buffer) X (kill-all-local-variables) X (erase-buffer) X (setq nntp-server-process nil) X ;; It is possible to change kanji-fileio-code in this hook. X (run-hooks 'nntp-server-hook) X t X )) X X(defun nntp-close-server-internal () X "Close connection to news server." X (if nntp-server-buffer X (kill-buffer nntp-server-buffer)) X (setq nntp-server-buffer nil) X (setq nntp-server-process nil)) X X(defun nnspool-find-file (file) X "Insert FILE in server buffer safely." X (set-buffer nntp-server-buffer) X (erase-buffer) X (condition-case () X (progn (insert-file-contents file) t) X (file-error nil) X )) X X(defun nnspool-article-pathname (group) X "Make pathname to news GROUP." X (let ((group (substring group 0)) ;Copy string. X (len (length group)) X (idx 0)) X ;; Replace all occurence of `.' with `/'. X (while (< idx len) X (if (= (aref group idx) ?.) X (aset group idx ?/)) X (setq idx (1+ idx))) X (concat nnspool-spool-directory group "/") X )) SHAR_EOF chmod 0444 nnspool.el || echo "restore of nnspool.el fails" set `wc -c nnspool.el`;Sum=$1 if test "$Sum" != "9488" then echo original size 9488, current size $Sum;fi sed 's/^X//' << 'SHAR_EOF' > nntp.el && X;;; NNTP (RFC977) Interface 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: nntp.el,v 3.5 88/09/19 11:01:51 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;; This implementation is tested on both 1.2a and 1.5 version of NNTP X;; package. X X;; Trouble shooting of NNTP X;; X;; (1) Select routine may signal an error or fall into infinite loop X;; while waiting for server response. In this case, you'd better not X;; use byte-compiled code but original source. If you still have a X;; trouble with it, set variable `nntp-buggy-select' to T. X;; X;; (2) Emacs may hang while retrieving headers since too many requests X;; have been sent to news server without reading their replies. In X;; this case, reduce number of requests sent to the server at once by X;; setting smaller value to `nntp-maximum-request'. X;; X;; (3) If TCP/IP stream (open-network-stream) is not supported by X;; emacs, compile and install `tcp.el' and `tcp.c' which is an X;; emulation program of the stream. If you modified `tcp.c' for your X;; system, please send me the diffs. I'll include it in the future X;; release. X X(provide 'nntp) X X(defvar nntp-server-hook nil X "*Hooks for NNTP news server. XIf Kanji code of news server is different from local kanji code, you Xhave to put the following code in your .emacs file: X X(setq nntp-server-hook X '(lambda () X ;; Server's Kanji code is EUC (NEmacs hack). X (make-local-variable 'kanji-fileio-code) X (setq kanji-fileio-code 0)))") X X(defvar nntp-buggy-select (memq system-type '(usg-unix-v fujitsu-uts)) X "*T if select routine is buggy. XIf select routine signals error or fall into infinite loop while Xwaiting for server response, the value must be set to T. XIn case of Fujitsu UTS it is set to T since `accept-process-output' Xdoesn't work properly.") X X(defvar nntp-maximum-request 400 X "*Maximum number of requests sent to news server at once. XIf Emacs hangs while retrieving headers, set smaller value than the default.") X X(defvar nntp-server-buffer nil X "Buffer associated with NNTP news server process.") X X(defvar nntp-server-process nil X "NNTP news server process. XYou'd better not use this variable in NNTP front-end program but Xinstead use `nntp-server-buffer'.") X X(defvar nntp-status-message-string nil X "Save server response message. XYou'd better not use this variable in NNTP front-end program but SHAR_EOF echo "End of part 3, continue with part 4" echo "4" > s2_seq_.tmp exit 0 -- Masanobu UMEDA umerin@flab.flab.Fujitsu.JUNET umerin%flab.flab.Fujitsu.JUNET@uunet.uu.NET