comparison .emacs @ 297:618db1b1f34b

dmenu + emacs, baby
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 11 May 2013 10:00:48 -0700
parents c738405d0d6c
children cc2f7d8307d0
comparison
equal deleted inserted replaced
296:ee3c1b65d6d1 297:618db1b1f34b
1 ;; emacs server (what a piece of crap) 1 ;; emacs server (what a piece of crap)
2 (require 'server) 2 ;; (commented out for now)
3 (or (server-running-p) 3 ;; (require 'server)
4 (server-start)) 4 ;; (or (server-running-p)
5 ;; (server-start))
6
7 ;;;; bars
8
9 ;; Turn off the status bar and on the mouse if we're not in a window system
10 (menu-bar-mode (if window-system 1 -1))
11
12 ;; no need for a tool bar
5 (if (boundp 'tool-bar-mode) (tool-bar-mode 0)) 13 (if (boundp 'tool-bar-mode) (tool-bar-mode 0))
14
15 ;; ...or a startup message
6 (setq inhibit-startup-message t) 16 (setq inhibit-startup-message t)
17
18 ;; no f-ing backup files
7 (setq make-backup-files nil) 19 (setq make-backup-files nil)
20
21 ;; show trailing whitespace
22 (setq-default show-trailing-whitespace t)
23
24 ;;;;
25
8 (put 'downcase-region 'disabled nil) 26 (put 'downcase-region 'disabled nil)
9 (setq truncate-lines nil) 27 (setq truncate-lines nil)
10 (setq truncate-partial-width-windows nil) 28 (setq truncate-partial-width-windows nil)
11 (setq use-file-dialog nil) 29 (setq use-file-dialog nil)
12 30
13 ;; make directories when they don't exist 31 ;; make directories when they don't exist
14 ;; from http://stackoverflow.com/questions/6830671/how-to-make-emacs-create-intermediate-dirs-when-saving-a-file 32 ;; from http://stackoverflow.com/questions/6830671/how-to-make-emacs-create-intermediate-dirs-when-saving-a-file
15 (add-hook 'before-save-hook 33 (add-hook 'before-save-hook
17 (when buffer-file-name 35 (when buffer-file-name
18 (let ((dir (file-name-directory buffer-file-name))) 36 (let ((dir (file-name-directory buffer-file-name)))
19 (when (not (file-exists-p dir)) 37 (when (not (file-exists-p dir))
20 (make-directory dir t)))))) 38 (make-directory dir t))))))
21 39
22 ;; indentation 40 ;;;; indentation
23 41
24 ;; python indentation 42 ;; python indentation
25 (setq python-indent 4) 43 (setq python-indent 4)
26 (setq-default py-indent-offset 4) 44 (setq-default py-indent-offset 4)
27 (setq python-guess-indent nil) 45 (setq python-guess-indent nil)
36 (autoload 'doctest-mode "doctest-mode" "doctest editing mode." t) 54 (autoload 'doctest-mode "doctest-mode" "doctest editing mode." t)
37 55
38 (transient-mark-mode 1) 56 (transient-mark-mode 1)
39 57
40 (put 'upcase-region 'disabled nil) 58 (put 'upcase-region 'disabled nil)
59
60 ;;;; line/col #s
61
41 ;; Show line-number in the mode line 62 ;; Show line-number in the mode line
42 (line-number-mode 1) 63 (line-number-mode 1)
43 64
44 ;; Show column-number in the mode line 65 ;; Show column-number in the mode line
45 (column-number-mode 1) 66 (column-number-mode 1)
46 67
47 ;; Bind major editing modes to certain file extensions 68 ;;;; modes
69
70 ;; Bind major editing modes to certain file extensions
48 (setq auto-mode-alist (cons '("\\.zcml$" . sgml-mode) auto-mode-alist)) 71 (setq auto-mode-alist (cons '("\\.zcml$" . sgml-mode) auto-mode-alist))
49 (setq auto-mode-alist (cons '("\\.pt$" . sgml-mode) auto-mode-alist)) 72 (setq auto-mode-alist (cons '("\\.pt$" . sgml-mode) auto-mode-alist))
50 (setq auto-mode-alist (cons '("\\.cpt$" . sgml-mode) auto-mode-alist)) 73 (setq auto-mode-alist (cons '("\\.cpt$" . sgml-mode) auto-mode-alist))
51 (setq auto-mode-alist (cons '("\\.cpy$" . python-mode) auto-mode-alist)) 74 (setq auto-mode-alist (cons '("\\.cpy$" . python-mode) auto-mode-alist))
52 (setq auto-mode-alist (cons '("\\.vpy$" . python-mode) auto-mode-alist)) 75 (setq auto-mode-alist (cons '("\\.vpy$" . python-mode) auto-mode-alist))
53 76
54 ;; Turn off the status bar and on the mouse if we're not in a window system 77 ;; set auto-fill for modes
55 (menu-bar-mode (if window-system 1 -1))
56 (add-hook 'text-mode-hook 'turn-on-auto-fill) 78 (add-hook 'text-mode-hook 'turn-on-auto-fill)
57
58 (add-hook 'sgml-mode-hook 'turn-off-auto-fill) 79 (add-hook 'sgml-mode-hook 'turn-off-auto-fill)
59 80
60 (setq grep-command "grep -liE") 81 (setq grep-command "grep -liE")
61 82
62 ;; recentf stuff 83 ;; recent history stuff
63 (require 'recentf) 84 (require 'recentf)
64 (recentf-mode 1) 85 (recentf-mode 1)
65 (setq recentf-max-menu-items 25) 86 (setq recentf-max-menu-items 25)
66 (global-set-key "\C-x\ \C-r" 'recentf-open-files) 87 (global-set-key "\C-x\ \C-r" 'recentf-open-files)
67 88
84 ;; substring buffer switching mode 105 ;; substring buffer switching mode
85 (iswitchb-mode 1) 106 (iswitchb-mode 1)
86 107
87 (global-set-key "\M-g" 'goto-line) 108 (global-set-key "\M-g" 'goto-line)
88 109
110 ;;;; python
111
89 ;; (when (load "flymake" t) 112 ;; (when (load "flymake" t)
90 ;; (defun flymake-pyflakes-init () 113 ;; (defun flymake-pyflakes-init ()
91 ;; (let* ((temp-file (flymake-init-create-temp-buffer-copy 114 ;; (let* ((temp-file (flymake-init-create-temp-buffer-copy
92 ;; 'flymake-create-temp-inplace)) 115 ;; 'flymake-create-temp-inplace))
93 ;; (local-file (file-relative-name 116 ;; (local-file (file-relative-name
94 ;; temp-file 117 ;; temp-file
95 ;; (file-name-directory buffer-file-name)))) 118 ;; (file-name-directory buffer-file-name))))
96 ;; (list "pyflakes" (list local-file)))) 119 ;; (list "pyflakes" (list local-file))))
97
98 ;; (add-to-list 'flymake-allowed-file-name-masks 120 ;; (add-to-list 'flymake-allowed-file-name-masks
99 ;; '("\\.py\\'" flymake-pyflakes-init))) 121 ;; '("\\.py\\'" flymake-pyflakes-init)))
100 122
101 ;; (add-hook 'find-file-hook 'flymake-find-file-hook) 123 ;; (add-hook 'find-file-hook 'flymake-find-file-hook)
102 (server-start)
103 124
104 (fset 'break "import pdb; pdb.set_trace();\C-a\C-i") 125 (fset 'break "import pdb; pdb.set_trace();\C-a\C-i")
105 (add-hook 'python-mode-hook 126 (add-hook 'python-mode-hook
106 '(lambda () 127 '(lambda ()
107 (local-set-key [(meta ?p) (meta ?p)] 'break))) 128 (local-set-key [(meta ?p) (meta ?p)] 'break)))
108
109 (setq-default show-trailing-whitespace t)