From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.gnus.general,gmane.emacs.devel Subject: Re: Displaying MIME parts internally/externally in Gnus Followup-To: gmane.emacs.devel Date: Fri, 02 Dec 2005 17:27:01 +0100 Message-ID: References: <87irum4tka.fsf-monnier+emacs@gnu.org> Reply-To: Reiner Steib NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1133541356 4913 80.91.229.2 (2 Dec 2005 16:35:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 2 Dec 2005 16:35:56 +0000 (UTC) Cc: Stefan Monnier Original-X-From: ding-owner+m9988@lists.math.uh.edu Fri Dec 02 17:35:52 2005 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EiDqm-0008Qu-HI for ding-account@gmane.org; Fri, 02 Dec 2005 17:33:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1EiDqZ-0006HD-00; Fri, 02 Dec 2005 10:33:19 -0600 Original-Received: from nas01.math.uh.edu ([129.7.128.39]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1EiDkp-0006H8-00 for ding@lists.math.uh.edu; Fri, 02 Dec 2005 10:27:23 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas01.math.uh.edu with esmtp (Exim 4.52) id 1EiDkj-0006No-BG for ding@lists.math.uh.edu; Fri, 02 Dec 2005 10:27:23 -0600 Original-Received: from mail.uni-ulm.de ([134.60.1.1]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1EiDke-0007vC-00 for ; Fri, 02 Dec 2005 17:27:12 +0100 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.10.123]) by mail.uni-ulm.de (8.13.4/8.13.4) with ESMTP id jB2GR2bU005075; Fri, 2 Dec 2005 17:27:02 +0100 (MET) Original-Received: by bridgekeeper.physik.uni-ulm.de (Postfix, from userid 170) id 0F16E10D58; Fri, 2 Dec 2005 17:27:01 +0100 (CET) Original-To: Emacs development , Mail-Followup-To: Emacs development , X-Face: .*T0'iU(sujq_j9\J>-d4fg;N/1++U#U$_5ii6k.=|"-n'?5O:Hyz&wi'-!I~,}7~GgT=0S /&-R5sbkNy5+Xo1y{Tw2KKxi@Xh"g@]Qc|.U<*]WDd)qvGowFDvfU1F]{EDho:7P0@|oOD=Bc{K4?> WP68K[Mx:}=`ZT'6g4'f+g?;`vri2!)xGy}3:=l'(/Cea0l4lo^H5#@/Z3ev User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-DCC-SIHOPE-DCC-3-Metrics: gemini 1085; Body=3 Fuz1=3 Fuz2=3 X-Spam-Score: -2.5 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:61456 gmane.emacs.devel:46885 Archived-At: On Mon, Nov 21 2005, Stefan Monnier wrote: | To: emacs-devel@gnu.org, gnus@gnus.org Probably you meant ding@gnus.org? > Many attachments come with poor content-type description, in which case Gnus > typically doesn't know what to do with it. When doing "view externally", > such attachments are actually saved. I don't know about you, but I don't > consider "saving" as a sort of "viewing" activity. If I had wanted to save > the attachment I'd have used something more like, say, the "Save" > command instead, don't you think? > Similar problems happen for "view internally". So I suggest the patch below > which tries harder to show the attachment internally or externally: if the > content-type can't be displayed as requested, it asks the user what kind of > content-type to use instead. > > A minor variant of it has been mildly tested (and only on Emacs-CVS), and > it's based on a very shallow understanding of the code, so it's probably > not perfect. > > If there's no objection I'll install it, otherwise please tell me what's > wrong with it. I don't see how you use the predicate `PRED'. Your patch may conflict with the one I've installed in the trunk to improve `gnus-mime-view-part-as-type' (see below[1] and http://thread.gmane.org/v9hdbnepee.fsf%40marauder.physik.uni-ulm.de). Does you patch address a similar scenario? (Sorry, I didn't have time to check it myself.) Bye, Reiner. [1] 2005-10-13 Reiner Steib [...] * gnus-art.el (gnus-mime-view-part-as-type-internal): Try to fetch `filename' from Content-Disposition if Content-Type doesn't provide `name'. (gnus-mime-view-part-as-type): Set default instead of initial-input. --8<---------------cut here---------------start------------->8--- --- gnus-art.el 12 Oct 2005 12:50:14 -0000 7.129 +++ gnus-art.el 13 Oct 2005 13:26:03 -0000 7.130 @@ -4317,9 +4317,12 @@ (defun gnus-mime-view-part-as-type-internal () (gnus-article-check-buffer) - (let* ((name (mail-content-type-get - (mm-handle-type (get-text-property (point) 'gnus-data)) - 'name)) + (let* ((handle (get-text-property (point) 'gnus-data)) + (name (or + ;; Content-Type: foo/bar; name=... + (mail-content-type-get (mm-handle-type handle) 'name) + ;; Content-Disposition: attachment; filename=... + (cdr (assq 'filename (cdr (mm-handle-disposition handle)))))) (def-type (and name (mm-default-file-encoding name)))) (and def-type (cons def-type 0)))) @@ -4327,11 +4330,14 @@ "Choose a MIME media type, and view the part as such." (interactive) (unless mime-type - (setq mime-type (completing-read - "View as MIME type: " - (mapcar #'list (mailcap-mime-types)) - nil nil - (gnus-mime-view-part-as-type-internal)))) + (setq mime-type + (let ((default (gnus-mime-view-part-as-type-internal))) + (completing-read + (format "View as MIME type (default %s): " + (car default)) + (mapcar #'list (mailcap-mime-types)) + nil nil nil nil + (car default))))) (gnus-article-check-buffer) (let ((handle (get-text-property (point) 'gnus-data))) (when handle --8<---------------cut here---------------end--------------->8--- -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/