Skip to content
Browse files

js-mode-expansions: Don't get confused by keywords in comments.

  • Loading branch information...
1 parent 87ce115 commit 13f9148fe7f2fb75f63d68028e12c9843a4e089d @magnars magnars committed May 16, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 js-mode-expansions.el
View
12 js-mode-expansions.el
@@ -54,7 +54,8 @@
(forward-char 8)
(error nil))
(word-search-backward "function")
- (while (er--point-inside-string-p)
+ (while (or (er--point-inside-string-p)
+ (er--point-is-in-comment-p))
(word-search-backward "function"))
(set-mark (point))
(while (not (looking-at "{"))
@@ -69,7 +70,8 @@
(forward-char 6)
(error nil))
(word-search-backward "return")
- (while (er--point-inside-string-p)
+ (while (or (er--point-inside-string-p)
+ (er--point-is-in-comment-p))
(word-search-backward "return"))
(set-mark (point))
(while (not (looking-at ";"))
@@ -86,7 +88,8 @@
(forward-char 6)
(error nil))
(word-search-backward "return")
- (while (er--point-inside-string-p)
+ (while (or (er--point-inside-string-p)
+ (er--point-is-in-comment-p))
(word-search-backward "return"))
(search-forward " ")
(set-mark (point))
@@ -103,7 +106,8 @@
(forward-char 2)
(error nil))
(word-search-backward "if")
- (while (er--point-inside-string-p)
+ (while (or (er--point-inside-string-p)
+ (er--point-is-in-comment-p))
(word-search-backward "if"))
(set-mark (point))
(while (not (looking-at "("))

0 comments on commit 13f9148

Please sign in to comment.
Something went wrong with that request. Please try again.