User Tools

Site Tools


mac:emacs

Table of Contents

Emacs

I used Emacs for over 10 years, but stopped using it when I had to administer nearly 100 servers, where I was not allowed to install Emacs. With the birth of the St. Louis Emacs User Group, I've decided to try to start using Emacs again.

I've decided to start with Prelude, since it provides a lot of add-on packages with decent configuration out of the box.

Installation

# Make sure we have the latests Homebrew.
brew update
 
# Install ctags, which Emacs likes to use to index source files to find function definitions.
brew install ctags
 
# Install latest version (24.3) of Emacs. Include Mac OS X GUI support with sRGB colors.
brew install --cocoa --srgb emacs
 
# Link Emacs.app into /Applications folder.
brew linkapps
 
# Link executables into the PATH, before system versions.
EMACS_VERSION=$(ls -1 /usr/local/Cellar/emacs | tail -1)
ln -sf /usr/local/Cellar/emacs/$EMACS_VERSION/bin/{emacs,emacsclient} /usr/local/bin/
hash -r
 
# Install Prelude.
mkdir -p ~/.emacs.d
git clone git://github.com/bbatsov/prelude.git ~/.emacs.d/prelude

Configuration

# Create a .emacs file that will load Prelude, but allow for personal customization.
cat > ~/.emacs.d/init.el <<-EOF
;;; Emacs Custom Configuration.
 
;; Load Prelude.
(load "~/.emacs.d/prelude/init.el")
 
;; Configure Prelude.
(setq prelude-guru nil) ;; Don't disable cursor keys.
(require 'prelude-ido) ;; Super charges Emacs completion for C-x C-f and more
(require 'prelude-c)
(require 'prelude-coffee)
(require 'prelude-css)
(require 'prelude-emacs-lisp)
(require 'prelude-js)
(require 'prelude-key-chord) ;; Binds useful features to key combinations
(require 'prelude-org) ;; Org-mode helps you keep TODO lists, notes and more
(require 'prelude-python)
(require 'prelude-ruby)
(require 'prelude-scala)
(require 'prelude-scss)
(require 'prelude-web) ;; Emacs mode for web templates
(require 'prelude-xml)
 
;; Set whitespace-mode to highlight (only) hard tabs and trailing whitespace.
(setq whitespace-style '(face tabs trailing))
 
;; Set color theme. Acceptable light themes: adwaita. Acceptable dark themes: zenburn tango-dark
(load-theme 'adwaita)
 
;; Map F11 to open menu (since we have Mac OS X map F10 to open the system menu).
(global-set-key (kbd "<f11>") 'menu-bar-open)
 
;; Make sure Home and End keys work in Mac OS X terminal.                                                                                                                                                                              
(global-set-key (kbd "M-[ H") 'move-beginning-of-line)                                                                                                                                                                                 
(global-set-key (kbd "M-[ F") 'move-end-of-line) 
 
;; Store customize UI changes in .emacs.d/custom.el. (Revert Prelude's change.)
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file)
EOF

TODO

  • Store my .emacs.d/init.el file in my config_files repo.
  • Break up init.el file into pieces:
    • packages.el
    • keymap.el
    • theme.el
    • ruby.el
    • prelude.el (maybe)
  • Need to make sure rubocop command is installed in all Ruby versions.
    • It's used by the Prelude Ruby mode.
mac/emacs.txt · Last modified: 2014/02/25 19:03 by Craig Buchek