X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fnnheader.el;h=c777023046653472d5e0e7fcf9138bd51636c52f;hb=4c4ee2ed7b5f6c14942c73a92ff0a761b78fe2dd;hp=f70171b966aaa730ef8b40e068f0bac58404dc2d;hpb=01a5793322a7c10a853ad5fef2dcbfad24e88a77;p=elisp%2Fgnus.git- diff --git a/lisp/nnheader.el b/lisp/nnheader.el index f70171b..c777023 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -189,7 +189,10 @@ This variable is a substitute for `mm-text-coding-system-for-write'.") ;; Parsing headers and NOV lines. (defsubst nnheader-header-value () - (buffer-substring (match-end 0) (gnus-point-at-eol))) + (let ((pt (point))) + (prog1 + (buffer-substring (match-end 0) (std11-field-end)) + (goto-char pt)))) (defun nnheader-parse-head (&optional naked) (let ((case-fold-search t) @@ -231,7 +234,8 @@ This variable is a substitute for `mm-text-coding-system-for-write'.") ;; From. (progn (goto-char p) - (if (search-forward "\nfrom: " nil t) + (if (or (search-forward "\nfrom: " nil t) + (search-forward "\nfrom:" nil t)) (nnheader-header-value) "(nobody)")) ;; Date. (progn @@ -793,11 +797,14 @@ list of headers that match SEQUENCE (see `nntp-retrieve-headers')." (string-match nnheader-numerical-short-files file) (string-to-int (match-string 0 file)))) +(defvar nnheader-directory-files-is-safe nil + "If non-nil, Gnus believes `directory-files' is safe. +It has been reported numerous times that `directory-files' fails with +an alarming frequency on NFS mounted file systems. If it is nil, +`nnheader-directory-files-safe' is used.") + (defun nnheader-directory-files-safe (&rest args) - ;; It has been reported numerous times that `directory-files' - ;; fails with an alarming frequency on NFS mounted file systems. - ;; This function executes that function twice and returns - ;; the longest result. + "Execute `directory-files' twice and returns the longer result." (let ((first (apply 'directory-files args)) (second (apply 'directory-files args))) (if (> (length first) (length second)) @@ -807,14 +814,20 @@ list of headers that match SEQUENCE (see `nntp-retrieve-headers')." (defun nnheader-directory-articles (dir) "Return a list of all article files in directory DIR." (mapcar 'nnheader-file-to-number - (nnheader-directory-files-safe - dir nil nnheader-numerical-short-files t))) + (if nnheader-directory-files-is-safe + (directory-files + dir nil nnheader-numerical-short-files t) + (nnheader-directory-files-safe + dir nil nnheader-numerical-short-files t)))) (defun nnheader-article-to-file-alist (dir) "Return an alist of article/file pairs in DIR." (mapcar (lambda (file) (cons (nnheader-file-to-number file) file)) - (nnheader-directory-files-safe - dir nil nnheader-numerical-short-files t))) + (if nnheader-directory-files-is-safe + (directory-files + dir nil nnheader-numerical-short-files t) + (nnheader-directory-files-safe + dir nil nnheader-numerical-short-files t)))) (defun nnheader-fold-continuation-lines () "Fold continuation lines in the current buffer." @@ -836,7 +849,8 @@ If FULL, translate everything." 2 0)) ;; We translate -- but only the file name. We leave the directory ;; alone. - (if (memq system-type '(win32 w32 mswindows windows-nt)) + (if (and (featurep 'xemacs) + (memq system-type '(win32 w32 mswindows windows-nt))) ;; This is needed on NT and stuff, because ;; file-name-nondirectory is not enough to split ;; file names, containing ':', e.g. @@ -854,7 +868,7 @@ If FULL, translate everything." (if (string-match "\\(^\\w:\\|[/\\]\\)\\([^/\\]+\\)$" file) (setq leaf (substring file (match-beginning 2)) path (substring file 0 (match-beginning 2))))) - ;; Fall back on this. + ;; Emacs DTRT, says andrewi. (setq leaf (file-name-nondirectory file) path (file-name-directory file)))) (setq len (length leaf)) @@ -1133,7 +1147,7 @@ find-file-hooks, etc. (message "%s(Y/n) Yes" prompt) t))) -(when (string-match "XEmacs" emacs-version) +(when (featurep 'xemacs) (require 'nnheaderxm)) (run-hooks 'nnheader-load-hook)