Last active
March 17, 2017 17:57
-
-
Save coproduto/bbb4e4983c64285ea76da61e42c80ee4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;Utils------------------------------------------------------ | |
(defun my/append-to-list (list-var elements) | |
"Append ELEMENTS to the end of LIST-VAR. | |
The return value is the new value of LIST-VAR." | |
(unless (consp elements) | |
(error "ELEMENTS must be a list")) | |
(let ((list (symbol-value list-var))) | |
(if list | |
(setcdr (last list) elements) | |
(set list-var elements))) | |
(symbol-value list-var)) | |
;;---------------------------------------------------------- | |
;;package archives------------------------------------------ | |
(require 'package) | |
(my/append-to-list 'package-archives | |
'(("melpa" . "https://melpa.org/packages/"))) | |
(package-initialize) | |
;;---------------------------------------------------------- | |
;;JS mode--------------------------------------------------- | |
(require 'js) | |
(setq js-indent-level 2) | |
;;---------------------------------------------------------- | |
;;Python mode----------------------------------------------- | |
(require 'python) | |
(setq-default python-indent-offset 2) | |
;;---------------------------------------------------------- | |
;;Wakatime-------------------------------------------------- | |
(add-to-list 'load-path "~/.emacs.d/elpa/wakatime-mode-20161019.602/") | |
(require 'wakatime-mode) | |
(load-library "wakatime-mode") | |
(setq wakatime-api-key (getenv "WAKATIME_KEY")) | |
(setq wakatime-cli-path "/usr/local/bin/wakatime") | |
(global-wakatime-mode) | |
;;---------------------------------------------------------- | |
;;customize------------------------------------------------- | |
(setq custom-file "~/.custom.el") | |
(load custom-file) | |
;;---------------------------------------------------------- | |
;;startup--------------------------------------------------- | |
(setq inhibit-startup-message t) | |
(setq inhibit-startup-screen t) | |
;;---------------------------------------------------------- | |
;;IDO------------------------------------------------------- | |
(require 'ido) | |
(setq ido-enable-flex-matching t) | |
(setq ido-everywhere t) | |
(ido-mode 1) | |
;;---------------------------------------------------------- | |
;;misc editing stuff---------------------------------------- | |
(setq tab-width 2) | |
(setq indent-tabs-mode nil) | |
(define-key global-map (kbd "RET") 'newline-and-indent) | |
(turn-on-font-lock) | |
(column-number-mode) | |
;;International keyboards | |
(require 'iso-transl) | |
;;---------------------------------------------------------- | |
;;commands enabled------------------------------------------ | |
(put 'narrow-to-region 'disabled nil) | |
;;---------------------------------------------------------- | |
;;GUI------------------------------------------------------- | |
(add-to-list 'default-frame-alist '(foreground-color . "#D7CEE0")) | |
(add-to-list 'default-frame-alist '(background-color . "#090909")) | |
(when (display-graphic-p) | |
(load "~/.font-support.el")) | |
;;---------------------------------------------------------- | |
;;Flycheck-------------------------------------------------- | |
(require 'flycheck) | |
(add-hook 'after-init-hook #'global-flycheck-mode) | |
;; use local eslint from node_modules before global | |
;; http://emacs.stackexchange.com/questions/21205/flycheck-with-file-relative-eslint-executable | |
(defun my/use-eslint-from-node-modules () | |
(let* ((root (locate-dominating-file | |
(or (buffer-file-name) default-directory) | |
"node_modules")) | |
(eslint (and root | |
(expand-file-name "node_modules/eslint/bin/eslint.js" | |
root)))) | |
(when (and eslint (file-executable-p eslint)) | |
(setq-local flycheck-javascript-eslint-executable eslint)))) | |
(add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules) | |
;;---------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment