From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/61807 Path: news.gmane.org!not-for-mail From: Hynek Schlawack Newsgroups: gmane.emacs.gnus.general Subject: Re: Viewing HTML-mails with external browsers - proposed code Date: Tue, 31 Jan 2006 13:38:48 +0100 Message-ID: References: <874q56xeh4@ularx.de> <878xt8wi4l@ularx.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1138711181 27760 80.91.229.2 (31 Jan 2006 12:39:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2006 12:39:41 +0000 (UTC) Original-X-From: ding-owner+m10337@lists.math.uh.edu Tue Jan 31 13:39:36 2006 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F3un9-0003rA-T4 for ding-account@gmane.org; Tue, 31 Jan 2006 13:39:28 +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 1F3un6-00044O-00; Tue, 31 Jan 2006 06:39:24 -0600 Original-Received: from nas02.math.uh.edu ([129.7.128.40]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1F3umd-00044I-00 for ding@lists.math.uh.edu; Tue, 31 Jan 2006 06:38:55 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas02.math.uh.edu with esmtp (Exim 4.52) id 1F3umY-0005NX-IB for ding@lists.math.uh.edu; Tue, 31 Jan 2006 06:38:55 -0600 Original-Received: from relay1.mail.vrmd.de ([81.28.232.18]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1F3umX-0003CM-00 for ; Tue, 31 Jan 2006 13:38:49 +0100 Original-Received: from [141.89.59.172] (helo=sanday.haiti.cs.uni-potsdam.de) by relay1.mail.vrmd.de with esmtpa (Exim 4.60) (envelope-from ) id 1F3umX-0000SO-9p for ding@gnus.org; Tue, 31 Jan 2006 13:38:49 +0100 Original-To: ding@gnus.org In-Reply-To: (Reiner Steib's message of "Wed, 25 Jan 2006 18:41:54 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Relay-User: mailout@ularx.de X-Spam-Score: -2.6 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:61807 Archived-At: --=-=-= * Reiner Steib wrote: > As for your code, it's fine for now if you use `mm-make-temp-file' > instead of `make-temp-name'. Done. I've attached it - would some Win32-user care to test whether it works as expected _please_? Thanks! >> So, there's the bug with your mail and the temp-file-stuff left, >> iirc? > You mean removing the temp file(s)? I'm still pondering how to get that best. I'll definitely add an argument for that because _I_ don't want to be bothered everytime I look at a HTML-mail. But any other suggestions? C'mon guys/gals, it's not only Reiner reading here. ;) > Yes, and waiting for your assignment. I've sent it out yesterday by airmail. Btw, are the cool GNU/Linux-stickers the $1 that is mentioned in the assignment? ;) --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=hs-show-html-mail.el Content-Transfer-Encoding: quoted-printable ;;; hs-show-html-mail.el --- View HTML-parts in a graphical browser. ;; Copyright (C) 2005, 2006 Hynek Schlawack ;; Author: Hynek Schlawack ;; Version: $Id: hs-show-html-mail.el 14 2006-01-31 12:33:07Z hynek $ ;; Keywords: mail news ;; This file is NOT part of GNU Emacs. ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; Scans the actual article in Gnus for HTML-parts and shows them using ;; browse-url. ;;; Code: (defun gnus-article-browse-html-parts (list) "View all \"text/html\" parts from LIST. Recurse into multiparts." (let ((showed)) ;; Find and show the html-parts. (dolist (handle list) ;; If HTML, show it (when (listp handle) (cond ((and (bufferp (car handle)) (string-match "text/html" (car (mm-handle-type handle)))) (let ((tmp-file (mm-make-temp-file (format "gnus-html-%s-" (user-lo= gin-name)) nil ".html"))) (mm-save-part-to-file handle tmp-file) (browse-url tmp-file) (setq showed t))) ;; If multipart, recurse ((and (stringp (car handle)) (string-match "^multipart/" (substring (car handle) 0 10)) (setq showed (or showed (hs-show-html-list handle)))))))) showed)) (defun gnus-article-browse-html-article () "View \"text/html\" parts of the current article with a WWW browser." (interactive) =20=20 (save-window-excursion ;; Open raw article and select the buffer (gnus-summary-show-article t) (gnus-summary-select-article-buffer) (let ((parts (mm-dissect-buffer t t))) ;; If singlepart, enforce a list. (when (and (bufferp (car parts)) (stringp (car (mm-handle-type parts)))) (setq parts (list parts))) ;; Process the list (unless (gnus-article-browse-html-parts parts) (gnus-error 3 "Mail doesn't contain a \"text/html\" part!")) (gnus-summary-show-article)))) =20=20=20=20 (provide 'hs-show-html-mail) ;;; hs-show-html-mail.el ends here --=-=-=--