annotate .elisp/settings/50.localfuncs.el @ 99:26450200777a

Latest textmate.el
author Augie Fackler <durin42@gmail.com>
date Sun, 03 May 2009 22:46:07 -0500
parents 8aa70b521063
children 67bfc48b2a61
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
1 (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
2 (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
3 (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
4 (file-name-directory buffer-file-name)
96
0eabfd7a8ffa Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents: 91
diff changeset
5 "; pyflakes " (file-name-nondirectory
0eabfd7a8ffa Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents: 91
diff changeset
6 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
7 nil
075b45c5aecc cd to the file dir before running pyflakes to make output less verbose.
Augie Fackler <durin42@gmail.com>
parents: 89
diff changeset
8 (lambda (mode) "*pyflakes*")))
96
0eabfd7a8ffa Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents: 91
diff changeset
9
0eabfd7a8ffa Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents: 91
diff changeset
10
98
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
11 (defun ido-imenu ()
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
12 "Update the imenu index and then use ido to select a symbol to navigate to.
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
13 Symbols matching the text at point are put first in the completion list."
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
14 (interactive)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
15 (imenu--make-index-alist)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
16 (let ((name-and-pos '())
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
17 (symbol-names '()))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
18 (flet ((addsymbols (symbol-list)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
19 (when (listp symbol-list)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
20 (dolist (symbol symbol-list)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
21 (let ((name nil) (position nil))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
22 (cond
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
23 ((and (listp symbol) (imenu--subalist-p symbol))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
24 (addsymbols symbol))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
25
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
26 ((listp symbol)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
27 (setq name (car symbol))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
28 (setq position (cdr symbol)))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
29
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
30 ((stringp symbol)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
31 (setq name symbol)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
32 (setq position (get-text-property 1 'org-imenu-marker symbol))))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
33
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
34 (unless (or (null position) (null name))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
35 (add-to-list 'symbol-names name)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
36 (add-to-list 'name-and-pos (cons name position))))))))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
37 (addsymbols imenu--index-alist))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
38 ;; If there are matching symbols at point, put them at the beginning of `symbol-names'.
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
39 (let ((symbol-at-point (thing-at-point 'symbol)))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
40 (when symbol-at-point
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
41 (let* ((regexp (concat (regexp-quote symbol-at-point) "$"))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
42 (matching-symbols (delq nil (mapcar (lambda (symbol)
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
43 (if (string-match regexp symbol) symbol))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
44 symbol-names))))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
45 (when matching-symbols
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
46 (sort matching-symbols (lambda (a b) (> (length a) (length b))))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
47 (mapc (lambda (symbol) (setq symbol-names (cons symbol (delete symbol symbol-names))))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
48 matching-symbols)))))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
49 (let* ((selected-symbol (ido-completing-read "Symbol? " symbol-names))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
50 (position (cdr (assoc selected-symbol name-and-pos))))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
51 (goto-char position))))
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
52
8aa70b521063 Jump-to-function trick with IDO.
Augie Fackler <durin42@gmail.com>
parents: 96
diff changeset
53
96
0eabfd7a8ffa Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents: 91
diff changeset
54 (defun fullscreen ()
0eabfd7a8ffa Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents: 91
diff changeset
55 (interactive)
0eabfd7a8ffa Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents: 91
diff changeset
56 (set-frame-parameter nil 'fullscreen
0eabfd7a8ffa Add a fullscreen function, cleanup.
Augie Fackler <durin42@gmail.com>
parents: 91
diff changeset
57 (if (frame-parameter nil 'fullscreen) nil 'fullboth)))