From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Francis Litterio Newsgroups: gmane.emacs.devel 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 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1087940268 15578 80.91.224.253 (22 Jun 2004 21:37:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 22 Jun 2004 21:37:48 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Jun 22 23:37:35 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BcsxT-0000aH-00 for ; Tue, 22 Jun 2004 23:37:35 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BcsxS-0005KF-00 for ; Tue, 22 Jun 2004 23:37:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bcsym-0007Hc-Ri for emacs-devel@quimby.gnus.org; Tue, 22 Jun 2004 17:38:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Bcsyc-0007H6-Sc for emacs-devel@gnu.org; Tue, 22 Jun 2004 17:38:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Bcsya-0007Ga-NT for emacs-devel@gnu.org; Tue, 22 Jun 2004 17:38:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bcsya-0007GX-Lv for emacs-devel@gnu.org; Tue, 22 Jun 2004 17:38:44 -0400 Original-Received: from [192.74.137.141] (helo=TheWorld.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BcsxD-0006EY-4u for emacs-devel@gnu.org; Tue, 22 Jun 2004 17:37:20 -0400 Original-Received: from shell.TheWorld.com (root@shell01.theworld.com [192.74.137.71]) by TheWorld.com (8.12.8p1/8.12.8) with ESMTP id i5MKwkKp006794 for ; Tue, 22 Jun 2004 16:58:49 -0400 Original-Received: from lt371-fran.theworld.com (shell01-g [192.74.137.71]) by shell.TheWorld.com (8.9.3/8.9.3) with ESMTP id QAA7765003 for ; Tue, 22 Jun 2004 16:11:38 -0400 (EDT) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (windows-nt) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25185 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25185 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)))))))) (defun compilation-find-file (marker filename dir &rest formats)