Last active
September 4, 2015 09:09
-
-
Save fujimisakari/9646250 to your computer and use it in GitHub Desktop.
EmacsでUnity開発(c#)するための環境構築 ref: http://qiita.com/fujimisakari/items/d043a2fae31ed740e290
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
#! /bin/bash | |
# シンタックスチェック | |
/usr/bin/mcs -r:/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll,/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll,~/projects/proj1/Library/ScriptAssemblies/Assembly-CSharp.dll,~/projects/proj1/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll $1 -target:library | |
dll_file=`echo $1 | sed -e "s/\.cs/.dll/"` | |
ls ${dll_file} && rm ${dll_file} | |
# コードスタイルチェック | |
/usr/bin/mono ~/.emacs.d/bin/StyleCopCLI.exe -cs $PWD/$1 -out /tmp/stylecop.log | |
# エラーとして扱いたくないものは、grepに追加していく | |
cat /tmp/stylecop.log | sed -e "s/\"//g" | sed -e "s/>/ /g" | grep -v "SA1001\|SA1202\|SA15013" | |
ls $PWD/StyleCop.Cache && rm $PWD/StyleCop.Cache |
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
@@ -5561,8 +5561,8 @@ Key bindings: | |
;; `imenu-generic-expression'; imenu will do a "generic scan" for you. | |
;; csharp-mode uses the former method. | |
;; | |
- (setq imenu-create-index-function 'csharp-imenu-create-index) | |
- (imenu-add-menubar-index))) | |
+ (setq imenu-create-index-function 'csharp-imenu-create-index))) | |
+ ;; (imenu-add-menubar-index))) |
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
/usr/bin/mcs -r:ライブラリpath $1 -target:Library |
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
System.Console.WriteLine("hoge"); // flymakeでは正常扱い | |
tem.Console.WriteLine("hoge"); // flymakeでは正常扱い | |
Sys tem.Console.WriteLine("hoge"); // flymakeでは異常扱い |
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
(require 'csharp-mode) | |
(setq auto-mode-alist | |
(append '(("\\.cs$" . csharp-mode)) auto-mode-alist)) | |
;; C#モードフック | |
(add-hook 'csharp-mode-hook | |
'(lambda() | |
(setq comment-column 40) | |
(setq c-basic-offset 4) | |
;; (font-lock-add-magic-number) | |
;; オフセットの調整 | |
(c-set-offset 'substatement-open 0) | |
(c-set-offset 'case-label '+) | |
(c-set-offset 'arglist-intro '+) | |
(c-set-offset 'arglist-close 0) | |
(hl-line-mode) | |
(auto-complete-mode) | |
(flymake-mode) | |
) | |
) | |
;; Gtags設定 | |
(require 'gtags) | |
(global-set-key (kbd "C-'") 'gtags-find-tag-other-window) ; (別バッファで)関数の定義元(関数の実体)へジャンプ | |
(global-set-key (kbd "C-M-'") 'gtags-find-tag) ; 変数等のジャンプ | |
;; Flymake | |
(defun flymake-csharp-init () | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-create-temp-inplace)) | |
(local-file (file-relative-name | |
temp-file | |
(file-name-directory buffer-file-name)))) | |
(list "~/.emacs.d/bin/csharp-checker" (list local-file)))) | |
(add-to-list 'flymake-allowed-file-name-masks | |
'("\\.cs$" flymake-csharp-init)) | |
(add-to-list 'flymake-err-line-patterns | |
'("cs\(\\([0-9]+\\),\\([0-9]+\\)\)\: \\(error\\|warning\\) \\(.+\\)$" nil 1 2 4)) | |
(add-to-list 'flymake-err-line-patterns | |
'("LineNumber=\\([0-9]+\\) .* RuleId=\\(.+\\)</Violation" nil 1 1 2)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment