From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Giorgos Keramidas Newsgroups: gmane.emacs.help Subject: Re: Enter Date: Tue, 04 Nov 2008 12:03:33 +0200 Organization: SunSITE.dk - Supporting Open source Message-ID: <87iqr34xl6.fsf@kobe.laptop> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1225795908 17762 80.91.229.12 (4 Nov 2008 10:51:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Nov 2008 10:51:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 04 11:52:49 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from mail-forward1.uio.no ([129.240.10.70]) by lo.gmane.org with esmtp (Exim 4.50) id 1KxJWT-0001SY-4L for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Nov 2008 11:52:33 +0100 Original-Received: from exim by mail-out1.uio.no with local-bsmtp (Exim 4.69) (envelope-from ) id 1KxJVM-0000WC-K0 for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Nov 2008 11:51:24 +0100 Original-Received: from mail-mx2.uio.no ([129.240.10.30]) by mail-out1.uio.no with esmtp (Exim 4.69) (envelope-from ) id 1KxJVM-0000W9-It for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Nov 2008 11:51:24 +0100 Original-Received: from lists.gnu.org ([199.232.76.165]) by mail-mx2.uio.no with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1KxJVM-0003jc-1W for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Nov 2008 11:51:24 +0100 Original-Received: from localhost ([127.0.0.1]:54191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxJVK-0004Mj-OJ for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Nov 2008 05:51:22 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!feeder.erje.net!newsfeed.straub-nv.de!nuzba.szn.dk!pnx.dk!news.banetele.no!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) Cancel-Lock: sha1:MU/VFIdCHsmAUhsav/aWPk7hm9c= Original-Lines: 29 Original-NNTP-Posting-Host: 77.49.147.3 Original-X-Trace: news.sunsite.dk DXC=IFaSJoXdVan]OI4DlPLEfeYSB=nbEKnkkCA74; ^LPKQcL^MjgbH?lJH1Tkjl?hKBZPI[=aie List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-UiO-SPF-Received: Received-SPF: pass (mail-mx2.uio.no: domain of gnu.org designates 199.232.76.165 as permitted sender) client-ip=199.232.76.165; envelope-from=help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org; helo=lists.gnu.org; X-UiO-Spam-info: not spam, SpamAssassin (score=-4.0, required=5.0, autolearn=disabled, MISSING_SUBJECT=0.001,NO_RECEIVED=-0.001,RCVD_IN_DNSWL_MED=-4, uiobl=NO, uiouri=NO) X-UiO-Scanned: 5CCE81476069FDBE6791D93C179901ECFFED38F9 X-UiO-SPAM-Test: remote_host: 199.232.76.165 spam_score: -39 maxlevel 200 minaction 2 bait 0 mail/h: 17 total 75768 max/h 424 blacklist 0 greylist 0 ratelimit 0 Xref: news.gmane.org gmane.emacs.help:59427 Archived-At: On Tue, 4 Nov 2008 00:46:11 -0800 (PST), TheFlyingDutchman 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). ...)