branch: externals/csharp-mode
commit fb1f7d57675df8c38bbf9cc3c99e0059c8b16d7f
Author: Theodor Thornhill <t...@thornhill.no>
Commit: Theodor Thornhill <t...@thornhill.no>

    Don't duplicate values and remove unneeded test
    
    We don't set the csharp style indentation the way we did before.  As such 
the
    removed case messes with CC Mode internals, in that the default should be 
"gnu",
    or whatever CC Mode sets at any given point in time.  However, csharp-mode
    should pick the correct indentation style in other cases.
---
 csharp-mode-tests.el | 20 ++++++++++----------
 csharp-mode.el       |  7 ++++---
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index 01eaa04..28f5984 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -322,29 +322,29 @@
      (equal before adaptive-fill-regexp))))
 
 (ert-deftest activating-mode-style-defaults-to-csharp ()
+  (with-temp-buffer
+    (csharp-mode)
+    (should
+     (equal "csharp" c-indentation-style)))
+
   (let ((c-default-style "csharp"))
     (with-temp-buffer
       (csharp-mode)
       (should
        (equal "csharp" c-indentation-style))))
+
   (let ((c-default-style '((csharp-mode . "csharp")
                            (java-mode . "java"))))
     (with-temp-buffer
       (csharp-mode)
       (should
-       (equal "csharp" c-indentation-style))))
-  (let (c-default-style)
-    (with-temp-buffer
-      (csharp-mode)
-      (should
        (equal "csharp" c-indentation-style)))))
 
 (ert-deftest inside-bracelist-test ()
-  (let ((c-default-style "csharp"))
-    (with-temp-buffer
-      (csharp-mode)
-      (insert "public class A { public void F() {")
-      (call-interactively #'newline))))
+  (with-temp-buffer
+    (csharp-mode)
+    (insert "public class A { public void F() {")
+    (call-interactively #'newline)))
 
 ;;(ert-run-tests-interactively t)
 ;; (local-set-key (kbd "<f6>") '(lambda ()
diff --git a/csharp-mode.el b/csharp-mode.el
index 320a1fc..692db57 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -234,9 +234,10 @@
                                    (substatement-open     . 0)))))
 
 (eval-and-compile
-  (setq c-default-style
-        (cons '(csharp-mode . "csharp")
-              c-default-style)))
+  (unless (assoc 'csharp-mode c-default-style)
+    (setq c-default-style
+          (cons '(csharp-mode . "csharp")
+                c-default-style))))
 
 (defun csharp--color-backwards (font-lock-face)
   (let (id-end)

Reply via email to