1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

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.
This commit is contained in:
Simen Heggestøyl 2017-10-01 20:24:55 +02:00
parent bd49b6f1b3
commit 60b7668b89

View File

@ -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