From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/69571 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.gnus.general Subject: Re: [emacs-w3m:11119] Re: Content-Location ignored? Date: Sun, 18 Apr 2010 10:01:43 +1000 Organization: Bah Humbug Message-ID: <87hbn9ocgo.fsf@blah.blah> References: <87bpgiu3uu.fsf@jidanni.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1271548975 3166 80.91.229.12 (18 Apr 2010 00:02:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 18 Apr 2010 00:02:55 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M17965@lists.math.uh.edu Sun Apr 18 02:02:54 2010 connect(): No such file or directory Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O3HyP-0001DU-Fn for ding-account@gmane.org; Sun, 18 Apr 2010 02:02:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1O3Hxx-0006Vg-3b; Sat, 17 Apr 2010 19:02:25 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1O3Hxt-0006VI-Rx for ding@lists.math.uh.edu; Sat, 17 Apr 2010 19:02:21 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.69) (envelope-from ) id 1O3Hxn-0002t7-Mn for ding@lists.math.uh.edu; Sat, 17 Apr 2010 19:02:20 -0500 Original-Received: from mailout1-1.pacific.net.au ([61.8.2.208] helo=mailout1.pacific.net.au) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1O3Hxj-000534-00 for ; Sun, 18 Apr 2010 02:02:12 +0200 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout1.pacific.net.au (Postfix) with ESMTP id 8633557671F for ; Sun, 18 Apr 2010 10:02:03 +1000 (EST) Original-Received: from blah.blah (ppp2F72.dyn.pacific.net.au [61.8.47.114]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id 5918A8C07 for ; Sun, 18 Apr 2010 10:01:53 +1000 (EST) Original-Received: from gg by blah.blah with local (Exim 4.71) (envelope-from ) id 1O3HxH-0003HR-AR for ding@gnus.org; Sun, 18 Apr 2010 10:01:43 +1000 In-Reply-To: (Katsumi Yamaoka's message of "Tue, 26 Jan 2010 17:51:05 +0900") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) X-Spam-Score: -0.5 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:69571 Archived-At: --=-=-= I had a go a while back at picking out the content-location from parts, per below. It might have bit-rotted by now. Apologies if I already reposted this and forgot. It was aimed the other way, to get the content-location on a html part through to w3m so it can resolve relative urls to the right place. But if the content-location is of interest for other things it might be worth holding in the mm-handle irrespective whether that resolving is done yet. Is it possible to give w3m a temporary cache of the provided parts and their urls? That'd sound easier than re-writing to content ids. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=mm-decode.el.content-location.diff --- mm-decode.el 04 Nov 2008 10:27:16 +1100 7.68 +++ mm-decode.el 04 Nov 2008 10:27:23 +1100 @@ -89,6 +89,8 @@ `(setcar (nthcdr 6 ,handle) ,contents)) (defmacro mm-handle-id (handle) `(nth 7 ,handle)) +(defmacro mm-handle-content-location (handle) + `(nth 8 ,handle)) (defmacro mm-handle-multipart-original-buffer (handle) `(get-text-property 0 'buffer (car ,handle))) (defmacro mm-handle-multipart-from (handle) @@ -98,9 +100,9 @@ (defmacro mm-make-handle (&optional buffer type encoding undisplayer disposition description cache - id) + id content-location) `(list ,buffer ,type ,encoding ,undisplayer - ,disposition ,description ,cache ,id)) + ,disposition ,description ,cache ,id ,content-location)) (defcustom mm-text-html-renderer (cond ((executable-find "w3m") @@ -550,7 +552,7 @@ (message "Destroying external MIME viewers") (mm-destroy-parts mm-postponed-undisplay-list))) -(defun mm-dissect-buffer (&optional no-strict-mime loose-mime from) +(defun mm-dissect-buffer (&optional no-strict-mime loose-mime from content-location) "Dissect the current buffer and return a list of MIME handles." (save-excursion (let (ct ctl type subtype cte cd description id result) @@ -564,7 +566,9 @@ cte (mail-fetch-field "content-transfer-encoding") cd (mail-fetch-field "content-disposition") description (mail-fetch-field "content-description") - id (mail-fetch-field "content-id")) + id (mail-fetch-field "content-id") + content-location (or (mail-fetch-field "content-location") + content-location)) (unless from (setq from (mail-fetch-field "from"))) ;; FIXME: In some circumstances, this code is running within @@ -583,7 +587,7 @@ (and cte (intern (downcase (mail-header-strip cte)))) no-strict-mime (and cd (mail-header-parse-content-disposition cd)) - description) + description content-location) (setq type (split-string (car ctl) "/")) (setq subtype (cadr type) type (car type)) @@ -608,7 +612,7 @@ 'from from 'start start) (car ctl)) - (cons (car ctl) (mm-dissect-multipart ctl from)))) + (cons (car ctl) (mm-dissect-multipart ctl from content-location)))) (t (mm-possibly-verify-or-decrypt (mm-dissect-singlepart @@ -616,7 +620,7 @@ (and cte (intern (downcase (mail-header-strip cte)))) no-strict-mime (and cd (mail-header-parse-content-disposition cd)) - description id) + description id content-location) ctl)))) (when id (when (string-match " *<\\(.*\\)> *" id) @@ -624,15 +628,15 @@ (push (cons id result) mm-content-id-alist)) result)))) -(defun mm-dissect-singlepart (ctl cte &optional force cdl description id) +(defun mm-dissect-singlepart (ctl cte &optional force cdl description id content-location) (when (or force (if (equal "text/plain" (car ctl)) (assoc 'format ctl) t)) (mm-make-handle - (mm-copy-to-buffer) ctl cte nil cdl description nil id))) + (mm-copy-to-buffer) ctl cte nil cdl description nil id content-location))) -(defun mm-dissect-multipart (ctl from) +(defun mm-dissect-multipart (ctl from content-location) (goto-char (point-min)) (let* ((boundary (concat "\n--" (mail-content-type-get ctl 'boundary))) (close-delimiter (concat (regexp-quote boundary) "--[ \t]*$")) @@ -649,7 +653,7 @@ (save-excursion (save-restriction (narrow-to-region start (point)) - (setq parts (nconc (list (mm-dissect-buffer t nil from)) parts))))) + (setq parts (nconc (list (mm-dissect-buffer t nil from content-location)) parts))))) (end-of-line 2) (or (looking-at boundary) (forward-line 1)) @@ -658,7 +662,7 @@ (save-excursion (save-restriction (narrow-to-region start end) - (setq parts (nconc (list (mm-dissect-buffer t nil from)) parts))))) + (setq parts (nconc (list (mm-dissect-buffer t nil from content-location)) parts))))) (mm-possibly-verify-or-decrypt (nreverse parts) ctl))) (defun mm-copy-to-buffer () --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=mm-view.el.content-location.diff --- mm-view.el 04 Nov 2008 10:26:46 +1100 7.59 +++ mm-view.el 04 Nov 2008 10:26:55 +1100 @@ -257,7 +257,8 @@ (insert (mm-decode-string text charset)))) (let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp) w3m-force-redisplay) - (w3m-region (point-min) (point-max) nil charset)) + (w3m-region (point-min) (point-max) + (mm-handle-content-location handle) charset)) (when (and mm-inline-text-html-with-w3m-keymap (boundp 'w3m-minor-mode-map) w3m-minor-mode-map) --=-=-=--