emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115213: * lisp/imenu.el (imenu-generic-skip-comment


From: Dmitry Gutov
Subject: [Emacs-diffs] trunk r115213: * lisp/imenu.el (imenu-generic-skip-comments-and-strings):
Date: Sun, 24 Nov 2013 21:24:11 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115213
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15560
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Sun 2013-11-24 23:23:47 +0200
message:
  * lisp/imenu.el (imenu-generic-skip-comments-and-strings):
  New option.
  (imenu--generic-function): Use it.
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/imenu.el                  imenu.el-20091113204419-o5vbwnq5f7feedwu-696
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-11-24 18:28:33 +0000
+++ b/etc/NEWS  2013-11-24 21:23:47 +0000
@@ -639,6 +639,10 @@
 +++
 ** There is a new macro `skip-unless' for skipping ERT tests.  See the manual.
 
+** Imenu
+
+*** New option `imenu-generic-skip-comments-and-strings'.
+
 
 * New Modes and Packages in Emacs 24.4
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-11-24 14:08:02 +0000
+++ b/lisp/ChangeLog    2013-11-24 21:23:47 +0000
@@ -1,3 +1,9 @@
+2013-11-24  Dmitry Gutov  <address@hidden>
+
+       * imenu.el (imenu-generic-skip-comments-and-strings):
+       New option (Bug#15560).
+       (imenu--generic-function): Use it.
+
 2013-11-24  Jorgen Schaefer  <address@hidden>
 
        * minibuffer.el (completion--in-region-1): Scroll the correct

=== modified file 'lisp/imenu.el'
--- a/lisp/imenu.el     2013-02-28 17:15:08 +0000
+++ b/lisp/imenu.el     2013-11-24 21:23:47 +0000
@@ -185,6 +185,13 @@
   :type 'string
   :group 'imenu)
 
+(defcustom imenu-generic-skip-comments-and-strings t
+  "When non-nil, ignore text inside comments and strings.
+Only affects `imenu--generic-function'."
+  :type 'boolean
+  :group 'imenu
+  :version "24.4")
+
 ;;;###autoload
 (defvar imenu-generic-expression nil
   "List of definition matchers for creating an Imenu index.
@@ -796,7 +803,9 @@
                      ;; starting with its title (or nil).
                      (menu (assoc menu-title index-alist)))
                  ;; Insert the item unless it is already present.
-                 (unless (member item (cdr menu))
+                 (unless (or (member item (cdr menu))
+                              (and imenu-generic-skip-comments-and-strings
+                                   (nth 8 (syntax-ppss))))
                    (setcdr menu
                            (cons item (cdr menu)))))
                ;; Go to the start of the match, to make sure we


reply via email to

[Prev in Thread] Current Thread [Next in Thread]