Merge pull request #3052 from sei40kr/dash-docs-xwidget-integration
Add Dash docsets + Xwidget integration
This commit is contained in:
commit
e411367f4b
2 changed files with 18 additions and 0 deletions
|
@ -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]]
|
||||
|
|
|
@ -96,6 +96,8 @@ Used by `+lookup/dictionary-definition' and `+lookup/synonyms'.
|
|||
For `+lookup/dictionary-definition', this is ignored on Mac, where Emacs users
|
||||
Dictionary.app behind the scenes to get definitions.")
|
||||
|
||||
(defvar +lookup--dash-docs-xwidget-webkit-last-session-buffer nil)
|
||||
|
||||
|
||||
;;
|
||||
;;; dumb-jump
|
||||
|
@ -178,6 +180,21 @@ 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 (featurep! +xwidget)
|
||||
(defun +lookup-dash-docs-xwidget-webkit-browse-url-fn (url &optional new-session)
|
||||
(if (not (display-graphic-p))
|
||||
(eww url new-session)
|
||||
(setq xwidget-webkit-last-session-buffer +lookup--dash-docs-xwidget-webkit-last-session-buffer)
|
||||
(save-window-excursion
|
||||
(xwidget-webkit-browse-url url new-session))
|
||||
(with-popup-rules!
|
||||
'((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-fn))
|
||||
|
||||
(cond ((featurep! :completion helm)
|
||||
(require 'helm-dash nil t))
|
||||
((featurep! :completion ivy)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue