From unknown Thu Sep 11 09:18:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14362: 24.3; Make it possible to modify compilation-find-file Resent-From: Gareth Rees Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 May 2013 19:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14362 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 14362@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136795443423994 (code B ref -1); Tue, 07 May 2013 19:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 May 2013 19:20:34 +0000 Received: from localhost ([127.0.0.1]:33148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UZnRB-0006Ex-GW for submit@debbugs.gnu.org; Tue, 07 May 2013 15:20:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60554) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UZnR8-0006Eo-Fd for submit@debbugs.gnu.org; Tue, 07 May 2013 15:20:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZnQ3-0001ae-BW for submit@debbugs.gnu.org; Tue, 07 May 2013 15:19:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_MED autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:36551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZnQ3-0001aa-80 for submit@debbugs.gnu.org; Tue, 07 May 2013 15:19:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZnPz-0003Wk-6G for bug-gnu-emacs@gnu.org; Tue, 07 May 2013 15:19:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZnPv-0001Yl-Ow for bug-gnu-emacs@gnu.org; Tue, 07 May 2013 15:19:19 -0400 Received: from raven.ravenbrook.com ([94.229.129.33]:12556) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZnPv-0001XV-Gw for bug-gnu-emacs@gnu.org; Tue, 07 May 2013 15:19:15 -0400 Received: from [192.168.0.2] (cpc22-cmbg15-2-0-cust180.5-4.cable.virginmedia.com [86.27.176.181]) (authenticated bits=0) by raven.ravenbrook.com (8.14.7/8.14.5) with ESMTP id r47JJ47N095795 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Tue, 7 May 2013 20:19:04 +0100 (BST) (envelope-from gdr@garethrees.org) From: Gareth Rees Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <1D196226-AB6A-49B4-A156-83EDFE9C6905@garethrees.org> Date: Tue, 7 May 2013 20:19:04 +0100 Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) X-Mailer: Apple Mail (2.1503) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (raven.ravenbrook.com [94.229.129.33]); Tue, 07 May 2013 20:19:04 +0100 (BST) X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) BACKGROUND I'm working on the Perforce/Emacs integration , and I recently added support for the "p4 grep" command. This command is just like "grep" except that it searches current or past revisions of files stored on the Perforce server. Typical output from the command looks like this: # find occurrences of FIXME in *.c as of 1st January 2013.=20 $ p4 grep -e FIXME '*.c@2013/01/01' //info.ravenbrook.com/project/mps/master/code/eventcnv.c#17: /* = FIXME: This attempted to print the event stats on a row that //info.ravenbrook.com/project/mps/master/code/mps.c#14:#include "span.c" = /* generic stack probe FIXME: Is this correct? */ The filename on the left of each hit is expressed in Perforce server format: thus the first hit is for revision number 17 of eventcnv.c. An Emacs interface to this command is easy to implement, using the grep function and setting compilation-error-regexp-alist accordingly. Except for one problem. If the user runs the p4 grep command via my interface, and then clicks on one of the hits, I want Emacs to jump to the corresponding line in that revision of the file. But the filename is given in Perforce server syntax, and compilation-next-error-function does not know how to visit that file. There seems to be no way to customize the behaviour of compilation-find-file. SUGGESTION The simplest way to support my use case would be to add a new variable compilation-find-file-function. If this is non-NIL, then call it instead of compilation-find-file. Suggested patch against 24.3 below. WORKAROUND I've set next-error-function to this function, which overrides compilation-find-file during the call to compilation-next-error-function. (defun p4-grep-next-error-function (n &optional reset) "Advance to the next error message and visit the file where the error = was. This is the value of `next-error-function' in P4 Grep buffers." (interactive "p") (let ((cff (symbol-function 'compilation-find-file))) (unwind-protect (progn (fset 'compilation-find-file 'p4-grep-find-file) (compilation-next-error-function n reset)) (fset 'compilation-find-file cff)))) PATCH --- compile.el-24.3 2013-05-07 20:07:58.000000000 +0100 +++ compile.el 2013-05-07 20:15:17.000000000 +0100 @@ -83,6 +83,15 @@ that value, otherwise it uses the value in the *compilation* buffer. This enables a major-mode to specify its own value.") =20 +(defvar compilation-find-file-function nil + "Function to call to visit a file found by `next-error' and +similar commands. It takes three arguments: MARKER FILENAME +DIRECTORY, where FILENAME is the name of the file to visit, MARKER +is the location in the compilation output where the file was +mentioned, and DIRECTORY is the \"current\" directory. If +DIRECTORY is relative, it is combined with `default-directory'. +If DIRECTORY is nil, that means use `default-directory'.") + (defvar compilation-parse-errors-filename-function nil "Function to call to post-process filenames while parsing error = messages. It takes one arg FILENAME which is the name of a file as found @@ -1972,6 +1981,7 @@ compilation-first-column compilation-mode-font-lock-keywords compilation-page-delimiter + compilation-find-file-function compilation-parse-errors-filename-function compilation-process-setup-function compilation-scroll-output @@ -2370,7 +2380,7 @@ ;; (setq timestamp = compilation-buffer-modtime))) ) (with-current-buffer - (compilation-find-file + (funcall (or compilation-find-file-function = 'compilation-find-file) marker (caar (compilation--loc->file-struct loc)) (cadr (car (compilation--loc->file-struct loc)))) --=20 Gareth Rees= From unknown Thu Sep 11 09:18:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14362: 24.3; Make it possible to modify compilation-find-file Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 May 2013 19:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14362 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Gareth Rees Cc: 14362@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 14362-submit@debbugs.gnu.org id=B14362.136795500625526 (code B ref 14362); Tue, 07 May 2013 19:31:02 +0000 Received: (at 14362) by debbugs.gnu.org; 7 May 2013 19:30:06 +0000 Received: from localhost ([127.0.0.1]:33154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UZnaP-0006df-Ss for submit@debbugs.gnu.org; Tue, 07 May 2013 15:30:06 -0400 Received: from mtaout23.012.net.il ([80.179.55.175]:54775) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UZnaN-0006ca-Nd for 14362@debbugs.gnu.org; Tue, 07 May 2013 15:30:05 -0400 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MMG005000BWE100@a-mtaout23.012.net.il> for 14362@debbugs.gnu.org; Tue, 07 May 2013 22:28:57 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MMG005780S9D230@a-mtaout23.012.net.il>; Tue, 07 May 2013 22:28:57 +0300 (IDT) Date: Tue, 07 May 2013 22:28:51 +0300 From: Eli Zaretskii In-reply-to: <1D196226-AB6A-49B4-A156-83EDFE9C6905@garethrees.org> X-012-Sender: halo1@inter.net.il Message-id: <83bo8megi4.fsf@gnu.org> References: <1D196226-AB6A-49B4-A156-83EDFE9C6905@garethrees.org> X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Gareth Rees > Date: Tue, 7 May 2013 20:19:04 +0100 > > If the user runs the p4 grep command via my interface, and then clicks > on one of the hits, I want Emacs to jump to the corresponding line in > that revision of the file. But the filename is given in Perforce > server syntax, and compilation-next-error-function does not know how > to visit that file. There seems to be no way to customize the > behaviour of compilation-find-file. > > > SUGGESTION > > The simplest way to support my use case would be to add a new variable > compilation-find-file-function. If this is non-NIL, then call it > instead of compilation-find-file. Suggested patch against 24.3 below. Isn't that what file handlers are for? From unknown Thu Sep 11 09:18:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14362: 24.3; Make it possible to modify compilation-find-file Resent-From: Gareth Rees Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 May 2013 19:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14362 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 14362@debbugs.gnu.org Received: via spool by 14362-submit@debbugs.gnu.org id=B14362.136795556026894 (code B ref 14362); Tue, 07 May 2013 19:40:01 +0000 Received: (at 14362) by debbugs.gnu.org; 7 May 2013 19:39:20 +0000 Received: from localhost ([127.0.0.1]:33166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UZnjL-0006zi-49 for submit@debbugs.gnu.org; Tue, 07 May 2013 15:39:19 -0400 Received: from raven.ravenbrook.com ([94.229.129.33]:64049) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UZnjI-0006za-RZ for 14362@debbugs.gnu.org; Tue, 07 May 2013 15:39:17 -0400 Received: from [192.168.0.2] (cpc22-cmbg15-2-0-cust180.5-4.cable.virginmedia.com [86.27.176.181]) (authenticated bits=0) by raven.ravenbrook.com (8.14.7/8.14.5) with ESMTP id r47Jc8h1096571 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 7 May 2013 20:38:08 +0100 (BST) (envelope-from gdr@garethrees.org) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) From: Gareth Rees In-Reply-To: <83bo8megi4.fsf@gnu.org> Date: Tue, 7 May 2013 20:38:08 +0100 Content-Transfer-Encoding: 7bit Message-Id: <779F4296-5CFD-4088-9696-E3CB997A7953@garethrees.org> References: <1D196226-AB6A-49B4-A156-83EDFE9C6905@garethrees.org> <83bo8megi4.fsf@gnu.org> X-Mailer: Apple Mail (2.1503) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (raven.ravenbrook.com [94.229.129.33]); Tue, 07 May 2013 20:38:09 +0100 (BST) X-Spam-Status: No, score=2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=no version=3.3.2 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on raven.ravenbrook.com X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.3 (--) Eli Zaretskii wrote: > Isn't that what file handlers are for? Yes, it is. Thank you. -- Gareth Rees From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 19 13:30:18 2013 Received: (at control) by debbugs.gnu.org; 19 Jun 2013 17:30:18 +0000 Received: from localhost ([127.0.0.1]:56133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UpMD2-0006tZ-QX for submit@debbugs.gnu.org; Wed, 19 Jun 2013 13:30:17 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:56550 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UpMCy-0006oR-Ge for control@debbugs.gnu.org; Wed, 19 Jun 2013 13:30:13 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1UpMCx-0003SG-V2 for control@debbugs.gnu.org; Wed, 19 Jun 2013 13:30:12 -0400 Date: Wed, 19 Jun 2013 13:30:11 -0400 Message-Id: Subject: control message for bug 14362 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.3 (------) tag 14362 notabug wontfix close 14362