Fix Dash docsets + Xwidget integration
Make Xwidget popup rules and advices less general. fix
This commit is contained in:
parent
174ab0303f
commit
1d0c79d63c
1 changed files with 15 additions and 16 deletions
|
@ -96,6 +96,8 @@ Used by `+lookup/dictionary-definition' and `+lookup/synonyms'.
|
||||||
For `+lookup/dictionary-definition', this is ignored on Mac, where Emacs users
|
For `+lookup/dictionary-definition', this is ignored on Mac, where Emacs users
|
||||||
Dictionary.app behind the scenes to get definitions.")
|
Dictionary.app behind the scenes to get definitions.")
|
||||||
|
|
||||||
|
(defvar +lookup--dash-docs-xwidget-webkit-last-session-buffer nil)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; dumb-jump
|
;;; dumb-jump
|
||||||
|
@ -179,24 +181,21 @@ See https://github.com/magit/ghub/issues/81"
|
||||||
(funcall orig-fn url)))
|
(funcall orig-fn url)))
|
||||||
|
|
||||||
;; Dash docset + Xwidget integration
|
;; Dash docset + Xwidget integration
|
||||||
(when (and (featurep! :tools lookup +xwidget) (display-graphic-p))
|
(when (and (featurep! +xwidget) (display-graphic-p))
|
||||||
(setq dash-docs-browser-func #'xwidget-webkit-browse-url)
|
(defun +lookup/dash-docs-xwidget-webkit-browse-url (url &optional new-session)
|
||||||
|
(setq xwidget-webkit-last-session-buffer +lookup--dash-docs-xwidget-webkit-last-session-buffer)
|
||||||
(set-popup-rule! "^\\*xwidget" :vslot -11 :size 0.35 :select nil)
|
|
||||||
|
|
||||||
(defun +xwidget--webkit-goto-url-a (&rest _)
|
|
||||||
(pop-to-buffer xwidget-webkit-last-session-buffer))
|
|
||||||
(advice-add #'xwidget-webkit-goto-url :after #'+xwidget--webkit-goto-url-a)
|
|
||||||
|
|
||||||
(defun +xwidget--webkit-new-session-a (orig-fun &rest args)
|
|
||||||
(save-window-excursion
|
(save-window-excursion
|
||||||
(apply orig-fun args))
|
(xwidget-webkit-browse-url url new-session))
|
||||||
(pop-to-buffer xwidget-webkit-last-session-buffer))
|
(with-popup-rules!
|
||||||
(advice-add #'xwidget-webkit-new-session :around #'+xwidget--webkit-new-session-a)
|
'((set-popup-rule! "^\\*xwidget" :vslot -11 :size 0.35 :select nil))
|
||||||
|
(pop-to-buffer xwidget-webkit-last-session-buffer))
|
||||||
|
(setq +lookup--dash-docs-xwidget-webkit-last-session-buffer xwidget-webkit-last-session-buffer
|
||||||
|
xwidget-webkit-last-session-buffer nil))
|
||||||
|
(setq dash-docs-browser-func #'+lookup/dash-docs-xwidget-webkit-browse-url))
|
||||||
|
|
||||||
(when (featurep! :editor evil +everywhere)
|
(when (featurep! :editor evil +everywhere)
|
||||||
(add-transient-hook! 'xwidget-webkit-mode-hook
|
(add-transient-hook! 'xwidget-webkit-mode-hook
|
||||||
(+evil-collection-init 'xwidget))))
|
(+evil-collection-init 'xwidget)))
|
||||||
|
|
||||||
(cond ((featurep! :completion helm)
|
(cond ((featurep! :completion helm)
|
||||||
(require 'helm-dash nil t))
|
(require 'helm-dash nil t))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue