dash-docs-el / helm-dash

Browse Dash docsets inside emacs
510 stars 59 forks source link

helm-dash does not provide any candidate #41

Closed jwintz closed 10 years ago

jwintz commented 10 years ago

Hello,

I can not get helm-dash to provide any candidate even though docsets seem to be installed correctly and variables set up just as well.

I am using Emacs 24.3.1 on MacOSX Mavericks, and have not yet tested on other platforms. helm-dash is master merged with #40.

Here is my configuration: https://github.com/jwintz/prelude/blob/master/personal/prelude-dash.el.

How can I debug docset queries ?

screen shot 2014-02-04 at 13 29 45

areina commented 10 years ago

Hi Julien,

There is a bug in helm-dash code related with the name of some docsets (C++ is one of them). The bug is in helm-dash-search function when we call to replace-regexp-in-string.

We'll fix it but before we want to add some unit tests to helm-dash. We're working on this right now.

If you need the fix asap, you could try to modify the code locally, I think that is just use regexp-quote function with the first argument for replace-regexp-in-string function. If that works, you could try to contribute with a PR.

Thank you for try helm-dash and for your feedback :metal:

jwintz commented 10 years ago

Thanks Toni, I'll be glad to. Does this all have anything to do with helm-dash:fix-docset-folder-name-for-macosx branch ?

kidd commented 10 years ago

@jwintz , nope, that branch was already merged some time ago.

I'd branch from interactive-install.

flexibeast commented 10 years ago

i'm having the same issue, on Debian Wheezy - no candidates are produced at all, after having successfully installed and activated two different docsets (HTML and CSS).

Assuming the fix you mentioned above involved simply wrapping the first argument to replace-regexp-in-string with regexp-quote, i modified helm-dash-search to:

(replace-regexp-in-string
  (regexp-quote (format "^%s " (downcase (car docset))))
  ...

But that has made no difference.

flexibeast commented 10 years ago

Sorry, accidentally posted previous comment before adding that i'm running a locally-compiled Emacs 24.3, and helm-dash 20140129.618.

kidd commented 10 years ago

@jwintz , @flexibeast . Fixes for that are in the master branch now.

jwintz commented 10 years ago

@kidd, unfortunately, that made no difference for me.

It looks like, (helm-dash-sql-execute 'select docset-type ...) never returns.

It executes the following query (trying on Redis for a start ...) with helm-dash-sql-execute

SELECT ty.ZTYPENAME, t.ZTOKENNAME, f.ZPATH, m.ZANCHOR FROM ZTOKEN t, ZTOKENTYPE ty, ZFILEPATH f, ZTOKENMETAINFORMATION m WHERE ty.Z_PK = t.ZTOKENTYPE AND f.Z_PK = m.ZFILE AND m.ZTOKEN = t.Z_PK AND t.ZTOKENNAME like '%popb%' ORDER BY LOWER(t.ZTOKENNAME) LIMIT 100

I have sqlite3 installed just as @flexibeast.

kidd commented 10 years ago

Are you sure this is the query executed for redis? Redis docset is of the other kind (the query should be different.)

Will try later, but it seems it's not guessing the type of docset. Also strange it's working fine here.....

kidd commented 10 years ago

could you run the tests on your machine?

jwintz commented 10 years ago

By kind you mean DASH instead of ZDASH ?

Here is the test result, it looks fine:

jwintz@utopis:~/Desktop/helm-dash$ make test
rm -f helm-dash.elc
/Applications/Xcode.app/Contents/Developer/usr/bin/make unit
cask exec ert-runner
Running 7 tests (2014-02-10 21:27:21+0100)

   passed  1/7  helm-dash-test/maybe-narrow-to-one-docset-filtered
   passed  2/7  helm-dash-test/maybe-narrow-to-one-docset-not-filtered
   passed  3/7  helm-dash-test/some-no-matches
   passed  4/7  helm-dash-test/some-with-matches
   passed  5/7  helm-dash-test/sub-docset-name-in-pattern-with-docset-name
   passed  6/7  helm-dash-test/sub-docset-name-in-pattern-with-special-docset-name
   passed  7/7  helm-dash-test/sub-docset-name-in-pattern-without-docset-name

Ran 7 tests, 7 results as expected (2014-02-10 21:27:21+0100)

/Applications/Xcode.app/Contents/Developer/usr/bin/make compile
cask exec emacs -Q -batch -f batch-byte-compile helm-dash.el

In helm-dash-search-all-docsets:
helm-dash.el:138:18:Warning: reference to free variable
    `url-http-end-of-headers'

In end of data:
helm-dash.el:334:1:Warning: the function `xml-get-children' is not known to be
    defined.
Wrote /Users/jwintz/Desktop/helm-dash/helm-dash.elc
/Applications/Xcode.app/Contents/Developer/usr/bin/make unit
cask exec ert-runner
Running 7 tests (2014-02-10 21:27:22+0100)

   passed  1/7  helm-dash-test/maybe-narrow-to-one-docset-filtered
   passed  2/7  helm-dash-test/maybe-narrow-to-one-docset-not-filtered
   passed  3/7  helm-dash-test/some-no-matches
   passed  4/7  helm-dash-test/some-with-matches
   passed  5/7  helm-dash-test/sub-docset-name-in-pattern-with-docset-name
   passed  6/7  helm-dash-test/sub-docset-name-in-pattern-with-special-docset-name
   passed  7/7  helm-dash-test/sub-docset-name-in-pattern-without-docset-name

Ran 7 tests, 7 results as expected (2014-02-10 21:27:22+0100)

/Applications/Xcode.app/Contents/Developer/usr/bin/make clean-elc
rm -f helm-dash.elc
jwintz commented 10 years ago

Also, here is a(n incomplete) "trace" for helm-dash-search

helm-dash-search: ("Redis" "~/.emacs.d/docsets/Redis.docset/Contents/Resources/docSet.dsidx" "ZDASH") (("Redis" "~/.emacs.d/docsets/Redis.docset/Contents/Resources/docSet.dsidx" "ZDASH"))
helm-dash-search: looking for "popb" "ZDASH"
helm-dash-sub-docset-name-in-pattern: "popb" "Redis"
helm-dash-sub-docset-name-in-pattern: => "popb"
helm-dash-sql-execute select: "ZDASH" "popb"
helm-dash-sql-compose-like: "t.ZTOKENNAME" "popb"
helm-dash-sql-execute "SELECT ty.ZTYPENAME, t.ZTOKENNAME, f.ZPATH, m.ZANCHOR FROM ZTOKEN t, ZTOKENTYPE ty, ZFILEPATH f, ZTOKENMETAINFORMATION m WHERE ty.Z_PK = t.ZTOKENTYPE AND f.Z_PK = m.ZFILE AND m.ZTOKEN = t.Z_PK AND t.ZTOKENNAME like '%popb%' ORDER BY LOWER(t.ZTOKENNAME) LIMIT 100"
helm-dash-sql-compose-like: "t.ZTOKENNAME" "popb"
kidd commented 10 years ago

OOOkks, I know what happens.

helm-dash is not resolving relative paths, as in ~/.emacs, but only absolute paths (/home/jwintz/.emacs) , that's why it doesn't catch the type of the db, because it probably just fails to load the db.

I'll try to push a patch tomorrow. Meanwhile, you can try the absolut path, and see if it works fine.

Btw, I didn't know about m-x trace-function. Nice tool! can you make it trace recursively everything that gets called, or this trace is after tracing manually many functions?

jwintz commented 10 years ago

Great ! Works like a charm. Thank you very much Raimon ! (it was a manual trace).