Add Dash docsets + Xwidget integration

This commit is contained in:
Seong Yong-ju 2020-05-07 01:05:57 +09:00
parent b5c4fce0b1
commit 174ab0303f
2 changed files with 21 additions and 0 deletions

View file

@ -40,6 +40,7 @@ or synonyms.
+ ~+dictionary~ Enable word definition and thesaurus lookup functionality.
+ ~+offline~ Install and prefer offline dictionary/thesaurus.
+ ~+docsets~ Enable integration with Dash.app docsets.
+ ~+xwidget~ Enable integration with [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Embedded-WebKit-Widgets.html][Embedded Webkit Widgets]].
** Plugins
+ [[https://github.com/jacktasia/dumb-jump][dumb-jump]]

View file

@ -178,6 +178,26 @@ See https://github.com/magit/ghub/issues/81"
(let ((gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
(funcall orig-fn url)))
;; Dash docset + Xwidget integration
(when (and (featurep! :tools lookup +xwidget) (display-graphic-p))
(setq dash-docs-browser-func #'xwidget-webkit-browse-url)
(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
(apply orig-fun args))
(pop-to-buffer xwidget-webkit-last-session-buffer))
(advice-add #'xwidget-webkit-new-session :around #'+xwidget--webkit-new-session-a)
(when (featurep! :editor evil +everywhere)
(add-transient-hook! 'xwidget-webkit-mode-hook
(+evil-collection-init 'xwidget))))
(cond ((featurep! :completion helm)
(require 'helm-dash nil t))
((featurep! :completion ivy)