Created
October 31, 2012 04:58
-
-
Save crowding/3984881 to your computer and use it in GitHub Desktop.
Flymake support for R code
This file contains hidden or 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
;; R flymake support (if Flymake is available) This will call a script | |
;; "rflymake" with the path given; make sure it is on emac's exec-path | |
;; or give a full path. | |
(when (require 'flymake nil) | |
(defun flymake-r-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 "~/bin/rflymake" (list local-file)))) | |
(add-to-list 'flymake-allowed-file-name-masks '("\\.[Rr]\\'" flymake-r-init)) | |
(add-to-list 'flymake-err-line-patterns | |
'("parse(\"\\([^\"]*\\)\"): \\([0-9]+\\):\\([0-9]+\\): \\(.*\\)$" | |
1 2 3 4)) | |
(add-hook 'r-mode-hook 'flymake-mode) | |
) |
This file contains hidden or 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/env Rscript --no-init-file | |
#Parse a file and print the first error encountered. | |
args <- commandArgs(trailingOnly=TRUE) | |
filename = args[[1]] | |
tryCatch(invisible(do.call("parse", list(filename))), error=print) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment