branch: elpa/d-mode
commit d7f46a28aca981e719d12460bf9b71e355d79565
Author: Vladimir Panteleev <[email protected]>
Commit: Vladimir Panteleev <[email protected]>
Add aliases to imenu
---
d-mode.el | 42 +++++++++++++++++++++++++++++++++++++++++-
tests/imenu.d | 11 ++++++++++-
2 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index 840b7a1..89ef834 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: 201610111950
+;; Version: 201610111956
;; Keywords: D programming language emacs cc-mode
;;;; NB Version number is date and time yyyymmddhhMM UTC.
@@ -638,6 +638,46 @@ The expression is added to
`compilation-error-regexp-alist' and
(zero-or-more (any " \t\n"))
(or ":" "{"))
1)
+ ;; NB: We can't easily distinguish aliases declared outside
+ ;; functions from local ones, so just search for those that are
+ ;; declared at the beginning of lines.
+ ("*Aliases*"
+ ,(rx
+ line-start
+ "alias"
+ (one-or-more (syntax whitespace))
+ (submatch
+ (one-or-more
+ (any ?_
+ (?0 . ?9)
+ (?A . ?Z)
+ (?a . ?z))))
+ (zero-or-more (syntax whitespace))
+ "=")
+ 1)
+ ("*Aliases*"
+ ,(rx
+ line-start
+ "alias"
+ (one-or-more (syntax whitespace))
+ (one-or-more
+ (not (any ";")))
+ (one-or-more (syntax whitespace))
+ (submatch
+ (one-or-more
+ (any ?_
+ (?0 . ?9)
+ (?A . ?Z)
+ (?a . ?z))))
+ (zero-or-more (syntax whitespace))
+ ";"
+ (zero-or-more (syntax whitespace))
+ (or
+ eol
+ "//"
+ "/*")
+ )
+ 1)
(nil d-imenu-method-index-function 2)))
;;----------------------------------------------------------------------------
diff --git a/tests/imenu.d b/tests/imenu.d
index 3ab7dab..4743bdc 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)
+// #out: (4 6 11 14 17 19 22 25 33 34 37 40 43 46 49 52 54 56)
void foo(int x) {}
@@ -48,3 +48,12 @@ private final class C
public struct S
{}
+
+alias xmlParse = parseDocument!XmlParseConfig;
+
+alias parseDocument!XmlParseConfig xmlParse;
+
+void test()
+{
+ alias foo = bar;
+}