Mercurial > hg > config
annotate .emacs @ 307:655a40db0977
ah, the magic switch
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 16 May 2013 11:25:10 -0700 |
parents | a1c72313b3df |
children | 6095d439d1f2 |
rev | line source |
---|---|
280 | 1 ;; emacs server (what a piece of crap) |
299
cc2f7d8307d0
maybe we have that server after all
Jeff Hammel <jhammel@mozilla.com>
parents:
297
diff
changeset
|
2 (require 'server) |
cc2f7d8307d0
maybe we have that server after all
Jeff Hammel <jhammel@mozilla.com>
parents:
297
diff
changeset
|
3 (or (server-running-p) |
cc2f7d8307d0
maybe we have that server after all
Jeff Hammel <jhammel@mozilla.com>
parents:
297
diff
changeset
|
4 (server-start)) |
297 | 5 |
6 ;;;; bars | |
7 | |
8 ;; Turn off the status bar and on the mouse if we're not in a window system | |
9 (menu-bar-mode (if window-system 1 -1)) | |
10 | |
11 ;; no need for a tool bar | |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
12 (if (boundp 'tool-bar-mode) (tool-bar-mode 0)) |
297 | 13 |
14 ;; ...or a startup message | |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
15 (setq inhibit-startup-message t) |
297 | 16 |
17 ;; no f-ing backup files | |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
18 (setq make-backup-files nil) |
297 | 19 |
20 ;; show trailing whitespace | |
21 (setq-default show-trailing-whitespace t) | |
22 | |
300 | 23 ;;;; ??? no idea |
297 | 24 |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
25 (put 'downcase-region 'disabled nil) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
26 (setq truncate-lines nil) |
297 | 27 (setq truncate-partial-width-windows nil) |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
28 (setq use-file-dialog nil) |
75
89a64b0d6146
adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents:
62
diff
changeset
|
29 |
280 | 30 ;; make directories when they don't exist |
31 ;; from http://stackoverflow.com/questions/6830671/how-to-make-emacs-create-intermediate-dirs-when-saving-a-file | |
32 (add-hook 'before-save-hook | |
33 (lambda () | |
34 (when buffer-file-name | |
35 (let ((dir (file-name-directory buffer-file-name))) | |
36 (when (not (file-exists-p dir)) | |
37 (make-directory dir t)))))) | |
38 | |
297 | 39 ;;;; indentation |
75
89a64b0d6146
adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents:
62
diff
changeset
|
40 |
89a64b0d6146
adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents:
62
diff
changeset
|
41 ;; python indentation |
120
339805e00f03
set python spacing back to four, by popular demand
Jeff Hammel <jhammel@mozilla.com>
parents:
75
diff
changeset
|
42 (setq python-indent 4) |
339805e00f03
set python spacing back to four, by popular demand
Jeff Hammel <jhammel@mozilla.com>
parents:
75
diff
changeset
|
43 (setq-default py-indent-offset 4) |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
44 (setq python-guess-indent nil) |
75
89a64b0d6146
adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents:
62
diff
changeset
|
45 |
89a64b0d6146
adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents:
62
diff
changeset
|
46 ;; javascript indentation: http://www.brgeight.se/downloads/emacs/javascript.el |
89a64b0d6146
adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents:
62
diff
changeset
|
47 (setq javascript-indent-level 2) |
148 | 48 (setq js-indent-level 2) |
75
89a64b0d6146
adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents:
62
diff
changeset
|
49 |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
50 (setq-default indent-tabs-mode nil) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
51 (defface extra-whitespace-face '((t (:background "pale green"))) "Used for tabs and such.") |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
52 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
53 (autoload 'doctest-mode "doctest-mode" "doctest editing mode." t) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
54 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
55 (transient-mark-mode 1) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
56 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
57 (put 'upcase-region 'disabled nil) |
297 | 58 |
59 ;;;; line/col #s | |
60 | |
300 | 61 ;; Show line and column numbers in the mode line |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
62 (line-number-mode 1) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
63 (column-number-mode 1) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
64 |
297 | 65 ;;;; modes |
66 | |
67 ;; Bind major editing modes to certain file extensions | |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
68 (setq auto-mode-alist (cons '("\\.zcml$" . sgml-mode) auto-mode-alist)) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
69 (setq auto-mode-alist (cons '("\\.pt$" . sgml-mode) auto-mode-alist)) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
70 (setq auto-mode-alist (cons '("\\.cpt$" . sgml-mode) auto-mode-alist)) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
71 (setq auto-mode-alist (cons '("\\.cpy$" . python-mode) auto-mode-alist)) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
72 (setq auto-mode-alist (cons '("\\.vpy$" . python-mode) auto-mode-alist)) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
73 |
300 | 74 ;; set auto-fill for appropriate modes |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
75 (add-hook 'text-mode-hook 'turn-on-auto-fill) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
76 (add-hook 'sgml-mode-hook 'turn-off-auto-fill) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
77 |
300 | 78 ;; set the grep command....for some reason |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
79 (setq grep-command "grep -liE") |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
80 |
300 | 81 |
82 ;;;; recent history stuff | |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
83 (require 'recentf) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
84 (recentf-mode 1) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
85 (setq recentf-max-menu-items 25) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
86 (global-set-key "\C-x\ \C-r" 'recentf-open-files) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
87 |
300 | 88 ;;;; full-steam-ahead-and-damn-the-torpedoes |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
89 (defun |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
90 full-steam-ahead-and-damn-the-torpedoes |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
91 (prompt) t) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
92 (defalias 'y-or-n-p |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
93 'full-steam-ahead-and-damn-the-torpedoes) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
94 (defalias 'yes-or-no-p |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
95 'full-steam-ahead-and-damn-the-torpedoes) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
96 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
97 (require 'uniquify) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
98 (setq uniquify-buffer-name-style 'post-forward) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
99 |
300 | 100 ;;;; |
101 | |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
102 ;; wheel mouse |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
103 (global-set-key [mouse-4] 'scroll-down) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
104 (global-set-key [mouse-5] 'scroll-up) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
105 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
106 ;; substring buffer switching mode |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
107 (iswitchb-mode 1) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
108 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
109 (global-set-key "\M-g" 'goto-line) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
110 |
297 | 111 ;;;; python |
112 | |
0
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
113 ;; (when (load "flymake" t) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
114 ;; (defun flymake-pyflakes-init () |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
115 ;; (let* ((temp-file (flymake-init-create-temp-buffer-copy |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
116 ;; 'flymake-create-temp-inplace)) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
117 ;; (local-file (file-relative-name |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
118 ;; temp-file |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
119 ;; (file-name-directory buffer-file-name)))) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
120 ;; (list "pyflakes" (list local-file)))) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
121 ;; (add-to-list 'flymake-allowed-file-name-masks |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
122 ;; '("\\.py\\'" flymake-pyflakes-init))) |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
123 |
f3ab51c79813
adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
124 ;; (add-hook 'find-file-hook 'flymake-find-file-hook) |
4 | 125 |
126 (fset 'break "import pdb; pdb.set_trace();\C-a\C-i") | |
127 (add-hook 'python-mode-hook | |
128 '(lambda () | |
129 (local-set-key [(meta ?p) (meta ?p)] 'break))) |