I've further refined this method a bit.  There's something wrong with using
exchange-point-and-mark, the first time one compiles there is no mark.
Although the goto-char idea I would expect to work, but I'm not fully
understanding something here.  Here's the current revision, perhaps there
are some better elisp experts out there reading this that have some ideas.

;;Make sure compilation mode finds the right file when instrumenting Java
code
(defun compilation-filter-hook-jps ()
  (interactive)
  (save-excursion
    ;;(goto-char (process-mark (get-buffer-process (current-buffer))))
    ;;Just want to search over the last set of stuff, so exchange point and
mark?
    (exchange-point-and-mark t) ;;doesn't work for first compile...
    (while (re-search-forward "[/\\\\]instrumented\\([/\\\\].\\)" nil t)
      (replace-match "\\1")))
  )
(add-hook 'compilation-filter-hook 'compilation-filter-hook-jps)

> -----Original Message-----
> From: Schewe, Jon (MN65) [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 25, 2002 3:23 PM
> To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
> Subject: RE: error navigation
> 
> 
> Interestingly enough I just wanted to do this today too:
> (defun compilation-filter-hook-jps ()
>   (interactive)
>   ;;Just want to search over the last set of stuff, so 
> exchange point and
> mark?
>   (exchange-point-and-mark t)
>   (while (re-search-forward "[/\\\\]instrumented" nil t)
>     (replace-match "" nil t))
>   (exchange-point-and-mark t)
>   )
> (add-hook 'compilation-filter-hook 'compilation-filter-hook-jps)
> 
> This isn't perfect, but it appears to work.  Any suggestions 
> are welcome.

Reply via email to