From 5d6a19e084ab4464a5b473ca67ff99cb55d1dab2 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Mon, 6 Mar 2006 06:53:12 +0000 Subject: [PATCH] (mm-w3m-cid-retrieve-1): Check carefully whether handle is multipart when calling it recursively. (mm-w3m-cid-retrieve): Display warning if retrieving fails. --- lisp/ChangeLog | 6 ++++++ lisp/mm-view.el | 26 +++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 97b0d357a..bc5bd47bb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-03-06 Katsumi Yamaoka + + * mm-view.el (mm-w3m-cid-retrieve-1): Check carefully whether + handle is multipart when calling it recursively. + (mm-w3m-cid-retrieve): Display warning if retrieving fails. + 2006-03-03 Daniel Pittman * nnimap.el (nnimap-request-update-info-internal): Optimize. diff --git a/lisp/mm-view.el b/lisp/mm-view.el index f1cfc74bb..36870afba 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -211,21 +211,25 @@ (defun mm-w3m-cid-retrieve-1 (url handle) (dolist (elem handle) - (when (listp elem) - (if (equal url (mm-handle-id elem)) - (progn - (mm-insert-part elem) - (throw 'found-handle (mm-handle-media-type elem)))) - (if (equal "multipart" (mm-handle-media-supertype elem)) - (mm-w3m-cid-retrieve-1 url elem))))) + (when (consp elem) + (when (equal url (mm-handle-id elem)) + (mm-insert-part elem) + (throw 'found-handle (mm-handle-media-type elem))) + (when (and (stringp (car elem)) + (equal "multipart" (mm-handle-media-supertype elem))) + (mm-w3m-cid-retrieve-1 url elem))))) (defun mm-w3m-cid-retrieve (url &rest args) "Insert a content pointed by URL if it has the cid: scheme." (when (string-match "\\`cid:" url) - (catch 'found-handle - (mm-w3m-cid-retrieve-1 (concat "<" (substring url (match-end 0)) ">") - (with-current-buffer w3m-current-buffer - gnus-article-mime-handles))))) + (or (catch 'found-handle + (mm-w3m-cid-retrieve-1 + (setq url (concat "<" (substring url (match-end 0)) ">")) + (with-current-buffer w3m-current-buffer + gnus-article-mime-handles))) + (prog1 + nil + (message "Failed to find \"Content-ID: %s\"" url))))) (defun mm-inline-text-html-render-with-w3m (handle) "Render a text/html part using emacs-w3m." -- 2.25.1