aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2006-05-05 01:53:06 +0000
committerMiles Bader2006-05-05 01:53:06 +0000
commit54e573e6f6f76c59e958cc20840dc3b57e72ee0a (patch)
tree60bd0c6150173ef6788e2cb14c38981b5929c3d2
parentcbe8cf2a450914c6d36babe4ee87a2cc161d0019 (diff)
downloademacs-54e573e6f6f76c59e958cc20840dc3b57e72ee0a.tar.gz
emacs-54e573e6f6f76c59e958cc20840dc3b57e72ee0a.zip
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-265
Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 99-100) - Merge from emacs--devo--0 - Update from CVS
-rw-r--r--lisp/gnus/ChangeLog21
-rw-r--r--lisp/gnus/gnus-art.el61
-rw-r--r--lisp/gnus/mm-decode.el22
3 files changed, 71 insertions, 33 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index cecc180f522..7f0f248c7cf 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,24 @@
12006-05-04 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * mm-decode.el (mm-dissect-buffer): Remove spurious double assignment.
4 (mm-copy-to-buffer): Use with-current-buffer.
5 (mm-display-part): Simplify.
6 (mm-inlinable-p): Add optional arg `type'.
7
8 * gnus-art.el (gnus-mime-view-part-as-type): Add optional PRED
9 argument.
10 (gnus-mime-view-part-externally, gnus-mime-view-part-internally):
11 Try harder to show the attachment internally or externally using
12 gnus-mime-view-part-as-type.
13
142006-05-04 Reiner Steib <Reiner.Steib@gmx.de>
15
16 * gnus-art.el (gnus-mime-view-part-as-type-internal): Try to fetch
17 `filename' from Content-Disposition if Content-Type doesn't
18 provide `name'.
19 (gnus-mime-view-part-as-type): Set default instead of
20 initial-input.
21
12006-04-28 Katsumi Yamaoka <yamaoka@jpl.org> 222006-04-28 Katsumi Yamaoka <yamaoka@jpl.org>
2 23
3 * mm-uu.el (mm-uu-pgp-encrypted-extract-1): Assume buffer is made 24 * mm-uu.el (mm-uu-pgp-encrypted-extract-1): Assume buffer is made
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 7e3b843d500..208103f805d 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -4317,21 +4317,29 @@ Deleting parts may malfunction or destroy the article; continue? ")
4317 4317
4318(defun gnus-mime-view-part-as-type-internal () 4318(defun gnus-mime-view-part-as-type-internal ()
4319 (gnus-article-check-buffer) 4319 (gnus-article-check-buffer)
4320 (let* ((name (mail-content-type-get 4320 (let* ((handle (get-text-property (point) 'gnus-data))
4321 (mm-handle-type (get-text-property (point) 'gnus-data)) 4321 (name (or
4322 'name)) 4322 ;; Content-Type: foo/bar; name=...
4323 (mail-content-type-get (mm-handle-type handle) 'name)
4324 ;; Content-Disposition: attachment; filename=...
4325 (cdr (assq 'filename (cdr (mm-handle-disposition handle))))))
4323 (def-type (and name (mm-default-file-encoding name)))) 4326 (def-type (and name (mm-default-file-encoding name))))
4324 (and def-type (cons def-type 0)))) 4327 (and def-type (cons def-type 0))))
4325 4328
4326(defun gnus-mime-view-part-as-type (&optional mime-type) 4329(defun gnus-mime-view-part-as-type (&optional mime-type pred)
4327 "Choose a MIME media type, and view the part as such." 4330 "Choose a MIME media type, and view the part as such.
4331If non-nil, PRED is a predicate to use during completion to limit the
4332available media-types."
4328 (interactive) 4333 (interactive)
4329 (unless mime-type 4334 (unless mime-type
4330 (setq mime-type (completing-read 4335 (setq mime-type
4331 "View as MIME type: " 4336 (let ((default (gnus-mime-view-part-as-type-internal)))
4332 (mapcar #'list (mailcap-mime-types)) 4337 (completing-read
4333 nil nil 4338 (format "View as MIME type (default %s): "
4334 (gnus-mime-view-part-as-type-internal)))) 4339 (car default))
4340 (mapcar #'list (mailcap-mime-types))
4341 pred nil nil nil
4342 (car default)))))
4335 (gnus-article-check-buffer) 4343 (gnus-article-check-buffer)
4336 (let ((handle (get-text-property (point) 'gnus-data))) 4344 (let ((handle (get-text-property (point) 'gnus-data)))
4337 (when handle 4345 (when handle
@@ -4511,12 +4519,18 @@ specified charset."
4511 (mm-inlined-types nil) 4519 (mm-inlined-types nil)
4512 (mail-parse-charset gnus-newsgroup-charset) 4520 (mail-parse-charset gnus-newsgroup-charset)
4513 (mail-parse-ignored-charsets 4521 (mail-parse-ignored-charsets
4514 (save-excursion (set-buffer gnus-summary-buffer) 4522 (with-current-buffer gnus-summary-buffer
4515 gnus-newsgroup-ignored-charsets))) 4523 gnus-newsgroup-ignored-charsets))
4516 (when handle 4524 (type (mm-handle-media-type handle))
4517 (if (mm-handle-undisplayer handle) 4525 (method (mailcap-mime-info type))
4518 (mm-remove-part handle) 4526 (mm-enable-external t))
4519 (mm-display-part handle))))) 4527 (if (not (stringp method))
4528 (gnus-mime-view-part-as-type
4529 nil (lambda (type) (stringp (mailcap-mime-info type))))
4530 (when handle
4531 (if (mm-handle-undisplayer handle)
4532 (mm-remove-part handle)
4533 (mm-display-part handle))))))
4520 4534
4521(defun gnus-mime-view-part-internally (&optional handle) 4535(defun gnus-mime-view-part-internally (&optional handle)
4522 "View the MIME part under point with an internal viewer. 4536 "View the MIME part under point with an internal viewer.
@@ -4528,13 +4542,16 @@ If no internal viewer is available, use an external viewer."
4528 (mm-inline-large-images t) 4542 (mm-inline-large-images t)
4529 (mail-parse-charset gnus-newsgroup-charset) 4543 (mail-parse-charset gnus-newsgroup-charset)
4530 (mail-parse-ignored-charsets 4544 (mail-parse-ignored-charsets
4531 (save-excursion (set-buffer gnus-summary-buffer) 4545 (with-current-buffer gnus-summary-buffer
4532 gnus-newsgroup-ignored-charsets)) 4546 gnus-newsgroup-ignored-charsets))
4533 (inhibit-read-only t)) 4547 (inhibit-read-only t))
4534 (when handle 4548 (if (not (mm-inlinable-p handle))
4535 (if (mm-handle-undisplayer handle) 4549 (gnus-mime-view-part-as-type
4536 (mm-remove-part handle) 4550 nil (lambda (type) (mm-inlinable-p handle type)))
4537 (mm-display-part handle))))) 4551 (when handle
4552 (if (mm-handle-undisplayer handle)
4553 (mm-remove-part handle)
4554 (mm-display-part handle))))))
4538 4555
4539(defun gnus-mime-action-on-part (&optional action) 4556(defun gnus-mime-action-on-part (&optional action)
4540 "Do something with the MIME attachment at \(point\)." 4557 "Do something with the MIME attachment at \(point\)."
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index b79e081f0e1..c5fd5d3c258 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -562,7 +562,7 @@ Postpone undisplaying of viewers for types in
562 description) 562 description)
563 (setq type (split-string (car ctl) "/")) 563 (setq type (split-string (car ctl) "/"))
564 (setq subtype (cadr type) 564 (setq subtype (cadr type)
565 type (pop type)) 565 type (car type))
566 (setq 566 (setq
567 result 567 result
568 (cond 568 (cond
@@ -641,16 +641,15 @@ Postpone undisplaying of viewers for types in
641 641
642(defun mm-copy-to-buffer () 642(defun mm-copy-to-buffer ()
643 "Copy the contents of the current buffer to a fresh buffer." 643 "Copy the contents of the current buffer to a fresh buffer."
644 (save-excursion
645 (let ((obuf (current-buffer)) 644 (let ((obuf (current-buffer))
646 beg) 645 beg)
647 (goto-char (point-min)) 646 (goto-char (point-min))
648 (search-forward-regexp "^\n" nil t) 647 (search-forward-regexp "^\n" nil t)
649 (setq beg (point)) 648 (setq beg (point))
650 (set-buffer 649 (with-current-buffer
651 ;; Preserve the data's unibyteness (for url-insert-file-contents). 650 ;; Preserve the data's unibyteness (for url-insert-file-contents).
652 (let ((default-enable-multibyte-characters (mm-multibyte-p))) 651 (let ((default-enable-multibyte-characters (mm-multibyte-p)))
653 (generate-new-buffer " *mm*"))) 652 (generate-new-buffer " *mm*"))
654 (insert-buffer-substring obuf beg) 653 (insert-buffer-substring obuf beg)
655 (current-buffer)))) 654 (current-buffer))))
656 655
@@ -701,7 +700,8 @@ external if displayed external."
701 (forward-line 1) 700 (forward-line 1)
702 (mm-insert-inline handle (mm-get-part handle)) 701 (mm-insert-inline handle (mm-get-part handle))
703 'inline) 702 'inline)
704 (if (and method ;; If nil, we always use "save". 703 (setq external
704 (and method ;; If nil, we always use "save".
705 (stringp method) ;; 'mailcap-save-binary-file 705 (stringp method) ;; 'mailcap-save-binary-file
706 (or (eq mm-enable-external t) 706 (or (eq mm-enable-external t)
707 (and (eq mm-enable-external 'ask) 707 (and (eq mm-enable-external 'ask)
@@ -714,9 +714,7 @@ external if displayed external."
714 (concat 714 (concat
715 " \"" (format method filename) "\"") 715 " \"" (format method filename) "\"")
716 "") 716 "")
717 "? "))))) 717 "? "))))))
718 (setq external t)
719 (setq external nil))
720 (if external 718 (if external
721 (mm-display-external 719 (mm-display-external
722 handle (or method 'mailcap-save-binary-file)) 720 handle (or method 'mailcap-save-binary-file))
@@ -1019,10 +1017,12 @@ external if displayed external."
1019 methods nil))) 1017 methods nil)))
1020 result)) 1018 result))
1021 1019
1022(defun mm-inlinable-p (handle) 1020(defun mm-inlinable-p (handle &optional type)
1023 "Say whether HANDLE can be displayed inline." 1021 "Say whether HANDLE can be displayed inline.
1022TYPE is the mime-type of the object; it defaults to the one given
1023in HANDLE."
1024 (unless type (setq type (mm-handle-media-type handle)))
1024 (let ((alist mm-inline-media-tests) 1025 (let ((alist mm-inline-media-tests)
1025 (type (mm-handle-media-type handle))
1026 test) 1026 test)
1027 (while alist 1027 (while alist
1028 (when (string-match (caar alist) type) 1028 (when (string-match (caar alist) type)