0

I am trying to get helm-dash to work on Windows and I want to view the docsets in emacs. Here is what I did so far:

  • downloaded ZealPortable (I don't have admin rights)
  • downloaded some docs
  • pointed helm-dash-docsets-path to the docsets folder
  • activate at least one docset

when I now invoke helm-dash and search for a function, the docset opens in the default browser.
What I want is to view the docsets inside emacs. For that I can set the handy variable helm-dash-browser-func to eww.
Problem: eww is not able to resolve URLs to local files. At least for me. It interprets the c: in the path as the hostname.
Has anyone ever stumbled upon that issue? Is there a way to solve it? Perhaps a different browser than eww?

Btw.: I'm using spacemacs but that shouldn't make any difference, should it?

1

I think the url package is not handling Windows pathnames well. We can try to fix it.

(defun url-generic-parse-url-fix-windows-path (fn url)
  (if (or (not (stringp url))
          (not (string-match "\\`file://\\(\\([a-z]\\):\\)/" url)))
      (funcall fn url)
    (let ((drive (match-string 2 url))
          (clx (funcall fn (replace-match "/\\2" t nil url 1))))
      (setf (url-filename clx)
            (concat drive ":" (substring (url-filename clx) 2)))
      clx)))

(advice-add 'url-generic-parse-url :around #'url-generic-parse-url-fix-windows-path)
(url-generic-parse-url "file://c:/foo")
;; => [cl-struct-url "file" nil nil "" nil "c:/foo" nil nil t nil t]

(advice-remove 'url-generic-parse-url #'url-generic-parse-url-fix-windows-path)
(url-generic-parse-url "file://c:/foo")
;; => [cl-struct-url "file" nil nil "c" nil "/foo" nil nil t nil t]

See, if that works for you (I have no access to such a machine right now.).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.