From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Compilation auto-jump bug Date: Wed, 23 Apr 2008 11:54:14 +0300 Organization: JURTA Message-ID: <87tzhtt0i1.fsf@jurta.org> 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 1208945447 25339 80.91.229.12 (23 Apr 2008 10:10:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Apr 2008 10:10:47 +0000 (UTC) Cc: Nick Roberts , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 23 12:11:18 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 1JobwN-0007g6-4a for ged-emacs-devel@m.gmane.org; Wed, 23 Apr 2008 12:11:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jobvh-0003UY-AO for ged-emacs-devel@m.gmane.org; Wed, 23 Apr 2008 06:10:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JobtV-0001VR-VZ for emacs-devel@gnu.org; Wed, 23 Apr 2008 06:08:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JobtU-0001Rk-0F for emacs-devel@gnu.org; Wed, 23 Apr 2008 06:08:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JobtT-0001RW-PO for emacs-devel@gnu.org; Wed, 23 Apr 2008 06:08:03 -0400 Original-Received: from relay03.kiev.sovam.com ([62.64.120.201]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JobtQ-0002xa-Gn for emacs-devel@gnu.org; Wed, 23 Apr 2008 06:08:02 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay03.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1Joatb-000N1e-Vi; Wed, 23 Apr 2008 12:04:08 +0300 In-Reply-To: (Stefan Monnier's message of "Tue, 22 Apr 2008 21:51:35 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: 4204c266f86c3e9b1e0231505dd73b85 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2693 [Apr 23 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 10 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release 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:95830 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)))) Yes, it works. Maybe we should add a primitive for this additional code with a name like `save-window-point'? If this name can be confused with a function that keeps the old window point before entering its body, then maybe some other name would be more clear. -- Juri Linkov http://www.jurta.org/emacs/