Skip to content

Instantly share code, notes, and snippets.

@uehaj
Created October 17, 2010 16:27
Show Gist options
  • Save uehaj/630992 to your computer and use it in GitHub Desktop.
Save uehaj/630992 to your computer and use it in GitHub Desktop.
flymake-groovy.el(GroovyServ version)
;;;; flymake for groovy
(require 'flymake)
(setq exec-path
(cons "/tool/groovyserv-0.4/bin" exec-path))
;; Invoke groovyclient for compile with syntax checking
(defun flymake-groovy-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 "groovyclient" (list "-e" "org.codehaus.groovy.tools.FileSystemCompiler.main(args)" "--" local-file))))
(push '(".+\\.groovy$" flymake-groovy-init) flymake-allowed-file-name-masks)
(push '("^\\(.*\\):\\([0-9]+\\): \\(.*\\)$" 1 2 nil 3) flymake-err-line-patterns)
(add-hook
'groovy-mode-hook
'(lambda ()
(if (not (null buffer-file-name)) (flymake-mode))))
(defun credmp/flymake-display-err-minibuf ()
"Displays the error/warning for the current line in the minibuffer"
(interactive)
(let* ((line-no (flymake-current-line-no))
(line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no)))
(count (length line-err-info-list))
)
(while (> count 0)
(when line-err-info-list
(let* ((file (flymake-ler-file (nth (1- count) line-err-info-list)))
(full-file (flymake-ler-full-file (nth (1- count) line-err-info-list)))
(text (flymake-ler-text (nth (1- count) line-err-info-list)))
(line (flymake-ler-line (nth (1- count) line-err-info-list))))
(message "[%s] %s" line text)
)
)
(setq count (1- count)))))
(defun flymake-display-err-menu-for-current-line ()
"Displays the error/warning for the current line in popup(needs popup.el in auto-complete)"
(interactive)
(let* ((line-no (flymake-current-line-no))
(line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no))))
(when line-err-info-list
(let* ((count (length line-err-info-list))
(menu-item-text nil))
(while (> count 0)
(setq menu-item-text (flymake-ler-text (nth (1- count) line-err-info-list)))
(let* ((file (flymake-ler-file (nth (1- count) line-err-info-list)))
(line (flymake-ler-line (nth (1- count) line-err-info-list))))
(if file
(setq menu-item-text (concat menu-item-text " - " file "(" (format "%d" line) ")"))))
(setq count (1- count))
(if (> count 0) (setq menu-item-text (concat menu-item-text "\n")))
)
(popup-tip menu-item-text)))))
(defun next-flymake-error ()
"Displays the error/warning for the current line in the minibuffer"
(interactive)
(flymake-goto-next-error)
(let ((err (get-char-property (point) 'help-echo)))
(when err
(message err))))
(provide 'flymake-groovy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment