diff lisp/gnus/nnheader.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 0293115a14e9
line wrap: on
line diff
--- a/lisp/gnus/nnheader.el	Mon Aug 13 08:45:53 2007 +0200
+++ b/lisp/gnus/nnheader.el	Mon Aug 13 08:46:35 2007 +0200
@@ -570,6 +570,40 @@
     (while (re-search-forward "\r$" nil t)
       (delete-backward-char 1))))
 
+(defun nnheader-file-size (file)
+  "Return the file size of FILE or 0."
+  (or (nth 7 (file-attributes file)) 0))
+
+(defun nnheader-find-etc-directory (package)
+  "Go through the path and find the \".../etc/PACKAGE\" directory."
+  (let ((path load-path)
+	dir result)
+    ;; We try to find the dir by looking at the load path,
+    ;; stripping away the last component and adding "etc/".
+    (while path
+      (if (and (car path)
+	       (file-exists-p
+		(setq dir (concat
+			   (file-name-directory
+			    (directory-file-name (car path)))
+			   "etc/" package "/")))
+	       (file-directory-p dir))
+	  (setq result dir
+		path nil)
+	(setq path (cdr path))))
+    result))
+
+(defvar ange-ftp-path-format)
+(defvar efs-path-regexp)
+(defun nnheader-re-read-dir (path)
+  "Re-read directory PATH if PATH is on a remote system."
+    (if (and (fboundp 'efs-re-read-dir) (boundp 'efs-path-regexp))
+	(when (string-match efs-path-regexp path)
+	  (efs-re-read-dir path))
+     (if (and (fboundp 'ange-ftp-re-read-dir) (boundp 'ange-ftp-path-format))
+      (when (string-match (car ange-ftp-path-format) path)
+	(ange-ftp-re-read-dir path)))))
+
 (fset 'nnheader-run-at-time 'run-at-time)
 (fset 'nnheader-cancel-timer 'cancel-timer)
 (fset 'nnheader-find-file-noselect 'find-file-noselect)