[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Allow compilation-next-error-function to leave code line highlig

From: Francis Litterio
Subject: [PATCH] Allow compilation-next-error-function to leave code line highlighted until next command is typed
Date: Tue, 22 Jun 2004 15:26:28 -0400
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (windows-nt)

This patch to lisp/progmodes/compile.el in the CVS Emacs sources allows
compilation-next-error-function to either highlight the displayed line
of code for a configurable amount of time (it used to be hard-coded at
0.5 seconds) or to leave it highlighted until the next command is

I hope this change is of value.
Francis Litterio
GPG and PGP public keys available on keyservers.

--- compile.el  09 Jun 2004 13:15:22 -0400      1.321
+++ compile.el  22 Jun 2004 15:25:41 -0400      
@@ -375,6 +375,16 @@
 (defvar compilation-highlight-overlay nil
   "Overlay used to temporarily highlight compilation matches.")
+(defcustom compilation-highlight-duration 0.5
+  "*If the value of this variable is a number, it specifies the
+number of seconds that the text highlighted by
+compilation-next-error-function will be highlighted.  If the
+value of this variable is not a number (e.g., a symbol, such as
+nil or t), then the text remains highlighted until the next
+command occurs."
+  :type 'integer
+  :group 'compilation)
 (defcustom compilation-error-screen-columns t
   "*If non-nil, column numbers in error messages are screen columns.
 Otherwise they are interpreted as character positions, with
@@ -1518,6 +1528,12 @@
   (set-window-point w mk))
+(defun compilation-delete-overlay ()
+  "Deletes the overlay stored in compilation-highlight-overlay
+and removes this function from pre-command-hook."
+  (delete-overlay compilation-highlight-overlay)
+  (remove-hook 'pre-command-hook 'compilation-delete-overlay 'local))
 (defun compilation-goto-locus (msg mk end-mk)
   "Jump to an error corresponding to MSG at MK.
 All arguments are markers.  If END-MK is non nil, mark is set there."
@@ -1574,8 +1590,11 @@
                  (goto-char (match-beginning 0))
                  (move-overlay compilation-highlight-overlay (match-beginning 
0) (match-end 0)))
              (move-overlay compilation-highlight-overlay (point) end))
-           (sit-for 0.5)
-           (delete-overlay compilation-highlight-overlay)))))))
+           (if (numberp compilation-highlight-duration)
+               (progn
+                 (sit-for compilation-highlight-duration)
+                 (delete-overlay compilation-highlight-overlay))
+             (add-hook 'pre-command-hook 'compilation-delete-overlay nil 
 (defun compilation-find-file (marker filename dir &rest formats)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]