]> code.delx.au - gnu-emacs-elpa/commitdiff
Add comments
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 3 Jun 2012 01:29:55 +0000 (05:29 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 3 Jun 2012 01:48:34 +0000 (05:48 +0400)
js2-imenu-extras.el

index 32bfce31cafc21e8a492e94c4d1676d885d84bc3..f6a0d2f06e47ade9e3a55b294d2fcff8d015b95e 100644 (file)
@@ -1,3 +1,37 @@
+;;; js2-imenu-extras.el --- Imenu support for additional constructs\r
+\r
+;; Author:    Dmitry Gutov <dgutov@yandex.ru>\r
+;; Keywords:  languages, javascript, imenu\r
+\r
+;; This file is part of GNU Emacs.\r
+\r
+;; GNU Emacs is free software: you can redistribute it and/or modify\r
+;; it under the terms of the GNU General Public License as published by\r
+;; the Free Software Foundation, either version 3 of the License, or\r
+;; (at your option) any later version.\r
+\r
+;; GNU Emacs is distributed in the hope that it will be useful,\r
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+;; GNU General Public License for more details.\r
+\r
+;; You should have received a copy of the GNU General Public License\r
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.\r
+\r
+;;; Commentary:\r
+\r
+;; This package adds Imenu support for additional framework constructs and\r
+;; general patterns to `js2-mode'.\r
+\r
+;; Usage:\r
+\r
+;; (eval-after-load 'js2-mode\r
+;;   (require 'js2-imenu-extras)\r
+;;   (js2-imenu-extras-setup))\r
+\r
+;; To customize how it works:\r
+;;   M-x customize-group RET js2-imenu RET\r
+\r
 (eval-when-compile\r
   (require 'cl))\r
 \r
 \r
     (:framework backbone\r
      :call-re   ,(concat "\\_<" js2-mode-identifier-re "\\.extend\\s-*(")\r
-     :recorder  js2-imenu-record-backbone-extend)))\r
+     :recorder  js2-imenu-record-backbone-extend))\r
+  "List of JavaScript class definition or extension styles.\r
+\r
+:framework is a valid value in `js2-imenu-enabled-frameworks.\r
+\r
+:call-re is a regular expression that has no capturing groups.\r
+\r
+:recorder is a function name that will be called when the regular\r
+expression matches some text in the buffer.  When it's called, point will be\r
+at the end of the match.  The function must keep the point position.")\r
 \r
 (defconst js2-imenu-available-frameworks\r
   (mapcar (lambda (style) (plist-get style :framework)) js2-imenu-extension-styles)\r
   "Frameworks to be recognized by `js2-mode'."\r
   :type (cons 'set (mapcar (lambda (x) (list 'const x))\r
                            js2-imenu-available-frameworks))\r
-  :group 'js2-mode)\r
+  :group 'js2-imenu)\r
 \r
 (defcustom js2-imenu-show-other-functions t\r
   "Non-nil to show functions not recognized by other mechanisms,\r
 in a shared namespace."\r
   :type 'boolean\r
-  :group 'js2-mode)\r
+  :group 'js2-imenu)\r
 \r
 (defcustom js2-imenu-other-functions-ns "?"\r
   "Namespace name to use for other functions."\r
   :type 'string\r
-  :group 'js2-mode)\r
+  :group 'js2-imenu)\r
 \r
 (defcustom js2-imenu-show-module-pattern t\r
   "Non-nil to recognize the module pattern:\r
@@ -51,8 +94,9 @@ var foobs = (function(a) {
 We record the returned hash as belonging to the named module, and\r
 prefix any functions defined inside the IIFE with the module name."\r
   :type 'boolean\r
-  :group 'js2-mode)\r
+  :group 'js2-imenu)\r
 \r
+;;;###autoload\r
 (defun js2-imenu-extras-setup ()\r
   (when js2-imenu-enabled-frameworks\r
     (add-to-list 'js2-post-parse-callbacks 'js2-imenu-record-declarations t))\r