Aggiunta configurazione per Erlang e Clojure
This commit is contained in:
98
.emacs.rc/clojure-rc.el
Normal file
98
.emacs.rc/clojure-rc.el
Normal file
@@ -0,0 +1,98 @@
|
||||
;;;;
|
||||
;; Clojure
|
||||
;;;;
|
||||
|
||||
;; Enable paredit for Clojure
|
||||
(add-hook 'clojure-mode-hook 'enable-paredit-mode)
|
||||
|
||||
;; This is useful for working with camel-case tokens, like names of
|
||||
;; Java classes (e.g. JavaClassName)
|
||||
(add-hook 'clojure-mode-hook 'subword-mode)
|
||||
|
||||
;; A little more syntax highlighting
|
||||
(require 'clojure-mode-extra-font-locking)
|
||||
|
||||
;; syntax hilighting for midje
|
||||
(add-hook 'clojure-mode-hook
|
||||
(lambda ()
|
||||
(setq inferior-lisp-program "lein repl")
|
||||
(font-lock-add-keywords
|
||||
nil
|
||||
'(("(\\(facts?\\)"
|
||||
(1 font-lock-keyword-face))
|
||||
("(\\(background?\\)"
|
||||
(1 font-lock-keyword-face))))
|
||||
(define-clojure-indent (fact 1))
|
||||
(define-clojure-indent (facts 1))
|
||||
(rainbow-delimiters-mode)))
|
||||
|
||||
;;;;
|
||||
;; Cider
|
||||
;;;;
|
||||
|
||||
;; provides minibuffer documentation for the code you're typing into the repl
|
||||
(add-hook 'cider-mode-hook 'eldoc-mode)
|
||||
|
||||
;; go right to the REPL buffer when it's finished connecting
|
||||
(setq cider-repl-pop-to-buffer-on-connect t)
|
||||
|
||||
;; When there's a cider error, show its buffer and switch to it
|
||||
(setq cider-show-error-buffer t)
|
||||
(setq cider-auto-select-error-buffer t)
|
||||
|
||||
;; Where to store the cider history.
|
||||
(setq cider-repl-history-file "~/.emacs.d/cider-history")
|
||||
|
||||
;; Wrap when navigating history.
|
||||
(setq cider-repl-wrap-history t)
|
||||
|
||||
;; enable paredit in your REPL
|
||||
(add-hook 'cider-repl-mode-hook 'paredit-mode)
|
||||
|
||||
;; Use clojure mode for other extensions
|
||||
(add-to-list 'auto-mode-alist '("\\.edn$" . clojure-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.boot$" . clojure-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.cljs.*$" . clojure-mode))
|
||||
(add-to-list 'auto-mode-alist '("lein-env" . enh-ruby-mode))
|
||||
|
||||
|
||||
;; key bindings
|
||||
;; these help me out with the way I usually develop web apps
|
||||
(defun cider-start-http-server ()
|
||||
(interactive)
|
||||
(cider-load-current-buffer)
|
||||
(let ((ns (cider-current-ns)))
|
||||
(cider-repl-set-ns ns)
|
||||
(cider-interactive-eval (format "(println '(def server (%s/start))) (println 'server)" ns))
|
||||
(cider-interactive-eval (format "(def server (%s/start)) (println server)" ns))))
|
||||
|
||||
|
||||
(defun cider-refresh ()
|
||||
(interactive)
|
||||
(cider-interactive-eval (format "(user/reset)")))
|
||||
|
||||
(defun cider-user-ns ()
|
||||
(interactive)
|
||||
(cider-repl-set-ns "user"))
|
||||
|
||||
(eval-after-load 'cider
|
||||
'(progn
|
||||
(define-key clojure-mode-map (kbd "C-c C-v") 'cider-start-http-server)
|
||||
(define-key clojure-mode-map (kbd "C-M-r") 'cider-refresh)
|
||||
(define-key clojure-mode-map (kbd "C-c u") 'cider-user-ns)
|
||||
(define-key cider-mode-map (kbd "C-c u") 'cider-user-ns)))
|
||||
|
||||
;; Customizations relating to editing a buffer.
|
||||
|
||||
;; Key binding to use "hippie expand" for text autocompletion
|
||||
;; http://www.emacswiki.org/emacs/HippieExpand
|
||||
(global-set-key (kbd "M-/") 'hippie-expand)
|
||||
|
||||
;; Lisp-friendly hippie expand
|
||||
(setq hippie-expand-try-functions-list
|
||||
'(try-expand-dabbrev
|
||||
try-expand-dabbrev-all-buffers
|
||||
try-expand-dabbrev-from-kill
|
||||
try-complete-lisp-symbol-partially
|
||||
try-complete-lisp-symbol))
|
||||
|
||||
@@ -3,3 +3,19 @@
|
||||
(local-set-key (kbd "C-c C-j")
|
||||
(quote eval-print-last-sexp))))
|
||||
(add-to-list 'auto-mode-alist '("Cask" . emacs-lisp-mode))
|
||||
|
||||
;; Automatically load paredit when editing a lisp file
|
||||
;; More at http://www.emacswiki.org/emacs/ParEdit
|
||||
(autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
|
||||
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
|
||||
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
|
||||
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
|
||||
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
|
||||
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
|
||||
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
|
||||
|
||||
;; eldoc-mode shows documentation in the minibuffer when writing code
|
||||
;; http://www.emacswiki.org/emacs/ElDoc
|
||||
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
|
||||
(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
|
||||
(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
|
||||
|
||||
42
.emacs.rc/erlang-rc.el
Normal file
42
.emacs.rc/erlang-rc.el
Normal file
@@ -0,0 +1,42 @@
|
||||
(use-package ivy-erlang-complete
|
||||
:ensure t)
|
||||
|
||||
(use-package flycheck
|
||||
:ensure t
|
||||
:delight
|
||||
:config (global-flycheck-mode))
|
||||
|
||||
(use-package hydra
|
||||
:defer 2
|
||||
:bind ("C-c f" . hydra-flycheck/body))
|
||||
|
||||
(defhydra hydra-flycheck (:color blue)
|
||||
"
|
||||
^
|
||||
^Errors^
|
||||
^──────^
|
||||
_<_ previous
|
||||
_>_ next
|
||||
_l_ list
|
||||
_q_ quit
|
||||
^^
|
||||
"
|
||||
("q" nil)
|
||||
("<" flycheck-previous-error :color pink)
|
||||
(">" flycheck-next-error :color pink)
|
||||
("l" flycheck-list-errors))
|
||||
|
||||
(use-package erlang
|
||||
:load-path ("/usr/lib/erlang/lib/tools-3.3/emacs/")
|
||||
:mode (("\\.erl?$" . erlang-mode)
|
||||
("rebar\\.config$" . erlang-mode)
|
||||
("relx\\.config$" . erlang-mode)
|
||||
("sys\\.config\\.src$" . erlang-mode)
|
||||
("sys\\.config$" . erlang-mode)
|
||||
("\\.config\\.src?$" . erlang-mode)
|
||||
("\\.config\\.script?$" . erlang-mode)
|
||||
("\\.hrl?$" . erlang-mode)
|
||||
("\\.app?$" . erlang-mode)
|
||||
("\\.app.src?$" . erlang-mode)
|
||||
("\\Emakefile" . erlang-mode)))
|
||||
|
||||
@@ -132,7 +132,18 @@ This command does the inverse of `fill-paragraph'."
|
||||
(setq x-alt-keysym 'meta)
|
||||
|
||||
(setq confirm-kill-emacs 'y-or-n-p)
|
||||
;; Changes all yes/no questions to y/n type
|
||||
(fset 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
;; shell scripts
|
||||
(setq-default sh-basic-offset 2)
|
||||
(setq-default sh-indentation 2)
|
||||
|
||||
;; No need for ~ files when editing
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
;; Go straight to scratch buffer on startup
|
||||
(setq inhibit-startup-message t)
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
@@ -143,3 +154,4 @@ This command does the inverse of `fill-paragraph'."
|
||||
|
||||
|
||||
(server-start)
|
||||
|
||||
|
||||
6
.emacs.rc/shell-integration-rc.el
Normal file
6
.emacs.rc/shell-integration-rc.el
Normal file
@@ -0,0 +1,6 @@
|
||||
;; Sets up exec-path-from shell
|
||||
;; https://github.com/purcell/exec-path-from-shell
|
||||
(when (memq window-system '(mac ns))
|
||||
(exec-path-from-shell-initialize)
|
||||
(exec-path-from-shell-copy-envs
|
||||
'("PATH")))
|
||||
Reference in New Issue
Block a user