Folks,
I had brought up this issue earlier...I took a first crack at
it.....
It is still rough but with some expert help this could be completed...
Especially I need help with save-excursion and buffer selection etc...
For now -
1. Compile any java class such that it results in error messages
2. Switch to the *compilation* buffer
3. Invoke the following function animate-messages
(defun animate-messages()
"Animate messages in *compilation* buffer."
(interactive)
(let* (
(errorMarker (compilation-next-error-locus 1 t t))
(compilation-error-overlay)
)
(while errorMarker
(let (
(nextErrorMarker (compilation-next-error-locus 1 nil t))
(errorBufferMarker (car errorMarker))
errorString
errorBegin
errorEnd
)
(save-excursion
(setq errorBegin (marker-position errorBufferMarker))
(if nextErrorMarker
(setq errorEnd (marker-position (car nextErrorMarker)))
(setq errorEnd (point-max))
)
(setq errorString (buffer-substring errorBegin errorEnd))
)
(save-excursion
(if (not (eq (current-buffer) (marker-buffer (cdr errorMarker))))
(switch-to-buffer (marker-buffer (cdr errorMarker)))
)
(goto-char (marker-position (cdr errorMarker)))
(if compilation-error-overlay
(move-overlay compilation-error-overlay (line-beginning-position)
(line-end-position))
(setq compilation-error-overlay
(make-overlay (line-beginning-position) (line-end-position)))
)
(overlay-put compilation-error-overlay 'face 'underline)
(message errorString)
(sit-for 3)
)
(setq errorMarker (compilation-next-error-locus 1 nil t))
)
)
(if compilation-error-overlay
(delete-overlay compilation-error-overlay)
)
(message "Done.")
)
)
[NOTE: The above works for grep output also.]
4. This should animate the error messages i.e.
i. move the point to the location of error
ii. temporarily underline the line
iii. echo the error message in mini-buffer
What I want to do eventually is to hook this function to compilation
finish hook.
When there are compilation error messages the error messages are shown
in the
buffer with some overlay. The help-echo text property is used to show
the error meesage
in mini-buffer.
A background compilation may be invoked every so often or on demand
basis...
enjoy,
sandip