all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Allow compilation-next-error-function to leave code line highlighted until next command is typed
@ 2004-06-22 19:26 Francis Litterio
  2004-06-22 23:19 ` Juri Linkov
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Francis Litterio @ 2004-06-22 19:26 UTC (permalink / raw)


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
entered.

I hope this change is of value.
--
Francis Litterio
franl@world.std.com
http://world.std.com/~franl/
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 @@
                             (point))))
   (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 'local))))))))
 
 \f
 (defun compilation-find-file (marker filename dir &rest formats)

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-09-17  9:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-22 19:26 [PATCH] Allow compilation-next-error-function to leave code line highlighted until next command is typed Francis Litterio
2004-06-22 23:19 ` Juri Linkov
2004-06-23  4:50 ` Eli Zaretskii
2004-06-28 14:58 ` Richard Stallman
2004-06-29  1:32   ` Juri Linkov
2004-06-30  3:02     ` Richard Stallman
2004-07-01  5:46       ` Juri Linkov
2004-07-02 10:12         ` Richard Stallman
2004-07-10 22:41         ` Richard Stallman
2004-07-12 16:13           ` Ted Zlatanov
2004-07-14  0:16             ` Richard Stallman
2004-09-13 17:58               ` Ted Zlatanov
2004-09-17  9:36                 ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.