]> code.delx.au - gnu-emacs/commitdiff
(compilation-goto-locus-delete-o): New fn.
authorRichard M. Stallman <rms@gnu.org>
Sun, 24 Sep 2006 20:42:08 +0000 (20:42 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 24 Sep 2006 20:42:08 +0000 (20:42 +0000)
(compilation-goto-locus): Use compilation-goto-locus-delete-o
to delete the overlay.  Put it on pre-command-hook.

lisp/progmodes/compile.el

index e6a6a8ed9c5087c86d169b1e8375e21d3fb78042..7d9ce41229ce16da2d6e9ad7955311402a66e0fc 100644 (file)
@@ -1784,17 +1784,31 @@ and overlay is highlighted between MK and END-MK."
                                (current-buffer)))
              (move-overlay compilation-highlight-overlay
                            (point) end (current-buffer)))
-           (if (numberp next-error-highlight)
-               (setq next-error-highlight-timer
-                     (run-at-time next-error-highlight nil 'delete-overlay
-                                  compilation-highlight-overlay)))
-           (if (not (or (eq next-error-highlight t)
-                        (numberp next-error-highlight)))
-               (delete-overlay compilation-highlight-overlay))))))
+           (if (or (eq next-error-highlight t)
+                   (numberp next-error-highlight))
+               ;; We want highlighting: delete overlay on next input.
+               (add-hook 'pre-command-hook
+                         'compilation-goto-locus-delete-o)
+             ;; We don't want highlighting: delete overlay now.
+             (delete-overlay compilation-highlight-overlay))
+           ;; We want highlighting for a limited time:
+           ;; set up a timer to delete it.
+           (when (numberp next-error-highlight)
+             (setq next-error-highlight-timer
+                   (run-at-time next-error-highlight nil
+                                'compilation-goto-locus-delete-o)))))))
     (when (and (eq next-error-highlight 'fringe-arrow))
+      ;; We want a fringe arrow (instead of highlighting).
       (setq next-error-overlay-arrow-position
            (copy-marker (line-beginning-position))))))
 
+(defun compilation-goto-locus-delete-o ()
+  (delete-overlay compilation-highlight-overlay)
+  ;; Get rid of timer and hook that would try to do this again.
+  (if (timerp next-error-highlight-timer)
+      (cancel-timer next-error-highlight-timer))
+  (remove-hook 'pre-command-hook
+              'compilation-goto-locus-delete-o))
 \f
 (defun compilation-find-file (marker filename directory &rest formats)
   "Find a buffer for file FILENAME.