Last active
December 23, 2015 14:49
-
-
Save itouhiro/6651213 to your computer and use it in GitHub Desktop.
csharp-setting.el: modify csharp-mode setting. copied almost all from http://blogs.msdn.com/b/dotnetinterop/archive/2008/04/14/dino-s-emacs-file.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; for Unity | |
;; set Windows EnvironmentalVariable EMACS_SERVER_FILE=Z:\home\.emacs.d\server\server | |
;; set Unity [Edit - Preference - External - Editor] C:\home\bin\gnupack\app\emacs\emacs\bin\emacsclientw.exe | |
(server-start) | |
;; csharp-mode | |
(autoload 'csharp-mode "csharp-mode" nil t) | |
(add-to-list 'auto-mode-alist '("\.cs$" . csharp-mode)) | |
(modify-coding-system-alist 'file "\\.cs\\'" 'utf-8-with-signature-unix) | |
;; http://blogs.msdn.com/b/dotnetinterop/archive/2008/04/14/dino-s-emacs-file.aspx | |
(c-add-style "C#" | |
'("Java" | |
;;(c-basic-offset . 2) | |
(c-basic-offset . 4) | |
(c-comment-only-line-offset . (0 . 0)) | |
(c-offsets-alist | |
. ( | |
(access-label . -) | |
(arglist-close . c-lineup-arglist) | |
(arglist-cont . 0) | |
(arglist-cont-nonempty . c-lineup-arglist) | |
(arglist-intro . c-lineup-arglist-intro-after-paren) | |
(block-close . 0) | |
(block-open . 0) | |
(brace-entry-open . 0) | |
(brace-list-close . 0) | |
(brace-list-entry . 0) | |
(brace-list-intro . +) | |
(brace-list-open . +) | |
(c . c-lineup-C-comments) | |
(case-label . 0) | |
(catch-clause . 0) | |
(class-close . 0) | |
(class-open . 0) | |
(comment-intro . c-lineup-comment) | |
(cpp-macro . 0) | |
(cpp-macro-cont . c-lineup-dont-change) | |
(defun-block-intro . +) | |
(defun-close . 0) | |
(defun-open . 0) | |
(do-while-closure . 0) | |
(else-clause . 0) | |
(extern-lang-close . 0) | |
(extern-lang-open . 0) | |
(friend . 0) | |
(func-decl-cont . +) | |
(inclass . +) | |
(inexpr-class . +) | |
(inexpr-statement . 0) | |
(inextern-lang . +) | |
(inher-cont . c-lineup-multi-inher) | |
(inher-intro . +) | |
(inlambda . c-lineup-inexpr-block) | |
(inline-close . 0) | |
(inline-open . 0) | |
(innamespace . +) | |
(knr-argdecl . 0) | |
(knr-argdecl-intro . 5) | |
(label . 0) | |
(lambda-intro-cont . +) | |
(member-init-cont . c-lineup-multi-inher) | |
(member-init-intro . +) | |
(namespace-close . 0) | |
(namespace-open . 0) | |
(objc-method-args-cont . c-lineup-ObjC-method-args) | |
(objc-method-call-cont . c-lineup-ObjC-method-call) | |
(objc-method-intro . [0]) | |
(statement . 0) | |
(statement-block-intro . +) | |
(statement-case-intro . +) | |
(statement-case-open . +) | |
(statement-cont . +) | |
(stream-op . c-lineup-streamop) | |
(string . c-lineup-dont-change) | |
(substatement . +) | |
(substatement-open . 0) | |
(template-args-cont c-lineup-template-args +) | |
(topmost-intro . 0) | |
(topmost-intro-cont . 0) | |
)) | |
)) | |
(c-add-style "myC#Style" | |
'("C#" ; this must be defined elsewhere | |
;;(c-basic-offset . 2) | |
(c-basic-offset . 4) | |
(c-echo-syntactic-information-p . t) | |
(c-comment-only-line-offset . (0 . 0)) | |
(c-offsets-alist . ( | |
(c . c-lineup-C-comments) | |
(namespace-open . 0) | |
(namespace-close . 0) | |
(innamespace . +) | |
(class-open . 0) | |
(class-close . 0) | |
(inclass . +) | |
(block-open . -) ; eg, open a block under a function name or if stmt; | |
; want this to be flush with prev line. | |
(arglist-cont . +) | |
(substatement-open . 0) ; I think this is for a try {} or if{} or etc. why this is not block open, I don't know! | |
(defun-open . 0) ; method defn? (but no!) | |
(defun-block-intro . +) ;0 ; block within a function???? | |
(inline-open . 0) ; eg, opening a function? ?? | |
(statement-block-intro . +) ; unknown what this is | |
(brace-list-open . 0) ; list open (like an enum, array initializer) | |
(brace-list-intro . +) ; first item in the list | |
(brace-list-entry . 0) ; subsequent items in the list | |
(brace-list-close . 0) ; list close | |
;(statement-cont . (dinoch-csharp-lineup-string-cont +)) ; align long strings | |
)) | |
)) | |
(add-hook 'csharp-mode-hook | |
'(lambda() | |
(c-set-style "myC#Style") | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment