From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Kanis Newsgroups: gmane.emacs.devel Subject: [PATCH] render region with eww Date: Thu, 27 Jun 2013 20:01:34 +0200 Message-ID: <87mwqbcu0x.fsf_-_@kanis.fr> References: <87y59xb8mh.fsf@kanis.fr> <2066702.3NLJt1OV8x@descartes> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1372356122 18210 80.91.229.3 (27 Jun 2013 18:02:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Jun 2013 18:02:02 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen , =?utf-8?Q?R=C3=BCdiger?= Sonderfeld Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 27 20:02:03 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UsGWB-0005tL-8w for ged-emacs-devel@m.gmane.org; Thu, 27 Jun 2013 20:02:03 +0200 Original-Received: from localhost ([::1]:45427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsGWA-0001a1-VD for ged-emacs-devel@m.gmane.org; Thu, 27 Jun 2013 14:02:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsGW2-0001ZO-VI for emacs-devel@gnu.org; Thu, 27 Jun 2013 14:02:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsGVz-0007Vn-M7 for emacs-devel@gnu.org; Thu, 27 Jun 2013 14:01:54 -0400 Original-Received: from kanis.fr ([46.19.35.252]:41858 helo=srv2.kanis.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsGVz-0007Ti-Au for emacs-devel@gnu.org; Thu, 27 Jun 2013 14:01:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kanis.fr; s=alpha; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:cc:to:References:Subject:From; bh=Lqt5TFrW2lxg3yQzBY/DgSN4bjWBOxE/wjOUJvi8SVk=; b=Z9/4LM2x+X0u8eCBYhmvn0PCdWd+8E2OpwYqmrTTM7YXsBidbqR47GDA6ftz4tZRvi7wLyG+XBYKs8WQO1q282dEyzFiwEMuL5WcW8G9sZpoCNlYXJckMh9tptK9BrSL; Original-Received: from smtp.comencini.fr ([164.138.25.8]) by smtp.comencini.fr with esmtpsa (TLS1.1:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80.1) (envelope-from ) id 1UsGVp-0005fI-6r; Thu, 27 Jun 2013 20:01:43 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAAB5QTFRF IBkXUxMTOCwoTC4qcUY8iFxQmmper31txpaJ/v/8aKZ1oAAAAcVJREFUOMt100tu2zAQAFDCXnUZ oAcIqG68LZULVLQBbwuSiffm6AIRRyeotAySJoVu2+FPpJWWC3/4NKOZocSW/yxWfnJ2+Bdwzhj7 8gleWVy7DXC2rkMNr2V/zRbghXIwthf3VbIA9Ffc71vZCSFyCEsBggtNS8ludwvfmhYA0Vn9o4DP zMWxR7+cPWzAYFzwM0ModtdmcDbDS6i/hT7L+RZof5yCXGrYe5jn2YO6BYMjgY+51tCIAqHgBLwR pwLnGuRjAKyBJkuN4yd4U92uCY1vUr2D/c5b8DuxyQwfOHUeaLqDJhnkkuGXbB56h2C1IVBdgncc bBi6feroa9B6jUDojnQPQKupbyXyeeCE1oT7Oqrt+SnfY3mkiyGA/3AmD3H5g32CcBx6hY8pRkwJ 9PpcjRGobUfprFnhAa1vepwcgMOhwG+pdSgKHFU9HAvoAH6XUl7lDUCCq5Qb6GMbVm3Aj++qDYCt wdBc/YHgOFCmS3mjDMRcSE2qY4E3Q3PVIQRQmeodNH4QEbRUFZzW+VotzwX4yTcRTySOML1qjcE5 hTirVqDHkMAP0PjAywp3d18JZtqzvr9zDYD+GaSKtE6Zlr/DLPNFmOcvBAAAAABJRU5ErkJggg== X-Hashcash: 1:20:130627:larsi@gnus.org::sH2ZdPEL9yxwIt5J:0001ERg X-Hashcash: 1:20:130627:emacs-devel@gnu.org::jO806lDrAbGFW1Hi:0000000000000000000000000000000000000000001qQ/ X-Hashcash: 1:20:130627:ruediger@c-plusplus.de::84PD+576xRbfO2jk:0000000000000000000000000000000000000003hv9 In-Reply-To: <2066702.3NLJt1OV8x@descartes> (=?utf-8?Q?=22R=C3=BCdiger?= Sonderfeld"'s message of "Wed, 26 Jun 2013 11:00:31 +0200") User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 46.19.35.252 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161148 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable June, 26 at 11:00 R=C3=BCdiger Sonderfeld wrote: >> I am not sure how to write it wit eww. Any thoughts? > > You can do this with shr alone. A quick hack: Thanks R=C3=BCdiger! it works nicely with newsticker. Here is the patch for you Lars. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-add-render-region-function.patch >From 656ced71e92d95b1ef8621bcb93984bd5e315711 Mon Sep 17 00:00:00 2001 From: Ivan Kanis Date: Thu, 27 Jun 2013 19:59:27 +0200 Subject: [PATCH] add render region function --- emacs/misc/shr.el | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/emacs/misc/shr.el b/emacs/misc/shr.el index f2db68b..fc48449 100644 --- a/emacs/misc/shr.el +++ b/emacs/misc/shr.el @@ -166,6 +166,17 @@ cid: URL as the argument.") (libxml-parse-html-region (point-min) (point-max)))) (goto-char (point-min))) +(defun shr-render-region (begin end &optional buffer) + "Display the HTML rendering of the region between BEGIN and END." + (interactive "r") + (unless (fboundp 'libxml-parse-html-region) + (error "This function requires Emacs to be compiled with libxml2")) + (with-current-buffer (or buffer (current-buffer)) + (let ((dom (libxml-parse-html-region begin end))) + (kill-region begin end) + (goto-char begin) + (shr-insert-document dom)))) + (defun shr-visit-file (file) "Parse FILE as an HTML document, and render it in a new buffer." (interactive "fHTML file name: ") -- 1.7.1 --=-=-=--