(menu-bar-mode -1)
(font-lock-mode t)
;; Shut off message buffer
(setq message-log-max nil)
(kill-buffer "*Messages*")
;; Error trace on .emacs loading failure
(setq debug-on-error t)
;; Set garbage collection hundred times the default, supposedly speeds up startup time
(setq gc-cons-threshold 50000000)
;; Ask me whether I want to close. No more accidents.
;; http://www.dotemacs.de/dotfiles/KilianAFoth.emacs.html
(global-set-key [(control x) (control c)]
(function
(lambda () (interactive)
(cond ((y-or-n-p "Quit? ")
(save-buffers-kill-emacs))))))
;; C-x C-k should be the same as C-x k
(global-set-key "\C-x\C-k" 'kill-this-buffer)
;; Don't echo passwords when communicating with interactive programs
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt)
;; Use ANSI colors within shell-mode
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
;; Disable over-write mode
(put 'overwrite-mode 'disabled t)
;; Paste at cursor, not mouse
(setq mouse-yank-at-point t)
;; Activate font-lock-mode
(global-font-lock-mode t)
;; Maximum colors
(setq font-lock-maximum-decoration t)
;; Change backup behavior to save in a directory, and not screw up my filesystem
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "/home/ricardo/.saves")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t) ; use versioned backups
;; Fix the whole huge-jumps-scrolling-between-windows nastiness
(setq scroll-conservatively 5)
;; "Don't hscroll unless needed"- ? More voodoo lisp.
(setq hscroll-margin 1)
;; Keep cursor in the same relative row during page up / down
(setq scroll-preserve-screen-position t)
;; Start scrolling when 2 lines from top/bottom
(setq scroll-margin 2)
;; Push mouse out of the way when the cursor approaches
(mouse-avoidance-mode 'jump)
;; SavePlace - this puts the cursor in the last place you edited
;; a particular file. Very useful for large files.
(require 'saveplace)
(setq-default save-place t)
;; This apparently allows seamless editting of files in a tar/jar/zip
;; file.
(auto-compression-mode 1)
;; Highlight regions so one can see what one is doing
(transient-mark-mode 1)
;; We can get completion in the mini-buffer as well
(icomplete-mode t)
;; Text files should end in newlines
(setq require-final-newline t)
;; Autocompile .emacs
(defun autocompile nil
"compile itself if /home/ricardo/.emacs"
(interactive)
(require 'bytecomp)
(if (string= (buffer-file-name) (expand-file-name (concat
default-directory ".emacs")))
(byte-compile-file (buffer-file-name))))
(add-hook 'after-save-hook 'autocompile)
;; Set Home and End keys
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
;; Set easy buffer scrolling, like in Conkeror
(global-set-key (kbd "M-n") 'next-buffer)
(global-set-key (kbd "M-p") 'previous-buffer)
;; Set up load path
(add-to-list 'load-path "/usr/local/lib/emacs/site-lisp")
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp")
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/slime/")
;; Slime
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(require 'slime)
(slime-setup)
;(global-set-key [f1] 'slime-documentation)
(global-set-key [f5] 'slime-eval-buffer)
(setq inhibit-startup-message t)
(defalias 'yes-or-no-p 'y-or-n-p)
;; UTF-8
(setq slime-net-coding-system 'utf-8-unix)
(set-language-environment 'utf-8)
(prefer-coding-system 'utf-8)