From baa7cb7f6c13f0609cb29ebefcff7a8fbd0d15e3 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Tue, 8 Sep 1998 22:01:56 +0000 Subject: [PATCH] Importing pgnus-0.22. --- lisp/ChangeLog | 44 ++++++++++++++++++++++++++++++++++++++++++++ lisp/gnus-art.el | 9 ++++++++- lisp/gnus-int.el | 8 ++++++++ lisp/gnus-start.el | 2 +- lisp/gnus-util.el | 2 +- lisp/gnus.el | 10 +++------- lisp/mm-util.el | 5 +++++ lisp/nnfolder.el | 2 +- lisp/nnheader.el | 13 +++---------- lisp/nnmail.el | 4 ++-- lisp/nnmh.el | 4 ++-- lisp/rfc2047.el | 29 +++++++++++++++++------------ lisp/time-date.el | 7 +++++++ texi/gnus.texi | 6 +++--- texi/message.texi | 8 ++++---- 15 files changed, 109 insertions(+), 44 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b65153b..cb4a22f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,47 @@ +Tue Sep 8 22:38:27 1998 Lars Magne Ingebrigtsen + + * gnus.el: Pterodactyl Gnus v0.22 is released. + +1998-09-08 22:36:54 Lars Magne Ingebrigtsen + + * mm-util.el (mm-multibyte-p): Typo. + +Tue Sep 8 22:25:53 1998 Lars Magne Ingebrigtsen + + * gnus.el: Pterodactyl Gnus v0.21 is released. + +1998-09-08 Hrvoje Niksic + + * gnus-art.el (article-treat-dumbquotes): Handle \224 correctly. + +1998-09-08 22:18:03 Lars Magne Ingebrigtsen + + * mm-util.el (mm-multibyte-p): New function. + +Tue Sep 8 21:43:03 1998 Lars Magne Ingebrigtsen + + * gnus.el: Pterodactyl Gnus v0.20 is released. + +1998-09-08 11:40:45 Lars Magne Ingebrigtsen + + * rfc2047.el (rfc2047-decode-region): Only decode when in + multibyte. + + * nnheader.el (nnheader-pathname-coding-system): Changed to binary. + + * gnus-int.el (gnus-request-replace-article): Encode. + (gnus-request-accept-article): Encode. + + * gnus-art.el (gnus-request-article-this-buffer): Decode charsets + here. + + * gnus.el (gnus-article-display-hook): Take the charset functions + out. + + * time-date.el (safe-date-to-time): New function. + + * gnus-util.el (gnus-dd-mmm): Protect against bogus dates. + Tue Sep 8 07:09:28 1998 Lars Magne Ingebrigtsen * gnus.el: Pterodactyl Gnus v0.19 is released. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index d76fe6e..373b095 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -545,6 +545,10 @@ displayed by the first non-nil matching CONTENT face." (item :tag "skip" nil) (face :value default))))) +(defcustom gnus-article-decode-hook + '(gnus-article-decode-charset gnus-article-decode-rfc1522) + "*Hook run to decode charsets in articles.") + ;;; Internal variables (defvar article-lapsed-timer nil) @@ -806,7 +810,7 @@ always hide." (defun article-treat-dumbquotes () "Translate M******** sm*rtq**t*s into proper text." (interactive) - (article-translate-characters "\221\222\223\223" "`'\"\"")) + (article-translate-characters "\221\222\223\224" "`'\"\"")) (defun article-translate-characters (from to) "Translate all characters in the body of the article according to FROM and TO. @@ -2538,6 +2542,9 @@ If given a prefix, show the hidden text instead." (insert-buffer-substring gnus-article-buffer)) (setq gnus-original-article (cons group article)))) + ;; Decode charsets. + (run-hooks 'gnus-article-decode-hook) + ;; Update sparse articles. (when (and do-update-line (or (numberp article) diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el index 8143d0d..505c284 100644 --- a/lisp/gnus-int.el +++ b/lisp/gnus-int.el @@ -433,6 +433,10 @@ If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned." (goto-char (point-max)) (unless (bolp) (insert "\n")) + (save-restriction + (message-narrow-to-headers) + (rfc2047-encode-message-header)) + (message-encode-message-body) (let ((func (car (or gnus-command-method (gnus-find-method-for-group group))))) (funcall (intern (format "%s-request-accept-article" func)) @@ -441,6 +445,10 @@ If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned." last))) (defun gnus-request-replace-article (article group buffer) + (save-restriction + (message-narrow-to-headers) + (rfc2047-encode-message-header)) + (message-encode-message-body) (let ((func (car (gnus-group-name-to-method group)))) (funcall (intern (format "%s-request-replace-article" func)) article (gnus-group-real-name group) buffer))) diff --git a/lisp/gnus-start.el b/lisp/gnus-start.el index 005d2d0..d955353 100644 --- a/lisp/gnus-start.el +++ b/lisp/gnus-start.el @@ -2531,7 +2531,7 @@ If FORCE is non-nil, the .newsrc file is read." (fboundp 'gnus-mule-get-coding-system) (gnus-mule-get-coding-system (symbol-name group))))) (when coding - (setq str (nnheader-decode-coding-string str (car coding)))) + (setq str (mm-decode-coding-string str (car coding)))) (set group str))) (forward-line 1)))) (gnus-message 5 "Reading descriptions file...done") diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index 03b017a..ee52653 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -291,7 +291,7 @@ (defun gnus-dd-mmm (messy-date) "Return a string like DD-MMM from a big messy string." - (format-time-string "%2d-%b" (date-to-time messy-date))) + (format-time-string "%2d-%b" (safe-date-to-time messy-date))) (defmacro gnus-date-get-time (date) "Convert DATE string to Emacs time. diff --git a/lisp/gnus.el b/lisp/gnus.el index 2bbe106..99d55e9 100644 --- a/lisp/gnus.el +++ b/lisp/gnus.el @@ -250,7 +250,7 @@ is restarted, and sometimes reloaded." :link '(custom-manual "(gnus)Exiting Gnus") :group 'gnus) -(defconst gnus-version-number "0.19" +(defconst gnus-version-number "0.22" "Version number for this version of Gnus.") (defconst gnus-version (format "Pterodactyl Gnus v%s" gnus-version-number) @@ -1346,16 +1346,12 @@ face." (defcustom gnus-article-display-hook (if (and (string-match "XEmacs" emacs-version) (featurep 'xface)) - '(gnus-article-decode-charset - gnus-article-decode-rfc1522 - gnus-article-hide-headers-if-wanted + '(gnus-article-hide-headers-if-wanted gnus-article-hide-boring-headers gnus-article-treat-overstrike gnus-article-maybe-highlight gnus-article-display-x-face) - '(gnus-article-decode-charset - gnus-article-decode-rfc1522 - gnus-article-hide-headers-if-wanted + '(gnus-article-hide-headers-if-wanted gnus-article-hide-boring-headers gnus-article-treat-overstrike gnus-article-maybe-highlight)) diff --git a/lisp/mm-util.el b/lisp/mm-util.el index 838a5c8..c8800b0 100644 --- a/lisp/mm-util.el +++ b/lisp/mm-util.el @@ -196,6 +196,11 @@ used as the line break code type of the coding system." (point-min) (point-max))))) (mm-mule-charset-to-mime-charset charset))) +(defun mm-multibyte-p () + "Say whether multibyte is enabled." + (and (boundp 'enable-multibyte-characters) + enable-multibyte-characters)) + (provide 'mm-util) ;;; mm-util.el ends here diff --git a/lisp/nnfolder.el b/lisp/nnfolder.el index b6ba830..7bf7d3a 100644 --- a/lisp/nnfolder.el +++ b/lisp/nnfolder.el @@ -801,7 +801,7 @@ deleted. Point is left where the deleted region was." (defun nnfolder-group-pathname (group) "Make pathname for GROUP." (setq group - (nnheader-encode-coding-string group nnmail-pathname-coding-system)) + (mm-encode-coding-string group nnmail-pathname-coding-system)) (let ((dir (file-name-as-directory (expand-file-name nnfolder-directory)))) ;; If this file exists, we use it directly. (if (or nnmail-use-long-file-names diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 98da659..cb6a44c 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -40,6 +40,7 @@ (eval-when-compile (require 'cl)) (require 'mail-utils) +(require 'mm-util) (defvar nnheader-max-head-length 4096 "*Max length of the head of articles.") @@ -641,7 +642,7 @@ without formatting." (or (not (numberp gnus-verbose-backends)) (<= level gnus-verbose-backends))) -(defvar nnheader-pathname-coding-system 'iso-8859-1 +(defvar nnheader-pathname-coding-system 'binary "*Coding system for pathname.") (defun nnheader-group-pathname (group dir &optional file) @@ -653,7 +654,7 @@ without formatting." (concat dir group "/") ;; If not, we translate dots into slashes. (concat dir - (nnheader-encode-coding-string + (mm-encode-coding-string (nnheader-replace-chars-in-string group ?. ?/) nnheader-pathname-coding-system) "/"))) @@ -809,14 +810,6 @@ find-file-hooks, etc. (fset 'nnheader-cancel-timer 'cancel-timer) (fset 'nnheader-cancel-function-timers 'cancel-function-timers) -(if (fboundp 'encode-coding-string) - (fset 'nnheader-encode-coding-string 'encode-coding-string) - (fset 'nnheader-encode-coding-string (lambda (s a) s))) - -(if (fboundp 'decode-coding-string) - (fset 'nnheader-decode-coding-string 'decode-coding-string) - (fset 'nnheader-decode-coding-string (lambda (s a) s))) - (when (string-match "XEmacs\\|Lucid" emacs-version) (require 'nnheaderxm)) diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 2581172..adeb605 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -512,7 +512,7 @@ parameter. It should return nil, `warn' or `delete'." (concat dir group "/") ;; If not, we translate dots into slashes. (concat dir - (nnheader-encode-coding-string + (mm-encode-coding-string (nnheader-replace-chars-in-string group ?. ?/) nnmail-pathname-coding-system) "/"))) @@ -1158,7 +1158,7 @@ Return the number of characters in the body." (insert (format "Xref: %s" (system-name))) (while group-alist (insert (format " %s:%d" - (nnheader-encode-coding-string + (mm-encode-coding-string (caar group-alist) nnmail-pathname-coding-system) (cdar group-alist))) diff --git a/lisp/nnmh.el b/lisp/nnmh.el index a393ebb..769d865 100644 --- a/lisp/nnmh.el +++ b/lisp/nnmh.el @@ -229,8 +229,8 @@ (expand-file-name nnmh-toplev)))) dir) (nnheader-replace-chars-in-string - (nnheader-decode-coding-string (substring dir (match-end 0)) - nnmail-pathname-coding-system) + (mm-decode-coding-string (substring dir (match-end 0)) + nnmail-pathname-coding-system) ?/ ?.)) (apply 'max files) (apply 'min files))))))) diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el index c96aeb2..8d36466 100644 --- a/lisp/rfc2047.el +++ b/lisp/rfc2047.el @@ -25,8 +25,9 @@ ;;; Code: (eval-and-compile - (if (not (fboundp 'base64-encode-string)) - (require 'base64))) + (eval + '(if (not (fboundp 'base64-encode-string)) + (require 'base64)))) (require 'qp) (require 'mm-util) @@ -254,20 +255,24 @@ Should be called narrowed to the head of the message." (prog1 (match-string 0) (delete-region (match-beginning 0) (match-end 0))))) - (mm-decode-coding-region b e rfc2047-default-charset) + (when (mm-multibyte-p) + (mm-decode-coding-region b e rfc2047-default-charset)) (setq b (point))) - (mm-decode-coding-region b (point-max) rfc2047-default-charset))))) + (when (mm-multibyte-p) + (mm-decode-coding-region b (point-max) rfc2047-default-charset)))))) ;;;###autoload (defun rfc2047-decode-string (string) - "Decode the quoted-printable-encoded STRING and return the results." - (with-temp-buffer - (mm-enable-multibyte) - (insert string) - (inline - (rfc2047-decode-region (point-min) (point-max))) - (buffer-string))) - + "Decode the quoted-printable-encoded STRING and return the results." + (let ((m (mm-multibyte-p))) + (with-temp-buffer + (when m + (mm-enable-multibyte)) + (insert string) + (inline + (rfc2047-decode-region (point-min) (point-max))) + (buffer-string)))) + (defun rfc2047-parse-and-decode (word) "Decode WORD and return it if it is an encoded word. Return WORD if not." diff --git a/lisp/time-date.el b/lisp/time-date.el index 4f07bbc..b3a50f1 100644 --- a/lisp/time-date.el +++ b/lisp/time-date.el @@ -116,6 +116,13 @@ The Gregorian date Sunday, December 31, 1bce is imaginary." (- (/ (1- year) 100)) ; - century years (/ (1- year) 400)))) ; + Gregorian leap years +(defun safe-date-to-time (date) + "Parse DATE and return a time structure. +If DATE is malformed, a zero time will be returned." + (condition-case () + (date-to-time date) + (error '(0 0)))) + (provide 'time-date) ;;; time-date.el ends here diff --git a/texi/gnus.texi b/texi/gnus.texi index 436d3f9..57d5efb 100644 --- a/texi/gnus.texi +++ b/texi/gnus.texi @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- @setfilename gnus -@settitle Pterodactyl Gnus 0.19 Manual +@settitle Pterodactyl Gnus 0.22 Manual @synindex fn cp @synindex vr cp @synindex pg cp @@ -318,7 +318,7 @@ into another language, under the above conditions for modified versions. @tex @titlepage -@title Pterodactyl Gnus 0.19 Manual +@title Pterodactyl Gnus 0.22 Manual @author by Lars Magne Ingebrigtsen @page @@ -354,7 +354,7 @@ can be gotten by any nefarious means you can think of---@sc{nntp}, local spool or your mbox file. All at the same time, if you want to push your luck. -This manual corresponds to Pterodactyl Gnus 0.19. +This manual corresponds to Pterodactyl Gnus 0.22. @end ifinfo diff --git a/texi/message.texi b/texi/message.texi index 1574359..36abb0c 100644 --- a/texi/message.texi +++ b/texi/message.texi @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- @setfilename message -@settitle Pterodactyl Message 0.19 Manual +@settitle Pterodactyl Message 0.22 Manual @synindex fn cp @synindex vr cp @synindex pg cp @@ -42,7 +42,7 @@ into another language, under the above conditions for modified versions. @tex @titlepage -@title Pterodactyl Message 0.19 Manual +@title Pterodactyl Message 0.22 Manual @author by Lars Magne Ingebrigtsen @page @@ -83,9 +83,9 @@ Message mode buffers. * Key Index:: List of Message mode keys. @end menu -This manual corresponds to Pterodactyl Message 0.19. Message is +This manual corresponds to Pterodactyl Message 0.22. Message is distributed with the Gnus distribution bearing the same version number -as this manual has. +as this manual. @node Interface -- 1.7.10.4