From eadb6068871e454712c1794f9589b57ef55da8ef Mon Sep 17 00:00:00 2001 From: Ivan Kanis Date: Fri, 28 Jun 2013 09:57:49 +0200 Subject: [PATCH] * net/shr.el (shr-render-region): New function. --- lisp/ChangeLog | 2 ++ lisp/net/shr.el | 11 +++++++++++ 2 files changed, 13 insertions(+) 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: ") -- 2.11.4.GIT