I am trying to add a hook which calls
shr-render-buffer after loading a file in
html-mode. This is what I came up with:
(add-hook 'html-mode-hook (lambda () (call-interactively #'shr-render-buffer)))
This works, except not quite as expected.
M-x shr-render-buffer in an
html-mode buffer splits the current frame vertically, and puts the rendered output in the bottom window with the html still visible in the top window. On the other hand, if I do
find-file and open an html file, my hook code splits the frame vertically, but buries the html buffer, so that I have the rendered buffer on the bottom, and whichever buffer I was visiting when I did
find-file at the top.
What is happening here? Seemingly, something with the timing is getting messed up from the way I am calling
shr-render-buffer, but I don't really know what/how.