help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Executing External Programs from Emacs


From: Xah Lee
Subject: Re: Executing External Programs from Emacs
Date: Sat, 14 Feb 2009 06:47:36 -0800 (PST)
User-agent: G2/1.0

On Feb 13, 10:48 pm, dstein64 <address@hidden> wrote:
> Are there any functions that can launch external programs (not just
> command line programs, but also GUI programs) from Emacs? I know that
> I can access a shell, and call a program from there, but then emacs is
> not operable until I close the program. Prepending the command with
> `nohup' is useful, but for some reason it does not work as expected
> with all programs, including emacs. I would prefer another way of
> doing this - using a specific built-in of emacs lisp if one exists.
> Any help would be greatly appreciated. Thanks.

if you OS support command line to open the gui app, then you can just
use emacs's shell-command. e.g. in mac os x, to open TextEdit, do

(shell-command "open -a TextEdit")

Q: How to open the current directory in Desktop?

You can define a function and assign it a keyboard shortcut, so that
by pressing a button, emacs will switch you to your operating
systems's file manager (aka Desktop) with the current directory open.

On the Mac OS X, this is done with the “/usr/bin/open” command. So,
press “Alt+! open .” to have Finder open the current directory. You
can define the function this way:

(defun open-with-finder ()
  "Open the current file in Mac's Finder."
  (interactive)
  (shell-command "open ."))

(global-set-key (kbd "<f2>") 'open-with-finder)

For a documentation of OS X's “open” command, see “man open”.

On Microsoft Windows, you can use “explorer.exe” instead of the “open”
command.

the above is from

• Emacs and HTML Tips
  http://xahlee.org/emacs/emacs_html.html

see also:

• Elisp Lesson: Execute/Compile Current File
  http://xahlee.org/emacs/elisp_run_current_file.html

  Xah
∑ http://xahlee.org/

reply via email to

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