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

Comments

@dzklaim
Copy link

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

This comment has been minimized.

Copy link
Owner

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Collaborator

commented May 31, 2018

I think this was fixed in #1401.

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Jun 11, 2018

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

@Mengesh

This comment has been minimized.

Copy link

commented Jun 12, 2018

Fixed! Thanks

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Jun 14, 2018

OK, closing the issue.

@abo-abo abo-abo closed this Jun 14, 2018

abo-abo added a commit that referenced this issue Sep 19, 2018
counsel.el: Fix xdg-open under Ubuntu for counsel-locate-action-extern
`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
Projects
None yet
4 participants
You can’t perform that action at this time.