emacs-devel
[Top][All Lists]
Advanced

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

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


From: Mathias Dahl
Subject: Re: Bug: can not start a w32 GUI program from Emacs
Date: Wed, 27 Dec 2006 13:00:06 +0100

    (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...

(defun w32-explorer(dir)
   "Open Windows Explorer in directory DIR."
   (interactive "DStart in directory: ")
   (setq dir (expand-file-name dir))
   (w32-shell-execute "open" dir))

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."
    (interactive)
    (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))))

 (defun slash-to-backslash (text)
  (substitute ?\\ ?/ text))

 (define-key dired-mode-map "j" 'w32-dired-open-explorer)

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.




reply via email to

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