I’ve created a Command that does some post processing of the current file. It calls a batch file, which in turn calls other command line applications.
The post processing step works, and the output is displayed as I expect it to be (in the Command Output window), but the file is not automatically reloaded.
Is there a way to get the current file to update after the command has been executed?
You can also enable file change detection; Preferences > Editor: Confirm Dialogs: Detect when files are changed…
That would require user intervention to reload the file though when Komodo alerts you. With @nathanr’s method you should be able to do it automatically in your Command.
Assuming you do mean that, I’ve converted it to a macro but it still doesn’t work. I’ve tried adding alerts before and after cmd_refreshStatus and they both trigger, indicating there is no issue with the call to cmd_refreshStatus.
Here’s my code in case it helps
if (komodo.view)
{
// Focus the current file
komodo.view.setFocus();
// Save the file before calling autopep8
ko.commands.doCommand('cmd_save');
// Execute the python autopep8 module and refresh the current file
ko.run.runEncodedCommand(
window,
'%(python3) -m autopep8 -i -v --ignore-local-config --max-line-length 100 \"%F\"',
(function(view)
{
return function()
{
// Focus the current file again
view.setFocus();
// Refresh the current file
ko.commands.doCommandAsync('cmd_refreshStatus');
}
})(komodo.view)
);
};