+1999-12-02 11:14:50 Shenghuo ZHU <zsh@cs.rochester.edu>
+
+ * mm-util.el (mm-with-unibyte-current-buffer): New macro.
+ * nnweb.el (nnweb-retrieve-headers): Use it.
+ (nnweb-request-article): Use it.
+
+ * nnweb.el (nnweb-dejanews-create-mapping): Set a default date in
+ case matching failed.
+
1999-12-02 John Wiegley <jwiegley@inprise.com>
* mail-source.el (mail-source-keyword-map): Add backslash to
(put 'mm-with-unibyte-buffer 'lisp-indent-function 0)
(put 'mm-with-unibyte-buffer 'edebug-form-spec '(body))
+(defmacro mm-with-unibyte-current-buffer (&rest forms)
+ "Evaluate FORMS there like `progn' in current buffer."
+ (let ((multibyte (make-symbol "multibyte")))
+ `(if (or (string-match "XEmacs\\|Lucid" emacs-version)
+ (not (fboundp 'set-buffer-multibyte)))
+ (progn
+ ,@forms)
+ (let ((,multibyte (default-value 'enable-multibyte-characters)))
+ (unwind-protect
+ (let ((buffer-file-coding-system mm-binary-coding-system)
+ (coding-system-for-read mm-binary-coding-system)
+ (coding-system-for-write mm-binary-coding-system))
+ (set-buffer-multibyte nil)
+ ,@forms)
+ (set-buffer-multibyte ,multibyte))))))
+(put 'mm-with-unibyte-current-buffer 'lisp-indent-function 0)
+(put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body))
+
(defun mm-find-charset-region (b e)
"Return a list of charsets in the region."
(cond
(set-buffer nntp-server-buffer)
(erase-buffer)
(let (article header)
- (while (setq article (pop articles))
- (when (setq header (cadr (assq article nnweb-articles)))
- (nnheader-insert-nov header)))
+ (mm-with-unibyte-current-buffer
+ (while (setq article (pop articles))
+ (when (setq header (cadr (assq article nnweb-articles)))
+ (nnheader-insert-nov header))))
'nov)))
(deffoo nnweb-request-scan (&optional group server)
(let* ((header (cadr (assq article nnweb-articles)))
(url (and header (mail-header-xref header))))
(when (or (and url
- (nnweb-fetch-url url))
+ (mm-with-unibyte-current-buffer
+ (nnweb-fetch-url url)))
(and (stringp article)
(nnweb-definition 'id t)
(let ((fetch (nnweb-definition 'id))
(setq art (match-string 1 article)))
(and fetch
art
- (nnweb-fetch-url
- (format fetch article))))))
+ (mm-with-unibyte-current-buffer
+ (nnweb-fetch-url
+ (format fetch article)))))))
(unless nnheader-callback-function
(funcall (nnweb-definition 'article))
(nnweb-decode-entities))
group (nth 2 text)
date (nth 1 text)
from (nth 0 text))
- (string-match "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" date)
- (setq date (format "%s %s 00:00:00 %s"
- (car (rassq (string-to-number
- (match-string 2 date))
- parse-time-months))
- (match-string 3 date) (match-string 1 date)))
+ (if (string-match "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" date)
+ (setq date (format "%s %s 00:00:00 %s"
+ (car (rassq (string-to-number
+ (match-string 2 date))
+ parse-time-months))
+ (match-string 3 date)
+ (match-string 1 date)))
+ (setq date "Jan 1 00:00:00 0000"))
(incf i)
(setq url (concat url "&fmt=text"))
(unless (nnweb-get-hashtb url)