From bb39fc7a397d0811a5891d60b07ecacc69b6dc59 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Tue, 19 Feb 2002 00:54:16 +0000 Subject: [PATCH] Synch with Oort Gnus. --- lisp/ChangeLog | 43 ++++++++++++++++++++++++++++++++++++++++++- lisp/gnus-art.el | 33 +++++++++------------------------ lisp/gnus-sum.el | 9 ++++----- lisp/gnus-util.el | 4 ++-- lisp/mm-decode.el | 7 +++++-- lisp/mm-partial.el | 2 +- lisp/mm-view.el | 32 +++++++++++++++++--------------- texi/ChangeLog | 6 ++++++ texi/emacs-mime.texi | 6 ++++-- texi/gnus-ja.texi | 2 +- texi/gnus.texi | 2 +- 11 files changed, 92 insertions(+), 54 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6058f4e..af0233c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,48 @@ +2002-02-18 Paul Jarc + + * gnus-util.el (gnus-parent-id): Ignore trailing whitespace in the + References header field. From Mark Thomas . + +2002-02-18 ShengHuo ZHU + + * mm-view.el (mm-inline-render-with-file): With unibyte buffer. + (mm-inline-render-with-stdin): Ditto. + (mm-inline-render-with-function): Ditto. + (mm-inline-wash-with-file): Bind coding-system-for-write. + (mm-inline-wash-with-stdin): Ditto. + +2002-02-18 ShengHuo ZHU + + Suggested by Felix Natter + + * gnus-art.el (gnus-mime-view-part-externally): Rename from + gnus-mime-externalize-view. + (gnus-mime-view-part-internally): Rename from + gnus-mime-internalize-view. + (gnus-article-view-part-externally): Rename from + gnus-article-externalize-part. + (gnus-mime-action-alist): Change correspondingly. + (gnus-mime-button-commands): Ditto. + (gnus-mime-action-alist): Remove duplication. + + * gnus-sum.el (gnus-summary-mime-map): Change correspondingly. + +2002-02-18 ShengHuo ZHU + + * mm-decode.el (mm-dissect-buffer): Add loose-mime parameter. + + * gnus-art.el (gnus-display-mime): Use it. + + * mm-partial.el (mm-partial-find-parts): Use it. + + * gnus-sum.el (gnus-article-loose-mime): Rename from + gnus-article-no-strict-mime. + (gnus-summary-save-parts): Use it. + 2002-02-18 Katsumi Yamaoka * gnus-fun.el (gnus-convert-gray-x-face-to-xpm): Remove unused - local varriable. + local variable. * gnus-art.el (article-display-x-face): Don't sort multiple X-Faces. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 6aa0f75..5a29e9a 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -816,28 +816,13 @@ used." ("toggle display" . gnus-article-press-button) ("toggle display" . gnus-article-view-part-as-charset) ("view as type" . gnus-mime-view-part-as-type) - ("internalize type" . gnus-mime-internalize-part) - ("externalize type" . gnus-mime-externalize-part)) + ("view internally" . gnus-mime-view-part-internally) + ("view externally" . gnus-mime-view-part-externally)) "An alist of actions that run on the MIME attachment." :group 'gnus-article-mime :type '(repeat (cons (string :tag "name") (function)))) -(defcustom gnus-mime-action-alist - '(("save to file" . gnus-mime-save-part) - ("display as text" . gnus-mime-inline-part) - ("view the part" . gnus-mime-view-part) - ("pipe to command" . gnus-mime-pipe-part) - ("toggle display" . gnus-article-press-button) - ("view as type" . gnus-mime-view-part-as-type) - ("internalize type" . gnus-mime-internalize-part) - ("externalize type" . gnus-mime-externalize-part)) - "An alist of actions that run on the MIME attachment." - :version "21.1" - :group 'gnus-article-mime - :type '(repeat (cons (string :tag "name") - (function)))) - ;;; ;;; The treatment variables ;;; @@ -4045,8 +4030,8 @@ General format specifiers can also be used. See (gnus-mime-save-part-and-strip "\C-o" "Save and Strip") (gnus-mime-copy-part "c" "View As Text, In Other Buffer") (gnus-mime-inline-part "i" "View As Text, In This Buffer") - (gnus-mime-internalize-part "E" "View Internally") - (gnus-mime-externalize-part "e" "View Externally") + (gnus-mime-view-part-internally "E" "View Internally") + (gnus-mime-view-part-externally "e" "View Externally") (gnus-mime-print-part "p" "Print") (gnus-mime-pipe-part "|" "Pipe To Command...") (gnus-mime-action-on-part "." "Take action on the part"))) @@ -4336,7 +4321,7 @@ specified charset." (gnus-newsgroup-ignored-charsets 'gnus-all)) (gnus-article-press-button))))) -(defun gnus-mime-externalize-part (&optional handle) +(defun gnus-mime-view-part-externally (&optional handle) "View the MIME part under point with an external viewer." (interactive) (gnus-article-check-buffer) @@ -4352,7 +4337,7 @@ specified charset." (mm-remove-part handle) (mm-display-part handle))))) -(defun gnus-mime-internalize-part (&optional handle) +(defun gnus-mime-view-part-internally (&optional handle) "View the MIME part under point with an internal viewer. If no internal viewer is available, use an external viewer." (interactive) @@ -4412,10 +4397,10 @@ If no internal viewer is available, use an external viewer." (interactive "p") (gnus-article-part-wrapper n 'gnus-mime-view-part-as-charset)) -(defun gnus-article-externalize-part (n) +(defun gnus-article-view-part-externally (n) "View MIME part N externally, which is the numerical prefix." (interactive "p") - (gnus-article-part-wrapper n 'gnus-mime-externalize-part)) + (gnus-article-part-wrapper n 'gnus-mime-view-part-externally)) (defun gnus-article-inline-part (n) "Inline MIME part N, which is the numerical prefix." @@ -4594,7 +4579,7 @@ If no internal viewer is available, use an external viewer." ;; may change the point. So we set the window point. (set-window-point window point))) (let* ((handles (or ihandles (mm-dissect-buffer - gnus-article-no-strict-mime) + nil gnus-article-loose-mime) (mm-uu-dissect))) buffer-read-only handle name type b e display) (when (and (not ihandles) diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index fc3a99d..42340cb 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -1064,8 +1064,8 @@ that were fetched. Say, for nnultimate groups." :group 'gnus-summary :type 'string) -(defcustom gnus-article-no-strict-mime nil - "If non-nil, don't require strict MIME. +(defcustom gnus-article-loose-mime nil + "If non-nil, don't require MIME-Version header. Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not supply the MIME-Version header or deliberately strip it From the mail. Set it to non-nil, Gnus will treat some articles as MIME even if @@ -1866,7 +1866,7 @@ increase the score of each group you read." "o" gnus-article-save-part "c" gnus-article-copy-part "C" gnus-article-view-part-as-charset - "e" gnus-article-externalize-part + "e" gnus-article-view-part-externally "E" gnus-article-encrypt-body "i" gnus-article-inline-part "|" gnus-article-pipe-part)) @@ -10438,8 +10438,7 @@ If REVERSE, save parts that do not match TYPE." (save-excursion (set-buffer gnus-article-buffer) (let ((handles (or gnus-article-mime-handles - (mm-dissect-buffer - gnus-article-no-strict-mime) + (mm-dissect-buffer nil gnus-article-loose-mime) (mm-uu-dissect)))) (when handles (gnus-summary-save-parts-1 type dir handles reverse) diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index 4874d1b..e8fbc36 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -510,8 +510,8 @@ If N, return the Nth ancestor instead." (while (nthcdr n ids) (setq ids (cdr ids))) (car ids)) - (when (string-match "<[^<]+\\'" references) - (match-string 0 references))))) + (when (string-match "\\(<[^<]+>\\)[ \t]*\\'" references) + (match-string 1 references))))) (defun gnus-buffer-live-p (buffer) "Say whether BUFFER is alive or not." diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index 6883c97..89d60bb 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -107,11 +107,13 @@ The defined renderer types are: `w3' : using Emacs/W3; `w3m' : using emacs-w3m; `links': using links; -`lynx' : using lynx." +`lynx' : using lynx; +`nil' : using external viewer." :type '(choice (symbol w3) (symbol w3m) (symbol links) (symbol lynx) + (symbol nil) (function)) :version "21.3" :group 'mime-display) @@ -454,13 +456,14 @@ for types in mm-keep-viewer-alive-types." (message "Destroying external MIME viewers") (mm-destroy-parts mm-postponed-undisplay-list))) -(defun mm-dissect-buffer (&optional no-strict-mime) +(defun mm-dissect-buffer (&optional no-strict-mime loose-mime) "Dissect the current buffer and return a list of MIME handles." (save-excursion (let (ct ctl type subtype cte cd description id result from) (save-restriction (mail-narrow-to-head) (when (or no-strict-mime + loose-mime (mail-fetch-field "mime-version")) (setq ct (mail-fetch-field "content-type") ctl (ignore-errors (mail-header-parse-content-type ct)) diff --git a/lisp/mm-partial.el b/lisp/mm-partial.el index 256ee10..7a4cd0b 100644 --- a/lisp/mm-partial.el +++ b/lisp/mm-partial.el @@ -43,7 +43,7 @@ gnus-newsgroup-name) (when (search-forward id nil t) (let ((nhandles (mm-dissect-buffer - gnus-article-no-strict-mime)) nid) + nil gnus-article-loose-mime)) nid) (if (consp (car nhandles)) (mm-destroy-parts nhandles) (setq nid (cdr (assq 'id diff --git a/lisp/mm-view.el b/lisp/mm-view.el index 534bfd7..87e6cff 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -40,22 +40,22 @@ (defvar mm-text-html-renderer-alist '((w3 . mm-inline-text-html-render-with-w3) (w3m . mm-inline-text-html-render-with-w3m) - (links mm-inline-render-with-file + (links mm-inline-render-with-file mm-links-remove-leading-blank "links" "-dump" file) (lynx mm-inline-render-with-stdin nil "lynx" "-dump" "-force_html" "-stdin")) - "The attributes of renderer types.") + "The attributes of renderer types for text/html.") (defvar mm-text-html-washer-alist '((w3 . gnus-article-wash-html-with-w3) (w3m . gnus-article-wash-html-with-w3m) - (links mm-inline-wash-with-file + (links mm-inline-wash-with-file mm-links-remove-leading-blank "links" "-dump" file) (lynx mm-inline-wash-with-stdin nil "lynx" "-dump" "-force_html" "-stdin")) - "The attributes of washer types.") + "The attributes of washer types for text/html.") ;;; Internal variables. @@ -309,9 +309,10 @@ will not be substituted.") (delete-region (match-beginning 0) (match-end 0)))) (defun mm-inline-wash-with-file (post-func cmd &rest args) - (let ((file (make-temp-name + (let ((file (make-temp-name (expand-file-name "mm" mm-tmp-directory)))) - (write-region (point-min) (point-max) file nil 'silent) + (let ((coding-system-for-write 'binary)) + (write-region (point-min) (point-max) file nil 'silent)) (delete-region (point-min) (point-max)) (unwind-protect (apply 'call-process cmd nil t nil (mapcar 'eval args)) @@ -319,33 +320,34 @@ will not be substituted.") (and post-func (funcall post-func)))) (defun mm-inline-wash-with-stdin (post-func cmd &rest args) - (apply 'call-process-region (point-min) (point-max) - cmd t t nil args) + (let ((coding-system-for-write 'binary)) + (apply 'call-process-region (point-min) (point-max) + cmd t t nil args)) (and post-func (funcall post-func))) (defun mm-inline-render-with-file (handle post-func cmd &rest args) (let ((source (mm-get-part handle))) (mm-insert-inline handle - (with-temp-buffer + (mm-with-unibyte-buffer (insert source) (apply 'mm-inline-wash-with-file post-func cmd args) (buffer-string))))) (defun mm-inline-render-with-stdin (handle post-func cmd &rest args) (let ((source (mm-get-part handle))) - (mm-insert-inline - handle - (with-temp-buffer + (mm-insert-inline + handle + (mm-with-unibyte-buffer (insert source) (apply 'mm-inline-wash-with-stdin post-func cmd args) (buffer-string))))) (defun mm-inline-render-with-function (handle func &rest args) (let ((source (mm-get-part handle))) - (mm-insert-inline - handle - (with-temp-buffer + (mm-insert-inline + handle + (mm-with-unibyte-buffer (insert source) (apply func args) (buffer-string))))) diff --git a/texi/ChangeLog b/texi/ChangeLog index caacb60..8c3efb5 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,9 @@ +2002-02-18 ShengHuo ZHU + + * emacs-mime.texi (mailcap): Addition. + + * gnus.texi (Using MIME): Rename functions. Addition. + 2002-02-16 Simon Josefsson * gnus.texi (Top): Change description of Posting Server node. diff --git a/texi/emacs-mime.texi b/texi/emacs-mime.texi index f597c37..6f66bb4 100644 --- a/texi/emacs-mime.texi +++ b/texi/emacs-mime.texi @@ -796,10 +796,12 @@ Here's an example file: @example image/*; gimp -8 %s audio/wav; wavplayer %s +application/msword; catdoc %s ; copiousoutput ; nametemplate=%s.doc @end example -This says that all image files should be displayed with @code{gimp}, and -that WAVE audio files should be played by @code{wavplayer}. +This says that all image files should be displayed with @code{gimp}, +that WAVE audio files should be played by @code{wavplayer}, and that +MS-WORD files should be inlined by @code{catdoc}. The @code{mailcap} library parses this file, and provides functions for matching types. diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index abc0006..79edc4f 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -9650,7 +9650,7 @@ Gnus $B$O%X%C%@!<$NJB$YBX$((B(sort)$B$b9T$$$^$9(B ($B$3$l$O%G%#%U%)%k%H$G9T @code{To} $BMs$,0l$D$h$j$bB?$1$l$P!"$=$l$i$rA4$F>C5n$7$^$9!#(B @end table -$B$3$l$i$N;0$D$NMWAG$rF~$l$?$1$l$P!"$3$s$JIw$K$J$j$^$9!#(B +$B$3$l$i$N;0$D$NMWAG$rF~$l$?$1$l$P!"$3$s$JIw$K$J$j$^$9(B: @lisp (setq gnus-boring-article-headers diff --git a/texi/gnus.texi b/texi/gnus.texi index 75c035e..832c1a2 100644 --- a/texi/gnus.texi +++ b/texi/gnus.texi @@ -10130,7 +10130,7 @@ Remove the @code{To} header if it is very long. Remove all @code{To} headers if there are more than one. @end table -To include these three elements, you could say something like; +To include these three elements, you could say something like: @lisp (setq gnus-boring-article-headers -- 1.7.10.4