*** empty log message ***
[gnus] / lisp / nnheader.el
index 97c842b..5751973 100644 (file)
@@ -1,5 +1,5 @@
 ;;; nnheader.el --- header access macros for Gnus and its backends
-;; Copyright (C) 1987,88,89,90,93,94,95,96,97 Free Software Foundation, Inc.
+;; Copyright (C) 1987,88,89,90,93,94,95,96,97,98 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;;     Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
@@ -59,7 +59,10 @@ on your system, you could say something like:
  (autoload 'mail-position-on-field "sendmail")
  (autoload 'message-remove-header "message")
  (autoload 'cancel-function-timers "timers")
- (autoload 'gnus-point-at-eol "gnus-util"))
+ (autoload 'gnus-point-at-eol "gnus-util")
+ (autoload 'gnus-delete-line "gnus-util")
+ (autoload 'gnus-buffer-live-p "gnus-util")
+ (autoload 'gnus-encode-coding-string "gnus-ems"))
 
 ;;; Header access macros.
 
@@ -166,7 +169,7 @@ on your system, you could say something like:
   (let ((case-fold-search t)
        (cur (current-buffer))
        (buffer-read-only nil)
-       in-reply-to lines p)
+       in-reply-to lines p ref)
     (goto-char (point-min))
     (when naked
       (insert "\n"))
@@ -214,8 +217,9 @@ on your system, you could say something like:
             (goto-char p)
             (if (search-forward "\nmessage-id:" nil t)
                 (buffer-substring
-                 (1- (or (search-forward "<" nil t) (point)))
-                 (or (search-forward ">" nil t) (point)))
+                 (1- (or (search-forward "<" (gnus-point-at-eol) t)
+                         (point)))
+                 (or (search-forward ">" (gnus-point-at-eol) t) (point)))
               ;; If there was no message-id, we just fake one to make
               ;; subsequent routines simpler.
               (nnheader-generate-fake-message-id)))
@@ -230,8 +234,14 @@ on your system, you could say something like:
               (if (and (search-forward "\nin-reply-to: " nil t)
                        (setq in-reply-to (nnheader-header-value))
                        (string-match "<[^>]+>" in-reply-to))
-                  (substring in-reply-to (match-beginning 0)
-                             (match-end 0))
+                  (let (ref2)
+                    (setq ref (substring in-reply-to (match-beginning 0)
+                                         (match-end 0)))
+                    (while (string-match "<[^>]+>" in-reply-to (match-end 0))
+                      (setq ref2 (substring in-reply-to (match-beginning 0)
+                                            (match-end 0)))
+                      (when (> (length ref2) (length ref))
+                        (setq ref ref2))))
                 "")))
           ;; Chars.
           0
@@ -744,8 +754,7 @@ If FILE, find the \".../etc/PACKAGE\" file instead."
       (when (string-match (car ange-ftp-path-format) path)
        (ange-ftp-re-read-dir path)))))
 
-;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
-(defvar nnheader-file-coding-system nil
+(defvar nnheader-file-coding-system 'raw-text
   "Coding system used in file backends of Gnus.")
 
 (defun nnheader-insert-file-contents (filename &optional visit beg end replace)
@@ -758,7 +767,6 @@ find-file-hooks, etc.
        (auto-mode-alist (nnheader-auto-mode-alist))
        (default-major-mode 'fundamental-mode)
         (after-insert-file-functions nil)
-       ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
        (coding-system-for-read nnheader-file-coding-system))
     (insert-file-contents filename visit beg end replace)))
 
@@ -768,7 +776,6 @@ find-file-hooks, etc.
        (default-major-mode 'fundamental-mode)
        (enable-local-variables nil)
         (after-insert-file-functions nil)
-       ;; 1997/5/16 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
        (coding-system-for-read nnheader-file-coding-system))
     (apply 'find-file-noselect args)))
 
@@ -792,6 +799,16 @@ find-file-hooks, etc.
       (pop files))
     (nreverse out)))
 
+(defun nnheader-directory-files (&rest args)
+  "Same as `directory-files', but prune \".\" and \"..\"."
+  (let ((files (apply 'directory-files args))
+       out)
+    (while files
+      (unless (member (file-name-nondirectory (car files)) '("." ".."))
+       (push (car files) out))
+      (pop files))
+    (nreverse out)))
+
 (defmacro nnheader-skeleton-replace (from &optional to regexp)
   `(let ((new (generate-new-buffer " *nnheader replace*"))
         (cur (current-buffer))