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:
parent
bd49b6f1b3
commit
60b7668b89
1 changed files with 7 additions and 8 deletions
|
@ -1659,14 +1659,13 @@ on what is seen near point."
|
||||||
(setq symbol (concat ":" symbol)))
|
(setq symbol (concat ":" symbol)))
|
||||||
(let ((url (format css-lookup-url-format symbol))
|
(let ((url (format css-lookup-url-format symbol))
|
||||||
(buffer (get-buffer-create "*MDN CSS*")))
|
(buffer (get-buffer-create "*MDN CSS*")))
|
||||||
(save-selected-window
|
;; Make sure to display the buffer before calling `eww', as that
|
||||||
;; Make sure to display the buffer before calling `eww', as
|
;; calls `pop-to-buffer-same-window'.
|
||||||
;; that calls `pop-to-buffer-same-window'.
|
(switch-to-buffer-other-window buffer)
|
||||||
(switch-to-buffer-other-window buffer)
|
(with-current-buffer buffer
|
||||||
(with-current-buffer buffer
|
(eww-mode)
|
||||||
(eww-mode)
|
(add-hook 'eww-after-render-hook #'css--mdn-after-render nil t)
|
||||||
(add-hook 'eww-after-render-hook #'css--mdn-after-render nil t)
|
(eww url)))))
|
||||||
(eww url))))))
|
|
||||||
|
|
||||||
(provide 'css-mode)
|
(provide 'css-mode)
|
||||||
;;; css-mode.el ends here
|
;;; css-mode.el ends here
|
||||||
|
|
Loading…
Add table
Reference in a new issue