[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109447: In Imenu, don't show defvars
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109447: In Imenu, don't show defvars with no second argument. |
Date: |
Sun, 05 Aug 2012 22:14:54 +0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109447
fixes bug: http://debbugs.gnu.org/8638
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2012-08-05 22:14:54 +0800
message:
In Imenu, don't show defvars with no second argument.
* lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Don't
show defvars which have no second argument.
* lisp/imenu.el (imenu-generic-expression): Move documentation here
from imenu--generic-function.
(imenu--generic-function): Refer to imenu-generic-expression.
modified:
lisp/ChangeLog
lisp/emacs-lisp/lisp-mode.el
lisp/imenu.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-08-05 08:52:45 +0000
+++ b/lisp/ChangeLog 2012-08-05 14:14:54 +0000
@@ -1,3 +1,12 @@
+2012-08-05 Chong Yidong <address@hidden>
+
+ * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Don't
+ show defvars which have no second argument (Bug#8638).
+
+ * imenu.el (imenu-generic-expression): Move documentation here
+ from imenu--generic-function.
+ (imenu--generic-function): Refer to imenu-generic-expression.
+
2012-08-05 Vegard Øye <address@hidden> (tiny change)
* emulation/viper-init.el (viper-deflocalvar): Add docstring and
=== modified file 'lisp/emacs-lisp/lisp-mode.el'
--- a/lisp/emacs-lisp/lisp-mode.el 2012-07-26 01:27:33 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el 2012-08-05 14:14:54 +0000
@@ -117,10 +117,15 @@
(purecopy (concat "^\\s-*("
(eval-when-compile
(regexp-opt
- '("defvar" "defconst" "defconstant" "defcustom"
+ '("defconst" "defconstant" "defcustom"
"defparameter" "define-symbol-macro") t))
"\\s-+\\(\\(\\sw\\|\\s_\\)+\\)"))
2)
+ ;; For `defvar', we ignore (defvar FOO) constructs.
+ (list (purecopy "Variables")
+ (purecopy (concat "^\\s-*(defvar\\s-+\\(\\(\\sw\\|\\s_\\)+\\)"
+ "[[:space:]\n]+[^)]"))
+ 1)
(list (purecopy "Types")
(purecopy (concat "^\\s-*("
(eval-when-compile
=== modified file 'lisp/imenu.el'
--- a/lisp/imenu.el 2012-07-10 11:51:54 +0000
+++ b/lisp/imenu.el 2012-08-05 14:14:54 +0000
@@ -187,16 +187,39 @@
;;;###autoload
(defvar imenu-generic-expression nil
- "The regex pattern to use for creating a buffer index.
+ "List of definition matchers for creating an Imenu index.
+Each element of this list should have the form
+
+ (MENU-TITLE REGEXP INDEX [FUNCTION] [ARGUMENTS...])
+
+MENU-TITLE should be nil (in which case the matches for this
+element are put in the top level of the buffer index) or a
+string (which specifies the title of a submenu into which the
+matches are put).
+REGEXP is a regular expression matching a definition construct
+which is to be displayed in the menu. REGEXP may also be a
+function, called without arguments. It is expected to search
+backwards. It must return true and set `match-data' if it finds
+another element.
+INDEX is an integer specifying which subexpression of REGEXP
+matches the definition's name; this subexpression is displayed as
+the menu item.
+FUNCTION, if present, specifies a function to call when the index
+item is selected by the user. This function is called with
+arguments consisting of the item name, the buffer position, and
+the ARGUMENTS.
+
+The variable `imenu-case-fold-search' determines whether or not
+the regexp matches are case sensitive, and `imenu-syntax-alist'
+can be used to alter the syntax table for the search.
If non-nil this pattern is passed to `imenu--generic-function' to
-create a buffer index. Look there for the documentation of this
-pattern's structure.
+create a buffer index.
-For example, see the value of `fortran-imenu-generic-expression' used by
-`fortran-mode' with `imenu-syntax-alist' set locally to give the
-characters which normally have \"symbol\" syntax \"word\" syntax
-during matching.")
+For example, see the value of `fortran-imenu-generic-expression'
+used by `fortran-mode' with `imenu-syntax-alist' set locally to
+give the characters which normally have \"symbol\" syntax
+\"word\" syntax during matching.")
;;;###autoload(put 'imenu-generic-expression 'risky-local-variable t)
;;;###autoload
@@ -694,46 +717,16 @@
;; so it needs to be careful never to loop!
(defun imenu--generic-function (patterns)
"Return an index alist of the current buffer based on PATTERNS.
-
-PATTERNS is an alist with elements that look like this:
- (MENU-TITLE REGEXP INDEX)
-or like this:
- (MENU-TITLE REGEXP INDEX FUNCTION ARGUMENTS...)
-with zero or more ARGUMENTS. The former format creates a simple
-element in the index alist when it matches; the latter creates a
-special element of the form (INDEX-NAME POSITION-MARKER FUNCTION
-ARGUMENTS...) with FUNCTION and ARGUMENTS copied from PATTERNS.
-
-MENU-TITLE is a string used as the title for the submenu or nil
-if the entries are not nested.
-
-REGEXP is a regexp that should match a construct in the buffer
-that is to be displayed in the menu; i.e., function or variable
-definitions, etc. It contains a substring which is the name to
-appear in the menu. See the info section on Regexps for more
-information. REGEXP may also be a function, called without
-arguments. It is expected to search backwards. It shall return
-true and set `match-data' if it finds another element.
-
-INDEX points to the substring in REGEXP that contains the
-name (of the function, variable or type) that is to appear in the
-menu.
-
-The variable `imenu-case-fold-search' determines whether or not the
-regexp matches are case sensitive, and `imenu-syntax-alist' can be
-used to alter the syntax table for the search.
-
-See `lisp-imenu-generic-expression' for an example of PATTERNS.
-
-Returns an index of the current buffer as an alist. The elements in
-the alist look like:
+PATTERNS should be an alist which has the same form as
+`imenu-generic-expression'.
+
+The return value is an alist of the form
(INDEX-NAME . INDEX-POSITION)
-or like:
+or
(INDEX-NAME INDEX-POSITION FUNCTION ARGUMENTS...)
-They may also be nested index alists like:
+The return value may also consist of nested index alists like:
(INDEX-NAME . INDEX-ALIST)
depending on PATTERNS."
-
(let ((index-alist (list 'dummy))
(case-fold-search (if (or (local-variable-p 'imenu-case-fold-search)
(not (local-variable-p 'font-lock-defaults)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109447: In Imenu, don't show defvars with no second argument.,
Chong Yidong <=