This piece of advice seems to fix the first half of the indentation problem # 1. I hope this does not cause problems elsewhere. It just searches for a condition that causes bad indentation (syntax statement-contand #ifor #endif(well, only #)) at the beginning of this) and returns the syntax output to this point. It looks good, but I'm not a judge here.
(defvar csharp-mode-syntax-table-no-special-slash
(let ((res (copy-syntax-table csharp-mode-syntax-table)))
(modify-syntax-entry ?\\ "w" res)
res)
"same as regular csharp-mode-syntax-table, only \\ is not an escape char")
(defadvice c-guess-basic-syntax (after c-guess-basic-syntax-csharp-hack activate)
"following an
(let ((res ad-return-value))
(save-excursion
(save-match-data
(cond ((and (eq major-mode 'csharp-mode)
(eq 'statement-cont (caar res))
(progn
(goto-char (cadar res))
(looking-at "
;; when following a
(goto-char (cadar res))
(setq ad-return-value (c-guess-basic-syntax)))
((and (eq major-mode 'csharp-mode)
(eq 'string (caar res)))
;; inside a string
;; check to see if it is a literal
;; and if so, redo with modified syntax table
(let ((p (point))
(extent (c-literal-limits)))
(when extent
(goto-char (- (car extent) 1))
(when (looking-at "@\"")
;; yup, a string literal
(with-syntax-table csharp-mode-syntax-table-no-special-slash
(goto-char p)
(setq ad-return-value (c-guess-basic-syntax))))))))))))
- . , , , , . . 104 "" , cc-engine...
( 2 3, statement-cont. , cc , , do: C-c C-s.
4, , , , , .