aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
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 /lisp/net
parent75dbaf9d8b91290ee078670db5f1fb68489af6c6 (diff)
downloademacs-eadb6068871e454712c1794f9589b57ef55da8ef.tar.gz
emacs-eadb6068871e454712c1794f9589b57ef55da8ef.zip
* net/shr.el (shr-render-region): New function.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/shr.el11
1 files changed, 11 insertions, 0 deletions
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: ")