Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

counsel-find-file-extern #863

Closed
dzklaim opened this issue Jan 25, 2017 · 7 comments
Closed

counsel-find-file-extern #863

dzklaim opened this issue Jan 25, 2017 · 7 comments

Comments

@dzklaim
Copy link

dzklaim commented Jan 25, 2017

hi. thank you for your work :) I would like to know if it is possible to execute the external app asynchronously when using the command counsel-find-file-extern.

@abo-abo
Copy link
Owner

abo-abo commented Jan 25, 2017

Yes, that's how it works right now, as long as your app is associated to the file type on your system.

@dzklaim
Copy link
Author

dzklaim commented Jan 25, 2017

It does not work for me. emacs hangs until I close the application. If I use openwith I have no problems. the applications are correctly associated with the file types on ~/.config/mimeapps.list. I'm using emacs 25.1 + nixos.

@Mengesh
Copy link

Mengesh commented Feb 3, 2017

You can redefine counsel-locate-action-extern function to run xdg-open in background by adding an ampersound & at the end.

      (defun counsel-locate-action-extern (x)
        "Use xdg-open shell command, or corresponding system command, on X."
        (interactive (list (read-file-name "File: ")))
        (if (and (eq system-type 'windows-nt)
                 (fboundp 'w32-shell-execute))
            (w32-shell-execute "open" x)
          (call-process shell-file-name nil
                        nil nil
                        shell-command-switch
                        (format "%s %s"
                                (cl-case system-type
                                  (darwin "open")
                                  (t "xdg-open"))
                                (concat (shell-quote-argument x) " &")))))

@basil-conto
Copy link
Collaborator

I think this was fixed in #1401.

@abo-abo
Copy link
Owner

abo-abo commented Jun 11, 2018

@dzklaim @Mengesh Could you please test and confirm that this was fixed?

@Mengesh
Copy link

Mengesh commented Jun 12, 2018

Fixed! Thanks

@abo-abo
Copy link
Owner

abo-abo commented Jun 14, 2018

OK, closing the issue.

@abo-abo abo-abo closed this as completed Jun 14, 2018
abo-abo pushed a commit that referenced this issue Sep 19, 2018
`start-process-shell-command` doesn't seem to wait for
`counsel-locate-action-extern` to finish under Ubuntu. [Gist to
reproduce the
issue](https://gist.github.com/yiufung/38be4c3a6832334f36f2441550cf0b12).

Related
discussion: ([#1](https://askubuntu.com/questions/646631/emacs-doesnot-work-with-xdg-open),
[#2](https://emacs.stackexchange.com/questions/19344/why-does-xdg-open-not-work-in-eshell),
[#3](http://emacs.1067599.n8.nabble.com/emacs-and-xdg-open-td106892.html))
suggests to:

1. Set `process-connection-type` as nil temporarily
2. Called with `setsid -w` to wait for the process to finish.

To avoid interfering with other platforms and applications, I adopted
the latter approach which uses `lsb_release` to check distribution
type with fall back as `xdg-open`. Currently only check for Ubuntu,
and to be extended in the future.

Re #863
Re #1401
Fixes #1759
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants