Gnus development mailing list
 help / color / mirror / Atom feed
From: Hynek Schlawack <hynek@ularx.de>
Subject: Re: Viewing HTML-mails with external browsers - proposed code
Date: Sun, 22 Jan 2006 13:40:26 +0100	[thread overview]
Message-ID: <878xt8wi4l@ularx.de> (raw)
In-Reply-To: <v9irsg2eq6.fsf@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Thu, 19 Jan 2006 20:35:13 +0100")

[-- Attachment #1: Type: text/plain, Size: 3366 bytes --]

* Reiner Steib <reinersteib+gmane@imap.cc> wrote:

> JFTR: It failed with "Mail doesn't contain a HTML-part!" on the
> following forwarded message:
>
> |   <* mixed> Fwd: RE: Termine
> |   <1 text>
> |   <2 rfc822>
> |   <2.* alternative> RE: Termine
> |   <2.1 text>
> |   <2.2 html>

Hm, would you mind to forward some look-a-like to me?

> I think (when your assignment is completed), 

It's up to our patience right now. ;)

> we should add both functions to `gnus-art.el' and add a key binding
> (suggestions?) 

Well, _I_ use "v", but I guess I won't be able to push that. ;)

> As requested, some comments/suggestions on the code:

Thanks!

>> (defun hs-show-html-list (LIST)
> Rename to, say `gnus-article-browse-html-parts'.  Other suggestions?
> Instead of LIST, you should write list (in lowercase).

*done*

>>   "View all HTML-parts from 'LIST'.
>   "View all \"text/html\" parts from LIST.

*done*

>>   (let ((showed))
> Maybe "done" instead of "showed"?

I'm not sure whether "done" exactly reflects the purpose of "showed".

>>     ;; Find and show the html-parts.
>>     (dolist (elt LIST)
>>       ;; If HTML, show it
>>       (cond ((and (listp elt)
> Maybe rename "elt" to "handle"?

*done* I've been lacking imagination in that point.

[ Factoring out cond ]

Yeah you're right. The routines grew a bit...evolutionary.

>> 		  (bufferp (car elt))
> Isn't (car elt) the same as (mm-handle-buffer elt)?  

Yes...but we don't know exactly whether it's a buffer (look at the
second condition), so I guess car is more appropriate here.

>> 		  (string-match "text/html" (car (mm-handle-type elt))))
>> 	     (let ((tmp (format "%s-%s.html"
> Maybe "file" instead of "tmp"?

I went for "tmp-file" if it's okay for you.

>> 				(make-temp-name "/tmp/gnus-html-")
>> 				(user-login-name))))
>
>   (mm-make-temp-file (expand-file-name "mm" mm-tmp-directory) nil ".html")
> Maybe even (convert-standard-filename (mm-make-temp-file ...))  like
> in `browse-url-of-buffer' is required?

Uhm, so what's your final suggestion here? :)

>> 	       (mm-save-part-to-file elt tmp)
>> 	       (browse-url tmp)
> It would be nice to remove the tmp file after proceeding to the next
> article or leaving the summary buffer (maybe similar to
> `mm-remove-part').  But it might depend on the browser and the user if
> this is desired.  Or it could be removed here:
>   (when (gnus-y-or-n-p "Remove temp file? ") (delete-file tmp))

Yes it would be nice and the only way would be this asking as we can't
delete it, before it has been showed...

>> 	       (setq showed t)))
>> 	    ;; If multipart, recurse
>> 	    ((and (listp elt)
>> 		  (stringp (car elt))
>> 		  (string-match "multipart/" (substring (car elt) 0 10))
>   (string-match "^multipart/" (car elt))

*done*

>> 		  (setq showed (or showed (hs-show-html-list elt)))))))
>>     showed))
>> (defun hs-show-html-mail ()
>   (defun gnus-article-browse-html-article

*done*

> Other suggestions?

I'm fine with it.

>>   "View HTML-parts of the current Gnus-Article in a graphical browser."
>
>     "View \"text/html\" parts of the current article with a WWW browser."
> See `C-h f browse-url RET'.

Ehm, for what exactly?

>> 	(message "Mail doesn't contain a HTML-part!"))
> Either (gnus-message 3 ...) or even (gnus-error ...) should be used
> here, I think.

Ok, I wasn't sure about what to use.

-hs


[-- Attachment #2: hs-show-html-mail.el --]
[-- Type: application/emacs-lisp, Size: 2684 bytes --]

  reply	other threads:[~2006-01-22 12:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-18 21:49 Hynek Schlawack
2006-01-13 13:42 ` Hynek Schlawack
2006-01-13 15:57   ` Reiner Steib
2006-01-13 17:13     ` Hynek Schlawack
2006-01-19 19:35 ` Reiner Steib
2006-01-22 12:40   ` Hynek Schlawack [this message]
2006-01-25 14:44     ` Reiner Steib
2006-01-25 16:29       ` Hynek Schlawack
2006-01-25 17:41         ` Reiner Steib
2006-01-31 12:38           ` Hynek Schlawack
2006-02-10 18:15             ` Reiner Steib
2006-02-13  0:06               ` Katsumi Yamaoka
2006-02-13 14:53                 ` Reiner Steib
2006-02-13 15:24                   ` Hynek Schlawack
2006-02-13 15:37                   ` Hynek Schlawack
2006-02-13 22:16                     ` Reiner Steib
2006-02-14  0:11                       ` Katsumi Yamaoka
2006-02-14 11:50                         ` Katsumi Yamaoka
2006-02-15  8:39                           ` mm-make-temp-file (was Re: Viewing HTML-mails with external browsers - proposed code) Katsumi Yamaoka
2006-02-14 20:08                         ` Viewing HTML-mails with external browsers - proposed code Hynek Schlawack

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=878xt8wi4l@ularx.de \
    --to=hynek@ularx.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).