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

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

[nongnu] elpa/dart-mode a935c27 059/192: don't advise c-parse-state if c


From: ELPA Syncer
Subject: [nongnu] elpa/dart-mode a935c27 059/192: don't advise c-parse-state if c-parse-state-1 isn't defined.
Date: Sun, 29 Aug 2021 11:01:50 -0400 (EDT)

branch: elpa/dart-mode
commit a935c27b15c0d7f4c05a6f0befaf18a8ebe1c350
Author: Robert Ginda <rginda@gmail.com>
Commit: Robert Ginda <rginda@gmail.com>

    don't advise c-parse-state if c-parse-state-1 isn't defined.
    
    This addresses issue #1.
    
    The comment mentions that c-parse-state was "screwing up indentation
    in wierd ways", so those may return with this change.  However,
    without this change, dart-mode seems to be useless in Emacs 23.3.1.
---
 dart-mode.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/dart-mode.el b/dart-mode.el
index 8a289ca..c76ad68 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -370,15 +370,16 @@ SYNTAX-GUESS is the output of `c-guess-basic-syntax'."
                 (c-end-of-current-token base))
         (setq base (point)))))))
 
-(defadvice c-parse-state (around dart-c-parse-state activate)
-  (if (not (c-major-mode-is 'dart-mode)) ad-do-it
-    ;; c-parse-state is a wrapper around c-parse-state-1 that does some tricks
-    ;; to ensure that dangling brackets in preprocessor commands don't screw up
-    ;; parse information for the real world. In Dart, all "preprocessor"
-    ;; directives have matched braces, so we don't need to worry about that. 
The
-    ;; wrapper was also screwing up indentation in weird ways, so we just 
ignore
-    ;; it.
-    (setq ad-return-value (c-parse-state-1))))
+(if (fboundp 'c-parse-state-1)
+  (defadvice c-parse-state (around dart-c-parse-state activate)
+    (if (not (c-major-mode-is 'dart-mode)) ad-do-it
+      ;; c-parse-state is a wrapper around c-parse-state-1 that does some 
tricks
+      ;; to ensure that dangling brackets in preprocessor commands don't screw 
up
+      ;; parse information for the real world. In Dart, all "preprocessor"
+      ;; directives have matched braces, so we don't need to worry about that. 
The
+      ;; wrapper was also screwing up indentation in weird ways, so we just 
ignore
+      ;; it.
+      (setq ad-return-value (c-parse-state-1)))))
 
 
 ;;; Additional fontification support



reply via email to

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