emacs-diffs
[Top][All Lists]
Advanced

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

master 5f89da1423b 1/3: Merge from origin/emacs-29


From: Eli Zaretskii
Subject: master 5f89da1423b 1/3: Merge from origin/emacs-29
Date: Sat, 6 Apr 2024 11:14:14 -0400 (EDT)

branch: master
commit 5f89da1423bfa17717c2237130bc9a6ff1a57394
Merge: eaec6cc3d7c 46b8746b38e
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Merge from origin/emacs-29
    
    46b8746b38e Fix warning-suppress for list type "warning type"
    910ea5f1e55 Make object init more robust (bug#69571)
---
 lisp/emacs-lisp/warnings.el                        |  8 ++-
 lisp/progmodes/csharp-mode.el                      | 10 ++-
 .../progmodes/csharp-mode-resources/indent.erts    | 78 ++++++++++++++++++++++
 3 files changed, 93 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 6c62a56e99c..8b43c6a8726 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -225,10 +225,14 @@ SUPPRESS-LIST is the list of kinds of warnings to 
suppress."
              (?q "quit and do nothing"))))
     (?y
      (customize-save-variable 'warning-suppress-log-types
-                              (cons (list type) warning-suppress-log-types)))
+                              (if (consp type)
+                                  (cons type warning-suppress-log-types)
+                                (cons (list type) 
warning-suppress-log-types))))
     (?n
      (customize-save-variable 'warning-suppress-types
-                              (cons (list type) warning-suppress-types)))
+                              (if (consp type)
+                                  (cons type warning-suppress-types)
+                                (cons (list type) warning-suppress-types))))
     (_ (message "Exiting"))))
 
 ;;;###autoload
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 9782eb443f2..10ac73d9691 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -500,7 +500,15 @@ compilation and evaluation time conflicts."
          ;; Also, deal with the possible end of line obscured by a
          ;; trailing comment.
          (goto-char (c-point 'iopl))
-         (looking-at "^[^//]*new[^//]*;$")))
+         (when (looking-at-p ".*new.*")
+           (if (re-search-forward ";" (pos-eol) t 1)
+               ;; If the ';' is inside a comment, the statement hasn't
+               ;; likely ended, so we should accept as object init.
+               ;; Example:
+               ;; var x = new         // This should return true ;
+               ;; var x = new();      // This should return false ;
+               (nth 4 (syntax-ppss (point)))
+             t))))
      ;; Line should not already be terminated
      (save-excursion
        (goto-char (c-point 'eopl))
diff --git a/test/lisp/progmodes/csharp-mode-resources/indent.erts 
b/test/lisp/progmodes/csharp-mode-resources/indent.erts
index a676ecc9728..e03ba80d709 100644
--- a/test/lisp/progmodes/csharp-mode-resources/indent.erts
+++ b/test/lisp/progmodes/csharp-mode-resources/indent.erts
@@ -16,4 +16,82 @@ public class Foo {
         }  // [2]
     }
 }
+
+public class Foo {
+    void Bar () {
+        var x = new X();
+        for (;;) {
+            x();
+        }  // [2]
+    }
+}
+
+public class Foo {
+    void Bar () {
+        var x = new X()
+        {
+            var b = 3;
+        };
+        for (;;) {
+            x();
+        }  // [2]
+    }
+}
+
+public class Foo {
+    void Bar () {
+        var x = new X()              // Hello
+        {
+            var b = 3;
+        };
+        for (;;) {
+            x();
+        }  // [2]
+    }
+}
+
+public class Foo {
+    void Bar () {
+        var x = new X()              // Hello ;
+        {
+            var b = 3;
+        };
+        for (;;) {
+            x();
+        }  // [2]
+    }
+}
+
+public class Foo {
+    void Bar () {
+        var x = new X                // Hello ;
+        {
+            var b = 3;
+        };
+        for (;;) {
+            x();
+        }  // [2]
+    }
+}
+
+public class Foo {
+    void Bar () {
+        var x = new X();             // Hello ;
+        for (;;) {
+            x();
+        }  // [2]
+    }
+}
+
+public class Foo
+{
+    void Bar ()
+    {
+        var x = new X();             // Hello ;
+        for (;;)
+        {
+            x();
+        }  // [2]
+    }
+}
 =-=-=



reply via email to

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