tools/lookup: remove duplicate code & minor fixes

- Removes vestigial definition of +lookup/in-docsets, which would throw
  an error.
- Fixes the universal argument for this function.
- Fix multiple set-docsets! calls prepending rather than setting
  dash-docs-docsets.
- Logs search attempts for debugging purposes.
This commit is contained in:
Henrik Lissner 2019-07-05 14:17:44 +02:00
parent fbf58aac8c
commit 6973a8926d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 7 additions and 29 deletions

View file

@ -316,29 +316,3 @@ Otherwise, falls back on `find-file-at-point'."
(run-hooks 'projectile-find-file-hook))))))
(#'doom-project-browse))))
(find-file-at-point path))))))
;;
;;; Source-specific commands
(defvar counsel-dash-docsets)
(defvar helm-dash-docsets)
;;;###autoload
(defun +lookup/in-docsets (&optional query docsets)
"Looks up QUERY (a string) in available Dash docsets for the current buffer.
DOCSETS is a list of docset strings. Docsets can be installed with
`+lookup/install-docset'."
(interactive)
(let* ((counsel-dash-docsets
(unless (eq docsets 'blank)
(or docsets
(or (bound-and-true-p counsel-dash-docsets)
(bound-and-true-p helm-dash-docsets)))))
(helm-dash-docsets counsel-dash-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.")))))