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

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

[nongnu] elpa/d-mode 8076559 081/346: Replace obsolete defadvice by the


From: ELPA Syncer
Subject: [nongnu] elpa/d-mode 8076559 081/346: Replace obsolete defadvice by the new advice-add.
Date: Sun, 29 Aug 2021 11:00:07 -0400 (EDT)

branch: elpa/d-mode
commit 807655921d38fbd32701a0ede4a06affba7de62b
Author: Dmitri Makarov <dmakarov@alumni.stanford.edu>
Commit: Dmitri Makarov <dmakarov@alumni.stanford.edu>

    Replace obsolete defadvice by the new advice-add.
    
    Also make recognition of 'static if' more precise.
---
 d-mode.el | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/d-mode.el b/d-mode.el
index f40949d..551abcd 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -460,24 +460,28 @@ operators."
     (nil d-imenu-method-index-function 2)))
 
 ;;----------------------------------------------------------------------------
-;;;Workaround for special case of 'else static if' not being handled properly
-(defun d-special-case-looking-at (oldfun &rest args)
+;;; Workaround for special case of 'else static if' not being handled properly
+(defun d-special-case-looking-at (orig-fun &rest args)
   (let ((rxp (car args)))
     (if (and (stringp rxp) (string= rxp "if\\>[^_]"))
-        (or (apply oldfun '("static\\>[^_]"))
-            (apply oldfun '("version\\>[^_]"))
-            (apply oldfun '("debug\\>[^_]"))
-            (apply oldfun args))
-      (apply oldfun args))))
+        (or (apply orig-fun '("static\\>\\s-+if\\>[^_]"))
+            (apply orig-fun '("version\\>[^_]"))
+            (apply orig-fun '("debug\\>[^_]"))
+            (apply orig-fun args))
+      (apply orig-fun args))))
 
-(defadvice c-add-stmt-syntax (around my-c-add-stmt-syntax-wrapper activate)
+(defun d-around--c-add-stmt-syntax (orig-fun &rest args)
   (if (not (string= major-mode "d-mode"))
-      ad-do-it
+      (apply orig-fun args)
     (progn
-      (add-function :around (symbol-function 'looking-at) 
#'d-special-case-looking-at)
+      (add-function :around (symbol-function 'looking-at)
+                    #'d-special-case-looking-at)
       (unwind-protect
-          ad-do-it
-          (remove-function (symbol-function 'looking-at) 
#'d-special-case-looking-at)))))
+          (apply orig-fun args)
+        (remove-function (symbol-function 'looking-at)
+                         #'d-special-case-looking-at)))))
+
+(advice-add 'c-add-stmt-syntax :around #'d-around--c-add-stmt-syntax)
 
 ;;----------------------------------------------------------------------------
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.d[i]?\\'" . d-mode))



reply via email to

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