;;; nnmh.el --- mhspool access for Gnus
-;; Copyright (C) 1995,96 Free Software Foundation, Inc.
-;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
-;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
+;; Copyright (C) 1995-2011 Free Software Foundation, Inc.
+
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
+;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
;; Keywords: news, mail
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Based on nnspool.el by Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>.
;; For an overview of what the interface functions do, please see the
-;; Gnus sources.
+;; Gnus sources.
;;; Code:
(require 'nnheader)
(require 'nnmail)
-(require 'gnus)
+(require 'gnus-start)
(require 'nnoo)
-(eval-and-compile (require 'cl))
+(eval-when-compile (require 'cl))
(nnoo-declare nnmh)
(defvoo nnmh-directory message-directory
- "*Mail spool directory.")
+ "Mail spool directory.")
(defvoo nnmh-get-new-mail t
- "*If non-nil, nnmh will check the incoming mail file and split the mail.")
+ "If non-nil, nnmh will check the incoming mail file and split the mail.")
(defvoo nnmh-prepare-save-mail-hook nil
- "*Hook run narrowed to an article before saving.")
+ "Hook run narrowed to an article before saving.")
(defvoo nnmh-be-safe nil
- "*If non-nil, nnmh will check all articles to make sure whether they are new or not.")
+ "If non-nil, nnmh will check all articles to make sure whether they are new or not.
+Go through the .nnmh-articles file and compare with the actual
+articles in this folder. The articles that are \"new\" will be marked
+as unread by Gnus.")
\f
(defvoo nnmh-status-string "")
(defvoo nnmh-group-alist nil)
+;; Don't even think about setting this variable. It does not exist.
+;; Forget about it. Uh-huh. Nope. Nobody here. It's only bound
+;; dynamically by certain functions in nndraft.
+(defvar nnmh-allow-delete-final nil)
\f
(nnoo-define-basics nnmh)
(deffoo nnmh-retrieve-headers (articles &optional newsgroup server fetch-old)
- (save-excursion
- (set-buffer nntp-server-buffer)
+ (with-current-buffer nntp-server-buffer
(erase-buffer)
(let* ((file nil)
(number (length articles))
(large (and (numberp nnmail-large-newsgroup)
(> number nnmail-large-newsgroup)))
(count 0)
+ (file-name-coding-system nnmail-pathname-coding-system)
beg article)
(nnmh-possibly-change-directory newsgroup server)
;; We don't support fetching by Message-ID.
(if (stringp (car articles))
'headers
(while articles
- (when (and (file-exists-p
- (setq file (concat (file-name-as-directory
+ (when (and (file-exists-p
+ (setq file (concat (file-name-as-directory
nnmh-current-directory)
(int-to-string
(setq article (pop articles))))))
(and large
(zerop (% count 20))
- (message "nnmh: Receiving headers... %d%%"
- (/ (* count 100) number))))
+ (nnheader-message 5 "nnmh: Receiving headers... %d%%"
+ (/ (* count 100) number))))
- (and large (message "nnmh: Receiving headers...done"))
+ (when large
+ (nnheader-message 5 "nnmh: Receiving headers...done"))
(nnheader-fold-continuation-lines)
'headers))))
(condition-case ()
(make-directory nnmh-directory t)
(error t)))
- (cond
+ (cond
((not (file-exists-p nnmh-directory))
(nnmh-close-server)
(nnheader-report 'nnmh "Couldn't create directory: %s" nnmh-directory))
(let ((file (if (stringp id)
nil
(concat nnmh-current-directory (int-to-string id))))
+ (file-name-coding-system nnmail-pathname-coding-system)
(nntp-server-buffer (or buffer nntp-server-buffer)))
(and (stringp file)
(file-exists-p file)
(not (file-directory-p file))
(save-excursion (nnmail-find-file file))
- (string-to-int (file-name-nondirectory file)))))
+ (string-to-number (file-name-nondirectory file)))))
-(deffoo nnmh-request-group (group &optional server dont-check)
+(deffoo nnmh-request-group (group &optional server dont-check info)
+ (nnheader-init-server-buffer)
+ (nnmh-possibly-change-directory group server)
(let ((pathname (nnmail-group-pathname group nnmh-directory))
+ (file-name-coding-system nnmail-pathname-coding-system)
dir)
- (cond
+ (cond
((not (file-directory-p pathname))
- (nnheader-report
+ (nnheader-report
'nnmh "Can't select group (no such directory): %s" group))
(t
(setq nnmh-current-directory pathname)
- (and nnmh-get-new-mail
+ (and nnmh-get-new-mail
nnmh-be-safe
(nnmh-update-gnus-unreads group))
(cond
(nnheader-report 'nnmh "Selected group %s" group)
t)
(t
- (setq dir
+ ;; Re-scan&nb