Hide the scroll bar.
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode -1))
Hide the tool bar.
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
Hide the menu bar.
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
Add UTF8 at the front of the priority list for automatic detection.
(prefer-coding-system 'utf-8)
Set up multilingual environment to use UTF-8.
(set-language-environment "UTF-8")
Set default value of various coding systems to UTF-8.
(set-default-coding-systems 'utf-8)
(set-frame-parameter (selected-frame) 'alpha '(85 50))
(add-to-list 'default-frame-alist '(alpha 85 50))
Set location of custom file.
(setq custom-file (expand-file-name "~/.emacs.d/custom.el"))
Load custom file.
(load custom-file)
Bootstrap use-package.
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
Report details about loading and configuration.
(setq use-package-verbose t)
(use-package cask
:disabled
:ensure t)
Load a file only if it exists.
(defun load-if-exists (file)
"Load `file` if it exists."
(when (file-exists-p file)
(load file)))
Indent the whole buffer.
(defun indent-buffer ()
"Indent the whole buffer."
(interactive)
(indent-region (point-min) (point-max)))
Remove all tabs from the current buffer.
(defun untabify-buffer ()
"Remove all tabs from the current buffer."
(interactive)
(untabify (point-min) (point-max)))
Cleanup the current buffer.
(defun cleanup-buffer ()
"Cleanup the current buffer."
(interactive)
(indent-buffer)
(delete-trailing-whitespace))
Find file as root.
(defun sudo-edit (&optional arg)
(interactive "p")
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: ")))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
Swap two buffers.
(defun swap-buffers ()
"Swap your buffers."
(interactive)
(cond ((not (> (count-windows)1))
(message "You can't rotate a single window!"))
(t
(setq i 1)
(setq numWindows (count-windows))
(while (< i numWindows)
(let* ((w1 (elt (window-list) i))
(w2 (elt (window-list) (+ (% i numWindows) 1)))
(b1 (window-buffer w1))
(b2 (window-buffer w2))
(s1 (window-start w1))
(s2 (window-start w2)))
(set-window-buffer w1 b2)
(set-window-buffer w2 b1)
(set-window-start w1 s2)
(set-window-start w2 s1)
(setq i (1+ i)))))))
Rotate two buffers.
(defun rotate-buffers ()
"Rotate your buffers."
(interactive)
(if (= (count-windows) 2)
(let* ((this-win-buffer (window-buffer))
(next-win-buffer (window-buffer (next-window)))
(this-win-edges (window-edges (selected-window)))
(next-win-edges (window-edges (next-window)))
(this-win-2nd (not (and (<= (car this-win-edges)
(car next-win-edges))
(<= (cadr this-win-edges)
(cadr next-win-edges)))))
(splitter
(if (= (car this-win-edges)
(car (window-edges (next-window))))
'split-window-horizontally
'split-window-vertically)))
(delete-other-windows)
(let ((first-win (selected-window)))
(funcall splitter)
(if this-win-2nd (other-window 1))
(set-window-buffer (selected-window) this-win-buffer)
(set-window-buffer (next-window) next-win-buffer)
(select-window first-win)
(if this-win-2nd (other-window 1))))))
Show the face found at the current point.
(defun what-face (pos)
"Show the face found at the current point."
(interactive "d")
(let ((face (or (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
Reload the ~/.Xresources configuration.
(defun xresources ()
"Reload the ~/.Xresources configuration."
(interactive)
(shell-command "xrdb -merge ~/.Xresources ")
(message "X resources reloaded."))
Insert a Clojure UUID.
(defun insert-clj-uuid (n)
"Insert a Clojure UUID tagged literal in the form of #uuid
\"11111111-1111-1111-1111-111111111111\". The prefix argument N
specifies the padding used."
(interactive "P")
(let ((n (or n 1)))
(if (or (< n 0) (> n 9))
(error "Argument N must be between 0 and 9."))
(let ((n (string-to-char (number-to-string n))))
(insert
(format "#uuid \"%s-%s-%s-%s-%s\""
(make-string 8 n)
(make-string 4 n)
(make-string 4 n)
(make-string 4 n)
(make-string 12 n))))))
(use-package color-theme
:ensure t
:load-path "~/workspace/emacs-color-theme-solarized"
:init
(require 'color-theme-solarized)
(load-theme 'solarized-dark t))
Make Emacs use the $PATH set up by the user’s shell.
(use-package exec-path-from-shell
:ensure t
:init (exec-path-from-shell-initialize))
This variable describes the behavior of the command key.
(setq mac-option-key-is-meta t)
(setq mac-right-option-modifier nil)
(use-package aggressive-indent
:ensure t
:disabled t
:init
(add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)
(add-hook 'clojure-mode-hook #'aggressive-indent-mode))
(use-package avy
:ensure t
:bind (("M-j" . avy-goto-char-2)
:map isearch-mode-map
("C-'" . avy-search)))
(use-package auto-dictionary
:ensure t
:init (add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
Enable appointments.
(appt-activate 1)
Display minutes to appointment and time on the mode line.
(setq appt-display-mode-line t)
(use-package find-file-in-project
:ensure t
:init
(setq ffip-prefer-ido-mode t))
(use-package ein
:ensure t
:commands (ein:notebooklist-open))
(use-package elpy
:ensure t
:disabled
:init
(with-eval-after-load 'python
(elpy-enable)
(elpy-use-ipython)
(delete 'elpy-module-highlight-indentation elpy-modules)))
(use-package clojure-mode
:ensure t
:mode (("\\.edn$" . clojure-mode)
("\\.cljs$" . clojurescript-mode)
("\\.cljx$" . clojurex-mode)
("\\.cljc$" . clojurec-mode))
:config
(add-hook 'clojure-mode-hook #'subword-mode)
(add-hook 'clojure-mode-hook #'paredit-mode)
(define-clojure-indent
(time! 1)
(fdef 1)
;; cljs.test
(async 1)
;; om-tools
(defcomponent 'defun)
(did-mount 1)
(did-update 1)
(will-unmount 1)
(init-state 1)
(render 1)
(will-mount 1)
(will-receive-props 1)
(will-update 1)
(should-update 1)
;; ClojureScript
(this-as 1)
;; COMPOJURE
(ANY 2)
(DELETE 2)
(GET 2)
(HEAD 2)
(POST 2)
(PUT 2)
(context 2)
;; ALGO.MONADS
(domonad 1)
;; Om.next
(defui '(1 nil nil (1)))
;; CUSTOM
(api-test 1)
(web-test 1)
(database-test 1)
(defroutes 'defun)
(assoc-some 1))
(put 'defmixin 'clojure-backtracking-indent '(4 (2))))
(use-package clojure-mode-extra-font-locking
:ensure t)
(use-package cider
:commands (cider-jack-in cider-jack-in-clojurescript)
:ensure t
;; :pin "melpa-stable"
:config
;; Enable eldoc in Clojure buffers
(add-hook 'cider-mode-hook #'eldoc-mode)
;; Pretty print in the REPL.
(setq cider-repl-use-pretty-printing t)
;; Hide *nrepl-connection* and *nrepl-server* buffers from appearing
;; in some buffer switching commands like switch-to-buffer
(setq nrepl-hide-special-buffers nil)
;; Enabling CamelCase support for editing commands(like forward-word,
;; backward-word, etc) in the REPL is quite useful since we often have
;; to deal with Java class and method names. The built-in Emacs minor
;; mode subword-mode provides such functionality
(add-hook 'cider-repl-mode-hook #'subword-mode)
;; The use of paredit when editing Clojure (or any other Lisp) code is
;; highly recommended. You're probably using it already in your
;; clojure-mode buffers (if you're not you probably should). You might
;; also want to enable paredit in the REPL buffer as well.
(add-hook 'cider-repl-mode-hook #'paredit-mode)
;; Auto-select the error buffer when it's displayed:
(setq cider-auto-select-error-buffer t)
;; Controls whether to pop to the REPL buffer on connect.
(setq cider-repl-pop-to-buffer-on-connect nil)
;; Controls whether to auto-select the error popup buffer.
(setq cider-auto-select-error-buffer t)
;; T to wrap history around when the end is reached.
(setq cider-repl-wrap-history t)
;; Don't log protocol messages to the `nrepl-message-buffer-name' buffer.
(setq nrepl-log-messages nil)
;; Don't show the `*cider-test-report*` buffer on passing tests.
(setq cider-test-report-on-success nil))
(use-package clj-refactor
:ensure t
:init
(defun enable-clj-refactor-mode ()
(clj-refactor-mode 1)
(cljr-add-keybindings-with-prefix "C-c C-R"))
(add-hook 'clojure-mode-hook 'enable-clj-refactor-mode)
;; Don't use prefix notation when cleaning the ns form.
(setq cljr-favor-prefix-notation nil)
(setq cljr--debug-mode t))
(use-package graphql-mode
:ensure t
:init
(setq graphql-url "http://localhost:7000/graphql"))
Enable company mode.
(use-package company
:ensure t
:bind ("TAB" . indent-or-complete)
:defer 1
:init (global-company-mode))
Indent with TAB, then do completion.
(defun indent-or-complete ()
"Indent or complete via company-mode."
(interactive)
(if (looking-at "\\_>")
(company-complete-common)
(indent-according-to-mode)))
(use-package company-quickhelp
:ensure t
:defer 1
:init (company-quickhelp-mode 1))
(setq user-full-name "Roman Scherer")
(defface paren-face
'((((class color) (background dark))
(:foreground "grey20"))
(((class color) (background light))
(:foreground "grey80")))
"Face used to dim parentheses.")
(defun dim-parens ()
(font-lock-add-keywords nil '(("(\\|)" . 'paren-face))))
(add-hook 'clojure-mode-hook 'dim-parens)
(add-hook 'emacs-lisp-mode-hook 'dim-parens)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
Use the Inconsolata font.
(defun inconsolata ()
"Set the default font to Inconsolata."
(interactive)
(set-default-font "Inconsolata 14"))
Reload files when they change on disk.
(global-auto-revert-mode 1)
(use-package inf-hy
:commands (inf-hy inf-hy-minor-mode)
:load-path ("~/workspace/inf-hy")
:init
(add-hook 'hy-mode-hook 'inf-hy-minor-mode))
(use-package helm
:ensure t
:bind (("M-x" . helm-M-x)
("C-x b" . helm-buffers-list)
("C-x f" . helm-find-files)
("C-x r b" . helm-bookmarks))
:config
(require 'helm-config)
(helm-mode 1)
;; Globally enable fuzzy matching for helm-mode.
(setq helm-mode-fuzzy-match t)
(setq helm-completion-in-region-fuzzy-match t)
(setq helm-M-x-fuzzy-match t)
(setq helm-buffers-fuzzy-matching t)
(setq helm-recentf-fuzzy-match t)
(global-set-key [remap execute-extended-command] #'helm-smex)
(global-set-key (kbd "M-X") #'helm-smex-major-mode-commands)
;; Disable Helm in the following functions.
;; See: https://github.com/emacs-helm/helm/wiki#customize-helm-mode
(setq helm-completing-read-handlers-alist
'((find-file-read-only . ido)
(magit-gitignore . nil)
(rename-file . ido)))
;; Enter directories with RET, same as ido
;; http://emacs.stackexchange.com/questions/3798/how-do-i-make-pressing-ret-in-helm-find-files-open-the-directory/7896#7896
(defun helm-find-files-navigate-forward (orig-fun &rest args)
(if (file-directory-p (helm-get-selection))
(apply orig-fun args)
(helm-maybe-exit-minibuffer)))
(advice-add 'helm-execute-persistent-action :around #'helm-find-files-navigate-forward)
(with-eval-after-load 'helm-files
(define-key helm-find-files-map (kbd "<return>") 'helm-execute-persistent-action))
;; Don't show "." and ".." directories when finding files.
;; https://github.com/hatschipuh/better-helm
(with-eval-after-load 'helm-files
(advice-add 'helm-ff-filter-candidate-one-by-one
:before-while 'no-dots-display-file-p))
(defvar no-dots-whitelist nil
"List of helm buffers in which to show dots.")
(defun no-dots-in-white-listed-helm-buffer-p ()
(member helm-buffer no-dots-whitelist))
(defun no-dots-display-file-p (file)
;; in a whitelisted buffer display the file regardless of its name
(or (no-dots-in-white-listed-helm-buffer-p)
;; not in a whitelisted buffer display all files
;; which does not end with /. /..
(not (string-match "\\(?:/\\|\\`\\)\\.\\{1,2\\}\\'" file)))))
(use-package helm-projectile
:ensure t
:init (helm-projectile-on))
(use-package hy-mode
:ensure t
:mode (("\\.hy$" . hy-mode))
:config
(add-hook 'hy-mode-hook 'paredit-mode)
(setq hy-indent-specform
'(("for" . 1)
("for*" . 1)
("while" . 1)
("except" . 1)
("catch" . 1)
("let" . 1)
("if" . 1)
("when" . 1)
("unless" . 1)
("test-set" . 1)
("test-set-fails" . 1))))
Put all backup files in a separate directory.
(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
Copy all files, don’t rename them.
(setq backup-by-copying t)
Make backups for files under version control as well.
(setq vc-make-backup-files nil)
If t, delete excess backup versions silently.
(setq delete-old-versions t)
Number of newest versions to keep when a new numbered backup is made.
(setq kept-new-versions 10)
Number of oldest versions to keep when a new numbered backup is made.
(setq kept-old-versions 0)
Make numeric backup versions unconditionally.
(setq version-control t)
Disable all version control to speed up file saving.
(setq vc-handled-backends nil)
Increase the number of messages in the Messages buffer.
(setq message-log-max 10000)
Answer questions with “y” or “n”.
(defalias 'yes-or-no-p 'y-or-n-p)
Highlight matching parentheses when the point is on them.
(show-paren-mode 1)
Enter debugger if an error is signaled?
(setq debug-on-error nil)
Don’t show startup message.
(setq inhibit-startup-message t)
Toggle column number display in the mode line.
(column-number-mode)
Enable display of time, load level, and mail flag in mode lines.
(display-time)
Whether to add a newline automatically at the end of the file.
(setq require-final-newline t)
Highlight trailing whitespace.
(setq show-trailing-whitespace t)
Controls the operation of the TAB key.
(setq tab-always-indent 'complete)
The maximum size in lines for term buffers.
(setq term-buffer-maximum-size (* 10 2048))
Use Chromium as default browser.
(setq browse-url-browser-function 'browse-url-chromium)
Clickable URLs.
(define-globalized-minor-mode global-goto-address-mode goto-address-mode goto-address-mode)
(global-goto-address-mode)
Set the name of file from which to read abbrevs.
(setq abbrev-file-name "~/.emacs.d/abbrev_defs")
Silently save word abbrevs too when files are saved.
(setq save-abbrevs 'silently)
Auto scroll compilation buffer.
(setq compilation-scroll-output 't)
Enable colors in compilation mode. http://stackoverflow.com/questions/3072648/cucumbers-ansi-colors-messing-up-emacs-compilation-buffer
(defun colorize-compilation-buffer ()
(toggle-read-only)
(ansi-color-apply-on-region (point-min) (point-max))
(toggle-read-only))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
Auto compile ClojureScript.
(defun lein-cljsbuild ()
(interactive)
(compile "lein clean; lein cljsbuild auto"))
Start a Rhino REPL.
(defun lein-rhino-repl ()
"Start a Rhino repl via Leiningen."
(interactive)
(run-lisp "lein trampoline cljsbuild repl-rhino"))
Start a Node.js REPL.
(defun lein-node-repl ()
"Start a NodeJS repl via Leiningen."
(interactive)
(run-lisp "lein trampoline noderepl"))
(use-package css-mode
:ensure t
:mode ("\\.css\\'" . css-mode)
:config (setq css-indent-offset 2))
(use-package scss-mode
:ensure t
:mode (("\\.sass\\'" . scss-mode)
("\\.scss\\'" . scss-mode))
:config (setq scss-compile-at-save nil))
Always save desktop.
(setq desktop-save t)
Load desktop even if it is locked.
(setq desktop-load-locked-desktop t)
Number of buffers to restore immediately.
(setq desktop-restore-eager 4)
Don’t save some buffers.
(setq desktop-buffers-not-to-save
(concat "\\("
"\\.bbdb|\\.gz"
"\\)$"))
Enable desktop save mode.
(desktop-save-mode 1)
Don’t save certain modes..
(add-to-list 'desktop-modes-not-to-save 'Info-mode)
(add-to-list 'desktop-modes-not-to-save 'dired-mode)
(add-to-list 'desktop-modes-not-to-save 'fundamental-mode)
(add-to-list 'desktop-modes-not-to-save 'info-lookup-mode)
Use Steel Bank Common Lisp (SBCL) as inferior-lisp-program.
(setq inferior-lisp-program "sbcl")
Switches passed to `ls’ for Dired. MUST contain the `l’ option.
(setq dired-listing-switches "-alh")
Try to guess a default target directory.
(setq dired-dwim-target t)
Find Clojure files in dired mode.
(defun find-dired-clojure (dir)
"Run find-dired on Clojure files."
(interactive (list (read-directory-name "Run find (Clojure) in directory: " nil "" t)))
(find-dired dir "-name \"*.clj\""))
Find Ruby files in dired mode.
(defun find-dired-ruby (dir)
"Run find-dired on Ruby files."
(interactive (list (read-directory-name "Run find (Ruby) in directory: " nil "" t)))
(find-dired dir "-name \"*.rb\""))
User-defined alist of rules for suggested commands.
(setq dired-guess-shell-alist-user
'(("\\.mp4$" "mplayer")
("\\.mkv$" "mplayer")
("\\.mov$" "mplayer")
("\\.pdf$" "evince")
("\\.xlsx?$" "libreoffice")))
Run shell command in background.
(defun dired-do-shell-command-in-background (command)
"In dired, do shell command in background on the file or directory named on
this line."
(interactive
(list (dired-read-shell-command (concat "& on " "%s: ") nil (list (dired-get-filename)))))
(call-process command nil 0 nil (dired-get-filename)))
(add-hook 'dired-load-hook
(lambda ()
(load "dired-x")
(define-key dired-mode-map "&" 'dired-do-shell-command-in-background)))
Electric Pair mode, a global minor mode, provides a way to easily insert matching delimiters. Whenever you insert an opening delimiter, the matching closing delimiter is automatically inserted as well, leaving point between the two.
(electric-pair-mode t)
(use-package engine-mode
:ensure t
:commands (engine/search-github engine/search-google)
:config
(engine-mode t)
(defengine github
"https://github.com/search?ref=simplesearch&q=%s")
(defengine google
"http://www.google.com/search?ie=utf-8&oe=utf-8&q=%s"
:keybinding "g"))
Unequivocally turn on ElDoc mode.
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
Auto load files.
(add-to-list 'auto-mode-alist '("Cask" . emacs-lisp-mode))
Key bindings.
(let ((mode emacs-lisp-mode-map))
(define-key mode (kbd "C-c m") 'macrostep-expand)
(define-key mode (kbd "C-c e E") 'elint-current-buffer)
(define-key mode (kbd "C-c e c") 'cancel-debug-on-entry)
(define-key mode (kbd "C-c e d") 'debug-on-entry)
(define-key mode (kbd "C-c e e") 'toggle-debug-on-error)
(define-key mode (kbd "C-c e f") 'emacs-lisp-byte-compile-and-load)
(define-key mode (kbd "C-c e l") 'find-library)
(define-key mode (kbd "C-c e r") 'eval-region)
(define-key mode (kbd "C-c C-k") 'eval-buffer)
(define-key mode (kbd "C-c ,") 'ert)
(define-key mode (kbd "C-c C-,") 'ert))
(use-package elisp-slime-nav
:ensure t
:init
(add-hook 'emacs-lisp-mode-hook 'elisp-slime-nav-mode))
Start the Emacs server if it’s not running.
(use-package server
:ensure t
:if window-system
:init
(require 'server)
(unless (server-running-p)
(add-hook 'after-init-hook 'server-start t)))
(use-package emms
:ensure t
:defer 1
:init
(progn
(emms-all)
(emms-default-players)
(add-to-list 'emms-player-list 'emms-player-mpd)
(condition-case nil
(emms-player-mpd-connect)
(error (message "Can't connect to music player daemon.")))
(setq emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find)
(setq emms-player-mpd-music-directory (expand-file-name "~/Music"))
(load-if-exists "~/.emms.el")
(add-to-list 'emms-stream-default-list
'("SomaFM: Space Station" "http://www.somafm.com/spacestation.pls" 1 streamlist))))
(use-package expand-region
:ensure t
:bind (("C-c C-+" . er/expand-region)
("C-c C--" . er/contract-region)))
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
(use-package flycheck-flow
:ensure t
:init (add-hook 'javascript-mode-hook 'flycheck-mode))
Enable flyspell in text mode.
(defun enable-flyspell-mode ()
"Enable Flyspell mode."
(flyspell-mode 1))
(dolist (hook '(text-mode-hook))
(add-hook hook 'enable-flyspell-mode))
Enable flyspell in programming mode.
(defun enable-flyspell-prog-mode ()
"Enable Flyspell Programming mode."
(flyspell-prog-mode))
(dolist (hook '(prog-mode-hook))
(add-hook hook 'enable-flyspell-prog-mode))
Don’t print messages when checking words.
(setq flyspell-issue-message-flag nil)
(use-package github-browse-file
:ensure t
:commands (github-browse-file github-browse-file-blame))
Write mail with Gnus.
(setq mail-user-agent 'gnus-user-agent)
The gnus-select-method variable says where Gnus should look for news. This variable should be a list where the first element says how and the second element says where. This method is your native method. All groups not fetched with this method are secondary or foreign groups.
(setq gnus-select-method
'(nnimap "gmail"
(nnimap-address "imap.gmail.com")
(nnimap-server-port 993)
(nnimap-stream ssl)))
All Gmail system labels have a prefix [Gmail], which matches the default value of gnus-ignored-newsgroups. A workaround is to redefine it as follows.
(setq gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")
An integer that says how verbose Gnus should be. The higher the number, the more messages Gnus will flash to say what it’s doing. At zero, Gnus will be totally mute; at five, Gnus will display most important messages; and at ten, Gnus will keep on jabbering all the time.
(setq gnus-verbose 10)
Require the Gnus demon.
(require 'gnus-demon)
Add daemonic server disconnection to Gnus.
(gnus-demon-add-disconnection)
Add daemonic scanning of mail from the mail backends.
(gnus-demon-add-scanmail)
Add daemonic nntp server disconnection to Gnus. If no commands have gone out via nntp during the last five minutes, the connection is closed.
(gnus-demon-add-nntp-close-connection)
Automatically switch to merged work directories during file name input.
(setq ido-auto-merge-work-directories-length nil)
Always create new buffer if no buffer matches substring.
(setq ido-create-new-buffer 'always)
Enable flexible string matching.
(setq ido-enable-flex-matching t)
(setq ido-enable-prefix nil)
(setq ido-handle-duplicate-virtual-buffers 2)
(setq ido-max-prospects 10)
(setq ido-use-filename-at-point 'guess)
(setq ido-use-virtual-buffers t)
Enable ido mode.
(ido-mode)
(use-package ido-vertical-mode
:ensure t
:init
(ido-vertical-mode)
(setq ido-vertical-define-keys 'C-n-and-C-p-only))
(use-package flx-ido
:ensure t
:init
(flx-ido-mode 1)
;; disable ido faces to see flx highlights.
(setq ido-use-faces nil)
(setq gc-cons-threshold 20000000))
(use-package magit
:ensure t
:bind (("C-x C-g s" . magit-status))
:config
(setq magit-last-seen-setup-instructions "1.4.0")
(setq magit-completing-read-function 'magit-ido-completing-read)
(setq magit-stage-all-confirm nil)
(setq magit-unstage-all-confirm nil)
(setq ediff-window-setup-function 'ediff-setup-windows-plain))
Indent Java annotations. See http://lists.gnu.org/archive/html/help-gnu-emacs/2011-04/msg00262.html
(add-hook
'java-mode-hook
'(lambda ()
(setq c-comment-start-regexp "\\(@\\|/\\(/\\|[*][*]?\\)\\)")
(modify-syntax-entry ?@ "< b" java-mode-syntax-table)))
Number of spaces for each indentation step in `js-mode’.
(setq js-indent-level 2)
(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode))
(add-hook 'octave-mode-hook
(lambda ()
(abbrev-mode 1)
(auto-fill-mode 1)
(if (eq window-system 'x)
(font-lock-mode 1))))
(load-if-exists "~/.rcirc.el")
(setq rcirc-default-nick "r0man"
rcirc-default-user-name "r0man"
rcirc-default-full-name "Roman Scherer"
rcirc-server-alist '(("irc.freenode.net" :channels ("#clojure")))
rcirc-private-chat t
rcirc-debug-flag t)
(add-hook 'rcirc-mode-hook
(lambda ()
(set (make-local-variable 'scroll-conservatively) 8192)
(rcirc-track-minor-mode 1)
(flyspell-mode 1)))
My email address.
(setq user-mail-address "[email protected]")
Use message mode to send emails.
(setq mail-user-agent 'message-user-agent)
Load smtpmail
(require 'smtpmail)
Send mail via smtpmail.
(setq send-mail-function 'smtpmail-send-it)
(setq message-send-mail-function 'smtpmail-send-it)
Whether to print info in debug buffer.
(setq smtpmail-debug-info t)
The name of the host running SMTP server.
(setq smtpmail-smtp-server "smtp.gmail.com")
SMTP service port number.
(setq smtpmail-smtp-service 587)
(use-package macrostep
:ensure t
:defer 1)
(use-package markdown-mode
:ensure t
:mode ("\\.md\\'" . markdown-mode)
:config
(setq markdown-command "doctor")
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode)))
(use-package multi-term
:ensure t
:bind (("C-x M" . multi-term)
("C-x m" . switch-to-term-mode-buffer))
:config
;; (setq multi-term-dedicated-select-after-open-p t
;; multi-term-dedicated-window-height 25
;; multi-term-program "/bin/bash")
;; ;; Enable compilation-shell-minor-mode in multi term.
;; ;; http://www.masteringemacs.org/articles/2012/05/29/compiling-running-scripts-emacs/
;; ;; TODO: WTF? Turns off colors in terminal.
;; ;; (add-hook 'term-mode-hook 'compilation-shell-minor-mode)
(add-hook 'term-mode-hook
(lambda ()
(dolist
(bind '(("<S-down>" . multi-term)
("<S-left>" . multi-term-prev)
("<S-right>" . multi-term-next)
("C-<backspace>" . term-send-backward-kill-word)
("C-<delete>" . term-send-forward-kill-word)
("C-<left>" . term-send-backward-word)
("C-<right>" . term-send-forward-word)
("C-c C-j" . term-line-mode)
("C-c C-k" . term-char-mode)
("C-v" . scroll-up)
("C-y" . term-paste)
("C-z" . term-stop-subjob)
("M-DEL" . term-send-backward-kill-word)
("M-d" . term-send-forward-kill-word)))
(add-to-list 'term-bind-key-alist bind)))))
Returns the most recently used term-mode buffer.
(defun last-term-mode-buffer (list-of-buffers)
"Returns the most recently used term-mode buffer."
(when list-of-buffers
(if (eq 'term-mode (with-current-buffer (car list-of-buffers) major-mode))
(car list-of-buffers) (last-term-mode-buffer (cdr list-of-buffers)))))
Switch to the most recently used term-mode buffer, or create a new one.
(defun switch-to-term-mode-buffer ()
"Switch to the most recently used term-mode buffer, or create a
new one."
(interactive)
(let ((buffer (last-term-mode-buffer (buffer-list))))
(if (not buffer)
(multi-term)
(switch-to-buffer buffer))))
(use-package multiple-cursors
:ensure t
:defer 1)
http://www.gnu.org/software/emacs/manual/html_node/emacs/Mail-Amusements.html
(setq mail-signature
'(progn
(goto-char (point-max))
(insert "\n\n--------------------------------------------------------------------------------")
(spook)))
Save the mini buffer history.
(setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
(setq savehist-file "~/.emacs.d/savehist")
(savehist-mode 1)
The Superior Lisp Interaction Mode for Emacs
(use-package slime
:commands (slime)
:ensure t)
(defun smarter-move-beginning-of-line (arg)
"Move point back to indentation of beginning of line.
Move point to the first non-whitespace character on this line.
If point is already there, move to the beginning of the line.
Effectively toggle between the first non-whitespace character and
the beginning of the line.
If ARG is not nil or 1, move forward ARG - 1 lines first. If
point reaches the beginning or end of the buffer, stop there."
(interactive "^p")
(setq arg (or arg 1))
;; Move lines first
(when (/= arg 1)
(let ((line-move-visual nil))
(forward-line (1- arg))))
(let ((orig-point (point)))
(back-to-indentation)
(when (= orig-point (point))
(move-beginning-of-line 1))))
Remap C-a to `smarter-move-beginning-of-line’
(global-set-key [remap move-beginning-of-line]
'smarter-move-beginning-of-line)
Use 2 spaces for indentation in SQL mode.
(setq sql-indent-offset 2)
Load database connection settings.
(eval-after-load "sql"
'(load-if-exists "~/.sql.el"))
(eval-after-load "tramp"
'(progn
(tramp-set-completion-function
"ssh"
'((tramp-parse-shosts "~/.ssh/known_hosts")
(tramp-parse-hosts "/etc/hosts")))))
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
(setq uniquify-separator "|")
(setq uniquify-ignore-buffers-re "^\\*")
(setq uniquify-after-kill-buffer-p t)
(use-package org
:ensure t
:defer 1
:mode ("\\.org\\'" . org-mode)
:config
(require 'ob-clojure)
(setq org-babel-clojure-backend 'cider)
(setq org-src-fontify-natively t)
(org-babel-do-load-languages
'org-babel-load-languages
'((clojure . t)
(emacs-lisp . t)
(ruby . t)
(sh . t)
(sql . t))))
(use-package org-plus-contrib
:ensure t
:init
(require 'org-invoice))
(use-package paredit
:ensure t
:init (dolist (mode '(scheme emacs-lisp lisp clojure clojurescript))
(add-hook (intern (concat (symbol-name mode) "-mode-hook"))
'paredit-mode)))
(use-package pretty-lambdada
:ensure t
:defer 1
:init (pretty-lambda-for-modes))
(use-package projectile
:ensure t
:defer 1
:init
(add-hook 'clojure-mode-hook 'projectile-mode)
(add-hook 'ruby-mode-hook 'projectile-mode)
:bind (("C-x C-f" . projectile-find-file)))
(use-package popwin
:ensure t
:defer 1
:init
(setq display-buffer-function 'popwin:display-buffer)
(setq popwin:special-display-config
'(("*Help*" :height 30)
("*Completions*" :noselect t)
("*Messages*" :noselect t :height 30)
("*Apropos*" :noselect t :height 30)
("*Backtrace*" :height 30)
("*Messages*" :height 30)
("*Occur*" :noselect t)
("*Ido Completions*" :noselect t :height 30)
("*magit-commit*" :noselect t :height 40 :width 80 :stick t)
("*magit-diff*" :noselect t :height 40 :width 80)
("*magit-edit-log*" :noselect t :height 15 :width 80)
("\\*ansi-term\\*.*" :regexp t :height 30)
("*shell*" :height 30)
(".*overtone.log" :regexp t :height 30)
("*gists*" :height 30)
("*sldb.*":regexp t :height 30)
("*Kill Ring*" :height 30)
("*Compile-Log*" :height 30 :stick t)
("*git-gutter:diff*" :height 30 :stick t))))
(use-package ruby-mode
:ensure t
:mode (("Capfile$" . ruby-mode)
("Gemfile$" . ruby-mode)
("Guardfile$" . ruby-mode)
("Rakefile$" . ruby-mode)
("Vagrantfile$" . ruby-mode)
("\\.gemspec$" . ruby-mode)
("\\.rake$" . ruby-mode)
("\\.ru$" . ruby-mode)))
(use-package rainbow-mode
:ensure t
:defer 1)
(use-package slamhound
:ensure t
:commands (slamhound))
(use-package smooth-scrolling
:ensure t
:defer 1)
(use-package soundklaus
:ensure t
:commands
(soundklaus-activities
soundklaus-connect
soundklaus-my-favorites
soundklaus-my-playlists
soundklaus-my-tracks
soundklaus-playlists
soundklaus-tracks)
:load-path
("~/workspace/soundklaus.el"
"~/workspace/soundklaus.el/test"))
Don’t insert tabs.
(setq-default indent-tabs-mode nil)
(use-package virtualenvwrapper
:ensure t
:commands (venv-workon)
:config
(setq venv-location "~/.virtualenv"))
(use-package web-mode
:ensure t
:mode (("\\.jsx$" . web-mode)
("\\.html$" . web-mode))
:config
(setq web-mode-code-indent-offset 2
web-mode-css-indent-offset 2
web-mode-markup-indent-offset 2))
(use-package which-key
:ensure t
:defer 10
:pin "melpa-stable"
:init (which-key-mode))
(winner-mode)
(use-package yaml-mode
:ensure t
:mode (("\\.yml$" . yaml-mode)))
(use-package yasnippet
:ensure t
:disabled t
:defer 1
:init
(yas-reload-all)
(mapcar
(lambda (mode)
(add-hook mode #'yas-minor-mode))
'(clojure-mode-hook
emacs-lisp-mode
js-mode
js2-mode
lisp--interaction-mode
lisp-mode
ruby-mode
sql-mode)))
(add-hook
'after-init-hook
(lambda ()
;; Load system specific config.
(load-if-exists (concat user-emacs-directory system-name ".el"))
;; Start a terminal.
(multi-term)
;; Load keyboard bindings.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
(global-set-key (kbd "C-c C-t") 'projectile-toggle-between-implementation-and-test)
(global-set-key (kbd "C-c n") 'cleanup-buffer)
(global-set-key (kbd "C-c r") 'rotate-buffers)
(global-set-key (kbd "C-x C-b") 'list-buffers)
(global-set-key (kbd "C-x C-d") 'dired)
(global-set-key (kbd "C-x C-o") 'delete-blank-lines)
(global-set-key (kbd "C-x TAB") 'indent-rigidly)
(global-set-key (kbd "C-x ^") 'enlarge-window)
(global-set-key (kbd "C-x f") 'ido-find-file)
(global-set-key (kbd "C-x h") 'mark-whole-buffer)
(define-key lisp-mode-shared-map (kbd "RET") 'reindent-then-newline-and-indent)
(define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol)))