all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to make a hook function and call from C?
@ 2008-05-08 20:44 joakim
  2008-05-09  1:25 ` Stefan Monnier
  2008-05-09 11:13 ` Richard M Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: joakim @ 2008-05-08 20:44 UTC (permalink / raw)
  To: emacs-devel

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




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

end of thread, other threads:[~2008-05-09 22:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-08 20:44 how to make a hook function and call from C? joakim
2008-05-09  1:25 ` Stefan Monnier
2008-05-09 15:56   ` joakim
2008-05-09 17:06     ` Stefan Monnier
2008-05-09 22:01       ` joakim
2008-05-09 11:13 ` Richard M Stallman
2008-05-09 14:31   ` Stefan Monnier

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.