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