Last active
August 29, 2015 14:08
-
-
Save tanb/704f4f663d2e68e410df to your computer and use it in GitHub Desktop.
flymake - swift
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
(when (require 'flymake nil 'noerror) | |
;; ignore syntax check error http://d.hatena.ne.jp/sugyan/20100705/1278306885 | |
(defadvice flymake-post-syntax-check (before flymake-force-check-was-interrupted) | |
(setq flymake-check-was-interrupted t)) | |
(ad-activate 'flymake-post-syntax-check) | |
;; swift | |
(defvar swift-sdk-path "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk") | |
(defvar swift-configure-target "i386-apple-ios8.1") | |
(defun flymake-swift-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 "swiftc" (list "-sdk" swift-sdk-path | |
"-parse" | |
"-DDEBUG=1" | |
"-target" swift-configure-target | |
local-file)))) | |
(add-to-list 'flymake-allowed-file-name-masks | |
'("\\.swift\\'" flymake-swift-init)) | |
(add-hook 'swift-mode-hook | |
'(lambda () (flymake-mode t))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment