Skip to content

Commit

Permalink
updated js2-mode config'
Browse files Browse the repository at this point in the history
  • Loading branch information
nisaacson committed Jan 30, 2013
1 parent beabc86 commit 86c9506
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions site-lisp/noah/javascript.el
Expand Up @@ -3,22 +3,22 @@
(add-to-list 'auto-mode-alist '("\\.json$" . js2-mode))

(defadvice js2-reparse (before json)
(setq js2-buffer-file-name buffer-file-name))
(setq js2-buffer-file-name buffer-file-name))
(ad-activate 'js2-reparse)

(defadvice js2-parse-statement (around json)
(if (and (= tt js2-LC)
js2-buffer-file-name
(string-equal (substring js2-buffer-file-name -5) ".json")
(eq (+ (save-excursion
(goto-char (point-min))
(back-to-indentation)
(while (eolp)
(next-line)
(back-to-indentation))
(point)) 1) js2-ts-cursor))
(setq ad-return-value (js2-parse-assign-expr))
ad-do-it))
(if (and (= tt js2-LC)
js2-buffer-file-name
(string-equal (substring js2-buffer-file-name -5) ".json")
(eq (+ (save-excursion
(goto-char (point-min))
(back-to-indentation)
(while (eolp)
(next-line)
(back-to-indentation))
(point)) 1) js2-ts-cursor))
(setq ad-return-value (js2-parse-assign-expr))
ad-do-it))
(ad-activate 'js2-parse-statement)
(add-hook 'javascript-mode-hook
'(lambda()
Expand All @@ -33,7 +33,7 @@
(js2-mode-extend-comment)
(newline-and-indent)
)

))


Expand All @@ -43,5 +43,11 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun noah-add-js2-keys ()
(local-set-key (kbd "C-j") 'js2-newline-key))

(add-hook 'js2-mode-hook 'noah-add-js2-keys)
(setq js2-missing-semi-one-line-override t)


(eval-after-load 'js2-mode
'(progn
(define-key js2-mode-map (kbd "C-c C-d") 'js2-next-error)))

0 comments on commit 86c9506

Please sign in to comment.