1 ;;;; Trevor's sysadmin .emacs file
2 ; started Sept 13, 2006
3 ; The goal is to set up emacs for personal usage.
4 ; See .emacs-admin for a more general setup
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 ; From http://www.delorie.com/gnu/docs/emacs/emacs_125.html
38 ; Emacs records interrupted sessions for later recovery in files named
39 ; `~/.emacs.d/auto-save-list/.saves-pid-hostname'. The
40 ; `~/.emacs.d/auto-save-list/.saves-' portion of these names comes
41 ; from the value of auto-save-list-file-prefix.
42 (setq auto-save-list-file-prefix "~/.auto-save-list/.saves-")
44 ; redefining the make-auto-save-file-name function in order to get
45 ; autosave files sent to a single directory. Note that this function
46 ; looks first to determine if you have a ~/.autosave/ directory. If
47 ; you do not it proceeds with the standard auto-save procedure.
48 (defun make-auto-save-file-name ()
49 "Return file name to use for auto-saves of current buffer.."
51 (if (file-exists-p "~/.autosave/")
52 (concat (expand-file-name "~/.autosave/") "#"
53 (replace-regexp-in-string "/" "!" buffer-file-name)
56 (file-name-directory buffer-file-name)
58 (file-name-nondirectory buffer-file-name)
61 (concat "#%" (buffer-name) "#"))))
63 ;------------------------------------------------------------------------------
66 ; Setup bundled EasyPG (encryption with gpg)
67 ; from minor emacs wizardry
68 ; http://emacs.wordpress.com/2008/07/18/keeping-your-secrets-secret/
74 ; http://orgmode.org/manual/Activation.html
75 ; The following lines are always needed. Choose your own keys.
76 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
77 (global-set-key "\C-cl" 'org-store-link)
78 (global-set-key "\C-ca" 'org-agenda)
79 (global-set-key "\C-cb" 'org-iswitchb)
81 (setq browse-url-browser-function 'browse-url-firefox) ; loki hack
83 (defun org-time-stamp-now ()
84 "Insert the current timestamp in org-mode, without recourse to the calendar."
86 (org-insert-time-stamp (current-time) 'with-hm 'inactive))
87 (global-set-key "\C-cn" 'org-time-stamp-now)
91 ;(setq load-path (cons "~/.emacs.d/load" load-path))
92 ; Load querty.el, for switching keyboard mappings.
95 ;(custom-set-variables
96 ;; custom-set-variables was added by Custom.
97 ;; If you edit it by hand, you could mess it up, so be careful.
98 ;; Your init file should contain only one such instance.
99 ;; If there is more than one, they won't work right.
100 ; '(safe-local-variable-values (quote ((noweb-code-mode . c-mode)))))
102 ;; custom-set-faces was added by Custom.
103 ;; If you edit it by hand, you could mess it up, so be careful.
104 ;; Your init file should contain only one such instance.
105 ;; If there is more than one, they won't work right.