From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joakim@verona.se Newsgroups: gmane.emacs.devel Subject: how to make a hook function and call from C? Date: Thu, 08 May 2008 22:44:18 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210279752 1812 80.91.229.12 (8 May 2008 20:49:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2008 20:49:12 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 08 22:49:47 2008 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 1JuD3G-0005tj-3e for ged-emacs-devel@m.gmane.org; Thu, 08 May 2008 22:49:18 +0200 Original-Received: from localhost ([127.0.0.1]:56042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuD2X-0004bb-PA for ged-emacs-devel@m.gmane.org; Thu, 08 May 2008 16:48:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JuD2R-0004ah-Vl for emacs-devel@gnu.org; Thu, 08 May 2008 16:48:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JuD2Q-0004aV-1A for emacs-devel@gnu.org; Thu, 08 May 2008 16:48:27 -0400 Original-Received: from [199.232.76.173] (port=41632 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuD2P-0004aS-SR for emacs-devel@gnu.org; Thu, 08 May 2008 16:48:25 -0400 Original-Received: from iwfs.imcode.com ([82.115.149.64]:46404 helo=gate.verona.se) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JuD2P-0003Vy-Kz for emacs-devel@gnu.org; Thu, 08 May 2008 16:48:25 -0400 Original-Received: from chopper (IDENT:1005@localhost [127.0.0.1]) by gate.verona.se (8.13.4/8.11.4) with ESMTP id m48KmL6L009930 for ; Thu, 8 May 2008 22:48:22 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:96815 Archived-At: I want to call lisp inside a gtk widget signal handler: ------------------------------------------------ xw->widget=GTK_WIDGET(gtk_button_new_with_label ( xw->title)); g_signal_connect (G_OBJECT (xw->widget), "clicked", G_CALLBACK (hello), xw); ... static void hello( GtkWidget *widget, gpointer data ) { printf ("button clicked %d\n",data); Lisp_Object args[2]; struct xwidget* xw=( struct xwidget*)data; /* FIXME i have no particular idea how to call lisp yet args[0] = data->message_hook; args[1] = arg; Ffuncall (2, args); */ // call0(intern("xwidget-dummy-hook")); //crashes even if fn exists // call0(intern("beep")); //"beep" seems to not crash and not do anything but "info" crashes } ----------------------------------------------- When I click the button, the "hello" function is reached, but I cant figure out how to call a lisp function. - Are there any similar examples in the codebase somewhere? - I would like xw->message_hook to contain a lisp hook, settable from the lisp level. How do I set this up at the C level? - Should I use Ffuncall to call my new hook or what? -- Joakim Verona