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

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

Re: How to make a lisp function use an outside executable such as a comp


From: gnuist007
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)
User-agent: G2/1.0

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.



reply via email to

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