annotate .emacs @ 845:70ae14b6be51

[sync] ~/k0s is no longer in PATH as it corrupts PYTHONPATH
author Jeff Hammel <k0scist@gmail.com>
date Thu, 17 Aug 2017 09:48:49 -0700
parents 03f9657514e9
children 1c3f6daa1190
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
362
ad10f719d160 hopefully fix this damn thing
Jeff Hammel <jhammel@mozilla.com>
parents: 359
diff changeset
1 (setq max-specpdl-size 5000)
ad10f719d160 hopefully fix this damn thing
Jeff Hammel <jhammel@mozilla.com>
parents: 359
diff changeset
2
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
3 (setq initial-scratch-message ";; scratch ;;
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
4
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
5 ")
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
6
504
c805a31fe0f5 http://www.emacswiki.org/emacs/GnuClient
Jeff Hammel <jhammel@mozilla.com>
parents: 368
diff changeset
7 ;; server: gnuserv
c805a31fe0f5 http://www.emacswiki.org/emacs/GnuClient
Jeff Hammel <jhammel@mozilla.com>
parents: 368
diff changeset
8 ;; http://www.emacswiki.org/emacs/GnuClient
c805a31fe0f5 http://www.emacswiki.org/emacs/GnuClient
Jeff Hammel <jhammel@mozilla.com>
parents: 368
diff changeset
9 (if (boundp 'gnuserv-start) (gnuserv-start))
c805a31fe0f5 http://www.emacswiki.org/emacs/GnuClient
Jeff Hammel <jhammel@mozilla.com>
parents: 368
diff changeset
10 ;; frames: http://www.emacswiki.org/emacs/GnuClient#toc6
c805a31fe0f5 http://www.emacswiki.org/emacs/GnuClient
Jeff Hammel <jhammel@mozilla.com>
parents: 368
diff changeset
11 (setq gnuserv-frame (selected-frame))
c805a31fe0f5 http://www.emacswiki.org/emacs/GnuClient
Jeff Hammel <jhammel@mozilla.com>
parents: 368
diff changeset
12
335
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
13 ;; ;; ;; emacs server (what a piece of crap)
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
14 ;; (require 'server)
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
15 ;; (unless (server-running-p)
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
16 ;; (server-start))
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
17 ;; ;; ;; An error has occurred while loading `/home/jhammel/.emacs':
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
18 ;; ;; ;; Symbol's function definition is void: server-running-p
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
19 ;; ;; ;; To ensure normal operation, you should investigate and remove the
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
20 ;; ;; ;; cause of the error in your initialization file. Start Emacs with
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
21 ;; ;; ;; the `--debug-init' option to view a complete error backtrace.
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
22
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
23 ;; ;; ;; For information about GNU Emacs and the GNU system, type C-h C-a.
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
24 ;; ;; How to fix:
a9d3f1210506 what a piece of crap; disablign for now since i dont use anyway
Jeff Hammel <jhammel@mozilla.com>
parents: 309
diff changeset
25 ;; http://stackoverflow.com/questions/9999320/how-to-check-if-a-function-e-g-server-running-p-is-available-under-emacs
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
26
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
27 ;;;; bars
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
28
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
29 ;; Turn off the status bar and on the mouse if we're not in a window system
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
30 (menu-bar-mode (if window-system 1 -1))
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
31
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
32 ;; no need for a tool bar
760
d0b975ffabdf http://serverfault.com/questions/132055/how-to-check-if-emacs-is-in-gui-mode-and-execute-tool-bar-mode-only-then
Jeff Hammel <k0scist@gmail.com>
parents: 703
diff changeset
33 ;; http://serverfault.com/questions/132055/how-to-check-if-emacs-is-in-gui-mode-and-execute-tool-bar-mode-only-then
d0b975ffabdf http://serverfault.com/questions/132055/how-to-check-if-emacs-is-in-gui-mode-and-execute-tool-bar-mode-only-then
Jeff Hammel <k0scist@gmail.com>
parents: 703
diff changeset
34 (if window-system
d0b975ffabdf http://serverfault.com/questions/132055/how-to-check-if-emacs-is-in-gui-mode-and-execute-tool-bar-mode-only-then
Jeff Hammel <k0scist@gmail.com>
parents: 703
diff changeset
35 (if (boundp 'tool-bar-mode) (tool-bar-mode 0)))
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
36
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
37 ;; ...or a startup message
309
6095d439d1f2 new stuff! realwhich
Jeff Hammel <jhammel@mozilla.com>
parents: 300
diff changeset
38 ;; instead, it'd be nice to start with a list of recent files (recentf)
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
39 (setq inhibit-startup-message t)
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
40
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
41 ;; no f-ing backup files
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
42 (setq make-backup-files nil)
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
43
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
44 ;; show trailing whitespace
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
45 (setq-default show-trailing-whitespace t)
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
46
300
a1c72313b3df minor mods
Jeff Hammel <jhammel@mozilla.com>
parents: 299
diff changeset
47 ;;;; ??? no idea
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
48
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
49 (put 'downcase-region 'disabled nil)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
50 (setq truncate-lines nil)
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
51 (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
52 (setq use-file-dialog nil)
75
89a64b0d6146 adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents: 62
diff changeset
53
280
c738405d0d6c mkdir -p
Jeff Hammel <jhammel@mozilla.com>
parents: 275
diff changeset
54 ;; make directories when they don't exist
c738405d0d6c mkdir -p
Jeff Hammel <jhammel@mozilla.com>
parents: 275
diff changeset
55 ;; from http://stackoverflow.com/questions/6830671/how-to-make-emacs-create-intermediate-dirs-when-saving-a-file
c738405d0d6c mkdir -p
Jeff Hammel <jhammel@mozilla.com>
parents: 275
diff changeset
56 (add-hook 'before-save-hook
c738405d0d6c mkdir -p
Jeff Hammel <jhammel@mozilla.com>
parents: 275
diff changeset
57 (lambda ()
c738405d0d6c mkdir -p
Jeff Hammel <jhammel@mozilla.com>
parents: 275
diff changeset
58 (when buffer-file-name
c738405d0d6c mkdir -p
Jeff Hammel <jhammel@mozilla.com>
parents: 275
diff changeset
59 (let ((dir (file-name-directory buffer-file-name)))
c738405d0d6c mkdir -p
Jeff Hammel <jhammel@mozilla.com>
parents: 275
diff changeset
60 (when (not (file-exists-p dir))
c738405d0d6c mkdir -p
Jeff Hammel <jhammel@mozilla.com>
parents: 275
diff changeset
61 (make-directory dir t))))))
c738405d0d6c mkdir -p
Jeff Hammel <jhammel@mozilla.com>
parents: 275
diff changeset
62
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
63 ;;;; indentation
75
89a64b0d6146 adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents: 62
diff changeset
64
89a64b0d6146 adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents: 62
diff changeset
65 ;; python indentation
120
339805e00f03 set python spacing back to four, by popular demand
Jeff Hammel <jhammel@mozilla.com>
parents: 75
diff changeset
66 (setq python-indent 4)
339805e00f03 set python spacing back to four, by popular demand
Jeff Hammel <jhammel@mozilla.com>
parents: 75
diff changeset
67 (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
68 (setq python-guess-indent nil)
75
89a64b0d6146 adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents: 62
diff changeset
69
89a64b0d6146 adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents: 62
diff changeset
70 ;; javascript indentation: http://www.brgeight.se/downloads/emacs/javascript.el
89a64b0d6146 adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents: 62
diff changeset
71 (setq javascript-indent-level 2)
148
7a4c86310463 add another variable
Jeff Hammel <jhammel@mozilla.com>
parents: 120
diff changeset
72 (setq js-indent-level 2)
75
89a64b0d6146 adding indentation for javascript
Jeff Hammel <jhammel@mozilla.com>
parents: 62
diff changeset
73
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
74 (setq-default indent-tabs-mode nil)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
75 (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
76
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
77 (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
78
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
79 (transient-mark-mode 1)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
80
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
81 (put 'upcase-region 'disabled nil)
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
82
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
83 ;;;; line/col #s
309
6095d439d1f2 new stuff! realwhich
Jeff Hammel <jhammel@mozilla.com>
parents: 300
diff changeset
84 ;;;; 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
85 (line-number-mode 1)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
86 (column-number-mode 1)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
87
309
6095d439d1f2 new stuff! realwhich
Jeff Hammel <jhammel@mozilla.com>
parents: 300
diff changeset
88
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
89 ;;;; modes
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
90
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
91 ;; 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
92 (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
93 (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
94 (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
95 (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
96 (setq auto-mode-alist (cons '("\\.vpy$" . python-mode) auto-mode-alist))
842
03f9657514e9 while we might not want Octave *that* much, we will never want OCAML
Jeff Hammel <k0scist@gmail.com>
parents: 760
diff changeset
97 (setq auto-mode-alist
03f9657514e9 while we might not want Octave *that* much, we will never want OCAML
Jeff Hammel <k0scist@gmail.com>
parents: 760
diff changeset
98 (cons '("\\.m$" . octave-mode) auto-mode-alist))
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
99
300
a1c72313b3df minor mods
Jeff Hammel <jhammel@mozilla.com>
parents: 299
diff changeset
100 ;; 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
101 (setq grep-command "grep -liE")
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
102
300
a1c72313b3df minor mods
Jeff Hammel <jhammel@mozilla.com>
parents: 299
diff changeset
103
a1c72313b3df minor mods
Jeff Hammel <jhammel@mozilla.com>
parents: 299
diff changeset
104 ;;;; recent history stuff
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
105 (require 'recentf)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
106 (recentf-mode 1)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
107 (setq recentf-max-menu-items 25)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
108 (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
109
300
a1c72313b3df minor mods
Jeff Hammel <jhammel@mozilla.com>
parents: 299
diff changeset
110 ;;;; 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
111 (defun
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
112 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
113 (prompt) t)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
114 (defalias 'y-or-n-p
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
115 '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
116 (defalias 'yes-or-no-p
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
117 '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
118
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
119 (require 'uniquify)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
120 (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
121
300
a1c72313b3df minor mods
Jeff Hammel <jhammel@mozilla.com>
parents: 299
diff changeset
122 ;;;;
a1c72313b3df minor mods
Jeff Hammel <jhammel@mozilla.com>
parents: 299
diff changeset
123
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
124 ;; wheel mouse
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
125 (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
126 (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
127
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
128 ;; substring buffer switching mode
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
129 (iswitchb-mode 1)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
130
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
131 (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
132
297
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
133 ;;;; python
618db1b1f34b dmenu + emacs, baby
Jeff Hammel <jhammel@mozilla.com>
parents: 280
diff changeset
134
0
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
135 ;; (when (load "flymake" t)
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
136 ;; (defun flymake-pyflakes-init ()
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
137 ;; (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
138 ;; 'flymake-create-temp-inplace))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
139 ;; (local-file (file-relative-name
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
140 ;; temp-file
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
141 ;; (file-name-directory buffer-file-name))))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
142 ;; (list "pyflakes" (list local-file))))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
143 ;; (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
144 ;; '("\\.py\\'" flymake-pyflakes-init)))
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
145
f3ab51c79813 adding configuration from https://svn.openplans.org/svn/config_jhammel/
k0s <k0scist@gmail.com>
parents:
diff changeset
146 ;; (add-hook 'find-file-hook 'flymake-find-file-hook)
4
81e89e519980 changed a bunch of stuff, evidently
k0s <k0scist@gmail.com>
parents: 0
diff changeset
147
81e89e519980 changed a bunch of stuff, evidently
k0s <k0scist@gmail.com>
parents: 0
diff changeset
148 (fset 'break "import pdb; pdb.set_trace();\C-a\C-i")
81e89e519980 changed a bunch of stuff, evidently
k0s <k0scist@gmail.com>
parents: 0
diff changeset
149 (add-hook 'python-mode-hook
81e89e519980 changed a bunch of stuff, evidently
k0s <k0scist@gmail.com>
parents: 0
diff changeset
150 '(lambda ()
81e89e519980 changed a bunch of stuff, evidently
k0s <k0scist@gmail.com>
parents: 0
diff changeset
151 (local-set-key [(meta ?p) (meta ?p)] 'break)))
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
152
572
980fd762e354 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 571
diff changeset
153 (fset 'pytodo "raise NotImplementedError('TODO') # -> record TODO items")
571
0dbde82d1c82 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 513
diff changeset
154
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
155 (fset 'python-file "#!/usr/bin/env python
585
1e3b778be7e4 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 572
diff changeset
156 # -*- coding: utf-8 -*-
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
157
589
680071699d35 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 586
diff changeset
158 import argparse
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
159 import os
621
cd51786972c4 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 605
diff changeset
160 import subprocess
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
161 import sys
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
162
658
c2e89dafa397 add __all__
Jeff Hammel <k0scist@gmail.com>
parents: 644
diff changeset
163 __all__ = ['main']
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
164 here = os.path.dirname(os.path.realpath(__file__))
644
b4dc72b7c5c3 string types
Jeff Hammel <k0scist@gmail.com>
parents: 641
diff changeset
165 string = (str, unicode)
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
166
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
167 def main(args=sys.argv[1:]):
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
168
658
c2e89dafa397 add __all__
Jeff Hammel <k0scist@gmail.com>
parents: 644
diff changeset
169 # parse command line
625
e92bd004b906 STUB: .emacs python/example/func_args.py
Jeff Hammel <k0scist@gmail.com>
parents: 621
diff changeset
170 parser = argparse.ArgumentParser(description=__doc__)
633
d37391e845f5 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 625
diff changeset
171 parser.add_argument('input', nargs='?',
d37391e845f5 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 625
diff changeset
172 type=argparse.FileType('r'), default=sys.stdin,
d37391e845f5 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 625
diff changeset
173 help='input file, or read from stdin if ommitted')
586
e14ba4fbc0e7 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 585
diff changeset
174 options = parser.parse_args(args)
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
175
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
176 if __name__ == '__main__':
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
177 main()")
348
6004e00b602d new hg file; TODO: incorporate!
Jeff Hammel <jhammel@mozilla.com>
parents: 347
diff changeset
178 ;; TODO: take directly from MakeItSo
644
b4dc72b7c5c3 string types
Jeff Hammel <k0scist@gmail.com>
parents: 641
diff changeset
179 ;; - makeitso should output .el files from the templates
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
180
513
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
181 (fset 'python-require "def require(url):
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
182 # http://k0s.org/hg/config/file/68635bbb3d3e/python/require.py
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
183 # import a module from the web
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
184 # url should be like scheme://host.name/path/to/module.py
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
185
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
186 import imp
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
187 import os
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
188 import tempfile
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
189 import urllib2
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
190 contents = urllib2.urlopen(url).read()
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
191 filename = url.rsplit('/', 1)[-1]
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
192 module = filename.rsplit('.', 1)[0]
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
193 dest = tempfile.mkstemp(suffix='.py', prefix=module)
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
194 f = file(dest, 'w')
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
195 f.write(contents)
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
196 f.close()
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
197 return imp.load_source(module, dest)
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
198 ")
Jeff Hammel <jhammel@mozilla.com>
parents: 504
diff changeset
199
597
04dfe64d1ba7 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 589
diff changeset
200 (fset 'python-test "#!/usr/bin/env python
359
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
201
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
202 import os
641
15c20cfc6b22 create tmpdir for test as boilerplate
Jeff Hammel <k0scist@gmail.com>
parents: 638
diff changeset
203 import shutil
638
6dedad97c4eb STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 633
diff changeset
204 import tempfile
359
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
205 import unittest
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
206
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
207 here = os.path.dirname(os.path.abspath(__file__))
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
208
621
cd51786972c4 STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 605
diff changeset
209 class Test(unittest.TestCase):
638
6dedad97c4eb STUB: .emacs
Jeff Hammel <k0scist@gmail.com>
parents: 633
diff changeset
210 def test_basic(self):
641
15c20cfc6b22 create tmpdir for test as boilerplate
Jeff Hammel <k0scist@gmail.com>
parents: 638
diff changeset
211 tmpdir = tempfile.mkdtemp()
15c20cfc6b22 create tmpdir for test as boilerplate
Jeff Hammel <k0scist@gmail.com>
parents: 638
diff changeset
212 try:
15c20cfc6b22 create tmpdir for test as boilerplate
Jeff Hammel <k0scist@gmail.com>
parents: 638
diff changeset
213 pass
15c20cfc6b22 create tmpdir for test as boilerplate
Jeff Hammel <k0scist@gmail.com>
parents: 638
diff changeset
214 finally:
15c20cfc6b22 create tmpdir for test as boilerplate
Jeff Hammel <k0scist@gmail.com>
parents: 638
diff changeset
215 shutil.rmtree(tmpdir)
359
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
216
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
217 if __name__ == '__main__':
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
218 unittest.main()
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
219 ")
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
220
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
221
347
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
222 ;;; TODO
c0f0f82f68ea better thing
Jeff Hammel <jhammel@mozilla.com>
parents: 335
diff changeset
223 ; - needless to say, zeitgeist integration
359
07d01606da84 add a macro for mozbase tests
Jeff Hammel <jhammel@mozilla.com>
parents: 348
diff changeset
224 ; - http://pedrokroger.net/2010/07/configuring-emacs-as-a-python-ide-2/