all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* elisp shell command for opening the current dir in OS
@ 2009-06-08 14:10 Xah Lee
  2009-06-08 14:25 ` rustom
  0 siblings, 1 reply; 4+ messages in thread
From: Xah Lee @ 2009-06-08 14:10 UTC (permalink / raw
  To: help-gnu-emacs

how to get emacs on windows to open the current dir the OS's file
manager?

on os x, i just do
(shell-command "open .")

On Windows Vista, i tried
(shell-command "explorer .")
which does the job but freezes emacs in the background until the
folder is closed.

I tried
(shell-command "explorer . &")
but that still leaves a running process.
This is annoying when you call shell command again, cause it'll ask
you if you want to kill previous instance.

(shell-command "start explorer . ")
seems to invoke cmd-shell.

Thanks.

Here's the function i'm trying to write:

(defun open-in-desktop ()
  "Open the current file in desktop."
  (interactive)
  (let (cmdStr)
    (cond
     ((string-equal system-type "windows-nt") (setq cmdStr "explorer .
&"))
     ((string-equal system-type "darwin") (setq cmdStr "open ."))
     )
    (shell-command cmdStr)
    )
  )

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: elisp shell command for opening the current dir in OS
  2009-06-08 14:10 elisp shell command for opening the current dir in OS Xah Lee
@ 2009-06-08 14:25 ` rustom
  2009-06-08 15:21   ` Xah Lee
  0 siblings, 1 reply; 4+ messages in thread
From: rustom @ 2009-06-08 14:25 UTC (permalink / raw
  To: help-gnu-emacs

On Jun 8, 7:10 pm, Xah Lee <xah...@gmail.com> wrote:
> how to get emacs on windows to open the current dir the OS's file
> manager?
>
> on os x, i just do
> (shell-command "open .")
>
> On Windows Vista, i tried
> (shell-command "explorer .")
> which does the job but freezes emacs in the background until the
> folder is closed.
>
> I tried
> (shell-command "explorer . &")
> but that still leaves a running process.
> This is annoying when you call shell command again, cause it'll ask
> you if you want to kill previous instance.
>
> (shell-command "start explorer . ")
> seems to invoke cmd-shell.
>
> Thanks.
>
> Here's the function i'm trying to write:
>
> (defun open-in-desktop ()
>   "Open the current file in desktop."
>   (interactive)
>   (let (cmdStr)
>     (cond
>      ((string-equal system-type "windows-nt") (setq cmdStr "explorer .
> &"))
>      ((string-equal system-type "darwin") (setq cmdStr "open ."))
>      )
>     (shell-command cmdStr)
>     )
>   )
>
>   Xah
> ∑http://xahlee.org/
>
> ☄
If you use w32-browser C-Ret does open and Alt-Ret does open explorer
http://www.emacswiki.org/emacs/w32-browser.el


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: elisp shell command for opening the current dir in OS
  2009-06-08 14:25 ` rustom
@ 2009-06-08 15:21   ` Xah Lee
  2009-06-08 22:51     ` Lennart Borgman
  0 siblings, 1 reply; 4+ messages in thread
From: Xah Lee @ 2009-06-08 15:21 UTC (permalink / raw
  To: help-gnu-emacs

On Jun 8, 7:25 am, rustom <rustompm...@gmail.com> wrote:
> On Jun 8, 7:10 pm, Xah Lee <xah...@gmail.com> wrote:
> > how to get emacs on windows to open the current dir the OS's file
> > manager?
>
> > on os x, i just do
> > (shell-command "open .")
>
> > On Windows Vista, i tried
> > (shell-command "explorer .")
> > which does the job but freezes emacs in the background until the
> > folder is closed.

> If you use w32-browser C-Ret does open and Alt-Ret does open explorerhttp://www.emacswiki.org/emacs/w32-browser.el

Thanks rustom. That does it.

(defun open-in-desktop ()
  "Open the current file's folder in desktop."
  (interactive)
  (cond
     ((string-equal system-type "windows-nt") (w32-shell-execute
"explore" "."))
     ((string-equal system-type "darwin") (shell-command "open ."))
     )
  )

btw, just curious, if anyone would mod the code so it works on linuxes
too.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: elisp shell command for opening the current dir in OS
  2009-06-08 15:21   ` Xah Lee
@ 2009-06-08 22:51     ` Lennart Borgman
  0 siblings, 0 replies; 4+ messages in thread
From: Lennart Borgman @ 2009-06-08 22:51 UTC (permalink / raw
  To: Xah Lee; +Cc: help-gnu-emacs

On Mon, Jun 8, 2009 at 5:21 PM, Xah Lee<xahlee@gmail.com> wrote:
> On Jun 8, 7:25 am, rustom <rustompm...@gmail.com> wrote:
>> On Jun 8, 7:10 pm, Xah Lee <xah...@gmail.com> wrote:
>> > how to get emacs on windows to open the current dir the OS's file
>> > manager?
>>
>> > on os x, i just do
>> > (shell-command "open .")
>>
>> > On Windows Vista, i tried
>> > (shell-command "explorer .")
>> > which does the job but freezes emacs in the background until the
>> > folder is closed.
>
>> If you use w32-browser C-Ret does open and Alt-Ret does open explorerhttp://www.emacswiki.org/emacs/w32-browser.el
>
> Thanks rustom. That does it.
>
> (defun open-in-desktop ()
>  "Open the current file's folder in desktop."
>  (interactive)
>  (cond
>     ((string-equal system-type "windows-nt") (w32-shell-execute
> "explore" "."))
>     ((string-equal system-type "darwin") (shell-command "open ."))
>     )
>  )
>
> btw, just curious, if anyone would mod the code so it works on linuxes
> too.


I am not sure where I left this, but did you try sex-mode (included in
nXhtml)? I think that I in the end for consistency used functions from
org-mode for opening files.

If sex-mode is on certain files will be opened in external
applications by Emacs when you do for example find-file. This should
work under both windows and GNU/Linux.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-08 22:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-08 14:10 elisp shell command for opening the current dir in OS Xah Lee
2009-06-08 14:25 ` rustom
2009-06-08 15:21   ` Xah Lee
2009-06-08 22:51     ` Lennart Borgman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.