def terminate(self):
self.terminated_user = True
if self.proc:
p = self.proc
self.proc = None
p.kill()
p.communicate()
## This is here for future reference.
# class EvalLatexMathematicaReplace(sublime_plugin.TextCommand):
# def run(self, edit):
# for sel in self.view.sel():
# if sel.begin() == sel.end():
# region = self.view.line(sel)
# else:
# region = sel
# code = self.view.substr(region)
# try:
# p = subprocess.Popen(
# 'math -run \'Print[TeXForm[ToExpression["%s", TeXForm]]]; Exit[]\'' % code.replace('\\', '\\\\'),
# shell=True,
# stdout=subprocess.PIPE,
# stderr=subprocess.STDOUT,
# bufsize=1,
# universal_newlines=True)
# p.wait()
# output = p.stdout.read()
# # Hack to compensate for not being able to use -noprompt, since -noprompt causes ToExpression to hang.
# output = '\n'.join(output.split('\n')[2:])
# except Exception as e:
# output = 'ERROR: %s' % str(e)
# if output:
# self.view.replace(edit, region, output)
评论列表
文章目录