6

I am aware about w3m integration with Emacs but I am exhausted to make it run on my W7/x64: there is a permanent segmentation fault of w3m binary here.

I wonder if there is an alternative way to display remote HTML in Emacs possibly preliminary filtered in the way it is done by Readability/GetPocket etc. services? I do not need a navigation there so cleared contents would be perfect.

Thanks,

zweibaranov
  • 560
  • 3
  • 11

1 Answers1

12

trunk / Emacs 24.4:

  • M-x eww RET (URL) RET

Emacs 24.1 - 24.3:

  • M-x browse-url-emacs RET (URL) RET
  • M-x load-library RET shr RET
  • M-x shr-render-buffer RET
(defun my-render-url (url)
  "Render URL as HTML."
  (interactive "sURL: ")
  (require 'shr)
  (let ((buf (save-window-excursion (browse-url-emacs url))))
    (shr-render-buffer buf)))

Edit: or this, which has absolutely no error handling, but is considerably faster (which I attribute to browse-url-emacs using url-retrieve-synchronously, where as this is asynchronous). Feel free to make improvements :)

(defun my-render-url (url)
  "Render URL as HTML."
  (declare (obsolete eww "24.4"))
  (interactive "sURL: ")
  (require 'shr)
  (url-retrieve
   url
   (lambda (&optional status cbargs)
     (let ((markup (current-buffer)))
       (delete-region (point-min) (1+ url-http-end-of-headers))
       (shr-render-buffer markup)
       (kill-buffer markup)))))
phils
  • 66,286
  • 9
  • 132
  • 174
  • I wish I knew before about :) Will try to backport it to 24.1, should be no problems. Thanks! – zweibaranov Oct 28 '13 at 12:04
  • For the current code in trunk, see [eww.el](http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/net/eww.el?h=trunk), [shr.el](http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/net/shr.el?h=trunk), and [shr-color.el](http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/net/shr-color.el?h=trunk) (although I'm not sure if that's all you need, or how practical backporting will be). – phils Oct 28 '13 at 12:11
  • The approach you have described above works like a charm for my 24.1 installation. Seems ''eww.el'' should be enough to have this feature on my local installation; but currently it does not work through the proxy but that is an another story. – zweibaranov Oct 28 '13 at 12:14