From 01451188ce033bbbd9ab4439a6a1bf6c13a47fa7 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Mon, 11 Apr 2005 23:28:32 +0000 Subject: [PATCH] Synch to No Gnus 200504112314. --- lisp/ChangeLog | 9 +++++++++ lisp/mm-util.el | 20 +++++++++++++++++++- lisp/nnimap.el | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 30fe9e8..657b4ae 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2005-04-11 Lute Kamstra + + * nnimap.el (nnimap-date-days-ago): Handle byte-compiler warnings + differently. + +2005-04-10 Stefan Monnier + + * mm-util.el (mm-detect-coding-region): Typo. + 2005-04-11 Katsumi Yamaoka * gnus-art.el (gnus-article-read-summary-keys): Fix misplaced parens. diff --git a/lisp/mm-util.el b/lisp/mm-util.el index 352830a..cee0393 100644 --- a/lisp/mm-util.el +++ b/lisp/mm-util.el @@ -76,6 +76,24 @@ (replace-regexp-in-string regexp rep string nil literal))) (string-as-unibyte . identity) (string-make-unibyte . identity) + ;; string-as-multibyte often doesn't really do what you think it does. + ;; Example: + ;; (aref (string-as-multibyte "\201") 0) -> 129 (aka ?\201) + ;; (aref (string-as-multibyte "\300") 0) -> 192 (aka ?\300) + ;; (aref (string-as-multibyte "\300\201") 0) -> 192 (aka ?\300) + ;; (aref (string-as-multibyte "\300\201") 1) -> 129 (aka ?\201) + ;; but + ;; (aref (string-as-multibyte "\201\300") 0) -> 2240 + ;; (aref (string-as-multibyte "\201\300") 1) -> + ;; Better use string-to-multibyte or encode-coding-string. + ;; If you really need string-as-multibyte somewhere it's usually + ;; because you're using the internal emacs-mule representation (maybe + ;; because you're using string-as-unibyte somewhere), which is + ;; generally a problem in itself. + ;; Here is an approximate equivalence table to help think about it: + ;; (string-as-multibyte s) ~= (decode-coding-string s 'emacs-mule) + ;; (string-to-multibyte s) ~= (decode-coding-string s 'binary) + ;; (string-make-multibyte s) ~= (decode-coding-string s locale-coding-system) (string-as-multibyte . identity) (string-to-multibyte . (lambda (string) @@ -913,7 +931,7 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'." (defun mm-detect-coding-region (start end) "Like `detect-coding-region' except returning the best one." (let ((coding-systems - (detect-coding-region (point) (point-max)))) + (detect-coding-region start end))) (or (car-safe coding-systems) coding-systems))) (defun mm-detect-coding-region (start end) diff --git a/lisp/nnimap.el b/lisp/nnimap.el index cf1e5ce..ab10457 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -1442,10 +1442,10 @@ function is generally only called when Gnus is shutting down." (list (- ms 1) (+ (expt 2 16) ls)) (list ms ls)))) +(eval-when-compile (require 'parse-time)) (defun nnimap-date-days-ago (daysago) "Return date, in format \"3-Aug-1998\", for DAYSAGO days ago." (require 'parse-time) - (defvar parse-time-months) (let* ((time (nnimap-time-substract (current-time) (days-to-time daysago))) (date (format-time-string (format "%%d-%s-%%Y" -- 1.7.10.4