Mercurial > dotfiles
annotate .elisp/settings/50.localfuncs.el @ 166:1f6d35a7a197
emacs: scrollbars on the right
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 14 Dec 2009 11:32:16 -0600 |
parents | 36a4e4b0f9c3 |
children | cd4e645d1207 |
rev | line source |
---|---|
158
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
1 (defun af-generic-diff-repo () |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
2 (interactive) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
3 (let ((root (textmate-project-root))) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
4 (cd root) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
5 (hg-view-output |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
6 ((format "project diff for %s" root)) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
7 (call-process (textmate-project-root-type root) nil t nil "diff") |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
8 (diff-mode) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
9 (setq diff (not (= (point-min) (point-max)))) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
10 (font-lock-fontify-buffer) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
11 (cd root)))) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
12 (global-set-key [(control c)(t)(=)] 'af-generic-diff-repo) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
13 (global-set-key [(control c)(d)] 'af-generic-diff-repo) |
36a4e4b0f9c3
localfuncs: smart multi-vcs diff command
Augie Fackler <durin42@gmail.com>
parents:
141
diff
changeset
|
14 |
89
f34d90569fdc
Add a file for local functions not yet extracted into a module. Includes a function to run pyflakes on the current buffer.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 (defun pyflakes-this-buffer () |
f34d90569fdc
Add a file for local functions not yet extracted into a module. Includes a function to run pyflakes on the current buffer.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 (interactive) |
91
075b45c5aecc
cd to the file dir before running pyflakes to make output less verbose.
Augie Fackler <durin42@gmail.com>
parents:
89
diff
changeset
|
17 (compilation-start (concat "cd " |
075b45c5aecc
cd to the file dir before running pyflakes to make output less verbose.
Augie Fackler <durin42@gmail.com>
parents:
89
diff
changeset
|
18 (file-name-directory buffer-file-name) |
96
0eabfd7a8ffa
Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents:
91
diff
changeset
|
19 "; pyflakes " (file-name-nondirectory |
0eabfd7a8ffa
Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents:
91
diff
changeset
|
20 buffer-file-name)) |
91
075b45c5aecc
cd to the file dir before running pyflakes to make output less verbose.
Augie Fackler <durin42@gmail.com>
parents:
89
diff
changeset
|
21 nil |
075b45c5aecc
cd to the file dir before running pyflakes to make output less verbose.
Augie Fackler <durin42@gmail.com>
parents:
89
diff
changeset
|
22 (lambda (mode) "*pyflakes*"))) |
96
0eabfd7a8ffa
Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents:
91
diff
changeset
|
23 |
0eabfd7a8ffa
Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents:
91
diff
changeset
|
24 (defun fullscreen () |
0eabfd7a8ffa
Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents:
91
diff
changeset
|
25 (interactive) |
0eabfd7a8ffa
Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents:
91
diff
changeset
|
26 (set-frame-parameter nil 'fullscreen |
0eabfd7a8ffa
Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents:
91
diff
changeset
|
27 (if (frame-parameter nil 'fullscreen) nil 'fullboth))) |
117
67bfc48b2a61
Function for removing a file from Mercurial.
Augie Fackler <durin42@gmail.com>
parents:
98
diff
changeset
|
28 |
67bfc48b2a61
Function for removing a file from Mercurial.
Augie Fackler <durin42@gmail.com>
parents:
98
diff
changeset
|
29 |
67bfc48b2a61
Function for removing a file from Mercurial.
Augie Fackler <durin42@gmail.com>
parents:
98
diff
changeset
|
30 (defun hg-rm-this-file () |
67bfc48b2a61
Function for removing a file from Mercurial.
Augie Fackler <durin42@gmail.com>
parents:
98
diff
changeset
|
31 (interactive) |
124
2ae20e96f6c0
Should really shell quote this arg.
Augie Fackler <durin42@gmail.com>
parents:
117
diff
changeset
|
32 (shell-command-to-string (concat "hg rm " (shell-quote-argument buffer-file-name)))) |
125
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
33 |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
34 ;; Lifted from http://code.google.com/p/ergoemacs/ |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
35 (defun select-text-in-quote () |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
36 "Select text between the nearest left and right delimiters. |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
37 Delimiters are paired characters: ()[]<>«»“”‘’「」, including \"\"." |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
38 (interactive) |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
39 (let (b1 b2) |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
40 (skip-chars-backward "^<>(“{[「«\"‘") |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
41 (setq b1 (point)) |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
42 (skip-chars-forward "^<>)”}]」»\"’") |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
43 (setq b2 (point)) |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
44 (set-mark b1) |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
45 ) |
15bcc3e0afeb
Function for selecting text inside of a quote pair.
Augie Fackler <durin42@gmail.com>
parents:
124
diff
changeset
|
46 ) |
126 | 47 |
48 ;; Most of this was extracted from show-paren-function in paren.el from an emacs 23 nightly | |
49 ;; Also, it seems like this really ought to be builtin, but I can't find it. | |
50 (defun bounce-to-other-paren () | |
51 (interactive) | |
52 (let ((oldpos (point)) | |
53 (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1) | |
54 ((eq (syntax-class (syntax-after (point))) 4) 1))) | |
55 pos mismatch face) | |
56 ;; | |
57 ;; Find the other end of the sexp. | |
58 (when dir | |
59 (save-excursion | |
60 (save-restriction | |
61 ;; Determine the range within which to look for a match. | |
62 (when blink-matching-paren-distance | |
63 (narrow-to-region | |
64 (max (point-min) (- (point) blink-matching-paren-distance)) | |
65 (min (point-max) (+ (point) blink-matching-paren-distance)))) | |
66 ;; Scan across one sexp within that range. | |
67 ;; Errors or nil mean there is a mismatch. | |
68 (condition-case () | |
69 (setq pos (scan-sexps (point) dir)) | |
70 (error (setq pos t mismatch t))) | |
71 ;; Move back the other way and verify we get back to the | |
72 ;; starting point. If not, these two parens don't really match. | |
73 ;; Maybe the one at point is escaped and doesn't really count. | |
74 (when (integerp pos) | |
75 (unless (condition-case () | |
76 (eq (point) (scan-sexps pos (- dir))) | |
77 (error nil)) | |
78 (setq pos nil))) | |
79 ))) | |
80 ;; Highlight the other end of the sexp, or unhighlight if none. | |
81 (if (and pos (integerp pos)) | |
82 (goto-char pos) | |
83 (message "No matching other paren found.") | |
84 ))) |