all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to make a lisp function use an outside executable such as a compiled C program?
@ 2002-10-03 12:30 gnuist
  2002-10-03 17:29 ` Barry Margolin
  0 siblings, 1 reply; 7+ messages in thread
From: gnuist @ 2002-10-03 12:30 UTC (permalink / raw)


How to make a lisp function use an outside executable such as a compiled C program?


How to write a lisp script? common lisp script? emacs lisp script?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to make a lisp function use an outside executable such as a compiled C program?
  2002-10-03 12:30 gnuist
@ 2002-10-03 17:29 ` Barry Margolin
  0 siblings, 0 replies; 7+ messages in thread
From: Barry Margolin @ 2002-10-03 17:29 UTC (permalink / raw)


In article <9e8ebeb2.0210030430.75338b18@posting.google.com>,
gnuist <gnuist007@hotmail.com> wrote:
>How to make a lisp function use an outside executable such as a compiled
>C program?

Use the call-process function.

-- 
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* How to make a lisp function use an outside executable such as a compiled C program?
@ 2012-10-24 18:02 gnuist007
  2012-10-24 18:13 ` How to make a lisp function use an outside executable such as acompiled " Drew Adams
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: gnuist007 @ 2012-10-24 18:02 UTC (permalink / raw)
  To: help-gnu-emacs


I asked this question in a 2002 post in the thread describing it and
previous response.

https://groups.google.com/group/gnu.emacs.help/browse_thread/thread/a556b6d959c4a84d/

Has there been any improvements in the last 10 years?

Gnuist


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: How to make a lisp function use an outside executable such as acompiled C program?
  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 ` Drew Adams
  2012-10-24 20:02 ` How to make a lisp function use an outside executable such as a compiled " Raymond Wiker
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2012-10-24 18:13 UTC (permalink / raw)
  To: gnuist007, help-gnu-emacs

> I asked this question in a 2002 post in the thread describing it and
> previous response.
> 
> https://groups.google.com/group/gnu.emacs.help/browse_thread/t
> hread/a556b6d959c4a84d/
> 
> Has there been any improvements in the last 10 years?

Barry Margolin already gave you the answer, at the URL you cite.
Did you try it in the last 10 years? ;-)

For more info, see the Elisp manual, nodes `Synchronous Processes' and
`Asynchronous Processes'.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to make a lisp function use an outside executable such as a compiled C program?
  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 ` Raymond Wiker
  2012-10-24 20:29 ` Aurélien Aptel
       [not found] ` <mailman.11641.1351110594.855.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 7+ messages in thread
From: Raymond Wiker @ 2012-10-24 20:02 UTC (permalink / raw)
  To: help-gnu-emacs

gnuist007@hotmail.com writes:

> I asked this question in a 2002 post in the thread describing it and
> previous response.
>
> https://groups.google.com/group/gnu.emacs.help/browse_thread/thread/a556b6d959c4a84d/
>
> Has there been any improvements in the last 10 years?

Apparently not... your question is still as ill-specified as it was 10
years ago.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to make a lisp function use an outside executable such as a compiled C program?
  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>
  3 siblings, 0 replies; 7+ messages in thread
From: Aurélien Aptel @ 2012-10-24 20:29 UTC (permalink / raw)
  To: gnuist007; +Cc: help-gnu-emacs

On Wed, Oct 24, 2012 at 8:02 PM,  <gnuist007@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/a556b6d959c4a84d/
>
> 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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to make a lisp function use an outside executable such as a compiled C program?
       [not found] ` <mailman.11641.1351110594.855.help-gnu-emacs@gnu.org>
@ 2012-10-25  2:53   ` gnuist007
  0 siblings, 0 replies; 7+ messages in thread
From: gnuist007 @ 2012-10-25  2:53 UTC (permalink / raw)
  To: help-gnu-emacs

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.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-10-25  2:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
2002-10-03 12:30 gnuist
2002-10-03 17:29 ` Barry Margolin

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.