running provided emacs binary directly instead of running it via python which does not work well on windows.
listening to emacs return codes.
This commit is contained in:
parent
4fc7c724a5
commit
d79eda0756
|
@ -7,41 +7,39 @@ Beautifier = require('../beautifier')
|
||||||
path = require("path")
|
path = require("path")
|
||||||
|
|
||||||
module.exports = class FortranBeautifier extends Beautifier
|
module.exports = class FortranBeautifier extends Beautifier
|
||||||
name: "Fortran Beautifier"
|
name: "Fortran Beautifier"
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
Fortran: true
|
Fortran: true
|
||||||
}
|
}
|
||||||
|
|
||||||
beautify: (text, language, options) ->
|
beautify: (text, language, options) ->
|
||||||
@debug('fortran-beautifier', options)
|
@debug('fortran-beautifier', options)
|
||||||
|
|
||||||
emacs_path = options.emacs_path
|
emacs_path = options.emacs_path
|
||||||
emacs_script_path = options.emacs_script_path
|
emacs_script_path = options.emacs_script_path
|
||||||
|
|
||||||
if not emacs_script_path
|
if not emacs_script_path
|
||||||
emacs_script_path = path.resolve(__dirname, "emacs-fortran-formating-script.lisp")
|
emacs_script_path = path.resolve(__dirname, "emacs-fortran-formating-script.lisp")
|
||||||
|
|
||||||
@debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)
|
@debug('fortran-beautifier', 'emacs script path: ' + emacs_script_path)
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
'--batch'
|
'--batch'
|
||||||
'-l'
|
'-l'
|
||||||
emacs_script_path
|
emacs_script_path
|
||||||
'-f'
|
'-f'
|
||||||
'f90-batch-indent-region'
|
'f90-batch-indent-region'
|
||||||
tempFile = @tempFile("temp", text)
|
tempFile = @tempFile("temp", text)
|
||||||
]
|
]
|
||||||
|
|
||||||
if emacs_path
|
if emacs_path?
|
||||||
args.unshift("#{emacs_path}")
|
@run(emacs_path, args, {ignoreReturnCode: false})
|
||||||
|
.then(=>
|
||||||
@run("python", args, {ignoreReturnCode: true})
|
@readFile(tempFile)
|
||||||
.then(=>
|
)
|
||||||
@readFile(tempFile)
|
else
|
||||||
)
|
@run("emacs", args, {ignoreReturnCode: false})
|
||||||
else
|
.then(=>
|
||||||
@run("emacs", args, {ignoreReturnCode: true})
|
@readFile(tempFile)
|
||||||
.then(=>
|
)
|
||||||
@readFile(tempFile)
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in New Issue