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

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

[nongnu] elpa/d-mode 27fbe66 065/346: Workaround for special case of 'el


From: ELPA Syncer
Subject: [nongnu] elpa/d-mode 27fbe66 065/346: Workaround for special case of 'else static if'.
Date: Sun, 29 Aug 2021 11:00:05 -0400 (EDT)

branch: elpa/d-mode
commit 27fbe66f6de27f8337fe40d6a19f039c589cd1fc
Author: Lukasz Wrzosek <wrzoski@gmail.com>
Commit: Lukasz Wrzosek <wrzoski@gmail.com>

    Workaround for special case of 'else static if'.
---
 d-mode.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/d-mode.el b/d-mode.el
index fc838ed..49edee9 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -420,6 +420,25 @@ 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)
+  (let ((rxp (car args)))
+    (if (and (stringp rxp)
+           (string= rxp "if\\>[^_]"))
+      (or (apply oldfun '("static\\>[^_]"))
+          (apply oldfun args))
+    (apply oldfun args))))
+
+(defadvice c-add-stmt-syntax (around my-c-add-stmt-syntax-wrapper 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))
 
 ;; Custom variables



reply via email to

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