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")
|
||||
|
||||
module.exports = class FortranBeautifier extends Beautifier
|
||||
name: "Fortran Beautifier"
|
||||
name: "Fortran Beautifier"
|
||||
|
||||
options: {
|
||||
Fortran: true
|
||||
}
|
||||
options: {
|
||||
Fortran: true
|
||||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
@debug('fortran-beautifier', options)
|
||||
beautify: (text, language, options) ->
|
||||
@debug('fortran-beautifier', options)
|
||||
|
||||
emacs_path = options.emacs_path
|
||||
emacs_script_path = options.emacs_script_path
|
||||
emacs_path = options.emacs_path
|
||||
emacs_script_path = options.emacs_script_path
|
||||
|
||||
if not emacs_script_path
|
||||
emacs_script_path = path.resolve(__dirname, "emacs-fortran-formating-script.lisp")
|
||||
if not emacs_script_path
|
||||
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 = [
|
||||
'--batch'
|
||||
'-l'
|
||||
emacs_script_path
|
||||
'-f'
|
||||
'f90-batch-indent-region'
|
||||
tempFile = @tempFile("temp", text)
|
||||
]
|
||||
args = [
|
||||
'--batch'
|
||||
'-l'
|
||||
emacs_script_path
|
||||
'-f'
|
||||
'f90-batch-indent-region'
|
||||
tempFile = @tempFile("temp", text)
|
||||
]
|
||||
|
||||
if emacs_path
|
||||
args.unshift("#{emacs_path}")
|
||||
|
||||
@run("python", args, {ignoreReturnCode: true})
|
||||
.then(=>
|
||||
@readFile(tempFile)
|
||||
)
|
||||
else
|
||||
@run("emacs", args, {ignoreReturnCode: true})
|
||||
.then(=>
|
||||
@readFile(tempFile)
|
||||
)
|
||||
if emacs_path?
|
||||
@run(emacs_path, args, {ignoreReturnCode: false})
|
||||
.then(=>
|
||||
@readFile(tempFile)
|
||||
)
|
||||
else
|
||||
@run("emacs", args, {ignoreReturnCode: false})
|
||||
.then(=>
|
||||
@readFile(tempFile)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue