Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

Commit

Permalink
Keep eww buffer current when looking up CSS on MDN
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
simenheg committed Oct 1, 2017
1 parent bd49b6f commit 60b7668
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lisp/textmodes/css-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 60b7668

Please sign in to comment.