all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: gnuist007@hotmail.com
To: help-gnu-emacs@gnu.org
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)	[thread overview]
Message-ID: <854761b0-8851-4eda-9f37-c3ffd18b13e4@c20g2000yqe.googlegroups.com> (raw)
In-Reply-To: mailman.11641.1351110594.855.help-gnu-emacs@gnu.org

On Oct 24, 1:29 pm, Aurélien Aptel <aurelien.aptel+em...@gmail.com>
wrote:
> On Wed, Oct 24, 2012 at 8:02 PM,  <gnuist...@hotmail.com> 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 ()
>   (interactive)
>   (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 "<f9>")   '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.



  parent reply	other threads:[~2012-10-25  2:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-24 18:02 How to make a lisp function use an outside executable such as a compiled C program? gnuist007
2012-10-24 18:13 ` How to make a lisp function use an outside executable such as acompiled " Drew Adams
2012-10-24 20:02 ` How to make a lisp function use an outside executable such as a compiled " Raymond Wiker
2012-10-24 20:29 ` Aurélien Aptel
     [not found] ` <mailman.11641.1351110594.855.help-gnu-emacs@gnu.org>
2012-10-25  2:53   ` gnuist007 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-10-03 12:30 gnuist
2002-10-03 17:29 ` Barry Margolin

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=854761b0-8851-4eda-9f37-c3ffd18b13e4@c20g2000yqe.googlegroups.com \
    --to=gnuist007@hotmail.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.