From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.bugs Subject: bug#14411: 24.3.50; compile.el: Better file search for parallel builds Date: Thu, 16 May 2013 21:09:38 +0200 Message-ID: <87d2sqzqq5.fsf@engster.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1368731464 15406 80.91.229.3 (16 May 2013 19:11:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 May 2013 19:11:04 +0000 (UTC) To: 14411@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 16 21:11:03 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ud3Zu-00082f-JC for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 May 2013 21:11:02 +0200 Original-Received: from localhost ([::1]:45211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud3Zt-0000vm-DI for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 May 2013 15:11:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud3Zm-0000rt-Q9 for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 15:10:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ud3Zk-0003xu-1M for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 15:10:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud3Zj-0003xE-Eb for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 15:10:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Ud3Zu-0001J8-QP for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 15:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Engster Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 May 2013 19:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14411 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13687314174965 (code B ref -1); Thu, 16 May 2013 19:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 May 2013 19:10:17 +0000 Original-Received: from localhost ([127.0.0.1]:47760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ud3ZB-0001I2-1K for submit@debbugs.gnu.org; Thu, 16 May 2013 15:10:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47506) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ud3Z7-0001Hn-S6 for submit@debbugs.gnu.org; Thu, 16 May 2013 15:10:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ud3Yp-0003bS-MN for submit@debbugs.gnu.org; Thu, 16 May 2013 15:09:56 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:54780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud3Yp-0003bO-Ip for submit@debbugs.gnu.org; Thu, 16 May 2013 15:09:55 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud3Yo-0000bL-Bf for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 15:09:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ud3Yl-0003au-Nb for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 15:09:54 -0400 Original-Received: from randomsample.de ([83.169.19.17]:37956) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ud3Yl-0003ZK-A6 for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 15:09:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=Fo+9cz1cEWB1hgS8tOnfz0bRUHlSN6PdmFEV3IesbnM=; b=RDY7qCWvK6Gm7dXgZO70NeahwFArMWI8BbnjsyDxHmKX6I517Aje9VbrqlyiSpc8wP1HLOPUHlnTlmVPVo5nIRCJwTqvHEqrUmRHXanw9mcJAw/5x8olc0SNydiVGVxi; Original-Received: from dslc-082-083-047-061.pools.arcor-ip.net ([82.83.47.61] helo=spaten) by randomsample.de with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Ud3Yd-00036t-Gp for bug-gnu-emacs@gnu.org; Thu, 16 May 2013 21:09:43 +0200 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:74342 Archived-At: --=-=-= Content-Type: text/plain When doing parallel builds using GNU Make, jumping to the location of a warning/error from the compilation buffer often does not work. This is because GNU Make enters different directories at the same time, and the resulting output is intermixed. The attached patch fixes this by looking at all directories which were entered up to the point of the warning/error, instead of just taking the directly preceding one. I'm aware that this is not a perfect solution, since those directories might contain files with identical names, in which case Emacs might show the wrong one, but IMO it's still an improvement over the current situation. This feature can also be disabled through a new variable. -David --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=compile-parallel-patch.diff === modified file 'lisp/progmodes/compile.el' --- lisp/progmodes/compile.el 2013-04-24 13:50:22 +0000 +++ lisp/progmodes/compile.el 2013-05-16 18:49:35 +0000 @@ -611,6 +611,18 @@ (string :tag "Directory"))) :group 'compilation) +(defcustom compilation-search-all-directories t + "Whether further upward directories should be used when searching a file. +When doing a parallel build, several files from different +directories can be compiled at the same time. This makes it +difficult to determine the base directory for a relative file +name in a compiler error or warning. If this variable is +non-nil, instead of just relying on the previous directory change +in the compilation buffer, all other directories further upwards +will be used as well." + :type 'boolean + :group 'compilation) + ;;;###autoload (defcustom compile-command (purecopy "make -k ") "Last shell command used to do a compilation; default for next compilation. @@ -2616,6 +2628,25 @@ (find-file-noselect name)) fmts (cdr fmts))) (setq dirs (cdr dirs))) + ;; If we haven't found it, this might be a parallel build. + ;; Search the directories further up the buffer. + (when (and (null buffer) + compilation-search-all-directories) + (with-current-buffer (marker-buffer marker) + (save-excursion + (goto-char (marker-position marker)) + (goto-char (compilation--previous-directory (point))) + (setq dirs (cdr (or (get-text-property (1- (point)) 'compilation-directory) + (get-text-property (point) 'compilation-directory)))))) + (while (and dirs (null buffer)) + (setq thisdir (car dirs) + fmts formats) + (while (and fmts (null buffer)) + (setq name (expand-file-name (format (car fmts) filename) thisdir) + buffer (and (file-exists-p name) + (find-file-noselect name)) + fmts (cdr fmts))) + (setq dirs (cdr dirs)))) (while (null buffer) ;Repeat until the user selects an existing file. ;; The file doesn't exist. Ask the user where to find it. (save-excursion ;This save-excursion is probably not right. --=-=-=--