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

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

Re: Enter


From: TheFlyingDutchman
Subject: Re: Enter
Date: Tue, 4 Nov 2008 11:22:05 -0800 (PST)
User-agent: G2/1.0

On Nov 4, 2:03 am, Giorgos Keramidas <keram...@ceid.upatras.gr> wrote:
> On Tue, 4 Nov 2008 00:46:11 -0800 (PST), TheFlyingDutchman <zzbba...@aol.com> 
> wrote:
> > I want to start a shell buffer and then run a command via an Emacs
> > Lisp function. If I do this:
>
> > (shell)
> > (insert "ls\n")
>
> You don't need the extra "\n" at the end of the command, but you may
> find the function `comint-send-input' useful.
>
>     (shell)
>     (insert "ls")
>     (comint-send-input)
>
> If you don't really need the command to support interactive input, you
> can also call `shell-command' with the full command string:
>
>     (shell-command "ls")
>
> With an optional second argument, you can send the output to a specific
> buffer, i.e.:
>
>     (with-temp-buffer
>       (shell-command "ls" (current-buffer))
>
>       ;; More stuff that processes parts of (current-buffer).
>       ...)

Thanks Giorgos. shell-command is probably what I should be using in
most cases instead of shell. Didn't know about with-temp-buffer
either.


reply via email to

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