Skip to content

Commit

Permalink
Clean up compilation messages, only fontify (and link) files in curre…
Browse files Browse the repository at this point in the history
…nt project.
  • Loading branch information
espenhw committed Mar 19, 2009
1 parent 1662824 commit 402452d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/main/lisp/malabar-project.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,37 @@
(setq malabar-compilation-project-file (malabar-find-project-file))
(malabar-groovy-setup-compilation-buffer))

(defun malabar--clean-compilation-messages (buffer &optional message)
(let ((source-dirs
(append (malabar-project-source-directories malabar-compilation-project-file)
(malabar-project-test-source-directories malabar-compilation-project-file))))
(with-current-buffer buffer
(remove-hook 'after-change-functions 'font-lock-after-change-function t)
(font-lock-fontify-buffer)
(save-excursion
(goto-char (point-min))
(let (locus)
(ignore-errors
(while t
;; Grubbing in compile's internals, here
(setq locus (compilation-next-error 1 nil (point)))
(setq file (car (car (nth 2 (car locus)))))
(unless (file-readable-p file)
(let ((end (or (text-property-not-all (point) (point-max) 'message locus)
(point-max)))
(file (malabar-project-locate-source-file file source-dirs)))
(if (null file)
(set-text-properties (point) end nil)
(rplaca (car (nth 2 (car locus))) file)
(put-text-property (point) end 'message locus)))))))))))

(add-hook 'compilation-finish-functions 'malabar--clean-compilation-messages)

(defun malabar-project-locate-source-file (filename dirs)
(catch 'found
(dolist (dir dirs)
(malabar--find-file filename dir)))))

(defun malabar-project (buffer)
(format "Project.makeProject('%s')" (malabar-find-project-file buffer)))

Expand Down

0 comments on commit 402452d

Please sign in to comment.