emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/d-mode ed0de34 222/346: Refactor "this" (constructor) hand


From: ELPA Syncer
Subject: [nongnu] elpa/d-mode ed0de34 222/346: Refactor "this" (constructor) handling
Date: Sun, 29 Aug 2021 11:00:35 -0400 (EDT)

branch: elpa/d-mode
commit ed0de346481292001b828618887d7ae19491a5b4
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>

    Refactor "this" (constructor) handling
    
    Fold behavior from the advice into our c-forward-type implementation.
---
 d-mode.el | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/d-mode.el b/d-mode.el
index 859f737..e189998 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -7,7 +7,7 @@
 ;; Maintainer:  Russel Winder <russel@winder.org.uk>
 ;;              Vladimir Panteleev <vladimir@thecybershadow.net>
 ;; Created:  March 2007
-;; Version:  201909091501
+;; Version:  201909091517
 ;; Keywords:  D programming language emacs cc-mode
 ;; Package-Requires: ((emacs "25.1"))
 
@@ -874,13 +874,6 @@ Each list item should be a regexp matching a single 
identifier."
     (forward-char 4)
     t))
 
-(defun d-special-case-c-forward-type (orig-fun &rest args)
-  ;; checkdoc-params: (orig-fun args)
-  "Advice function for fixing cc-mode handling of D constructors."
-  (if (not (looking-at (c-make-keywords-re t '("this"))))
-      (apply orig-fun args)
-    nil))
-
 (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."
@@ -902,15 +895,10 @@ Each list item should be a regexp matching a single 
identifier."
    (t
     (add-function :around (symbol-function 'c-forward-name)
                  #'d-special-case-c-forward-name)
-    (add-function :around (symbol-function 'c-forward-type)
-                 #'d-special-case-c-forward-type)
     (unwind-protect
        (apply orig-fun args)
       (remove-function (symbol-function 'c-forward-name)
-                      #'d-special-case-c-forward-name)
-      (remove-function (symbol-function 'c-forward-type)
-                      #'d-special-case-c-forward-type)
-      ))))
+                      #'d-special-case-c-forward-name)))))
 
 (advice-add 'c-forward-decl-or-cast-1 :around 
#'d-around--c-forward-decl-or-cast-1)
 
@@ -1212,6 +1200,11 @@ Key bindings:
       (setq saw-storage-class t))
 
     (cond
+     ;; D: "this" is not a type, even though it appears at the
+     ;; beginning of a "function" (constructor) declaration.
+     ((looking-at (c-make-keywords-re t '("this")))
+      nil)
+
      ;; D: Storage class substituting the type (e.g. auto)
      ((and
        saw-storage-class



reply via email to

[Prev in Thread] Current Thread [Next in Thread]