Add js and json modules

This commit is contained in:
2016-01-30 12:02:20 +00:00
parent b27cd00b37
commit b4132e5019
3 changed files with 86 additions and 0 deletions

44
modules/siren-js.el Normal file
View File

@@ -0,0 +1,44 @@
;;; siren-js.el --- jimeh's Emacs setup: js-mode configuration.
;;; Commentary:
;; Basic configuration for js-mode.
;;; Code:
(require 'siren-programming)
(siren-require-packages '(js2-mode json-mode))
(require 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.pac\\'" . js2-mode))
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
(eval-after-load 'js2-mode
'(progn
(defun siren-js2-mode-defaults ()
"Default tweaks for `js2-mode'."
(setq js2-basic-offset 2)
(setq tab-width 2)
(setq mode-name "JS2")
(js2-imenu-extras-mode +1)
(siren-prog-mode-defaults)
(company-mode +1)
(subword-mode +1)
(hs-minor-mode 1)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)
(let ((map js2-mode-map))
(define-key map (kbd "C-j") 'newline-and-indent)
(define-key map (kbd "C-c C-h") 'toggle-hiding)))
(setq siren-js2-mode-hook 'siren-js2-mode-defaults)
(add-hook 'js2-mode-hook (lambda ()
(run-hooks 'siren-js2-mode-hook)))))
(provide 'siren-js)
;;; siren-js.el ends here

40
modules/siren-json.el Normal file
View File

@@ -0,0 +1,40 @@
;;; siren-json.el --- jimeh's Emacs setup: json-mode configuration.
;;; Commentary:
;; Basic configuration for json-mode.
;;; Code:
(require 'siren-programming)
(siren-require-packages '(json-mode))
;; (require 'json-mode)
(defun siren-json-mode-defaults ()
"Default tweaks for `json-mode'."
(siren-prog-mode-defaults)
(let ((indent-width 2))
(setq js-indent-level indent-width)
(setq json-reformat:indent-width indent-width)
(setq tab-width indent-width)
(highlight-indentation-set-offset indent-width))
(company-mode +1)
(subword-mode +1)
(hs-minor-mode 1)
(highlight-indentation-mode)
(highlight-indentation-current-column-mode)
(let ((map json-mode-map))
(define-key map (kbd "C-j") 'newline-and-indent)
(define-key map (kbd "C-c C-h") 'toggle-hiding)))
(setq siren-json-mode-hook 'siren-json-mode-defaults)
(add-hook 'json-mode-hook (lambda ()
(run-hooks 'siren-json-mode-hook)))
(provide 'siren-json)
;;; siren-js.el ends here

View File

@@ -49,6 +49,8 @@
(require 'siren-cucumber)
(require 'siren-emacs-lisp)
(require 'siren-go)
(require 'siren-js)
(require 'siren-json)
(require 'siren-lua)
(require 'siren-makefile)
(require 'siren-markdown)