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

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

RE: sending commands to shell with emacs lisp


From: Corey Foote
Subject: RE: sending commands to shell with emacs lisp
Date: Sun, 13 Sep 2009 02:43:29 -0400

Thanks, but I really am just looking for a way to send an "enter" keystroke to my *shell* buffer after I've inserted a command. I'm just trying to save myself a few keystrokes in my edit, compile, execute cycle.

> Date: Sun, 13 Sep 2009 07:45:08 +0200
> From: tomas@tuxteam.de
> To: coreyfoote@hotmail.com
> CC: help-gnu-emacs@gnu.org
> Subject: Re: sending commands to shell with emacs lisp
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sun, Sep 13, 2009 at 01:15:38AM -0400, Corey Foote wrote:
> >
> > I'm trying to send commands to a shell buffer. I'm able to send the command "hello world" by calling this:
> >
> > (defun exec-command ()
> > (interactive)
> > (set-buffer (get-buffer "*shell*"))
> > (insert "hello world"))
> >
> > But I can't figure out how to send over the "enter key" to actually make it execute the shell command. I'm an emacs lisp newbie!
>
> I think what you are looking for is "call-process" and "start-process".
>
> Evaluating
>
> (call-process "ls" nil t t "-l")
>
> for example, you get the current directory listing in long form inserted
> at point into the current buffer.
>
> (call-process waits for the process to terminate, while start-process
> just lets the process run while Emacs goes on with its other tasks).
>
> There are so many options and variants that I'll stop here and refer you
> to the documentation -- but do ask here if you get stuck.
>
> Regards
> - -- tomás
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFKrIbkBcgs9XrR2kYRAvHvAJ4iqHDOcRWoJz+861efBHlUMn9qBACfRUgI
> pjtfndJKqUQ6W7HTCkmtGgg=
> =V2HY
> -----END PGP SIGNATURE-----


Ready for Fall shows? Use Bing to find helpful ratings and reviews on digital tv's. Click here.

reply via email to

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