From: Reiner Steib <reinersteib+gmane@imap.cc>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Displaying MIME parts internally/externally in Gnus
Date: Fri, 02 Dec 2005 17:27:01 +0100 [thread overview]
Message-ID: <v94q5rxy5m.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: 87irum4tka.fsf-monnier+emacs@gnu.org
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 <Reiner.Steib@gmx.de>
[...]
* 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/
next prev parent reply other threads:[~2005-12-02 16:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-21 2:42 Displaying MIME parts internally/externally in Gnus Stefan Monnier
2005-12-02 15:11 ` Stefan Monnier
[not found] ` <m31wvwgt0w.fsf@quimbies.gnus.org>
[not found] ` <873bgcns63.fsf-monnier+emacs@gnu.org>
[not found] ` <m3mzekdxn0.fsf@quimbies.gnus.org>
[not found] ` <jwvwtdomay3.fsf-monnier+emacs@gnu.org>
[not found] ` <m3vet8p2w4.fsf@quimbies.gnus.org>
2006-05-03 14:01 ` Reiner Steib
2006-05-03 16:36 ` Lars Magne Ingebrigtsen
2006-05-03 23:32 ` Katsumi Yamaoka
2006-05-04 11:01 ` Reiner Steib
2006-05-04 12:04 ` Stefan Monnier
2006-05-04 12:43 ` Reiner Steib
2006-05-04 15:18 ` Stefan Monnier
2006-05-06 12:42 ` Reiner Steib
2005-12-02 16:27 ` Reiner Steib [this message]
2005-12-02 21:28 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=v94q5rxy5m.fsf@marauder.physik.uni-ulm.de \
--to=reinersteib+gmane@imap.cc \
--cc=Reiner.Steib@gmx.de \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).