From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Compilation auto-jump bug Date: Tue, 22 Apr 2008 21:51:35 -0400 Message-ID: References: <87iqybasft.fsf@stupidchicken.com> <87fxte7q9f.fsf@jurta.org> <18445.9167.275354.249388@kahikatea.snap.net.nz> <87ej8xka66.fsf_-_@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1208915516 12441 80.91.229.12 (23 Apr 2008 01:51:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Apr 2008 01:51:56 +0000 (UTC) Cc: Nick Roberts , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 23 03:52:30 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JoU9q-0002rp-90 for ged-emacs-devel@m.gmane.org; Wed, 23 Apr 2008 03:52:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JoU9A-0005ep-Lg for ged-emacs-devel@m.gmane.org; Tue, 22 Apr 2008 21:51:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JoU95-0005eR-Ge for emacs-devel@gnu.org; Tue, 22 Apr 2008 21:51:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JoU92-0005dz-CS for emacs-devel@gnu.org; Tue, 22 Apr 2008 21:51:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JoU92-0005dw-6J for emacs-devel@gnu.org; Tue, 22 Apr 2008 21:51:36 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JoU92-0004nk-27 for emacs-devel@gnu.org; Tue, 22 Apr 2008 21:51:36 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4CAKcyDkjO+KGddGdsb2JhbACBUpACASqbLA X-IronPort-AV: E=Sophos;i="4.25,696,1199682000"; d="scan'208";a="18900160" Original-Received: from smtp.pppoe.ca (HELO smtp.teksavvy.com) ([65.39.196.238]) by ironport2-out.teksavvy.com with ESMTP; 22 Apr 2008 21:51:35 -0400 Original-Received: from pastel.home ([206.248.161.157]) by smtp.teksavvy.com (Internet Mail Server v1.0) with ESMTP id DFW42335; Tue, 22 Apr 2008 21:51:35 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 390548066; Tue, 22 Apr 2008 21:51:35 -0400 (EDT) In-Reply-To: <87ej8xka66.fsf_-_@jurta.org> (Juri Linkov's message of "Tue, 22 Apr 2008 23:57:51 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:95819 Archived-At: > BTW, there is also the opposite bug: when `compilation-scroll-output' is > `first-error', but `compilation-auto-jump-to-first-error' is nil, when > the current buffer is not the *compilation* buffer, then it doesn't keep > point on the first error. This means when I switch to the *compilation* > buffer, point is at the beginning of the *compilation* buffer instead of > the position of the first error. But when the current buffer is the > *compilation* buffer at the time when compilation moves point, then it > keeps the correct position of the first error. This is due to the code: > (defun compilation-auto-jump (buffer pos) > (with-current-buffer buffer > (goto-char pos) > (if compilation-auto-jump-to-first-error > (compile-goto-error)))) > It doesn't use `save-excursion', so it is strange that it doesn't keep > point on the new position after `goto-char'. I guess the problem is that we need to affect the window-point of the window that's showing the compilation buffer and this only happens when we do `goto-char' if that window is the selected one. So maybe something like: (defun compilation-auto-jump (buffer pos) (with-current-buffer buffer (goto-char pos) (let ((win (get-buffer-window buffer 0))) (if win (set-window-point win pos))) (if compilation-auto-jump-to-first-error (compile-goto-error)))) -- Stefan