branch: elpa/d-mode
commit f3843276e235c6b633ba5367f78d74fe7c04e244
Author: Vladimir Panteleev <[email protected]>
Commit: Vladimir Panteleev <[email protected]>
Fix imenu with typename ending with keyword
---
d-mode.el | 6 ++++--
tests/imenu.d | 10 +++++++++-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index f714093..f8211cd 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -7,7 +7,7 @@
;; Maintainer: Russel Winder <[email protected]>
;; Vladimir Panteleev <[email protected]>
;; Created: March 2007
-;; Version: 201812050604
+;; Version: 201908262243
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "24.3"))
@@ -556,7 +556,9 @@ Each list item should be a regexp matching a single
identifier."
(while (let ((type (match-string 1)))
(and pt type
(save-match-data
- (string-match (c-lang-const c-regular-keywords-regexp)
type))))
+ (string-match
+ (concat "\\<" (c-lang-const c-regular-keywords-regexp))
+ type))))
(setq pt (re-search-backward d-imenu-method-name-pattern nil t)))
pt)
;; Do not count invisible definitions.
diff --git a/tests/imenu.d b/tests/imenu.d
index 07c959d..9559331 100644
--- a/tests/imenu.d
+++ b/tests/imenu.d
@@ -1,5 +1,5 @@
// #run: (d-test-get-imenu-lines)
-// #out: (4 6 11 14 17 19 22 25 33 34 37 40 43 46 49 52 54 56)
+// #out: (4 6 11 14 17 19 22 25 33 34 37 40 43 46 49 52 54 56 67)
void foo(int x) {}
@@ -62,3 +62,11 @@ void test()
/**
a a (a) aaaaaaaaaaaaaaaaaaaaaaaaaaaa
*/
+
+// Type name ends with a keyword ("try")
+Entry getLog()
+{
+ static if(x) {
+ return foo(x);
+ }
+}