[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode b20e65f 249/459: communicate default style
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode b20e65f 249/459: communicate default style safely (#118) |
Date: |
Sun, 22 Aug 2021 13:59:37 -0400 (EDT) |
branch: externals/csharp-mode
commit b20e65fe9b34ecd54a69974288ded42ba05dc0b8
Author: M-frankied <fwvdijk@gmail.com>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>
communicate default style safely (#118)
Communicate default style safely
---
csharp-mode-tests.el | 25 +++++++++++++++++++++++++
csharp-mode.el | 29 +++++++++++++++--------------
2 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index fb72759..12becdd 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -397,6 +397,31 @@
;; look for 'string' - should always be a type
(should (assess-face-at= buf 'csharp-mode (lambda (buf) (m-buffer-match
buf "string")) 'font-lock-type-face))))
+(ert-deftest activating-mode-doesnt-clobber-global-adaptive-fill-regexp ()
+ (let ((before adaptive-fill-regexp))
+ (with-temp-buffer
+ (csharp-mode))
+ (should
+ (equal before adaptive-fill-regexp))))
+
+(ert-deftest activating-mode-style-defaults-to-csharp ()
+ (let ((c-default-style "defaultc#"))
+ (with-temp-buffer
+ (csharp-mode)
+ (should
+ (equal "defaultc#" c-indentation-style))))
+ (let ((c-default-style '((csharp-mode . "defaultc#fromlist")
+ (java-mode . "defaultjava"))))
+ (with-temp-buffer
+ (csharp-mode)
+ (should
+ (equal "defaultc#fromlist" c-indentation-style))))
+ (let (c-default-style)
+ (with-temp-buffer
+ (csharp-mode)
+ (should
+ (equal "C#" c-indentation-style)))))
+
;;(ert-run-tests-interactively t)
;; (local-set-key (kbd "<f6>") '(lambda ()
;; (interactive)
diff --git a/csharp-mode.el b/csharp-mode.el
index 204d2a9..44a4e7e 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -2968,20 +2968,21 @@ Key bindings:
;; customized values for our language.
(c-init-language-vars csharp-mode)
- ;; Set style to c# style unless a file local variable or default
- ;; style is found, in which case it should be set after
- ;; calling `c-common-init' below.
- (unless (or c-file-style
- (stringp c-default-style)
- (assq 'csharp-mode c-default-style))
- (c-set-style "C#" 'do-not-override-customized-values))
-
- ;; `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
- ;; only makes the necessary initialization to get the syntactic
- ;; analysis and similar things working.
- (c-common-init 'csharp-mode)
+ ;; Use our predefined "C#" style unless a file local or default
+ ;; style is found. This is done by rebinding `c-default-style'
+ ;; during the `c-common-init' call. 'c-common-init' will initialize
+ ;; the buffer's style using the value of `c-default-style'.
+ (let ((c-default-style (if (or c-file-style
+ (stringp c-default-style)
+ (assq 'csharp-mode c-default-style))
+ c-default-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
+ ;; only makes the necessary initialization to get the syntactic
+ ;; analysis and similar things working.
+ (c-common-init 'csharp-mode))
(define-key csharp-mode-map (kbd "/") 'csharp-maybe-insert-codedoc)
- [elpa] externals/csharp-mode 3526396 305/459: Remove before/after functions, (continued)
- [elpa] externals/csharp-mode 3526396 305/459: Remove before/after functions, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode dbbd17a 312/459: Merge pull request #171 from josteink/fontification-lighter, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 7a41dad 318/459: Add attributes to indentation-tests, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f46d656 321/459: Fix indentation in one defconst, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 49d8392 323/459: Add nullable operator to concatenated identifiers, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 2ee53e4 234/459: Fix some easy checkdoc errors., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 309e2c8 238/459: Create failing test-case., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode cef0d90 243/459: Don't override user's customizations., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode af61254 244/459: Fix off-by-one error for region directive comments, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 4b3d6f8 247/459: More region comment fixes., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode b20e65f 249/459: communicate default style safely (#118),
ELPA Syncer <=
- [elpa] externals/csharp-mode 29dab33 255/459: Silence warning in compatibility-shim., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0481983 264/459: Fix indentation behaviour of preprocessor statements., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 4babfff 265/459: Merge branch 'preproc-indentation', ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 8100976 267/459: Fix fontification of unsafe methods., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 68a8a69 270/459: Fixed enum indentation level., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0825112 276/459: Fix CI-error on Emacs 25.x, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode d537cfa 271/459: Add test-case for Enum-indentation., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 981ff38 275/459: Make it easier to reproduce CI errors locally., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 274dd88 273/459: Update CI-settings, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode e7e96e3 272/459: Fixed callback indentation level. (#145), ELPA Syncer, 2021/08/22