<commit_before>path = require "path"

LatexmkBuilder = require "./builders/latexmk"
ProgressIndicatorView = require "./progress-indicator-view"

module.exports =
  configDefaults:
    texPath: "$PATH:/usr/texbin"
    outputDirectory: ""
    enableShellEscape: false

  activate: ->
    atom.workspaceView.command "latex:build", => @build()

  build: ->
    editor = atom.workspace.activePaneItem
    file = editor?.buffer.file
    unless file?
      # TODO: Show info message that the file has to be saved once?
      return

    editor.save() if editor.isModified() # NOTE: Should this be configurable?

    builder = @getBuilder()
    args = builder.constructArgs(file.path)
    @showProgressIndicator()
    proc = builder.run args, (statusCode) =>
      @destroyProgressIndicator()
      if statusCode == 0
        @showResult()
      else
        @showError("TeXification failed! Check the log file for more info...")
<commit_msg>Improve error messages with Latexmk is not found.<commit_after>path = require "path"

LatexmkBuilder = require "./builders/latexmk"
ProgressIndicatorView = require "./progress-indicator-view"

module.exports =
  configDefaults:
    texPath: "$PATH:/usr/texbin"
    outputDirectory: ""
    enableShellEscape: false

  activate: ->
    atom.workspaceView.command "latex:build", => @build()

  build: ->
    editor = atom.workspace.activePaneItem
    file = editor?.buffer.file
    unless file?
      # TODO: Show info message that the file has to be saved once?
      return

    editor.save() if editor.isModified() # NOTE: Should this be configurable?

    builder = @getBuilder()
    args = builder.constructArgs(file.path)
    @showProgressIndicator()
    proc = builder.run args, (statusCode) =>
      @destroyProgressIndicator()
      if statusCode == 0
        @showResult()
      else if statusCode == 127
        @showError(
          """
          TeXification failed! Builder executable not found.

            latex.texPath
              as configured: #{atom.config.get("latex.texPath")}
              when resolved: #{builder.constructPath()}

          Make sure latex.texPath is configured correctly; either adjust it \
          via the settings view, or directly in your config.cson file.
          """
        )
      else
        @showError(
          """
          TeXification failed with status code #{statusCode}! \
          Check the log file for more info...
          """
        )

{'fraction_non_alphanumeric': 0.10606060606060606, 'fraction_numerical': 0.0020475020475020475, 'mean_word_length': 2.6192592592592594, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3344182', 'n_tokens_mistral': 688, 'n_tokens_neox': 667, 'n_words': 193}