dash-docs-el / helm-dash

Browse Dash docsets inside emacs
510 stars 59 forks source link

helm-dash-installed-docsets: "Not a directory" #158

Closed otsaw closed 7 years ago

otsaw commented 7 years ago

Hello,

https://github.com/areina/helm-dash/blob/9a230125a7a11f5fa90aa048b61abd95eb78ddfe/helm-dash.el#L241-L250

Line 246 above fails with (file-error "Opening directory" "Not a directory" ...) if helm-dash-docsets-path contains regular files. I'm not really familiar with cl-loop or all the directory structures the code is trying to cover, so I didn't send a PR. Maybe wrap that line in an and call, see below? Or shop around for a directory-directories function? -- for dir in (directory-files ...) is not quite right.

for subdir = (and (file-directory-p full-path)
                  (cl-first (directory-files full-path t "\\.docset\\'")))

My particular use case is that I have my ~/.emacs.d/docsets as a git repository of if its own which I sync around and for that reason I have README.md, COPYING etc. files in there.

kidd commented 7 years ago

what's the value of your helm-dash-docsets-path? I'd think that setting it to ~/.emacs.d/docsets/ should do the trick as it's ment to be a directory where all docsets are placed.

Then it's doing several checks, but if your structure is

~/.emacs.d/docsets/Foo.docset
~/.emacs.d/docsets/Bar.docset

It should work

otsaw commented 7 years ago

helm-dash-docsets-path is set to ~/.emacs.d/docsets and I do have the docset directories directly underneath that, but also regular files. So, helm-dash-installed-docsets iterates over

~/.emacs.d/docsets/Foo.docset
~/.emacs.d/docsets/Bar.docset
~/.emacs.d/docsets/README.md

The checks should ignore that third line above instead of throwing an error.

kidd commented 7 years ago

yup, you're right. Fixed :).

Btw, explanation of why that logic is super convoluted: e3c8ee5bcc0009ec5c20b2e38523ca4ce5a272d1