Skip to content

Commit

Permalink
Merge pull request #86 from tko/refactor
Browse files Browse the repository at this point in the history
refactor helm-dash-search
  • Loading branch information
kidd committed Jun 19, 2015
2 parents 88417ed + 9b935d1 commit ddec610
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions helm-dash.el
Original file line number Diff line number Diff line change
Expand Up @@ -330,24 +330,21 @@ Ex: This avoids searching for redis in redis unless you type 'redis redis'"

(defun helm-dash-search ()
"Iterates every `helm-dash-connections' looking for the `helm-pattern'."
(let ((full-res (list))
(connections (helm-dash-maybe-narrow-docsets helm-pattern)))

(dolist (docset connections)
(let* ((docset-type (cl-caddr docset))
(res
(helm-dash-sql
(cadr docset)
(helm-dash-sql-execute 'select
docset-type
(helm-dash-sub-docset-name-in-pattern helm-pattern (car docset))))))
;; how to do the appending properly?
(setq full-res
(append full-res
(mapcar (lambda (x)
(cons (format "%s %s" (car docset) (cadr x)) (list (car docset) x)))
res)))))
full-res))
(let ((connections (helm-dash-maybe-narrow-docsets helm-pattern)))
(cl-loop for docset in connections
append (cl-loop for row in (helm-dash--run-query docset)
collect (helm-dash--candidate docset row)))))

(defun helm-dash--run-query (docset)
(let ((docset-type (cl-caddr docset)))
(helm-dash-sql
(cadr docset)
(helm-dash-sql-execute 'select
docset-type
(helm-dash-sub-docset-name-in-pattern helm-pattern (car docset))))))

(defun helm-dash--candidate (docset x)
(cons (format "%s %s" (car docset) (cadr x)) (list (car docset) x)))

(defun helm-dash-result-url (docset-name filename &optional anchor)
"Return the full, absolute URL to documentation: either a file:// URL joining
Expand Down

0 comments on commit ddec610

Please sign in to comment.