From: TheFlyingDutchman <zzbbaadd@aol.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Enter
Date: Tue, 4 Nov 2008 11:22:05 -0800 (PST) [thread overview]
Message-ID: <8a30f5a5-b82d-4a79-b4ba-d8e5e23130a3@u29g2000pro.googlegroups.com> (raw)
In-Reply-To: 87iqr34xl6.fsf@kobe.laptop
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.
prev parent reply other threads:[~2008-11-04 19:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-04 8:46 Enter TheFlyingDutchman
2008-11-04 9:51 ` Enter TheFlyingDutchman
2008-11-04 10:03 ` Enter Giorgos Keramidas
2008-11-04 19:22 ` TheFlyingDutchman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8a30f5a5-b82d-4a79-b4ba-d8e5e23130a3@u29g2000pro.googlegroups.com \
--to=zzbbaadd@aol.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).