From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: callback functions in Emacs Date: Tue, 04 Sep 2007 22:27:43 +0200 Message-ID: <87642qmb0g.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1188937485 14724 80.91.229.12 (4 Sep 2007 20:24:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 4 Sep 2007 20:24:45 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 04 22:24:44 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ISewv-0001gX-5t for ged-emacs-devel@m.gmane.org; Tue, 04 Sep 2007 22:24:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ISewt-0003VN-J6 for ged-emacs-devel@m.gmane.org; Tue, 04 Sep 2007 16:24:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ISewp-0003TY-L1 for emacs-devel@gnu.org; Tue, 04 Sep 2007 16:24:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ISewn-0003Rq-RI for emacs-devel@gnu.org; Tue, 04 Sep 2007 16:24:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ISewn-0003Rn-LE for emacs-devel@gnu.org; Tue, 04 Sep 2007 16:24:29 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1ISewn-0000C6-6l for emacs-devel@gnu.org; Tue, 04 Sep 2007 16:24:29 -0400 Original-Received: (qmail invoked by alias); 04 Sep 2007 20:24:28 -0000 Original-Received: from p57A22FC4.dip0.t-ipconnect.de (EHLO arthur.local) [87.162.47.196] by mail.gmx.net (mp041) with SMTP; 04 Sep 2007 22:24:28 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18ZrzR4C0AZ2/B/8KcBlNphiC76FqRvgVh6pzB/ua z0iB+9gGaoc5hp User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:77763 Archived-At: Hi, I'm playing a little bit with integration of D-Bus(*) into Emacs. In order to get this, I'm writing dbusbindings.{h,c}, which are linked to Emacs. One of the basic concepts od D-Bus is, that one could register a callback function which is applied when there bis a signal on the bus one has registered for. That works fine as long everything is handled on C level. But I intend to register a callback C function, which calls then a Lisp function internally (via Ffuncall etc). Unfortunately, this fails. Feval does abort when evalling the corresponding Lisp form, because handling_signal is equal 1 (the comment in eval.c explains, that the Lisp interpreter cannot be called from a signal handler, because it isn't reentrant). One possible solution I found is the use of an additional, Emacs internal network process, installed when registering the callback function in D-Bus. I can send something to the process when being inside the callback function. The process filter of this process reads then the sent string, and calls the corresponding Lisp function. But that looks ugly to me. Isn't there another, more simple way to evaluate Lisp code from inside a callback function? (*): http://dbus.freedesktop.org TIA, and best regards, Michael.