Commit 60b7668b authored by Simen Heggestøyl's avatar Simen Heggestøyl

Keep eww buffer current when looking up CSS on MDN

* lisp/textmodes/css-mode.el (css-lookup-symbol): Keep the eww buffer
current when looking up CSS documentation on MDN.  This fixes a bug
where the eww buffer's content sometimes get mangled when switching
buffers mid-render.
parent bd49b6f1
......@@ -1659,14 +1659,13 @@ on what is seen near point."
(setq symbol (concat ":" symbol)))
(let ((url (format css-lookup-url-format symbol))
(buffer (get-buffer-create "*MDN CSS*")))
(save-selected-window
;; Make sure to display the buffer before calling `eww', as
;; that calls `pop-to-buffer-same-window'.
(switch-to-buffer-other-window buffer)
(with-current-buffer buffer
(eww-mode)
(add-hook 'eww-after-render-hook #'css--mdn-after-render nil t)
(eww url))))))
;; Make sure to display the buffer before calling `eww', as that
;; calls `pop-to-buffer-same-window'.
(switch-to-buffer-other-window buffer)
(with-current-buffer buffer
(eww-mode)
(add-hook 'eww-after-render-hook #'css--mdn-after-render nil t)
(eww url)))))
(provide 'css-mode)
;;; css-mode.el ends here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment