Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;; .emacs.el -- Emacs configuration file.
- ;;; Commentary:
- ;;; Code:
- (require 'package)
- (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
- (not (gnutls-available-p))))
- (proto (if no-ssl "http" "https")))
- ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
- (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
- ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
- (when (< emacs-major-version 24)
- ;; For important compatibility libraries like cl-lib
- (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
- (package-initialize)
- ;; TODO add the rest of the packages to this list
- (defvar my-packages '(better-defaults
- projectile
- clojure-mode
- cider))
- (dolist (p my-packages)
- (unless (package-installed-p p)
- (package-install p)))
- (custom-set-variables
- ;; custom-set-variables was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- '(company-quickhelp-color-background "#4F4F4F")
- '(company-quickhelp-color-foreground "#DCDCCC")
- '(custom-enabled-themes (quote (spacemacs-dark)))
- '(custom-safe-themes
- (quote
- ("ec5f697561eaf87b1d3b087dd28e61a2fc9860e4c862ea8e6b0b77bd4967d0ba" "f71859eae71f7f795e734e6e7d178728525008a28c325913f564a42f74042c31" "bffa9739ce0752a37d9b1eee78fc00ba159748f50dc328af4be661484848e476" default)))
- '(fci-rule-color "#383838")
- '(nrepl-message-colors
- (quote
- ("#CC9393" "#DFAF8F" "#F0DFAF" "#7F9F7F" "#BFEBBF" "#93E0E3" "#94BFF3" "#DC8CC3")))
- '(package-selected-packages
- (quote
- (jedi-direx jedi python-mode js-comint paredit parinfer use-package htmlize org-link-minor-mode elcord telephone-line smart-tabs-mode cider projectile better-defaults clojure-mode zenburn-theme challenger-deep-theme haskell-mode neotree web-mode json-mode flycheck js2-mode spaceline spacemacs-theme)))
- '(vc-annotate-background "#2B2B2B")
- '(vc-annotate-color-map
- (quote
- ((20 . "#BC8383")
- (40 . "#CC9393")
- (60 . "#DFAF8F")
- (80 . "#D0BF8F")
- (100 . "#E0CF9F")
- (120 . "#F0DFAF")
- (140 . "#5F7F5F")
- (160 . "#7F9F7F")
- (180 . "#8FB28F")
- (200 . "#9FC59F")
- (220 . "#AFD8AF")
- (240 . "#BFEBBF")
- (260 . "#93E0E3")
- (280 . "#6CA0A3")
- (300 . "#7CB8BB")
- (320 . "#8CD0D3")
- (340 . "#94BFF3")
- (360 . "#DC8CC3"))))
- '(vc-annotate-very-old-color "#DC8CC3"))
- (custom-set-faces
- ;; custom-set-faces was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- )
- ;; custom-set-faces was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- (setq inhibit-startup-screen t)
- (menu-bar-mode 0)
- (tool-bar-mode 0)
- (scroll-bar-mode 0)
- (setq-default tab-width 2)
- (when (version<= "26.0.50" emacs-version)
- (global-display-line-numbers-mode))
- (setq ring-bell-function 'ignore)
- (require 'ido)
- (ido-mode t)
- (setq backup-directory-alist `(("." . "~/.saves")))
- (setq backup-by-copying t)
- ;;(require 'spaceline-config)
- ;; (spaceline-spacemacs-theme)
- (require 'telephone-line)
- (setq telephone-line-primary-left-separator 'telephone-line-cubed-left
- telephone-line-secondary-left-separator 'telephone-line-cubed-hollow-left
- telephone-line-primary-right-separator 'telephone-line-cubed-right
- telephone-line-secondary-right-separator 'telephone-line-cubed-hollow-right)
- (setq telephone-line-height 24
- telephone-line-evil-use-short-tag t)
- (telephone-line-mode 1)
- ;;(require 'smart-tabs-mode)
- ;; (smart-tabs-insinuate 'javascript)
- (setq-default indent-tabs-mode nil)
- (require 'js2-mode)
- (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
- (add-to-list 'interpreter-mode-alist '("node" . js2-mode))
- ;; use web-mode for .js and .jsx files
- (add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode))
- ;;(add-to-list 'auto-mode-alist '("\\.js$" . web-mode))
- ;; http://www.flycheck.org/manual/latest/index.html
- (require 'flycheck)
- ;; turn on flychecking globally
- (add-hook 'after-init-hook #'global-flycheck-mode)
- (global-flycheck-mode)
- ;; disable jshint since we prefer eslint checking
- (setq-default flycheck-disabled-checkers
- (append flycheck-disabled-checkers
- '(javascript-jshint)))
- ;; use eslint with web-mode for js and jsx files
- (flycheck-add-mode 'javascript-eslint 'web-mode)
- ;; customize flycheck temp file prefix
- (setq-default flycheck-temp-prefix ".flycheck")
- ;; disable json-jsonlist checking for json files
- (setq-default flycheck-disabled-checkers
- (append flycheck-disabled-checkers
- '(json-jsonlist)))
- ;; 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)
- ;; adjust indents for web-mode to 2 spaces
- (defun my-web-mode-hook ()
- "Hooks for Web mode. Adjust indent."
- ;;; http://web-mode.org/
- (setq web-mode-markup-indent-offset 2)
- (setq web-mode-css-indent-offset 2)
- (setq web-mode-code-indent-offset 2))
- (add-hook 'web-mode-hook 'my-web-mode-hook)
- ;; for better jsx syntax-highlighting in web-mode
- ;; - courtesy of Patrick @halbtuerke
- (defadvice web-mode-highlight-part (around tweak-jsx activate)
- (if (or (equal web-mode-content-type "jsx") (equal web-mode-content-type "js"))
- (let ((web-mode-enable-part-face nil))
- ad-do-it)
- ad-do-it))
- ;;; runs eslint --fix on the current file after save
- ;;; alpha quality -- use at your own risk
- (defun eslint-fix-file ()
- (interactive)
- (message "eslint --fixing the file" (buffer-file-name))
- (shell-command (concat "eslint --fix " (buffer-file-name))))
- (defun eslint-fix-file-and-revert ()
- (interactive)
- (eslint-fix-file)
- (revert-buffer t t))
- (add-hook 'js2-mode-hook
- (lambda ()
- (add-hook 'after-save-hook #'eslint-fix-file-and-revert)))
- (require 'neotree)
- (global-set-key [f8] 'neotree-toggle)
- ;; Haskell setup
- (require 'haskell-mode)
- (require 'haskell-interactive-mode)
- (require 'haskell-process)
- (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
- ;; Keybindings for Haskell
- (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload)
- (define-key haskell-mode-map (kbd "C-`") 'haskell-interactive-bring)
- (define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
- (define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
- (define-key haskell-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
- (define-key haskell-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
- (define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal)
- ;; elcord
- (require 'elcord)
- (elcord-mode)
- ;; Org-mode
- (require 'org)
- ;; The following lines are always needed. Choose your own keys.
- (global-set-key "\C-cl" 'org-store-link)
- (global-set-key "\C-ca" 'org-agenda)
- (global-set-key "\C-cc" 'org-capture)
- (global-set-key "\C-cb" 'org-switchb)
- ;; HTML export stuff
- (setq browse-url-browser-function 'browse-url-generic
- browse-url-generic-program "firefox")
- (setenv "BROWSER" "firefox")
- ;; Latex export stuff
- (setq org-latex-listings '('minted 'hyperref))
- (require 'ox-latex)
- (add-to-list 'org-latex-packages-alist '("" "minted" "" "hyperref"))
- (unless (boundp 'org-latex-classes)
- (setq org-latex-classes nil))
- (add-to-list 'org-latex-classes
- '("article"
- "\\documentclass{article}"
- ("\\section{%s}" . "\\section*{%s}")))
- ;; prolog
- (add-to-list 'auto-mode-alist '("\\.pl\\'" . prolog-mode))
- ;; use-package
- (require 'use-package)
- ;; parinfer
- (use-package parinfer
- :ensure t
- :bind
- (("C-," . parinfer-toggle-mode))
- :init
- (progn
- (setq parinfer-extensions
- '(defaults ; should be included.
- pretty-parens ; different paren styles for different modes.
- ; evil ; If you use Evil.
- ; lispy ; If you use Lispy. With this extension, you should install Lispy and do not enable lispy-mode directly.
- paredit ; Introduce some paredit commands.
- smart-tab ; C-b & C-f jump positions and smart shift with tab & S-tab.
- smart-yank)) ; Yank behavior depend on mode.
- (add-hook 'clojure-mode-hook #'parinfer-mode)
- (add-hook 'emacs-lisp-mode-hook #'parinfer-mode)
- (add-hook 'common-lisp-mode-hook #'parinfer-mode)
- (add-hook 'scheme-mode-hook #'parinfer-mode)
- (add-hook 'lisp-mode-hook #'parinfer-mode)))
- (require 'js-comint)
- (setq inferior-js-program-command "/usr/bin/java org.mozilla.javascript.tools.shell.Main")
- (add-hook 'js2-mode-hook '(lambda ()
- (local-set-key (kbd "C-x C-e") 'js-send-last-sexp)
- (local-set-key "\C-\M-x" 'js-send-last-sexp-and-go)
- (local-set-key (kbd "C-c b") 'js-send-buffer)
- (local-set-key "\C-c\C-b" 'js-send-buffer-and-go)
- (local-set-key "\C-cl" 'js-load-file-and-go)))
- (defun inferior-js-mode-hook-setup ()
- "Cleaner node.js output."
- (add-hook 'comint-output-filter-functions 'js-comint-process-output))
- (add-hook 'inferior-js-mode-hook 'inferior-js-mode-hook-setup t)
- (global-set-key (kbd "<S-tab>") 'un-indent-by-removing-4-spaces)
- (defun un-indent-by-removing-4-spaces ()
- "Remove 4 spaces from beginning of of line."
- (interactive)
- (save-excursion
- (save-match-data
- (beginning-of-line)
- ;; get rid of tabs at beginning of line
- (when (looking-at "^\\s-+")
- (untabify (match-beginning 0) (match-end 0)))
- (when (looking-at "^ ")
- (replace-match "")))))
- ;; Flycheck clojure
- ;;(require 'flycheck-clojure)
- ;;(eval-after-load 'flycheck '(flycheck-clojure-setup))
- ;;(add-hook 'after-init-hook #'global-flycheck-mode)
- ;; Flycheck pos tip
- ;; (require 'flycheck-pos-tip)
- ;; (eval-after-load 'flycheck
- ;; '(setq flycheck-display-errors-function #'flycheck-pos-tip-error-messages))
- (require 'python-mode)
- (setq py-install-directory "/usr/bin/python3")
- (add-to-list 'load-path py-install-directory)
- (defun MY-LOCAL-SHELL ()
- "Start interactive shell."
- (interactive)
- (py-shell nil py-install-directory))
- (defun load-into-py-shell ()
- "Start interactive shell with file loaded."
- (interactive)
- (py-shell-send-file buffer-file-name))
- (define-key python-mode-map (kbd "C-c C-l") 'load-into-py-shell)
- ;; Load jedi auto-complete for python
- (require 'jedi)
- (add-hook 'python-mode-hook 'jedi:setup)
- (setq jedi:environment-virtualenv nil)
- (setq jedi:complete-on-dot t)
- (setq-local flycheck-python-pylint-executable "python3")
- (global-eldoc-mode t)
- (setq create-lockfiles nil)
- (provide '.emacs)
- ;;; .emacs ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement