Skip to content

Instantly share code, notes, and snippets.

@asenchi
Created April 14, 2014 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asenchi/10611704 to your computer and use it in GitHub Desktop.
Save asenchi/10611704 to your computer and use it in GitHub Desktop.
Basic Emacs init.el
(defun set-exec-path-from-shell-PATH ()
(let ((path-from-shell (shell-command-to-string "$SHELL -i -c 'echo $PATH'")))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator))))
(when window-system (set-exec-path-from-shell-PATH))
(require 'cl)
(require 'package)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(defvar my-packages
'(starter-kit
starter-kit-lisp
starter-kit-bindings
starter-kit-eshell
clojure-mode
clojure-test-mode
cider))
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
(require 'ido)
(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(setq ibuffer-expert t)
(setq inhibit-startup-message t)
(menu-bar-mode 1)
(display-time)
(if window-system
(tool-bar-mode -1))
(show-paren-mode t)
(column-number-mode t)
(setq show-trailing-whitespace t)
(setq insert-time-string-default-format "iso-8601-date")
(setq-default truncate-lines t)
(setq echo-keystrokes 0.1)
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(setq x-select-enable-clipboard t)
(global-auto-revert-mode 1)
(setq global-auto-revert-non-file-buffers t)
(setq auto-revert-verbose nil)
(dolist (command '(yank yank-pop))
(eval `(defadvice ,command (after indent-region activate)
(and (not current-prefix-arg)
(member major-mode '(emacs-lisp-mode lisp-mode
clojure-mode scheme-mode
haskell-mode ruby-mode
rspec-mode python-mode
c-mode c++-mode
objc-mode latex-mode
plain-tex-mode))
(let ((mark-even-if-inactive transient-mark-mode))
(indent-region (region-beginning) (region-end) nil))))))
(require 'recentf)
(recentf-mode t)
(setq recentf-max-saved-items 50)
(defun ido-recentf-open ()
"Use `ido-completing-read' to \\[find-file] a recent file"
(interactive)
(if (find-file
(ido-completing-read
"Find recent file: "
(mapcar (lambda (path)
(replace-regexp-in-string (getenv "HOME") "~" path))
recentf-list)))
(message "Opening file...")
(message "Aborting")))
(global-set-key (kbd "C-x C-r") 'ido-recentf-open)
(global-set-key (kbd "C-x C-k") 'kill-region)
(global-set-key (kbd "M-g") 'goto-line)
(server-start)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment