dash-docs-el / helm-dash

Browse Dash docsets inside emacs
511 stars 59 forks source link

Add a way to open doc in other window #74

Closed s9gf4ult closed 9 years ago

s9gf4ult commented 9 years ago

Hello, I have implemented this (copy paste from helm-dash-browse-url)

(defun helm-dash-browse-url-other-window (search-result)
  "Call to `browse-url' with the result returned by `helm-dash-result-url'.
Get required params to call `helm-dash-result-url' from SEARCH-RESULT."
  (let ((docset-name (car search-result))
    (filename (nth 2 (cadr search-result)))
    (anchor (nth 3 (cadr search-result))))
    (if (< (length (window-list)) 2)
        (split-window-horizontally))
    (other-window 1)
    (funcall helm-dash-browser-func (helm-dash-result-url docset-name filename anchor))))

and also modified

(defun helm-dash-actions (actions doc-item)
  "Return an alist with the possible actions to execute with DOC-ITEM."
  `(("Go to doc" . helm-dash-browse-url)
    ("Go to doc other window" . helm-dash-browse-url-other-window)
    ("Copy to clipboard" . helm-dash-copy-to-clipboard)))

but when I select second action in helm buffer documentation just opens inside the same buffer. How should I fix this code to make it work?

Also, using split-window-horizontally is too ad-hoc, maybe you know a better way to do that to make reasonable pull request?

BTW, I am using eww for browsing docs, this feature may be unrelated for other browser users, and I dont know how to deal with it.

s9gf4ult commented 9 years ago

Looks like everything works, I've just restarted my Emacs.

What would you say about using split-window-horizontally ?

areina commented 9 years ago

Hi @s9gf4ult ,

I think this can be very useful, but it's a bit ad-hoc because it makes sense only for eww users. Also, we're trying to cover this behaviour in a different way (see #48). As it can be helpful for other users, I encourage you to create a PR adding this to Readme.

Thank you!

contrun commented 5 years ago

Thank you. This is quite useful. helm-dash-result-url is renamed to dash-docs-result-url.