Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

dss/js2-insert-semicolon

  • Loading branch information...
commit c17d4f0e01bb728237e35a220196459b094b09a6 1 parent d4c7f40
Tavis Rudd authored

Showing 1 changed file with 15 additions and 2 deletions. Show diff stats Hide diff stats

  1. +15 2 dss-javascript.el
17 dss-javascript.el
@@ -2,7 +2,6 @@
2 2 (require 'cc-vars)
3 3 (require 'dss-codenav-helpers)
4 4
5   -
6 5 ;;; http://weblogs.asp.net/george_v_reilly/archive/2009/03/24/exuberant-ctags-and-javascript.aspx
7 6 ;;; http://tbaggery.com/2011/08/08/effortless-ctags-with-git.html
8 7
@@ -83,12 +82,25 @@ PARSE-STATUS is as documented in `parse-partial-sexp'."
83 82 (insert quote-string)
84 83 (backward-char 1))))
85 84
  85 +(defun dss/js-insert-semicolon ()
  86 + (interactive)
  87 + (cond ((eq last-command this-command)
  88 + (end-of-line))
  89 + ((not (or (dss/in-string-p)
  90 + (dss/in-comment-p)))
  91 + (save-excursion
  92 + (end-of-line)
  93 + (when (not (looking-back ";"))
  94 + (insert ";"))
  95 + ))
  96 + (t (self-insert-command 1))))
  97 +
86 98 (require 'jquery-doc)
87 99 (defun dss/js2-mode-hook ()
88 100 (require 'espresso)
89 101 (flymake-mode)
90 102 ;; (setq ac-sources '(ac-source-semantic-raw))
91   -
  103 + (setq mode-name "JS")
92 104 (setq espresso-indent-level 4
93 105 indent-tabs-mode nil
94 106 c-basic-offset 4)
@@ -110,6 +122,7 @@ PARSE-STATUS is as documented in `parse-partial-sexp'."
110 122 (define-key js2-mode-map [(backspace)] 'c-electric-backspace)
111 123 (define-key js2-mode-map [(control d)] 'c-electric-delete-forward)
112 124 (define-key js2-mode-map [(control meta q)] 'dss/indent-sexp)
  125 + (define-key js2-mode-map ";" 'dss/js-insert-semicolon)
113 126 (if (featurep 'js2-highlight-vars)
114 127 (js2-highlight-vars-mode))
115 128 (mapc (lambda (char)

0 comments on commit c17d4f0

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