From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Allow compilation-next-error-function to leave code line highlighted until next command is typed Date: Tue, 29 Jun 2004 04:32:11 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87oen3hwg0.fsf@mail.jurta.org> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1088480365 7998 80.91.224.253 (29 Jun 2004 03:39:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 29 Jun 2004 03:39:25 +0000 (UTC) Cc: Francis Litterio , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Jun 29 05:39:18 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 1Bf9So-0007ah-00 for ; Tue, 29 Jun 2004 05:39:18 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bf9So-0001gB-00 for ; Tue, 29 Jun 2004 05:39:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bf9UR-0008Rv-Qi for emacs-devel@quimby.gnus.org; Mon, 28 Jun 2004 23:40:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Bf9UO-0008R7-Bl for emacs-devel@gnu.org; Mon, 28 Jun 2004 23:40:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Bf9UM-0008Qt-QJ for emacs-devel@gnu.org; Mon, 28 Jun 2004 23:40:56 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bf9UM-0008Qq-OR for emacs-devel@gnu.org; Mon, 28 Jun 2004 23:40:54 -0400 Original-Received: from [66.33.205.9] (helo=spatula.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Bf9S9-0000e6-2X; Mon, 28 Jun 2004 23:38:37 -0400 Original-Received: from mail.jurta.org (80-235-38-110-dsl.mus.estpak.ee [80.235.38.110]) by spatula.dreamhost.com (Postfix) with ESMTP id DC5EC17D02B; Mon, 28 Jun 2004 20:38:31 -0700 (PDT) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Mon, 28 Jun 2004 10:58:13 -0400") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) 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:25302 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25302 Richard Stallman writes: > Juri Linkov responded: > A similar change was discussed recently but was stuck with naming > of this option: it should be used by packages other than compile > (grep, diff, occur, ...), but neither `compilation-highlight' nor > `next-error-highlight' seems right when applied to non-compilation > buffers. > > As long as the command is called `next-error', it is ok to call some > related thing `next-error-highlight'. The command `next-error' already has two aliases: `goto-next-locus' and `next-match'. Should we make aliases for new options, faces and customization group? > Even the name `compilation-highlight-duration' can't be objected to, > given that the function that would use it is called > `compilation-goto-locus'. If it is used only in `compilation-goto-locus' the option name `compilation-highlight-duration' is still not right for grep commands which use compile.el. > We might consider a change in all these names, but that is a > separate issue. There is no need to hold up this little feature for > that. It's better to resolve the naming issue now than to make the option name obsolete after the next release when a better name will be proposed. > ISTR that we already discussed some other feature for highlighting > the source code line. What is actually installed now? Nothing was installed yet. The proposed patch was like below: Index: lisp/simple.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v retrieving revision 1.648 diff -u -r1.648 simple.el --- lisp/simple.el 13 Jun 2004 22:00:17 -0000 1.648 +++ lisp/simple.el 29 Jun 2004 02:33:55 -0000 @@ -200,7 +207,8 @@ Finds and highlights the source line like \\[next-error], but does not select the source buffer." (interactive "p") - (next-error n) + (let ((next-error-highlight next-error-highlight-no-select)) + (next-error n)) (pop-to-buffer next-error-last-buffer)) (defun previous-error-no-select (n) @@ -212,6 +220,44 @@ (interactive "p") (next-error-no-select (- n))) +(defgroup next-error nil + "next-error support framework." + :group 'tools) + +(defface next-error + '((t (:inherit region))) + "Face used to highlight next error locus." + :group 'next-error + :version "21.4") +(defvar next-error-face 'next-error + "Face name used to highlight next error locus.") + +(defcustom next-error-highlight 0.1 + "*Highlighting method in selected buffers. +If number highlight the locus in next-error face for given time in seconds. +If t, use persistent overlays fontified in next-error face. +If nil, don't highlight the locus in the source buffer. +If `fringe-arrow', indicate the locus by the fringe arrow." + :type '(choice (integer :tag "Delay") + (const :tag "Persistent overlay" t) + (const :tag "No highlighting" nil) + (const :tag "Fringe arrow" 'fringe-arrow)) + :group 'compilation + :version "21.4") + +(defcustom next-error-highlight-no-select 0.1 + "*Highlighting method in non-selected buffers. +If number, highlight the locus in next-error face for given time in seconds. +If t, use persistent overlays fontified in next-error face. +If nil, don't highlight the locus in the source buffer. +If `fringe-arrow', indicate the locus by the fringe arrow." + :type '(choice (integer :tag "Delay") + (const :tag "Persistent overlay" t) + (const :tag "No highlighting" nil) + (const :tag "Fringe arrow" 'fringe-arrow)) + :group 'compilation + :version "21.4") + ;;; (defun fundamental-mode () Index: lisp/progmodes/compile.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/compile.el,v retrieving revision 1.322 diff -u -r1.322 compile.el --- lisp/progmodes/compile.el 18 Jun 2004 23:00:46 -0000 1.322 +++ lisp/progmodes/compile.el 29 Jun 2004 02:35:35 -0000 @@ -1562,7 +1569,7 @@ (unless compilation-highlight-overlay (setq compilation-highlight-overlay (make-overlay (point-min) (point-min))) - (overlay-put compilation-highlight-overlay 'face 'region)) + (overlay-put compilation-highlight-overlay 'face next-error-face)) (with-current-buffer (marker-buffer mk) (save-excursion (end-of-line) @@ -1572,11 +1579,17 @@ (re-search-forward highlight-regexp end t)) (progn (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))))))) - + (move-overlay compilation-highlight-overlay + (match-beginning 0) (match-end 0) (current-buffer))) + (move-overlay compilation-highlight-overlay + (point) end (current-buffer))) + (if (numberp next-error-highlight) + (sit-for next-error-highlight)) + (if (not (eq next-error-highlight t)) + (delete-overlay compilation-highlight-overlay)))))) + (when (and (eq next-error-highlight 'fringe-arrow)) + (set (make-local-variable 'overlay-arrow-position) + (copy-marker (line-beginning-position)))))) (defun compilation-find-file (marker filename dir &rest formats) "Find a buffer for file FILENAME. -- Juri Linkov http://www.jurta.org/emacs/