Browse Source

Declare success local variable

success is used as global variable in Original code.
pull/7/head
Syohei YOSHIDA 11 years ago
parent
commit
5e769f3429
1 changed files with 18 additions and 17 deletions
  1. +18
    -17
      jsfmt.el

+ 18
- 17
jsfmt.el View File

@ -113,25 +113,26 @@ buffer."
;; We're using errbuf for the mixed stdout and stderr output. This
;; is not an issue because jsfmt --write does not produce any stdout
;; output in case of success.
(if save
(let (success)
(if save
(if ast
(setq success (zerop (call-process jsfmt-command nil errbuf nil "--save-ast" "--write" tmpfile)))
(setq success (zerop (call-process jsfmt-command nil errbuf nil "--write" tmpfile))))
(if ast
(setq success (zerop (call-process jsfmt-command nil errbuf nil "--save-ast" "--write" tmpfile)))
(setq success (zerop (call-process jsfmt-command nil errbuf nil "--write" tmpfile))))
(if ast
(setq success (zerop (call-process jsfmt-command nil errbuf nil "--ast" "--write" tmpfile)))
(setq success (zerop (call-process jsfmt-command nil errbuf nil "--ast" "--write" tmpfile)))
(setq success nil))
(setq success nil))
(setq success nil))
(if 'success
(if (zerop (call-process-region (point-min) (point-max) "diff" nil patchbuf nil "-n" "-" tmpfile))
(progn
(kill-buffer errbuf)
(message "Buffer is already jsfmted"))
(js--apply-rcs-patch patchbuf)
(kill-buffer errbuf)
(message "Applied jsfmt"))
(message "Could not apply jsfmt. Check errors for details")
(jsfmt--process-errors (buffer-file-name) tmpfile errbuf))
(if success
(if (zerop (call-process-region (point-min) (point-max) "diff" nil patchbuf nil "-n" "-" tmpfile))
(progn
(kill-buffer errbuf)
(message "Buffer is already jsfmted"))
(js--apply-rcs-patch patchbuf)
(kill-buffer errbuf)
(message "Applied jsfmt"))
(message "Could not apply jsfmt. Check errors for details")
(jsfmt--process-errors (buffer-file-name) tmpfile errbuf)))
(kill-buffer patchbuf)
(delete-file tmpfile)))


Loading…
Cancel
Save