From: Reiner Steib <reinersteib+gmane@imap.cc>
Subject: Bug in "View as type"?
Date: Tue, 11 Oct 2005 23:04:41 +0200 [thread overview]
Message-ID: <v9hdbnepee.fsf@marauder.physik.uni-ulm.de> (raw)
Hi,
if I understand the code correctly, `gnus-mime-view-part-as-type'
(bound to `t' on MIME buttons) is supposed to offer the type by
calling `mm-default-file-encoding' in
`gnus-mime-view-part-as-type-internal'. I.e. when the content type is
application/octet-stream and the file is in fact image/whatever or
application/pdf (some broken mailers do), the user should be offered
as more reasonable default.
But in fact this doesn't work (at least for me):
(get-text-property (point) 'gnus-data)
=> (#<buffer *mm*<7>> ("application/octet-stream") base64 nil
("attachment" (filename . "cookies.txt")) nil nil nil)
(mm-handle-type ...)
=> ("application/octet-stream")
(mail-content-type-get ... 'name)
=> nil
The following seems to do better.
The only use of `gnus-mime-view-part-as-type-internal' is in
`gnus-mime-view-part-as-type'. Or can anyone imaging a situation
where the current implementation is preferable?
Do we have some shortcut for this?
(cdr (assq 'name (cdr (mm-handle-disposition handle))))
--8<---------------cut here---------------start------------->8---
--- gnus-art.el 27 Sep 2005 17:50:05 +0200 7.128
+++ gnus-art.el 11 Oct 2005 22:59:23 +0200
@@ -4317,9 +4317,9 @@
(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 (cdr (assq 'name (cdr (mm-handle-disposition handle))))
+ (cdr (assq 'filename (cdr (mm-handle-disposition handle))))))
(def-type (and name (mm-default-file-encoding name))))
(and def-type (cons def-type 0))))
@@ -4328,10 +4328,12 @@
(interactive)
(unless mime-type
(setq mime-type (completing-read
- "View as MIME type: "
+ (format "View as MIME type (default %s): "
+ (car (gnus-mime-view-part-as-type-internal)))
(mapcar #'list (mailcap-mime-types))
nil nil
- (gnus-mime-view-part-as-type-internal))))
+ nil nil
+ (car (gnus-mime-view-part-as-type-internal)))))
(gnus-article-check-buffer)
(let ((handle (get-text-property (point) 'gnus-data)))
(when handle
--8<---------------cut here---------------end--------------->8---
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
next reply other threads:[~2005-10-11 21:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-11 21:04 Reiner Steib [this message]
2005-10-11 23:04 ` Adam Sjøgren
2005-10-12 12:31 ` Reiner Steib
2005-10-12 13:22 ` Adam Sjøgren
2005-10-12 15:43 ` Reiner Steib
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=v9hdbnepee.fsf@marauder.physik.uni-ulm.de \
--to=reinersteib+gmane@imap.cc \
--cc=Reiner.Steib@gmx.de \
/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.
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 NNTP newsgroup(s).