wiki:PluginAPI/Padre_Hooks

Version 2 (modified by Sewi, 3 years ago) (diff)

--

Padre Plugin API hooks

Plugins could add hooks to Padre core functions.

Each of the following hooks is a key in the hash reference returned by the padre_hooks method of a plugin.

The value should be

  • a code reference
  • an array ref of code references

Note: The list should be sorted alphabetically ignoring "before_" and "after_" prefixes of hooks

Note2: The usage samples should give you a hint how a hook could be used. They may not be useful for other cases (like svn auto-commit).

before_save

Arguments none
Return value undef or text
Called before any file is written to disk

| Usage Example | tidy Perl source on every save |

This hook should return undef if everything is ok. Any returned text is treated as an error message and shown to the user. The save process is stopped on the first hook returning an error message.

after_save

Arguments none
Return value ignored
Called after any file is written to disk
Usage Example svn commit on save