├── README.md ├── custom ├── 00common-setup.el └── 01ruby.el ├── emacs └── init.el /README.md: -------------------------------------------------------------------------------- 1 | # Ian's Emacs Settings 2 | 3 | I'm no Emacs expert but this is what I have. Basically here so I can centralize changes. Use at your own risk. 4 | 5 | -------------------------------------------------------------------------------- /custom/00common-setup.el: -------------------------------------------------------------------------------- 1 | (setq column-number-mode t) 2 | (setq x-select-enable-clipboard t) 3 | (setq insert-directory-program "/usr/local/bin/gls") 4 | (setq dired-listing-switches "-aBhl --group-directories-first") 5 | 6 | (require 'auto-complete-config) 7 | (add-to-list 'ac-dictionary-directories 8 | "~/.emacs.d/.cask/24.5.1/elpa/auto-complete-20150618.1949/dict") 9 | (ac-config-default) 10 | (setq ac-ignore-case nil) 11 | (add-to-list 'ac-modes 'enh-ruby-mode) 12 | (add-to-list 'ac-modes 'web-mode) 13 | 14 | (require 'tramp-term) 15 | -------------------------------------------------------------------------------- /emacs: -------------------------------------------------------------------------------- 1 | (load-file "~/.emacs.d/init.el") 2 | (custom-set-variables 3 | ;; custom-set-variables was added by Custom. 4 | ;; If you edit it by hand, you could mess it up, so be careful. 5 | ;; Your init file should contain only one such instance. 6 | ;; If there is more than one, they won't work right. 7 | '(enh-ruby-indent-level 4)) 8 | (custom-set-faces 9 | ;; custom-set-faces was added by Custom. 10 | ;; If you edit it by hand, you could mess it up, so be careful. 11 | ;; Your init file should contain only one such instance. 12 | ;; If there is more than one, they won't work right. 13 | ) 14 | -------------------------------------------------------------------------------- /init.el: -------------------------------------------------------------------------------- 1 | ;(add-to-list 'load-path "~/elisp") 2 | ;(require 'whitespace) 3 | (setq backup-directory-alist `(("." . "~/.saves"))) 4 | (setq backup-by-copying t) 5 | (setq delete-old-versions t 6 | kept-new-versions 6 7 | kept-old-versions 2 8 | version-control t) 9 | (require 'cask "/usr/local/Cellar/cask/0.7.2_1/cask.el") 10 | (cask-initialize) 11 | (require 'pallet) 12 | (pallet-mode t) 13 | (add-to-list 'load-path "~/.emacs.d/custom") 14 | (load "00common-setup.el") 15 | (load "01ruby.el") 16 | (setq tab-width 4) 17 | (setq indent-tabs-mode nil) ; always replace tabs with spaces 18 | (setq-default tab-width 4) ; set tab width to 4 for all buffers 19 | -------------------------------------------------------------------------------- /custom/01ruby.el: -------------------------------------------------------------------------------- 1 | (require 'ruby-mode) 2 | (setq ruby-indent-level 4) 3 | (setq enh-ruby-program "/Users/ian/.rvm/rubies/ruby-2.1.2/bin/ruby") 4 | (autoload 'enh-ruby-mode "enh-ruby-mode" "Major mode for ruby files" t) 5 | (add-to-list 'auto-mode-alist '("\\.rb$" . enh-ruby-mode)) 6 | (add-to-list 'auto-mode-alist '("\\.rake$" . enh-ruby-mode)) 7 | (add-to-list 'auto-mode-alist '("Rakefile$" . enh-ruby-mode)) 8 | (add-to-list 'auto-mode-alist '("\\.gemspec$" . enh-ruby-mode)) 9 | (add-to-list 'auto-mode-alist '("\\.ru$" . enh-ruby-mode)) 10 | (add-to-list 'auto-mode-alist '("Gemfile$" . enh-ruby-mode)) 11 | 12 | (add-to-list 'interpreter-mode-alist '("ruby" . enh-ruby-mode)) 13 | 14 | (setq enh-ruby-bounce-deep-indent t) 15 | (setq enh-ruby-hanging-brace-indent-level 2) 16 | 17 | (require 'cl) ; If you don't have it already 18 | 19 | (defun* get-closest-gemfile-root (&optional (file "Gemfile")) 20 | "Determine the pathname of the first instance of FILE starting from the current directory towards root. 21 | This may not do the correct thing in presence of links. If it does not find FILE, then it shall return the name 22 | of FILE in the current directory, suitable for creation" 23 | (let ((root (expand-file-name "/"))) ; the win32 builds should translate this correctly 24 | (loop 25 | for d = default-directory then (expand-file-name ".." d) 26 | if (file-exists-p (expand-file-name file d)) 27 | return d 28 | if (equal d root) 29 | return nil))) 30 | 31 | (require 'compile) 32 | 33 | (defun rspec-compile-file () 34 | (interactive) 35 | (compile (format "cd %s;bundle exec rspec %s" 36 | (get-closest-gemfile-root) 37 | (file-relative-name (buffer-file-name) (get-closest-gemfile-root)) 38 | ) t)) 39 | 40 | (defun rspec-compile-on-line () 41 | (interactive) 42 | (compile (format "cd %s;bundle exec rspec %s -l %s" 43 | (get-closest-gemfile-root) 44 | (file-relative-name (buffer-file-name) (get-closest-gemfile-root)) 45 | (line-number-at-pos) 46 | ) t)) 47 | 48 | (add-hook 'enh-ruby-mode-hook 49 | (lambda () 50 | (local-set-key (kbd "C-c l") 'rspec-compile-on-line) 51 | (local-set-key (kbd "C-c k") 'rspec-compile-file) 52 | )) 53 | --------------------------------------------------------------------------------