Skip to content

Instantly share code, notes, and snippets.

@wasabili
Created December 21, 2010 15:38
Show Gist options
  • Save wasabili/750072 to your computer and use it in GitHub Desktop.
Save wasabili/750072 to your computer and use it in GitHub Desktop.
.emacs
;;; Startup Screen
(setq inhibit-startup-message t)
;;; Wrapping Line
(setq truncate-partial-width-windows nil)
(setq truncate-lines t)
;;; Don't make backup files automatically
(setq auto-save-default nil)
(setq make-backup-files nil)
;;; Misc
(delete-selection-mode t)
(show-paren-mode t)
(column-number-mode t)
;;; Auto-install
(add-to-list 'load-path "~/Library/Emacs")
(require 'auto-install)
(setq auto-install-directory "~/Library/Emacs/Autoinstall/")
(auto-install-update-emacswiki-package-name t)
(add-to-list 'load-path "~/Library/Emacs/Autoinstall/")
;;; Anything
(require 'anything-startup)
;;; Haskell Mode
(add-to-list 'load-path "~/Library/Emacs/haskell-mode-2.8.0")
(load "haskell-site-file")
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
;;; Flymake
(require 'flymake)
(defun flymake-cc-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "g++" (list "-Wall" "-Wextra" "-fsyntax-only" local-file))))
(push '("\\.cpp$" flymake-cc-init) flymake-allowed-file-name-masks)
(add-hook 'c++-mode-hook
'(lambda ()
(flymake-mode t)))
(defun flymake-display-err-minibuf ()
"Displays the error/warning for the current line in the minibuffer"
(interactive)
(let* ((line-no (flymake-current-line-no))
(line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no)))
(count (length line-err-info-list)))
(while (> count 0)
(when line-err-info-list
(let* ((file (flymake-ler-file (nth (1- count) line-err-info-list)))
(full-file (flymake-ler-full-file (nth (1- count) line-err-info-list)))
(text (flymake-ler-text (nth (1- count) line-err-info-list)))
(line (flymake-ler-line (nth (1- count) line-err-info-list))))
(message "[%s] %s" line text)))
(setq count (1- count)))))
;;; Key bindings
(global-set-key "\C-xl" 'goto-line)
(global-set-key "\C-xm" 'flymake-display-err-minibuf)
;;; Shell toggle
(load-library "~/.emacs.d/shell-toggle-patched.el")
(autoload 'shell-toggle "shell-toggle"
"Toggles between the *shell* buffer and whatever buffer you are editing." t)
(autoload 'shell-toggle-cd "shell-toggle"
"Pops up a shell-buffer and insert a \"cd <file-dir>\" command." t)
(global-set-key "\C-ct" 'shell-toggle)
(global-set-key "\C-cd" 'shell-toggle-cd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment