branch: elpa/d-mode
commit d14a00100398d8a1ad7e18f9079abfd241bbb248
Author: Vladimir Panteleev <[email protected]>
Commit: Vladimir Panteleev <[email protected]>
Fix imenu false positive for static imports
---
d-mode.el | 21 ++++++++++++---------
tests/imenu.d | 2 ++
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index 5de4b2a..64f9459 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: 201909092109
+;; Version: 201909092113
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "25.1"))
@@ -609,17 +609,20 @@ Each list item should be a regexp matching a single
identifier."
((memq next-char '(?\; ?= ?,))
"Variables")
((memq next-char '(?\())
- nil) ; function
+ t) ; function
+ ((equal name "import")
+ nil) ; static import
(t ; unknown
id-prev-token))))
- (setq last-spot (car decl-or-cast)
- d-spots
- (cons
- (if kind
- (list kind (cons name (car decl-or-cast)))
- (cons name (car decl-or-cast)))
- d-spots))))))))
+ (when kind
+ (setq last-spot (car decl-or-cast)
+ d-spots
+ (cons
+ (if (eq kind t)
+ (cons name (car decl-or-cast))
+ (list kind (cons name (car decl-or-cast))))
+ d-spots)))))))))
(nreverse d-spots)))
;;----------------------------------------------------------------------------
diff --git a/tests/imenu.d b/tests/imenu.d
index 8af5f7a..0b49bb5 100644
--- a/tests/imenu.d
+++ b/tests/imenu.d
@@ -97,3 +97,5 @@ void run(Parameter!("foo()") command) {}
Parameter!("foo()") run(string command) {}
string[string] environment;
+
+static import std.process;