Render current HTML buffer with EWW
From time to time I end up with raw HTML content in an emacs buffer and want to know how it looks or just want to read it properly. Until now either I opened firefox to read that file or I opened it with eww-open-file. The problem is, that sometimes there is no file, the HTML buffer is just the output of some generator or something. In such cases I needed to save the buffer as a file and then re-open it with EWW. Very annoying.
With this simple function the nightmare is over. I just use the EWW internal render function to do the job. That way I can view any HTML in emacs without even saving it to disk.
(require 'eww) (defun eww-render-current-buffer () "Render HTML in the current buffer with EWW" (interactive) (beginning-of-buffer) (eww-display-html 'utf8 (buffer-name))) (global-set-key (kbd "<C-c C-e C-w C-w>") 'eww-render-current-buffer)
Now when I'm inside a HTML buffer, I can just render it and take a look with EWW. Very handy!

Similar posts
- 03.08.2017:
Emacs lisp: which key was pressed? - 17.07.2017:
autoscratch - solve the *scratch* buffer problem - 16.05.2016:
Emacs viking mode - 02.09.2013:
Der Herausgeber konnte nicht verifiziert werden - 07.11.2012:
vimacs
Null Comment zu Render current HTML buffer with EWW