"Add to kill ring errors/warnings for current line. Also display error/warnings as Emacs messages (on the minibuffer)"
(let* ((line-no (flymake-current-line-no))
(line-err-info-list (nth 0 (flymake-find-err-info (flymake-get-buffer-err-info (current-buffer)) line-no))))
"Save a list with errors/warnings from line-err-info in the kill ring.
Also displays them as messages"
(mapcar 'flymakeh-kill-data-from-err-entry line-err-info-list)
(defun flymakeh-kill-data-from-err-entry (line-err-info-entry)
(let ((err-entry-text (flymake-ler-get-text line-err-info-entry)))
(defun flymakeh-open-compilation (&optional other-files)
"Open Flymake errors in a compilation buffer.
Shows only errors for the current buffer.
With the optional prefix argument it also shows messages for other files."
(let ((errs (flymake-get-buffer-err-info (current-buffer)))
(comp-buffer (get-buffer-create "*compilation*")))
(setq buffer-read-only nil)
(if (null errs)
(insert "\nCompilation finished at " (current-time-string) "\n")
(dolist (fileline errs)
(dolist (errmsg (cadr fileline))
(let ((file (nth 0 errmsg))
(line (nth 1 errmsg))
(severity (nth 2 errmsg))
(msg (nth 3 errmsg))
(path (nth 4 errmsg)))
(if (and (or other-files (null file)) (> line 0))
(insert path ":" (number-to-string line) ":"
(replace-regexp-in-string "\\`[:0-9]+: \\(Semantic \\|Syntax \\)*" "" msg)
(insert "\nCompilation exited abnormally with code 1 at "
(next-error 0 t)))