comparison lisp/progmodes/compile.el @ 73104:a90c9318cca9

(compilation-goto-locus-delete-o): New fn. (compilation-goto-locus): Use compilation-goto-locus-delete-o to delete the overlay. Put it on pre-command-hook.
author Richard M. Stallman <rms@gnu.org>
date Sun, 24 Sep 2006 20:42:08 +0000
parents 26df5bbb5d61
children 8c8ad3efe1fe bb0e318b7c53
comparison
equal deleted inserted replaced
73103:76400a9b9e59 73104:a90c9318cca9
1782 (move-overlay compilation-highlight-overlay 1782 (move-overlay compilation-highlight-overlay
1783 (match-beginning 0) (match-end 0) 1783 (match-beginning 0) (match-end 0)
1784 (current-buffer))) 1784 (current-buffer)))
1785 (move-overlay compilation-highlight-overlay 1785 (move-overlay compilation-highlight-overlay
1786 (point) end (current-buffer))) 1786 (point) end (current-buffer)))
1787 (if (numberp next-error-highlight) 1787 (if (or (eq next-error-highlight t)
1788 (setq next-error-highlight-timer 1788 (numberp next-error-highlight))
1789 (run-at-time next-error-highlight nil 'delete-overlay 1789 ;; We want highlighting: delete overlay on next input.
1790 compilation-highlight-overlay))) 1790 (add-hook 'pre-command-hook
1791 (if (not (or (eq next-error-highlight t) 1791 'compilation-goto-locus-delete-o)
1792 (numberp next-error-highlight))) 1792 ;; We don't want highlighting: delete overlay now.
1793 (delete-overlay compilation-highlight-overlay)))))) 1793 (delete-overlay compilation-highlight-overlay))
1794 ;; We want highlighting for a limited time:
1795 ;; set up a timer to delete it.
1796 (when (numberp next-error-highlight)
1797 (setq next-error-highlight-timer
1798 (run-at-time next-error-highlight nil
1799 'compilation-goto-locus-delete-o)))))))
1794 (when (and (eq next-error-highlight 'fringe-arrow)) 1800 (when (and (eq next-error-highlight 'fringe-arrow))
1801 ;; We want a fringe arrow (instead of highlighting).
1795 (setq next-error-overlay-arrow-position 1802 (setq next-error-overlay-arrow-position
1796 (copy-marker (line-beginning-position)))))) 1803 (copy-marker (line-beginning-position))))))
1797 1804
1805 (defun compilation-goto-locus-delete-o ()
1806 (delete-overlay compilation-highlight-overlay)
1807 ;; Get rid of timer and hook that would try to do this again.
1808 (if (timerp next-error-highlight-timer)
1809 (cancel-timer next-error-highlight-timer))
1810 (remove-hook 'pre-command-hook
1811 'compilation-goto-locus-delete-o))
1798 1812
1799 (defun compilation-find-file (marker filename directory &rest formats) 1813 (defun compilation-find-file (marker filename directory &rest formats)
1800 "Find a buffer for file FILENAME. 1814 "Find a buffer for file FILENAME.
1801 Search the directories in `compilation-search-path'. 1815 Search the directories in `compilation-search-path'.
1802 A nil in `compilation-search-path' means to try the 1816 A nil in `compilation-search-path' means to try the