branch: elpa/d-mode
commit 07cb4d01d5f6d4708924997b4543a126a88a27ef
Author: Vladimir Panteleev <[email protected]>
Commit: Vladimir Panteleev <[email protected]>
Add d-lineup-arglists
Fixes #70, hopefully without side effects.
---
d-mode-test.el | 1 +
d-mode.el | 19 ++++++++++++++++++-
tests/I0070.d | 6 ++++++
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/d-mode-test.el b/d-mode-test.el
index dd1f7f8..50f206c 100644
--- a/d-mode-test.el
+++ b/d-mode-test.el
@@ -316,6 +316,7 @@ is expected to succeed, and nil otherwise."
(d-test-deftest i0064 "tests/I0064.d" t)
(d-test-deftest i0067 "tests/I0067.d" (version< "24.4" emacs-version))
(d-test-deftest i0069 "tests/I0069.txt" t)
+(d-test-deftest i0070 "tests/I0070.d" (version< "24.4" emacs-version))
(d-test-deftest i0072 "tests/I0072.txt" t)
(d-test-deftest i0090 "tests/I0090.d" t)
diff --git a/d-mode.el b/d-mode.el
index 8d5370c..02579f9 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: 201908290919
+;; Version: 201908291019
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "24.3"))
@@ -1134,6 +1134,23 @@ parameters in function calls." ;; checkdoc-params:
langelem
;;----------------------------------------------------------------------------
+(defun d-lineup-arglists (elem)
+ "Line up runtime argument list with compile-time argument list.
+
+Works with: func-decl-cont." ;; checkdoc-params: (elem)
+ (save-excursion
+ (beginning-of-line)
+ (c-backward-syntactic-ws)
+ (let ((c (char-before)))
+ (cond
+ ((eq c ?\))
+ (c-go-list-backward)
+ (vector (current-column)))
+ (t
+ "+")))))
+
+;;----------------------------------------------------------------------------
+
(provide 'd-mode)
;;; d-mode.el ends here
diff --git a/tests/I0070.d b/tests/I0070.d
new file mode 100644
index 0000000..e9bb6df
--- /dev/null
+++ b/tests/I0070.d
@@ -0,0 +1,6 @@
+// #run: (progn (c-set-offset 'func-decl-cont #'d-lineup-arglists)
(d-test-indent))
+
+auto foo(A, B, C)
+ (A a, B b, C c)
+{
+}