From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: gnuist007@hotmail.com Newsgroups: gmane.emacs.help Subject: Re: How to make a lisp function use an outside executable such as a compiled C program? Date: Wed, 24 Oct 2012 19:53:06 -0700 (PDT) Message-ID: <854761b0-8851-4eda-9f37-c3ffd18b13e4@c20g2000yqe.googlegroups.com> References: <25381a0a-3810-406e-aa80-600b5b6201de@g8g2000yqp.googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1351133713 23638 80.91.229.3 (25 Oct 2012 02:55:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Oct 2012 02:55:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 25 04:55:22 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TRDbN-0003fe-JG for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Oct 2012 04:55:21 +0200 Original-Received: from localhost ([::1]:55552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRDbF-0002kv-Ox for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Oct 2012 22:55:13 -0400 Original-Received: by 10.224.223.14 with SMTP id ii14mr9696149qab.3.1351133586385; Wed, 24 Oct 2012 19:53:06 -0700 (PDT) Original-Received: by 10.236.73.230 with SMTP id v66mr907279yhd.9.1351133586338; Wed, 24 Oct 2012 19:53:06 -0700 (PDT) Original-Path: usenet.stanford.edu!x14no7317945qar.0!news-out.google.com!r17ni57592152qap.0!nntp.google.com!x14no7317937qar.0!postnews.google.com!c20g2000yqe.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: c20g2000yqe.googlegroups.com; posting-host=99.42.78.5; posting-account=HZMwaQgAAABuThfluRZ4FM7A69xRFwOt Original-NNTP-Posting-Host: 99.42.78.5 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0,gzip(gfe) Injection-Date: Thu, 25 Oct 2012 02:53:06 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:195082 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87411 Archived-At: On Oct 24, 1:29=A0pm, Aur=E9lien Aptel wrote: > On Wed, Oct 24, 2012 at 8:02 PM, =A0 wrote: > > > I asked this question in a 2002 post in the thread describing it and > > previous response. > > You have to write some emacs lisp. > As someone already said, use call-process. > > This calls synchronously ls with the -l and -a options: > > (call-process "ls" nil nil nil "-l" "-a") > > If you want the return value to be the program output you can use > shell-command-to-string. > > You can wrap this line in a function and put it in your .emacs like this: > > (defun my-function () > =A0 (interactive) > =A0 (call-process "ls" nil nil nil "-l" "-a")) > > You can then bind it to a key like this (still in .emacs): > > (global-set-key (kbd "") =A0 'my-function) > > > > >https://groups.google.com/group/gnu.emacs.help/browse_thread/thread/a... > > > Has there been any improvements in the last 10 years? > > It's really not difficult, you should read what people say in this thread= . > If you have a previous experience in programming and want a short > introduction to emacs lisp I recommend you Xah Lee's tutorials : > > http://ergoemacs.org/emacs/elisp.html Thanks for the great reply. Your illustrative example was the thing in need.