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

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

Re: Enter


From: Giorgos Keramidas
Subject: Re: Enter
Date: Tue, 04 Nov 2008 12:03:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix)

On Tue, 4 Nov 2008 00:46:11 -0800 (PST), TheFlyingDutchman <zzbbaadd@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).
      ...)




reply via email to

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