From 571e7bd5279d3cb05af6fcdb27e632aaa410a3cf Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 17 May 2019 20:43:36 -0400 Subject: [PATCH] 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. --- modules/config/default/+evil-bindings.el | 3 ++- modules/tools/lookup/autoload/docsets.el | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index c0c4a6ad5..3f8a6bff5 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -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) ;;; TAB --- workspace diff --git a/modules/tools/lookup/autoload/docsets.el b/modules/tools/lookup/autoload/docsets.el index 99fb0cd01..c1b513448 100644 --- a/modules/tools/lookup/autoload/docsets.el +++ b/modules/tools/lookup/autoload/docsets.el @@ -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))