[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: can not start a w32 GUI program from Emacs

From: Lennart Borgman (gmail)
Subject: Re: Bug: can not start a w32 GUI program from Emacs
Date: Wed, 27 Dec 2006 13:36:19 +0100
User-agent: Thunderbird (Windows/20061207)

Mathias Dahl wrote:
    (w32-shell-execute "open" ".")

just gives "ShellExecute failed: No application is associated with the
specified file for this operation".

If you thought the above to work, in the same way that "start ." works
from cmd.exe I think you simply missed that "." is "magic" only inside
cmd.exe. So it's natural that ShellExecute does not recognize it. I
guess if you put the correct data in Windows registry, it might be
possible to open a "." file though...

Maybe it is more about file name expansion? For example

   (expand-file-name ".")

works in Emacs. And directory-files (which depends on a basic w32 API) returns also "." in the list of files.

I have something similar for dired that I use a lot:

  (defun w32-dired-open-explorer ()
    "Open a file in dired mode by explorer.exe as you double click it."
    (let ((file-name (dired-get-file-for-visit)))
      (if (file-exists-p file-name)
          (w32-shell-execute "open" (concat "\"" (slash-to-backslash
file-name) "\"") nil 1))))

Seems useful, but maybe it is better to use convert-standard-filename and expand-file-name here?

While on the subject of w32-shell-execute I have found that it is
often much easier to use than struggling with `call-process' et al,
when you just want to "start" something. Of course when you want to
control output and input, then it's another story.

I believe that w32-shell-execute can start only programs by file association, or am I missing something? call-process can also wait (even for a gui app I believe).

As I pointed out in another message there is perhaps a problem with w32proc in that it binds stdin etc for gui applications. I believe that exe-files on w32 that are marked as gui do not have consoles. But I am not at all sure that this is a problem. Anyway I patched away that in my patched version now to see if any problems shows up.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]