From: Tim H. <tho...@te...> - 2018-11-20 00:32:28
|
Hi Flo! You are creating an infinite loop because buildManager.runCommand() will activate your trigger ?after-command-run again. You could use the system() command instead of buildManager.runCommand(). Note however, that the trigger is activated after every command (e.g. also after a simple view) and you may not want to commit on this. An alternative appoach is to invert the logic and create a custom macro "Build and commit" that calls the build command and then commits. Then assign a suitable shortcut. That way, you can have two commands one with commit and one without and you can decide which to use on a case-by-case basis. Tim Am 14.11.2018 um 17:46 schrieb Florian Hennig: > Hi there! > > I'm kind of new to texstudio and I'm struggeling to achive a simple > function: > I want to run a git commit and a git push everytime I hit the "Compile and > View" button. > To implement that feature I created the following lines to a "User Macro": > > %SCRIPT > buildManager.runCommand("git commit -a -m \"autosave\"", editor.fileName()) > buildManager.runCommand("git push origin master", editor.fileName()) > > and I set the trigger to ?after-command-run. > > But for some reason texstudion crashes as soon as I try it (with the > "Compile > and view button", the "Run script" button seems to work fine.) > I'm also interested if it is possible to include a timestamp into the > commit > message and maybe redirect the output of the commands to the "Messages" > Tab. > > Thanks for helping > Flo > > > _______________________________________________ > TeXstudio-list mailing list > TeX...@li... > https://lists.sourceforge.net/lists/listinfo/texstudio-list > |