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

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

[nongnu] elpa/d-mode ee38763 083/346: Use the new advising mechanism on


From: ELPA Syncer
Subject: [nongnu] elpa/d-mode ee38763 083/346: Use the new advising mechanism on new emacs versions.
Date: Sun, 29 Aug 2021 11:00:08 -0400 (EDT)

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

    Use the new advising mechanism on new emacs versions.
---
 d-mode.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/d-mode.el b/d-mode.el
index 551abcd..2c6c2ff 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -481,7 +481,16 @@ operators."
         (remove-function (symbol-function 'looking-at)
                          #'d-special-case-looking-at)))))
 
-(advice-add 'c-add-stmt-syntax :around #'d-around--c-add-stmt-syntax)
+(if (> emacs-major-version 24)
+    (advice-add 'c-add-stmt-syntax :around #'d-around--c-add-stmt-syntax)
+  (defadvice c-add-stmt-syntax (around d-around--c-add-stmt-syntax activate)
+    (if (not (string= major-mode "d-mode"))
+        ad-do-it
+      (progn
+        (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))))))
 
 ;;----------------------------------------------------------------------------
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.d[i]?\\'" . d-mode))



reply via email to

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