X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fnnmbox.el;h=5c3a674c03d905d9296c1b1fb0205a369e6de223;hb=31ac812d0664c72238c6c2266c35d478474c7697;hp=38f36c28b4ef1ad60821b84d884e8543d1d1dbdd;hpb=09868cf7efbfa51562d76580eafc9a7b6b0c8d72;p=elisp%2Fgnus.git- diff --git a/lisp/nnmbox.el b/lisp/nnmbox.el index 38f36c2..5c3a674 100644 --- a/lisp/nnmbox.el +++ b/lisp/nnmbox.el @@ -24,11 +24,13 @@ ;;; Code: +(eval-when-compile (require 'cl)) +(eval-when-compile (require 'static)) + (require 'nnheader) (require 'message) (require 'nnmail) (require 'nnoo) -(eval-when-compile (require 'cl)) (nnoo-declare nnmbox) @@ -59,9 +61,9 @@ (defvoo nnmbox-group-alist nil) (defvoo nnmbox-active-timestamp nil) -(defvoo nnmbox-file-coding-system mm-text-coding-system) +(defvoo nnmbox-file-coding-system nnheader-text-coding-system) (defvoo nnmbox-file-coding-system-for-write nil) -(defvoo nnmbox-active-file-coding-system mm-text-coding-system) +(defvoo nnmbox-active-file-coding-system nnheader-text-coding-system) (defvoo nnmbox-active-file-coding-system-for-write nil) @@ -186,11 +188,18 @@ (1+ (- (cdr active) (car active))) (car active) (cdr active) group))))) -(defun nnmbox-save-buffer () - (let ((coding-system-for-write - (or nnmbox-file-coding-system-for-write - nnmbox-file-coding-system))) - (save-buffer))) +(static-if (boundp 'MULE) + (defun nnmbox-save-buffer () + (let ((output-coding-system + (or nnmbox-file-coding-system-for-write + nnmbox-file-coding-system))) + (save-buffer))) + (defun nnmbox-save-buffer () + (let ((coding-system-for-write + (or nnmbox-file-coding-system-for-write + nnmbox-file-coding-system))) + (save-buffer))) + ) (defun nnmbox-save-active (group-alist active-file) (let ((nnmail-active-file-coding-system @@ -243,7 +252,7 @@ (nnheader-report 'nnmbox "LIST NEWSGROUPS is not implemented.")) (deffoo nnmbox-request-expire-articles - (articles newsgroup &optional server force) + (articles newsgroup &optional server force) (nnmbox-possibly-change-newsgroup newsgroup server) (let* ((is-old t) rest) @@ -278,7 +287,7 @@ (nconc rest articles)))) (deffoo nnmbox-request-move-article - (article group server accept-form &optional last) + (article group server accept-form &optional last) (let ((buf (get-buffer-create " *nnmbox move*")) result) (and @@ -448,7 +457,6 @@ nnmbox-file-coding-system)) (nnheader-find-file-noselect nnmbox-mbox-file nil t)))) - (mm-enable-multibyte) (buffer-disable-undo))) (when (not nnmbox-group-alist) (nnmail-activate 'nnmbox)) @@ -519,7 +527,8 @@ (defun nnmbox-create-mbox () (when (not (file-exists-p nnmbox-mbox-file)) (let ((nnmail-file-coding-system - nnmbox-file-coding-system-for-write)) + (or nnmbox-file-coding-system-for-write + nnmbox-file-coding-system))) (nnmail-write-region 1 1 nnmbox-mbox-file t 'nomesg)))) (defun nnmbox-read-mbox () @@ -540,8 +549,7 @@ nnmbox-file-coding-system)) (nnheader-find-file-noselect nnmbox-mbox-file nil t)))) - (mm-enable-multibyte) - (buffer-disable-undo) + (buffer-disable-undo) ;; Go through the group alist and compare against ;; the mbox file. @@ -550,26 +558,31 @@ (when (and (re-search-backward (format "^X-Gnus-Newsgroup: %s:\\([0-9]+\\) " (caar alist)) nil t) - (>= (setq number - (string-to-number - (buffer-substring - (match-beginning 1) (match-end 1)))) - (cdadar alist))) - (setcdr (cadar alist) (1+ number))) + (> (setq number + (string-to-number + (buffer-substring + (match-beginning 1) (match-end 1)))) + (cdadar alist))) + (setcdr (cadar alist) number)) (setq alist (cdr alist))) (goto-char (point-min)) (while (re-search-forward delim nil t) (setq start (match-beginning 0)) - (when (not (search-forward "\nX-Gnus-Newsgroup: " - (save-excursion - (setq end - (or - (and - (re-search-forward delim nil t) - (match-beginning 0)) - (point-max)))) - t)) + (unless (search-forward + "\nX-Gnus-Newsgroup: " + (save-excursion + (setq end + (or + (and + ;; skip to end of headers first, since mail + ;; which has been respooled has additional + ;; "From nobody" lines. + (search-forward "\n\n" nil t) + (re-search-forward delim nil t) + (match-beginning 0)) + (point-max)))) + t) (save-excursion (save-restriction (narrow-to-region start end)