;;; nnheader.el --- header access macros for Gnus and its backends
;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996,
-;; 1997, 1998, 2000, 2001, 2002
+;; 1997, 1998, 2000, 2001, 2002, 2003
;; Free Software Foundation, Inc.
;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
;; Requiring `gnus-util' at compile time creates a circular
;; dependency between nnheader.el and gnus-util.el.
- ;(eval-when-compile (require 'gnus-util))
+;;(eval-when-compile (require 'gnus-util))
(require 'mail-utils)
(require 'mm-util)
(defvar nnheader-head-chop-length 2048
"*Length of each read operation when trying to fetch HEAD headers.")
+(defvar nnheader-read-timeout
+ (if (string-match "windows-nt\\|os/2\\|emx\\|cygwin"
+ (symbol-name system-type))
+ 1.0
+ 0.1)
+ "How long nntp should wait between checking for the end of output.
+Shorter values mean quicker response, but is more CPU intensive.")
+
(defvar nnheader-file-name-translation-alist
(let ((case-fold-search t))
(cond
\(setq nnheader-file-name-translation-alist '((?: . ?_)))")
+(defvar nnheader-directory-separator-character
+ (string-to-char (substring (file-name-as-directory ".") -1))
+ "*A character used to a directory separator.")
+
(eval-and-compile
(autoload 'nnmail-message-id "nnmail")
(autoload 'mail-position-on-field "sendmail")
(prev (point-min))
num found)
(while (not found)
- (goto-char (/ (+ max min) 2))
+ (goto-char (+ min (/ (- max min) 2)))
(beginning-of-line)
(if (or (= (point) prev)
(eobp))
(setq prev (point))
(while (and (not (numberp (setq num (read cur))))
(not (eobp)))
- (delete-region (progn (beginning-of-line) (point))
- (progn (forward-line 1) (point))))
+ (gnus-delete-line))
(cond ((> num article)
(setq max (point)))
((< num article)
;; This is invalid, but not all articles have Message-IDs.
()
(mail-position-on-field "References")
- (let ((begin (save-excursion (beginning-of-line) (point)))
+ (let ((begin (gnus-point-at-bol))
(fill-column 78)
(fill-prefix "\t"))
(when references
"Regexp that matches numerical file names.")
(defvar nnheader-numerical-full-files (concat "/" nnheader-numerical-files)
- "Regexp that matches numerical full file paths.")
+ "Regexp that matches numerical full file names.")
(defsubst nnheader-file-to-number (file)
"Take a FILE name and return the article number."
;; We translate -- but only the file name. We leave the directory
;; alone.
(if (and (featurep 'xemacs)
- (memq system-type '(cygwin32 win32 w32 mswindows windows-nt)))
+ (memq system-type '(cygwin32 win32 w32 mswindows windows-nt
+ cygwin)))
;; This is needed on NT and stuff, because
;; file-name-nondirectory is not enough to split
;; file names, containing ':', e.g.
(expand-file-name
(file-name-as-directory top))))
(error "")))
- ?/ ?.))
+ nnheader-directory-separator-character ?.))
(defun nnheader-message (level &rest args)
"Message if the Gnus backends are talkative."
(<= level gnus-verbose-backends)))
(defvar nnheader-pathname-coding-system 'iso-8859-1
- "*Coding system for pathname.")
+ "*Coding system for file name.")
(defun nnheader-group-pathname (group dir &optional file)
- "Make pathname for GROUP."
+ "Make file name for GROUP."
(concat
(let ((dir (file-name-as-directory (expand-file-name dir))))
;; If this directory exists, we use it directly.
(or (nth 7 (file-attributes file)) 0))
(defun nnheader-find-etc-directory (package &optional file)
- "Go through the path and find the \".../etc/PACKAGE\" directory.
+ "Go through `load-path' and find the \"../etc/PACKAGE\" directory.
+This function will look in the parent directory of each `load-path'
+entry, and look for the \"etc\" directory there.
If FILE, find the \".../etc/PACKAGE\" file instead."
(let ((path load-path)
dir result)
(defalias 'nnheader-cancel-function-timers 'cancel-function-timers)
(defalias 'nnheader-string-as-multibyte 'string-as-multibyte)
+(defun nnheader-accept-process-output (process)
+ (accept-process-output
+ process
+ (truncate nnheader-read-timeout)
+ (truncate (* (- nnheader-read-timeout
+ (truncate nnheader-read-timeout))
+ 1000))))
+
(when (featurep 'xemacs)
(require 'nnheaderxm))