Skip to content

Instantly share code, notes, and snippets.

@KirinDave
Created April 22, 2011 17:26
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 KirinDave/937157 to your computer and use it in GitHub Desktop.
Save KirinDave/937157 to your computer and use it in GitHub Desktop.
My toplevel emacs file
;;This is needed for Erlang mode setup
(defun get-erlang-root ()
(if (file-exists-p "/p/lib/erlang")
"/p/lib/erlang"
"/usr/local/lib/erlang"))
(let* ((root-dir (get-erlang-root))
(bin-dir (expand-file-name "bin" root-dir))
(tools-dirs (file-expand-wildcards (concat root-dir
"/lib/tools-2.6.*/emacs"))))
(setq erlang-root-dir root-dir)
(add-to-list 'load-path (car tools-dirs))
(add-to-list 'exec-path bin-dir))
(require 'erlang-start)
;;This is needed for Distel setup
(let ((distel-dir (expand-file-name "~/.emacs.d/manual/distel/elisp")))
(unless (member distel-dir load-path)
; Add distel-dir to the end of load-path
(setq load-path (append load-path (list distel-dir)))))
(require 'distel)
(distel-setup)
;;Some Erlang customizations
(add-hook 'erlang-mode-hook
(lambda ()
;; when starting an Erlang shell in Emacs, default in the node name
(setq inferior-erlang-machine-options '("-sname" "emacs"))
;; add Erlang functions to an imenu menu
(imenu-add-to-menubar "imenu")
(yas/minor-mode-on)
(define-key erlang-mode-map [f5] 'compile)
(define-key erlang-mode-map (kbd "\C-c\C-dM") 'erlang-man-function)))
;;A number of the erlang-extended-mode key bindings are useful in the shell too
(defconst distel-shell-keys
'(("\C-\M-i" erl-complete)
("\M-?" erl-complete)
("\M-." erl-find-source-under-point)
("\M-," erl-find-source-unwind)
("\M-*" erl-find-source-unwind)
)
"Additional keys to bind when in Erlang shell.")
(add-hook 'erlang-shell-mode-hook
(lambda ()
;; add some Distel bindings to the Erlang shell
(dolist (spec distel-shell-keys)
(define-key erlang-shell-mode-map (car spec) (cadr spec)))))
(setq erlang-indent-level 2)
;;; Dave Fayram's Emacs setup.
;;; ~/.emacs -> (load "~/.emacs.d/main.el)
;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
(load
(expand-file-name "~/.emacs.d/elpa/package.el"))
(package-initialize))
(add-to-list 'load-path "~/.emacs.d/manual")
(setq-default indent-tabs-mode nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Setup files (used later!)
(defconst my-setup-files
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
'(theme lisp erlang org c markdown scala haskell)) ; Removed CEDET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun edit-my-preferences ()
"Edits my local preferences."
(interactive)
(find-file
(expand-file-name "~/.emacs.d/main.el")))
(defun run-setup (setup-sym)
"Loads a file in .emacs.d named \"symbol-setup.el\"."
(let* ((sstr (symbol-name setup-sym))
(fname (concat sstr "-setup.el")))
(message (concat "Loading setup for " sstr))
(load (expand-file-name fname "~/.emacs.d/"))))
(dolist (s my-setup-files)
(run-setup s))
; Some odds and ends that don't fit anywhere else
(define-key global-map "\C-xP" 'edit-my-preferences)
(defadvice zap-to-char (after my-zap-to-char-advice (arg char) activate)
"Kill up to the ARG'th occurence of CHAR, and leave CHAR.
The CHAR is replaced and the point is put before CHAR."
(insert char)
(forward-char -1))
(defun unfill-paragraph ()
"Takes a multi-line paragraph and makes it into a single line of text."
(interactive)
(let ((fill-column (point-max)))
(fill-paragraph nil)))
(require 'ido)
(ido-mode t)
(blink-cursor-mode nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment