comparison .elisp/settings/50.localfuncs.el @ 141:e30655eb7050

textmate.el: synced with upstream Includes discovering that ido-imenu was a better textmate-goto-symbol and support for excluding files from grepping that are otherwise tracked in VCS. Useful for symlinks to large trees, and other such things.
author Augie Fackler <durin42@gmail.com>
date Tue, 15 Sep 2009 20:28:22 -0400
parents 34b698771af9
children 36a4e4b0f9c3
comparison
equal deleted inserted replaced
140:7fa84e297c84 141:e30655eb7050
4 (file-name-directory buffer-file-name) 4 (file-name-directory buffer-file-name)
5 "; pyflakes " (file-name-nondirectory 5 "; pyflakes " (file-name-nondirectory
6 buffer-file-name)) 6 buffer-file-name))
7 nil 7 nil
8 (lambda (mode) "*pyflakes*"))) 8 (lambda (mode) "*pyflakes*")))
9
10
11 (defun ido-imenu ()
12 "Update the imenu index and then use ido to select a symbol to navigate to.
13 Symbols matching the text at point are put first in the completion list."
14 (interactive)
15 (imenu--make-index-alist)
16 (let ((name-and-pos '())
17 (symbol-names '()))
18 (flet ((addsymbols (symbol-list)
19 (when (listp symbol-list)
20 (dolist (symbol symbol-list)
21 (let ((name nil) (position nil))
22 (cond
23 ((and (listp symbol) (imenu--subalist-p symbol))
24 (addsymbols symbol))
25
26 ((listp symbol)
27 (setq name (car symbol))
28 (setq position (cdr symbol)))
29
30 ((stringp symbol)
31 (setq name symbol)
32 (setq position (get-text-property 1 'org-imenu-marker symbol))))
33
34 (unless (or (null position) (null name))
35 (add-to-list 'symbol-names name)
36 (add-to-list 'name-and-pos (cons name position))))))))
37 (addsymbols imenu--index-alist))
38 ;; If there are matching symbols at point, put them at the beginning of `symbol-names'.
39 (let ((symbol-at-point (thing-at-point 'symbol)))
40 (when symbol-at-point
41 (let* ((regexp (concat (regexp-quote symbol-at-point) "$"))
42 (matching-symbols (delq nil (mapcar (lambda (symbol)
43 (if (string-match regexp symbol) symbol))
44 symbol-names))))
45 (when matching-symbols
46 (sort matching-symbols (lambda (a b) (> (length a) (length b))))
47 (mapc (lambda (symbol) (setq symbol-names (cons symbol (delete symbol symbol-names))))
48 matching-symbols)))))
49 (let* ((selected-symbol (ido-completing-read "Symbol? " symbol-names))
50 (position (cdr (assoc selected-symbol name-and-pos))))
51 (goto-char position))))
52
53 9
54 (defun fullscreen () 10 (defun fullscreen ()
55 (interactive) 11 (interactive)
56 (set-frame-parameter nil 'fullscreen 12 (set-frame-parameter nil 'fullscreen
57 (if (frame-parameter nil 'fullscreen) nil 'fullboth))) 13 (if (frame-parameter nil 'fullscreen) nil 'fullboth)))