unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
To: emacs-devel@gnu.org
Cc: Ivan Kanis <ivan@kanis.fr>, Lars Ingebrigtsen <larsi@gnus.org>
Subject: Re: render region with eww
Date: Wed, 26 Jun 2013 11:00:31 +0200	[thread overview]
Message-ID: <2066702.3NLJt1OV8x@descartes> (raw)
In-Reply-To: <87y59xb8mh.fsf@kanis.fr>

On Wednesday 26 June 2013 10:04:38 Ivan Kanis wrote:
> emacs-w3m has a function called w3m-region. As the name implies it
> renders html within a region. The package newsticker (included in Emacs)
> uses that feature. I think it's implemented as a minor mode.
> 
> I am not sure how to write it wit eww. Any thoughts?

You can do this with shr alone.  A quick hack:

(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))))

Best Regards
Rüdiger



  reply	other threads:[~2013-06-26  9:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26  8:04 render region with eww Ivan Kanis
2013-06-26  9:00 ` Rüdiger Sonderfeld [this message]
2013-06-27 18:01   ` [PATCH] " Ivan Kanis
2013-06-27 19:03     ` Stefan Monnier
2013-06-28  7:59     ` Lars Magne Ingebrigtsen

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=2066702.3NLJt1OV8x@descartes \
    --to=ruediger@c-plusplus.de \
    --cc=emacs-devel@gnu.org \
    --cc=ivan@kanis.fr \
    --cc=larsi@gnus.org \
    /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).