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

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

[elpa] externals/csharp-mode 55fe188 101/459: Use `define-derived-mode`


From: ELPA Syncer
Subject: [elpa] externals/csharp-mode 55fe188 101/459: Use `define-derived-mode`
Date: Sun, 22 Aug 2021 13:59:05 -0400 (EDT)

branch: externals/csharp-mode
commit 55fe188c41fef31aae81e77a446e4b651a134d02
Author: Vasilij Schneidermann <v.schneidermann@gmail.com>
Commit: Vasilij Schneidermann <v.schneidermann@gmail.com>

    Use `define-derived-mode`
---
 csharp-mode.el | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/csharp-mode.el b/csharp-mode.el
index d87a4f5..0a02034 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -4159,7 +4159,7 @@ The return value is meaningless, and is ignored by 
cc-mode.
 
 ;;; The entry point into the mode
 ;;;###autoload
-  (defun csharp-mode ()
+(define-derived-mode csharp-mode c-mode "C#"
   "Major mode for editing C# code. This mode is derived from CC Mode to
 support C#.
 
@@ -4206,12 +4206,9 @@ use imenu, you can turn this off with the variable 
`csharp-want-imenu'.
 
 Key bindings:
 \\{csharp-mode-map}"
-    (interactive)
-    (kill-all-local-variables)
     (make-local-variable 'beginning-of-defun-function)
     (make-local-variable 'end-of-defun-function)
     (c-initialize-cc-mode t)
-    (set-syntax-table csharp-mode-syntax-table)
 
     ;; define underscore as part of a word in the Csharp syntax table
     (modify-syntax-entry ?_ "w" csharp-mode-syntax-table)
@@ -4219,12 +4216,6 @@ Key bindings:
     ;; define @ as an expression prefix in Csharp syntax table
     (modify-syntax-entry ?@ "'" csharp-mode-syntax-table)
 
-    (setq major-mode 'csharp-mode
-          mode-name "C#"
-          local-abbrev-table csharp-mode-abbrev-table
-          abbrev-mode t)
-    (use-local-map csharp-mode-map)
-
     ;; `c-init-language-vars' is a macro that is expanded at compile
     ;; time to a large `setq' with all the language variables and their
     ;; customized values for our language.
@@ -4236,8 +4227,8 @@ Key bindings:
     (unless (or c-file-style
                 (stringp c-default-style)
                 (assq 'csharp-mode c-default-style))
-      (c-set-style "c#" t))
-    
+      (c-set-style "C#"))
+
     ;; `c-common-init' initializes most of the components of a CC Mode
     ;; buffer, including setup of the mode menu, font-lock, etc.
     ;; There's also a lower level routine `c-basic-common-init' that
@@ -4245,7 +4236,7 @@ Key bindings:
     ;; analysis and similar things working.
     (c-common-init 'csharp-mode)
 
-    (local-set-key (kbd "/") 'csharp-maybe-insert-codedoc)
+    (define-key csharp-mode-map (kbd "/") 'csharp-maybe-insert-codedoc)
 
     ;; Need the following for parse-partial-sexp to work properly with
     ;; verbatim literal strings Setting this var to non-nil tells
@@ -4272,10 +4263,6 @@ Key bindings:
         (speedbar-add-supported-extension '(".cs"))) ;; idempotent
 
     (c-update-modeline)
-    ;; run prog-mode-hooks if available
-    (if (boundp 'prog-mode-hook)
-       (c-run-mode-hooks 'prog-mode-hook 'c-mode-common-hook 'csharp-mode-hook)
-      (c-run-mode-hooks 'c-mode-common-hook 'csharp-mode-hook))
 
     ;; maybe do imenu scan after hook returns
     (if csharp-want-imenu
@@ -4297,8 +4284,7 @@ Key bindings:
     (setq beginning-of-defun-function 'csharp-move-back-to-beginning-of-defun)
     ;; end-of-defun-function   can remain forward-sexp !!
 
-    (set (make-local-variable 'comment-auto-fill-only-comments) t)
-    )
+    (set (make-local-variable 'comment-auto-fill-only-comments) t))
 
 (provide 'csharp-mode)
 



reply via email to

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