Fix +lookup/in-docsets & docsets lookup backend
They were throwing 'cannot find docset' errors. - Adds new +lookup/in-all-docsets command. - If a prefix arg is passed to +lookup/in-docsets, it will search all docsets in dash-docs-common-docsets.
This commit is contained in:
parent
507fb50ff2
commit
571e7bd527
2 changed files with 17 additions and 9 deletions
|
@ -533,7 +533,8 @@
|
|||
:desc "Jump to symbol across buffers" "I" #'imenu-anywhere
|
||||
:desc "Jump to link" "l" #'ace-link
|
||||
:desc "Look up online" "o" #'+lookup/online-select
|
||||
:desc "Look up in docsets" "k" #'+lookup/in-docsets
|
||||
:desc "Look up in local docsets" "k" #'+lookup/in-docsets
|
||||
:desc "Look up in all docsets" "K" #'+lookup/in-all-docsets
|
||||
:desc "Search project" "p" #'+default/search-project)
|
||||
|
||||
;;; <leader> TAB --- workspace
|
||||
|
|
|
@ -65,29 +65,36 @@ Docsets must be installed with one of the following commands:
|
|||
+ `dash-docs-async-install-docset-from-file'
|
||||
|
||||
Docsets can be searched directly via `+lookup/in-docsets'."
|
||||
(let ((docsets (dash-docs-buffer-local-docsets)))
|
||||
(when (cl-some #'dash-docs-docset-path docsets)
|
||||
(+lookup/in-docsets identifier docsets)
|
||||
'deferred)))
|
||||
(when-let* ((docsets (cl-remove-if-not #'dash-docs-docset-path (dash-docs-buffer-local-docsets))))
|
||||
(+lookup/in-docsets nil identifier docsets)
|
||||
'deferred))
|
||||
|
||||
|
||||
;;
|
||||
;;; Commands
|
||||
|
||||
;;;###autoload
|
||||
(defun +lookup/in-docsets (&optional query docsets)
|
||||
(defun +lookup/in-docsets (arg &optional query docsets)
|
||||
"Lookup QUERY in dash DOCSETS.
|
||||
|
||||
QUERY is a string and docsets in an array of strings, each a name of a Dash
|
||||
docset. Requires either helm or ivy.
|
||||
|
||||
Use `dash-docs-install-docset' to install docsets."
|
||||
(interactive)
|
||||
If prefix ARG is supplied, search all installed installed docsets. They can be
|
||||
installed with `dash-docs-install-docset'."
|
||||
(interactive "P")
|
||||
(require 'dash-docs)
|
||||
(let ((dash-docs-docsets (or docsets (dash-docs-buffer-local-docsets)))
|
||||
(let ((dash-docs-common-docsets (if arg dash-docs-common-docsets))
|
||||
(dash-docs-docsets (cl-remove-if-not #'dash-docs-docset-path (or docsets dash-docs-docsets)))
|
||||
(query (or query (+lookup-symbol-or-region) "")))
|
||||
(cond ((featurep! :completion helm)
|
||||
(helm-dash query))
|
||||
((featurep! :completion ivy)
|
||||
(counsel-dash query))
|
||||
((user-error "No dash backend is installed, enable ivy or helm.")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +lookup/in-all-docsets (&optional query)
|
||||
"TODO"
|
||||
(interactive)
|
||||
(+lookup/in-docsets t query))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue