[Tex/LaTex] Disable “Auto remove aux files” dialog in TeXworks

auxiliary-fileserrorstexworks

Every time LaTeX happens to generate a corrupted .aux file for whatever reason, the following dialog appears, reading _Whil tupesetting, a corrupt .aux file from a previous run was detected. You should remove it and rerun the typesetting process. Do you want to displaythe "Remove Aux Files…" dialog now?

enter image description here

Not only it is redundant (why not to display the other dialog immediately with Skip button?), but more importantly it is very annoying.

I do not want any dialogs to appear! Can it be switched off somehow or do I have to get the source, erase this part and recompile it?

Best Answer

From my comment to a proper answer. :)

The root of all evil relies on a hook named logParser.js inside <USERHOME>/.TeXworks/scripts/Hooks. If you are not sure where to find this path, TeXworks has a shortcut for it:

Quack 1

Namely, Scripts ▶ Scripting TeXworks ▶ Show Scripts Folder. Then you can access a folder named Hooks in there. Pretty easy, isn't it? :)

The file to blame is logParser.js,

Quack 2

which is a JavaScript code. We have two ways of dealing with it. Either by disabling the whole execution of this log parser via:

Quack 3

(Scripts ▶ Scripting TeXworks ▶ Manage Scripts)

And then unchecking the item Errors, warnings, badboxes under the Hook Scripts tab.

Quack 4

Or we can edit logParser.js directly. The function that deals with warning about auxiliary files is around line 373:

LogParser.prototype.WarnAuxFiles = function()
{
  for (var i = this.Results.length-1; i >= 0; i--) {
    if (this.Results[i].Description.indexOf("File ended while scanning use of") > -1) {
      if (TW.question(null, "", "While typesetting, a corrupt .aux " +
        "file from a previous run was detected. You should remove " +
        "it and rerun the typesetting process. Do you want to display" +
        "the \"Remove Aux Files...\" dialog now?", 0x14000) == 0x4000)
        TW.target.removeAuxFiles();
      break;
    }
  }
}

Although I could add a return statement right after the function body opening block, I'd favour commenting the offending parts. :) So:

LogParser.prototype.WarnAuxFiles = function()
{
/*
No more! (Dr. Who, The Day Of The Doctor)

                        _.._
                       /   a\__,
                       \  -.___/
                        \  \
                   (\____)  \
               |\_(         ))
          _____|   (_        /________
               _\____(______/__
                    ______

  ooh a duck! :)

  for (var i = this.Results.length-1; i >= 0; i--) {
    if (this.Results[i].Description.indexOf("File ended while scanning use of") > -1) {
      if (TW.question(null, "", "While typesetting, a corrupt .aux " +
        "file from a previous run was detected. You should remove " +
        "it and rerun the typesetting process. Do you want to display" +
        "the \"Remove Aux Files...\" dialog now?", 0x14000) == 0x4000)
        TW.target.removeAuxFiles();
      break;
    }
  }
*/
}

And we are done. :)