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

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

[elpa] externals/csharp-mode 3b54997 130/459: Merge pull request #55 fro


From: ELPA Syncer
Subject: [elpa] externals/csharp-mode 3b54997 130/459: Merge pull request #55 from josteink/derive-from-prog-mode
Date: Sun, 22 Aug 2021 13:59:11 -0400 (EDT)

branch: externals/csharp-mode
commit 3b54997d61d13c2b336332d0feba8cecffde879e
Merge: 73e7ed6 6e3cdc1
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>

    Merge pull request #55 from josteink/derive-from-prog-mode
    
    Derive from prog mode
---
 csharp-mode-tests.el |  8 ++++++++
 csharp-mode.el       | 46 +++++++++++++++++-----------------------------
 2 files changed, 25 insertions(+), 29 deletions(-)

diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index 2393d40..0fb7661 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -178,6 +178,14 @@
     (should (equal t (and csharp-hook1
                           csharp-hook2)))))
 
+(defvar c-mode-hook-run nil)
+(ert-deftest avoid-runing-c-mode-hook ()
+  (add-hook 'c-mode-hook (lambda () (setq c-mode-hook-run t)))
+
+  (with-temp-buffer
+    (csharp-mode)
+     (should-not c-mode-hook-run)))
+
 (ert-deftest indentation-rules-should-be-as-specified-in-test-doc ()
   (let* ((buffer (find-file "test-files/indentation-tests.cs"))
          (orig-content)
diff --git a/csharp-mode.el b/csharp-mode.el
index 55df6bc..190d815 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -4177,18 +4177,9 @@ The return value is meaningless, and is ignored by 
cc-mode.
                ))
 
 
-;;; The entry point into the mode
 ;;;###autoload
-(define-derived-mode csharp-mode c-mode "C#"
-  "Major mode for editing C# code. This mode is derived from CC Mode to
-support C#.
-
-Normally, you'd want to autoload this mode by setting `auto-mode-alist' with
-an entry for csharp, in your .emacs file:
-
-   (autoload 'csharp-mode \"csharp-mode\" \"Major mode for editing C# code.\" 
t)
-   (setq auto-mode-alist
-      (append '((\"\\.cs$\" . csharp-mode)) auto-mode-alist))
+(define-derived-mode csharp-mode prog-mode "C#"
+  "Major mode for editing C# code.
 
 The mode provides fontification and indent for C# syntax, as well
 as some other handy features.
@@ -4212,15 +4203,15 @@ To run your own logic after csharp-mode starts, do this:
 The function above is just a suggestion.
 
 
-IMenu Integraiton
+Imenu Integration
 ===============================
 
-Check the menubar for menu entries for Imenu; It is labelled
+Check the menubar for menu entries for Imenu; it is labelled
 \"Index\".
 
 The Imenu index gets computed when the file is .cs first opened and loaded.
 This may take a moment or two.  If you don't like this delay and don't
-use imenu, you can turn this off with the variable `csharp-want-imenu'.
+use Imenu, you can turn this off with the variable `csharp-want-imenu'.
 
 
 
@@ -4282,25 +4273,22 @@ Key bindings:
     ;; so I put it afterwards to make it stick.
     (make-local-variable 'paragraph-separate)
 
-    ;;(message "C#: set paragraph-separate")
-
     ;; Speedbar handling
-    (if (fboundp 'speedbar-add-supported-extension)
-        (speedbar-add-supported-extension '(".cs"))) ;; idempotent
+    (when (fboundp 'speedbar-add-supported-extension)
+      (speedbar-add-supported-extension '(".cs"))) ;; idempotent
 
     (c-update-modeline)
 
     ;; maybe do imenu scan after hook returns
-    (if csharp-want-imenu
-      (progn
-        ;; There are two ways to do imenu indexing. One is to provide a
-        ;; function, via `imenu-create-index-function'.  The other is to
-        ;; provide imenu with a list of regexps via
-        ;; `imenu-generic-expression'; imenu will do a "generic scan" for you.
-        ;; csharp-mode uses the former method.
-        ;;
-        (setq imenu-create-index-function 'csharp-imenu-create-index)
-        (imenu-add-menubar-index)))
+    (when csharp-want-imenu
+      ;; There are two ways to do imenu indexing. One is to provide a
+      ;; function, via `imenu-create-index-function'.  The other is to
+      ;; provide imenu with a list of regexps via
+      ;; `imenu-generic-expression'; imenu will do a "generic scan" for you.
+      ;; csharp-mode uses the former method.
+
+      (setq imenu-create-index-function 'csharp-imenu-create-index)
+      (imenu-add-menubar-index))
 
     ;; The paragraph-separate variable was getting stomped by
     ;; other hooks, so it must reside here.
@@ -4308,7 +4296,7 @@ Key bindings:
           "[ \t]*\\(//+\\|\\**\\)\\([ \t]+\\|[ \t]+<.+?>\\)$\\|^\f")
 
     (setq beginning-of-defun-function 'csharp-move-back-to-beginning-of-defun)
-    ;; end-of-defun-function   can remain forward-sexp !!
+    ;; `end-of-defun-function' can remain forward-sexp !!
 
     (set (make-local-variable 'comment-auto-fill-only-comments) t))
 



reply via email to

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