I am trying to remove REDO context.
The function PurgeAllUndos may be suitable,
but, from API reference it saids, should not use PurgeAllUndos.
Are there any function substitute for PurgeAllUndos ?
You should only try to undo things your plugin has done. If you want to disallow undo for your plugin, you can set the undo context to "silent."