On 12/10/2012 10:39 AM, bear jiang wrote:
> I've written a minor mode to work with semantic-ia-fast-jump, let's say
> As a result, I want `xxx-mode' to be automatically turned on every time
> I entered
> into a semantic enabled buffer.
> I've noticed that lots of semantic's minor modes are turned on in this
> way, such as
> semantic-highlight-mode. But now the internal code is too hard for me to
> find the
> right function/hook. Can someone tell me how to do this?
Look at semantic-highlight-edits-mode as a pretty simple example that
shows how to make a global semantic based mode. Most of the behavior is
wrapped up in a couple functions for handling semantic based minor modes.
For temporary purposes, you could also just do:
(add-hook 'semantic-init-hook '(lambda () (my-cool-fcn))
to run something whenever a buffer gets semantic enabled.
Definitely wrap up your mode as a semantic minor mode for public
consumption using the convenience functions though.