aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Kanis2013-06-28 09:57:49 +0200
committerLars Magne Ingebrigtsen2013-06-28 09:57:49 +0200
commiteadb6068871e454712c1794f9589b57ef55da8ef (patch)
tree8115a9cb736a9eb8770192a0948d5081062f8e44
parent75dbaf9d8b91290ee078670db5f1fb68489af6c6 (diff)
downloademacs-eadb6068871e454712c1794f9589b57ef55da8ef.tar.gz
emacs-eadb6068871e454712c1794f9589b57ef55da8ef.zip
* net/shr.el (shr-render-region): New function.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/net/shr.el11
2 files changed, 13 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index aba9c0ecc5a..e8342f7d508 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
12013-06-28 Ivan Kanis <ivan@kanis.fr> 12013-06-28 Ivan Kanis <ivan@kanis.fr>
2 2
3 * net/shr.el (shr-render-region): New function.
4
3 * net/eww.el: Autoload `eww-browse-url'. 5 * net/eww.el: Autoload `eww-browse-url'.
4 6
52013-06-27 Dmitry Gutov <dgutov@yandex.ru> 72013-06-27 Dmitry Gutov <dgutov@yandex.ru>
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.")
166 (libxml-parse-html-region (point-min) (point-max)))) 166 (libxml-parse-html-region (point-min) (point-max))))
167 (goto-char (point-min))) 167 (goto-char (point-min)))
168 168
169(defun shr-render-region (begin end &optional buffer)
170 "Display the HTML rendering of the region between BEGIN and END."
171 (interactive "r")
172 (unless (fboundp 'libxml-parse-html-region)
173 (error "This function requires Emacs to be compiled with libxml2"))
174 (with-current-buffer (or buffer (current-buffer))
175 (let ((dom (libxml-parse-html-region begin end)))
176 (delete-region begin end)
177 (goto-char begin)
178 (shr-insert-document dom))))
179
169(defun shr-visit-file (file) 180(defun shr-visit-file (file)
170 "Parse FILE as an HTML document, and render it in a new buffer." 181 "Parse FILE as an HTML document, and render it in a new buffer."
171 (interactive "fHTML file name: ") 182 (interactive "fHTML file name: ")