aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2013-11-24 23:23:47 +0200
committerDmitry Gutov2013-11-24 23:23:47 +0200
commitee4f026188438f2531364fb042af91b427c0b944 (patch)
tree9906d9a6dbd4c40e1a4b816df02ecfdf66c78fc5
parent740bcff0c1de06859c8139dd8e23e82aa28401a0 (diff)
downloademacs-ee4f026188438f2531364fb042af91b427c0b944.tar.gz
emacs-ee4f026188438f2531364fb042af91b427c0b944.zip
* lisp/imenu.el (imenu-generic-skip-comments-and-strings):
New option. (imenu--generic-function): Use it. Fixes: debbugs:15560
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/imenu.el11
3 files changed, 20 insertions, 1 deletions
diff --git a/etc/NEWS b/etc/NEWS
index dcb2e614d46..6cff14d2742 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -639,6 +639,10 @@ whether it is safe to use Bash's --noediting option. These days
639+++ 639+++
640** There is a new macro `skip-unless' for skipping ERT tests. See the manual. 640** There is a new macro `skip-unless' for skipping ERT tests. See the manual.
641 641
642** Imenu
643
644*** New option `imenu-generic-skip-comments-and-strings'.
645
642 646
643* New Modes and Packages in Emacs 24.4 647* New Modes and Packages in Emacs 24.4
644 648
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 286a32cbf7d..36c4c6ae4e8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12013-11-24 Dmitry Gutov <dgutov@yandex.ru>
2
3 * imenu.el (imenu-generic-skip-comments-and-strings):
4 New option (Bug#15560).
5 (imenu--generic-function): Use it.
6
12013-11-24 Jorgen Schaefer <contact@jorgenschaefer.de> 72013-11-24 Jorgen Schaefer <contact@jorgenschaefer.de>
2 8
3 * minibuffer.el (completion--in-region-1): Scroll the correct 9 * minibuffer.el (completion--in-region-1): Scroll the correct
diff --git a/lisp/imenu.el b/lisp/imenu.el
index d79b0abeebc..f41fcda2713 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -185,6 +185,13 @@ with name concatenation."
185 :type 'string 185 :type 'string
186 :group 'imenu) 186 :group 'imenu)
187 187
188(defcustom imenu-generic-skip-comments-and-strings t
189 "When non-nil, ignore text inside comments and strings.
190Only affects `imenu--generic-function'."
191 :type 'boolean
192 :group 'imenu
193 :version "24.4")
194
188;;;###autoload 195;;;###autoload
189(defvar imenu-generic-expression nil 196(defvar imenu-generic-expression nil
190 "List of definition matchers for creating an Imenu index. 197 "List of definition matchers for creating an Imenu index.
@@ -796,7 +803,9 @@ depending on PATTERNS."
796 ;; starting with its title (or nil). 803 ;; starting with its title (or nil).
797 (menu (assoc menu-title index-alist))) 804 (menu (assoc menu-title index-alist)))
798 ;; Insert the item unless it is already present. 805 ;; Insert the item unless it is already present.
799 (unless (member item (cdr menu)) 806 (unless (or (member item (cdr menu))
807 (and imenu-generic-skip-comments-and-strings
808 (nth 8 (syntax-ppss))))
800 (setcdr menu 809 (setcdr menu
801 (cons item (cdr menu))))) 810 (cons item (cdr menu)))))
802 ;; Go to the start of the match, to make sure we 811 ;; Go to the start of the match, to make sure we