I want to make a buffer in a new window (but not pop to it) insert HTML code in it, and render its content with shr-render-*. Yes, an HTML preview window, let me know if you know of a (simple) existing implementation ; I tried various strategies, like temp buffers :

(with-output-to-temp-buffer "foo"
  (print (format "%s" "<h1>plop</h1>"))
  (print standard-output)

But this opens yet another window, and I lose my original window ; Ideally, what I'd like is a help buffer, but I'm guessing they are read-only..?


OK, I found out :

(with-output-to-temp-buffer "foo"
  (pop-to-buffer "foo")
  (insert "<h1>plip</h1>")
  (shr-render-region (point-min) (point-max)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.