Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My init.el file.
; search path
(let ((default-directory "~/.emacs.d/"))
(normal-top-level-add-subdirs-to-load-path))
; MELPA
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
; save desktop
(desktop-save-mode 1)
; indentation
(setq-default indent-tabs-mode nil)
(setq ruby-deep-indent-paren nil)
; line numbers
; (require 'nlinum)
(global-linum-mode 1)
; auto-complete
(require 'auto-complete-config)
(ac-config-default)
(setq ac-delay 0.7)
; css-mode
(setq-default css-indent-offset 2)
; sass-mode
(autoload 'scss-mode "scss-mode")
(add-to-list 'auto-mode-alist '("\\.scss\\'" . css-mode))
(setq scss-compile-at-save nil)
; web-mode
(add-to-list 'load-path "~/.emacs.d/")
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(setq web-mode-markup-indent-offset 2)
;;; yasnippet and web-mode are incompatible
(add-hook 'web-mode-hook (lambda()
(setq yas-dont-activate t)))
(add-to-list 'auto-mode-alist '("\\.mahtml\\'" . web-mode))
(setq web-mode-engines-alist
'(("erb" . "\\.mahtml\\'")))
; use ruby-mode for DSLs
(setq auto-mode-alist (cons '("\\.rabl$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\Gemfile$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\Gemfile.lock$" . ruby-mode) auto-mode-alist))
; auto-indent
(electric-indent-mode 1)
(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))))))
(defadvice kill-line (before check-position activate)
(if (member major-mode
'(emacs-lisp-mode scheme-mode lisp-mode
c-mode c++-mode objc-mode
latex-mode plain-tex-mode))
(if (and (eolp) (not (bolp)))
(progn (forward-char 1)
(just-one-space 0)
(backward-char 1)))))
; speedbar
;(speedbar t)
;(require 'speedbar)
; (defconst my-speedbar-buffer-name "SPEEDBAR")
; ; (defconst my-speedbar-buffer-name " SPEEDBAR") ; try this if you get "Wrong type argument: stringp, nil"
; (defun my-speedbar-no-separate-frame ()
; (interactive)
; (when (not (buffer-live-p speedbar-buffer))
; (setq speedbar-buffer (get-buffer-create my-speedbar-buffer-name)
; speedbar-frame (selected-frame)
; dframe-attached-frame (selected-frame)
; speedbar-select-frame-method 'attached
; speedbar-verbosity-level 0
; speedbar-last-selected-file nil)
; (set-buffer speedbar-buffer)
; (speedbar-mode)
; (speedbar-reconfigure-keymaps)
; (speedbar-update-contents)
; (speedbar-set-timer 1)
; (make-local-hook 'kill-buffer-hook)
; (add-hook 'kill-buffer-hook
; (lambda () (when (eq (current-buffer) speedbar-buffer)
; (setq speedbar-frame nil
; dframe-attached-frame nil
; speedbar-buffer nil)
; (speedbar-set-timer nil)))))
; (set-window-buffer (selected-window)
; (get-buffer my-speedbar-buffer-name)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.