branch: elpa/d-mode
commit 2b486565a5d35652660c660347ba517627036e32
Author: Vladimir Panteleev <[email protected]>
Commit: Vladimir Panteleev <[email protected]>
Simplify c-forward-decl-or-cast-1 advice
---
d-mode.el | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index e36ebfe..23341f1 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: 201911111348
+;; Version: 201911111350
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "25.1"))
@@ -637,6 +637,18 @@ operators."
(or (eq context 'top) make-top)))))
+(defun d-around--c-forward-decl-or-cast-1 (orig-fun &rest args)
+ ;; checkdoc-params: (orig-fun args)
+ "Advice function for patching D support into cc-mode."
+ (apply
+ (if (c-major-mode-is 'd-mode)
+ #'d-forward-decl-or-cast-1
+ orig-fun)
+ args))
+(advice-add 'c-forward-decl-or-cast-1 :around
#'d-around--c-forward-decl-or-cast-1)
+
+;----------------------------------------------------------------------------
+
(defun d-forward-identifier ()
"Advance point by one D identifier."
(when (and (not (looking-at c-keywords-regexp))
@@ -696,20 +708,6 @@ declaration (or follow the argument list, in case of
functions)."
;;----------------------------------------------------------------------------
-(defun d-around--c-forward-decl-or-cast-1 (orig-fun &rest args)
- ;; checkdoc-params: (orig-fun args)
- "Advice function for fixing cc-mode handling of D constructors."
- (cond
- ((not (c-major-mode-is 'd-mode))
- (apply orig-fun args))
-
- (t
- (apply #'d-forward-decl-or-cast-1 args))))
-
-(advice-add 'c-forward-decl-or-cast-1 :around
#'d-around--c-forward-decl-or-cast-1)
-
-;;----------------------------------------------------------------------------
-
(defun d-around--c-get-fontification-context (orig-fun match-pos &rest args)
;; checkdoc-params: (orig-fun match-pos args)
"Advice function for fixing cc-mode handling of D lambda parameter lists."