;;;; Trevor's sysadmin .emacs file ; started Sept 12, 2008 ; The goal is to set up emacs for general usage & organization, without ; too much Trevor-specific personalization. An inheritable .emacs file ;). ; Lisp comments begin with a ";" ;------------------------------------------------------------------------------ ; Make operating on buffers more convienient (setq inhibit-startup-message t) ; no splash screen (fset 'yes-or-no-p 'y-or-n-p) ; use y or n instead of yes or n (setq require-final-newline t) ; always end a file with a newline (setq backup-by-copying-when-mismatch t) ; preserve file's owner and group (when (fboundp 'global-font-lock-mode) ; turn on font-lock mode (global-font-lock-mode t)) (setq transient-mark-mode t) ; enable visual feedback on selections (global-set-key "\C-xg" 'goto-line) ; bind the goto-line function ; Make scripts executable on Save (saves having to do the chmod every time) (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) ;------------------------------------------------------------------------------ ; Set up a more organized version control ; ; Backups are saved to ~/.backup, and autosaves to ~/.autosave If ; ~/.backup doesn't exist it is created. If ~/.autosace doesn't exist ; it is created, the standard autosave procedure is followed. ; ; following J.T. Halbert at http://www.math.umd.edu/~halbert/dotemacs.html ; and the Emacs manual at ; http://www.gnu.org/software/emacs/manual/html_node/emacs/Backup-Names.html (setq backup-directory-alist (quote ((".*" . "~/.backup")))) (defconst use-backup-dir t) ; Use backup directory ; redefining the make-auto-save-file-name function in order to get ; autosave files sent to a single directory. Note that this function ; looks first to determine if you have a ~/.autosaves/ directory. If ; you do not it proceeds with the standard auto-save procedure. (defun make-auto-save-file-name () "Return file name to use for auto-saves of current buffer.." (if buffer-file-name (if (file-exists-p "~/.autosaves/") (concat (expand-file-name "~/.autosaves/") "#" (replace-regexp-in-string "/" "!" buffer-file-name) "#") (concat (file-name-directory buffer-file-name) "#" (file-name-nondirectory buffer-file-name) "#")) (expand-file-name (concat "#%" (buffer-name) "#"))))