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

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

Re: Building a database interface in Emacs


From: Mathias Dahl
Subject: Re: Building a database interface in Emacs
Date: Wed, 20 Dec 2006 17:02:05 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (windows-nt)

"aartist" <aartist@gmail.com> writes:

> You might want to look at Widget and Skeleton.  M-x Customize-browse
> is one classic example, you might want to follow.

I am afraid I did not express myself clearly enough; I am not so
interested in the actual building of a form or similar, what I want to
know is what the best way is to communicate with the database.

I have read up on receiving data from an asynchronous process and
there is one thing I have trouble with, how do I send input to the
process and wait until I get output back, from the same function?

An example:

(defun foo ()
 (process-send-string process "blabla")
 (wait-for-and-get-result)
 (use-the-result))

I can attach a process filter function to the process but I don't
understand how to "pause" my main code until my filter function has
been called. Well, I came up with a hack, that seems really ugly:

(defvar foo-output nil)

(defun foo ()
 (process-send-string process "blabla")
 (setq foo-output nil)
 (while (not foo-output)
   (sleep-for 0 10))
 (use-result))

(defun foo-filter (proc string)
 (setq foo-output string))

There must be a neater way to do this, right?

/Mathias


reply via email to

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