diff options
| author | Ivan Kanis | 2013-06-28 09:57:49 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2013-06-28 09:57:49 +0200 |
| commit | eadb6068871e454712c1794f9589b57ef55da8ef (patch) | |
| tree | 8115a9cb736a9eb8770192a0948d5081062f8e44 | |
| parent | 75dbaf9d8b91290ee078670db5f1fb68489af6c6 (diff) | |
| download | emacs-eadb6068871e454712c1794f9589b57ef55da8ef.tar.gz emacs-eadb6068871e454712c1794f9589b57ef55da8ef.zip | |
* net/shr.el (shr-render-region): New function.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/net/shr.el | 11 |
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 @@ | |||
| 1 | 2013-06-28 Ivan Kanis <ivan@kanis.fr> | 1 | 2013-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 | ||
| 5 | 2013-06-27 Dmitry Gutov <dgutov@yandex.ru> | 7 | 2013-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: ") |