Refactor core-docs.el
This commit is contained in:
parent
85f3c14b2f
commit
60f395c8d6
2 changed files with 12 additions and 11 deletions
|
@ -5,20 +5,22 @@
|
||||||
:commands (dash-at-point dash-at-point-with-docset dash-at-point-run-search
|
:commands (dash-at-point dash-at-point-with-docset dash-at-point-run-search
|
||||||
dash-at-point-guess-docset)
|
dash-at-point-guess-docset)
|
||||||
:init
|
:init
|
||||||
(defmacro def-docset! (mode docset)
|
(defun doom-docs-lookup (&optional search all)
|
||||||
`(add-hook! ,mode (setq-local dash-at-point-docset ,docset)))
|
(let ((docset (unless all (dash-at-point-guess-docset))))
|
||||||
(defun doom-docs-lookup (&optional search docset)
|
(dash-at-point-run-search search docset))))
|
||||||
(dash-at-point-run-search search docset)))
|
|
||||||
|
|
||||||
(use-package zeal-at-point
|
(use-package zeal-at-point
|
||||||
:when (not IS-MAC)
|
:when (not IS-MAC)
|
||||||
:commands (zeal-at-point zeal-at-point-set-docset)
|
:commands (zeal-at-point zeal-at-point-set-docset)
|
||||||
:init
|
:init
|
||||||
(defmacro def-docset! (mode docset)
|
(defun doom-docs-lookup (&optional search all)
|
||||||
`(add-hook! ,mode (setq-local zeal-at-point-docset ,docset)))
|
(let ((zeal-at-point-docset (if all "" zeal-at-point-docset)))
|
||||||
(defun doom-docs-lookup (&optional search docset)
|
|
||||||
(let ((zeal-at-point-docset (or docset zeal-at-point-docset)))
|
|
||||||
(zeal-at-point search))))
|
(zeal-at-point search))))
|
||||||
|
|
||||||
|
(defmacro def-docset! (mode docset)
|
||||||
|
`(add-hook! ,mode
|
||||||
|
(setq-local ,(if IS-MAC 'dash-at-point-docset 'zeal-at-point-docset)
|
||||||
|
,docset)))
|
||||||
|
|
||||||
(provide 'core-docs)
|
(provide 'core-docs)
|
||||||
;;; core-docs.el ends here
|
;;; core-docs.el ends here
|
||||||
|
|
|
@ -4,14 +4,13 @@
|
||||||
(evil-define-command doom:docs-lookup (&optional bang input)
|
(evil-define-command doom:docs-lookup (&optional bang input)
|
||||||
"Look up INPUT (otherwise the current selection) in Dash or Zeal."
|
"Look up INPUT (otherwise the current selection) in Dash or Zeal."
|
||||||
(interactive "<!><a>")
|
(interactive "<!><a>")
|
||||||
(let ((docset (unless bang (dash-at-point-guess-docset)))
|
(let ((query input))
|
||||||
(query input))
|
|
||||||
(when (evil-visual-state-p)
|
(when (evil-visual-state-p)
|
||||||
(setq query (concat (buffer-substring-no-properties (region-beginning) (region-end))
|
(setq query (concat (buffer-substring-no-properties (region-beginning) (region-end))
|
||||||
" " query)))
|
" " query)))
|
||||||
(when (or (not query) (zerop (length query)))
|
(when (or (not query) (zerop (length query)))
|
||||||
(setq query (thing-at-point 'symbol)))
|
(setq query (thing-at-point 'symbol)))
|
||||||
(doom-docs-lookup query docset)))
|
(doom-docs-lookup query bang)))
|
||||||
|
|
||||||
(provide 'defuns-docs)
|
(provide 'defuns-docs)
|
||||||
;;; defuns-docs.el ends here
|
;;; defuns-docs.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue