From: Ivan Kanis Date: Fri, 28 Jun 2013 07:57:49 +0000 (+0200) Subject: * net/shr.el (shr-render-region): New function. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1992^2~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=eadb6068871e454712c1794f9589b57ef55da8ef;p=emacs.git * net/shr.el (shr-render-region): New function. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aba9c0ecc5a..e8342f7d508 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2013-06-28 Ivan Kanis + * net/shr.el (shr-render-region): New function. + * net/eww.el: Autoload `eww-browse-url'. 2013-06-27 Dmitry Gutov diff --git a/lisp/net/shr.el b/lisp/net/shr.el index f2db68b96d1..490bea40afd 100644 --- a/lisp/net/shr.el +++ b/lisp/net/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))) + (delete-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: ")