forked from technomancy/emacs-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtopfunky-js.el
28 lines (25 loc) · 934 Bytes
/
topfunky-js.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;; DESCRIPTION:
;; Useful patterns for using the ido menu with Javascript files.
;;
;; AUTHOR:
;; Geoffrey Grosenbach http://peepcode.com
;;
;; Matches things like:
;;
;; function bacon() {} // Standard function
;; getJSON: function () {} // Function as a key in a hash
;; this.post = function () {} // Instance method in a function
;; var MyObj = { ... // Capitalized variable object
;;
;; USAGE:
;; (require 'topfunky-js)
(setq topfunky-js-imenu-generic-expression
'(("Named Function" "function\\s-+\\(\\w+\\)\\s-*(" 1)
("Hash Method" "^\\s-*\\(\\w+\\):\\s-*function\\s-*(" 1)
("Instance Method" "this\.\\(\\w+\\)\\s-*=\\s-*function\\s-*(" 1)
("Variable as Class" "var \\([A-Z]+\\w+\\) = {" 1)
))
(add-hook 'javascript-mode-hook
(lambda ()
(setq imenu-generic-expression topfunky-js-imenu-generic-expression)))
(provide 'topfunky-js)