emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: render region with eww


From: Rüdiger Sonderfeld
Subject: Re: render region with eww
Date: Wed, 26 Jun 2013 11:00:31 +0200
User-agent: KMail/4.10.3 (Linux/3.8.0-23-generic; KDE/4.10.3; x86_64; ; )

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 via email to

[Prev in Thread] Current Thread [Next in Thread]