Skip to content

Commit

Permalink
Fix js2r-kill for cases where the AST is not available.
Browse files Browse the repository at this point in the history
In some cases (like new ediff buffers), the js2 AST is not immediately
available.
  • Loading branch information
NicolasPetton committed Jan 18, 2018
1 parent a86cb31 commit c005a0d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js2r-paredit.el
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ function foo() {|2 + 3} -> function foo() {}
(interactive)
(if js2-parsed-errors
(progn
(message "Buffer has parse errors. Killing the line")
(message "Buffer has parse errors. Killing the line")
(kill-line))
(js2r--kill-line)))
(condition-case error
(js2r--kill-line)
(progn
(message "Error occured while trying to kill AST node. Killing the line.")
(kill-line)))))

(defun js2r--kill-line ()
"Kill a line, but respecting node boundaries."
Expand Down

0 comments on commit c005a0d

Please sign in to comment.