aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodor Thornhill2022-11-26 20:10:58 +0100
committerStefan Kangas2022-11-27 10:32:56 +0100
commitea2f2f1e71188a4b0ff3fa390914d8ca23deacb9 (patch)
tree9d52a2d8e0c2706ec996f66559f661b78733a5ff
parent8cda625b22e20b0e0e6bbf602a1bd9d5042cf264 (diff)
downloademacs-ea2f2f1e71188a4b0ff3fa390914d8ca23deacb9.tar.gz
emacs-ea2f2f1e71188a4b0ff3fa390914d8ca23deacb9.zip
Remove compatibility code in csharp-mode
* lisp/progmodes/csharp-mode.el (c-basic-matchers-before): Remove invalid string check for Emacs 27. (version=): Remove compatibility hack for string handling in CC Mode in Emacs 27.1. (Bug#59602)
-rw-r--r--lisp/progmodes/csharp-mode.el75
1 files changed, 2 insertions, 73 deletions
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index a684e5d09db..3f691956f8f 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -319,12 +319,7 @@
319(c-lang-defconst c-basic-matchers-before 319(c-lang-defconst c-basic-matchers-before
320 csharp `( 320 csharp `(
321 ;; Warning face on unclosed strings 321 ;; Warning face on unclosed strings
322 ,@(if (version< emacs-version "27.0") 322 ("\\s|" 0 font-lock-warning-face t nil)
323 ;; Taken from 26.1 branch
324 `(,(c-make-font-lock-search-function
325 (concat ".\\(" c-string-limit-regexp "\\)")
326 '((c-font-lock-invalid-string))))
327 `(("\\s|" 0 font-lock-warning-face t nil)))
328 323
329 ;; Invalid single quotes 324 ;; Invalid single quotes
330 c-font-lock-invalid-single-quotes 325 c-font-lock-invalid-single-quotes
@@ -346,7 +341,6 @@
346 nil 341 nil
347 (goto-char (match-end 0))))) 342 (goto-char (match-end 0)))))
348 343
349
350 ;; Negation character 344 ;; Negation character
351 (eval . (list "\\(!\\)[^=]" 1 c-negation-char-face-name)) 345 (eval . (list "\\(!\\)[^=]" 1 c-negation-char-face-name))
352 346
@@ -375,8 +369,7 @@
375 (eval . (list (concat "\\<catch\\> *( *" 369 (eval . (list (concat "\\<catch\\> *( *"
376 csharp--regex-type-name-matcher 370 csharp--regex-type-name-matcher
377 " *) *") 371 " *) *")
378 1 font-lock-type-face)) 372 1 font-lock-type-face))))
379 ))
380 373
381(c-lang-defconst c-basic-matchers-after 374(c-lang-defconst c-basic-matchers-after
382 csharp (append 375 csharp (append
@@ -505,70 +498,6 @@ compilation and evaluation time conflicts."
505 498
506;;; End of new syntax constructs 499;;; End of new syntax constructs
507 500
508
509
510;;; Fix for strings on version 27.1
511
512(when (version= emacs-version "27.1")
513 ;; See:
514 ;; https://github.com/emacs-csharp/csharp-mode/issues/175
515 ;; https://github.com/emacs-csharp/csharp-mode/issues/151
516 ;; for the full story.
517 (defun c-pps-to-string-delim (end)
518 (let* ((start (point))
519 (no-st-s `(0 nil nil ?\" nil nil 0 nil ,start nil nil))
520 (st-s `(0 nil nil t nil nil 0 nil ,start nil nil))
521 no-st-pos st-pos
522 )
523 (parse-partial-sexp start end nil nil no-st-s 'syntax-table)
524 (setq no-st-pos (point))
525 (goto-char start)
526 (while (progn
527 (parse-partial-sexp (point) end nil nil st-s 'syntax-table)
528 (unless (bobp)
529 (c-clear-syn-tab (1- (point))))
530 (setq st-pos (point))
531 (and (< (point) end)
532 (not (eq (char-before) ?\")))))
533 (goto-char (min no-st-pos st-pos))
534 nil))
535
536 (defun c-multiline-string-check-final-quote ()
537 (let (pos-ll pos-lt)
538 (save-excursion
539 (goto-char (point-max))
540 (skip-chars-backward "^\"")
541 (while
542 (and
543 (not (bobp))
544 (cond
545 ((progn
546 (setq pos-ll (c-literal-limits)
547 pos-lt (c-literal-type pos-ll))
548 (memq pos-lt '(c c++)))
549 ;; In a comment.
550 (goto-char (car pos-ll)))
551 ((save-excursion
552 (backward-char) ; over "
553 (c-is-escaped (point)))
554 ;; At an escaped string.
555 (backward-char)
556 t)
557 (t
558 ;; At a significant "
559 (c-clear-syn-tab (1- (point)))
560 (setq pos-ll (c-literal-limits)
561 pos-lt (c-literal-type pos-ll))
562 nil)))
563 (skip-chars-backward "^\""))
564 (cond
565 ((bobp))
566 ((eq pos-lt 'string)
567 (c-put-syn-tab (1- (point)) '(15)))
568 (t nil))))))
569
570;;; End of fix for strings on version 27.1
571
572;; When invoked by MSBuild, csc’s errors look like this: 501;; When invoked by MSBuild, csc’s errors look like this:
573;; subfolder\file.cs(6,18): error CS1006: Name of constructor must 502;; subfolder\file.cs(6,18): error CS1006: Name of constructor must
574;; match name of class [c:\Users\user\project.csproj] 503;; match name of class [c:\Users\user\project.csproj]