branch: elpa/d-mode
commit 5abe29dafca098051660de187b594261a4634693
Author: Vladimir Panteleev <[email protected]>
Commit: Vladimir Panteleev <[email protected]>
Consolidate c-forward-decl-or-cast-1 c-forward-name patch
---
d-mode.el | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index 31eae77..7277088 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: 201911081530
+;; Version: 201911081535
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "25.1"))
@@ -455,16 +455,15 @@ operators."
;; Make it so that inside c-forward-decl-or-cast-1,
;; "this" looks like a function identifier but not a type identifier.
-(defun d-special-case-c-forward-name (orig-fun &rest args)
- ;; checkdoc-params: (orig-fun args)
- "Advice function for fixing cc-mode handling of D constructors."
+(defun d-forward-name ()
+ "Wraps `c-forward-name' for d-mode.
+
+Fixes cc-mode handling of D constructors."
(if (not (looking-at (d-make-keywords-re t '("this" "~this"))))
- (apply orig-fun args)
+ (c-forward-name)
(goto-char (match-end 1))
t))
-(defsubst d-forward-name () "Shorthand." (d-special-case-c-forward-name
#'c-forward-name))
-
;;----------------------------------------------------------------------------
(defun d-forward-decl-or-cast-1 (preceding-token-end context last-cast-end)
@@ -888,7 +887,7 @@ operators."
;; we're looking at an identifier that's a
;; prefix only if it specifies a member pointer.
(when (progn (setq pos (point))
- (setq got-identifier (c-forward-name)))
+ (setq got-identifier (d-forward-name)))
(setq name-start pos)
(if (looking-at "\\(::\\)")
;; We only check for a trailing "::" and
@@ -917,7 +916,7 @@ operators."
(or got-identifier
(and (looking-at c-identifier-start)
(setq pos (point))
- (setq got-identifier (c-forward-name))
+ (setq got-identifier (d-forward-name))
(setq name-start pos))
(when (looking-at "[0-9]")
(setq got-number t))) ; We've probably got an arithmetic expression.
@@ -1563,12 +1562,7 @@ operators."
(apply #'d-forward-decl-or-cast-1 args))
(t
- (add-function :around (symbol-function 'c-forward-name)
- #'d-special-case-c-forward-name)
- (unwind-protect
- (apply #'d-forward-decl-or-cast-1 args)
- (remove-function (symbol-function 'c-forward-name)
- #'d-special-case-c-forward-name)))))
+ (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)