emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108770: * lisp/gnus/shr.el (shr-rend


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108770: * lisp/gnus/shr.el (shr-render-buffer): New command.
Date: Wed, 27 Jun 2012 10:40:22 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108770
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2012-06-27 10:40:22 -0400
message:
  * lisp/gnus/shr.el (shr-render-buffer): New command.
  (shr-visit-file): Use it.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/shr.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2012-06-27 00:47:19 +0000
+++ b/lisp/gnus/ChangeLog       2012-06-27 14:40:22 +0000
@@ -1,3 +1,8 @@
+2012-06-27  Stefan Monnier  <address@hidden>
+
+       * shr.el (shr-render-buffer): New command.
+       (shr-visit-file): Use it.
+
 2012-06-27  Katsumi Yamaoka  <address@hidden>
 
        * tests/gnustest-nntp.el, tests/gnustest-registry.el:

=== modified file 'lisp/gnus/shr.el'
--- a/lisp/gnus/shr.el  2012-06-26 22:52:31 +0000
+++ b/lisp/gnus/shr.el  2012-06-27 14:40:22 +0000
@@ -129,17 +129,23 @@
 
 ;; Public functions and commands.
 
-(defun shr-visit-file (file)
-  "Parse FILE as an HTML document, and render it in a new buffer."
-  (interactive "fHTML file name: ")
+(defun shr-render-buffer (buffer)
+  "Display the HTML rendering of the current buffer."
+  (interactive (list (current-buffer)))
   (pop-to-buffer "*html*")
   (erase-buffer)
   (shr-insert-document
-   (with-temp-buffer
-     (insert-file-contents file)
+   (with-current-buffer buffer
      (libxml-parse-html-region (point-min) (point-max))))
   (goto-char (point-min)))
 
+(defun shr-visit-file (file)
+  "Parse FILE as an HTML document, and render it in a new buffer."
+  (interactive "fHTML file name: ")
+  (with-temp-buffer
+    (insert-file-contents file)
+    (shr-render-buffer (current-buffer))))
+
 ;;;###autoload
 (defun shr-insert-document (dom)
   "Render the parsed document DOM into the current buffer.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]