unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Mathias Dahl <brakjoller@gmail.com>
Subject: Re: Building a database interface in Emacs
Date: Wed, 20 Dec 2006 17:02:05 +0100	[thread overview]
Message-ID: <ur6uuzhc2.fsf@gmail.com> (raw)
In-Reply-To: 1166629368.130069.193700@80g2000cwy.googlegroups.com

"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	other threads:[~2006-12-20 16:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-20 12:28 Building a database interface in Emacs Mathias Dahl
2006-12-20 15:42 ` aartist
2006-12-20 16:02   ` Mathias Dahl [this message]
2006-12-20 16:49     ` Mathias Dahl
2006-12-20 16:59       ` aartist
2006-12-20 17:13         ` Mathias Dahl
2006-12-20 17:46       ` Lennart Borgman
     [not found]       ` <mailman.2154.1166636803.2155.help-gnu-emacs@gnu.org>
2006-12-20 17:51         ` Mathias Dahl
2006-12-20 20:23     ` Magnus Henoch
     [not found]     ` <mailman.2158.1166646507.2155.help-gnu-emacs@gnu.org>
2006-12-21  9:04       ` Mathias Dahl
2006-12-20 19:49 ` jason haslup
     [not found] ` <mailman.2157.1166644516.2155.help-gnu-emacs@gnu.org>
2006-12-21  9:03   ` Mathias Dahl
2006-12-21 16:42     ` Hadron Quark

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=ur6uuzhc2.fsf@gmail.com \
    --to=brakjoller@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).