Permalink
Browse files

js2-mode: Expanding to statement when point is right after the ;

  • Loading branch information...
1 parent 13f9148 commit a715075a9ab42e113b185d9a58e82070a4fe7439 @magnars magnars committed Jun 18, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 js2-mode-expansions.el
View
7 js2-mode-expansions.el
@@ -33,7 +33,10 @@
(defun js2-mark-parent-statement ()
(interactive)
- (let* ((parent-statement (js2-node-parent-stmt (js2-node-at-point)))
+ (let* ((parent-statement (if (not (looking-back ";"))
+ (js2-node-parent-stmt (js2-node-at-point))
+ (forward-char -1)
+ (js2-node-at-point)))
(beg (js2-node-abs-pos parent-statement))
(end (+ beg (js2-node-len parent-statement))))
(goto-char beg)
@@ -46,7 +49,7 @@
'(js2-mark-parent-statement))))
(add-hook 'js2-mode-hook 'er/add-js2-mode-expansions)
-;(add-hook 'js3-mode-hook 'er/add-js2-mode-expansions) -- works?
+;;(add-hook 'js3-mode-hook 'er/add-js2-mode-expansions) -- works?
(provide 'js2-mode-expansions)

0 comments on commit a715075

Please sign in to comment.