Author Topic: Hooking 'compile' event?  (Read 3884 times)

aurora_borealis

  • Community Member
  • Posts: 5
  • Hero Points: 0
Hooking 'compile' event?
« on: May 25, 2012, 04:21:55 PM »
I know it's possible to hook the build event using a macro such as:
Code: [Select]
_prebuild_event()
{
     stuff();
}

However, I have not been able to figure this out for a compile event. It does not seem to be possible, using the built-in events, such as ones from this thread: http://community.slickedit.com/index.php/topic,84.msg331.html#msg331 . I was wondering if it was maybe possible to use some alternate way to detect a compile event?

Graeme

  • Senior Community Member
  • Posts: 2821
  • Hero Points: 347
Re: Hooking 'compile' event?
« Reply #1 on: May 25, 2012, 11:41:29 PM »
Do you need pre or post events?  If it's pre compile, one way is to write your own macro

Code: [Select]
_command my_compile() name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
    // do something
   execute('project-compile');
}

Another way is to use the %M switch in the compile command - see _parse_project_command in the help.
You could also hack the project_compile() function in compile.e.

If you need a "post compile" event, I don't know how to find out when an asynchronous command running in the process buffer has finished.  If you run the compiler via a batch file, you might be able to call slickedit back at the end.

aurora_borealis

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Hooking 'compile' event?
« Reply #2 on: May 29, 2012, 04:22:16 PM »
I needed the pre-compile event and I think this should do it. Thanks!