From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#20489: 25.0.50; next-error-find-buffer chooses non-current buffer without good reason Date: Tue, 27 Feb 2018 23:16:00 +0200 Organization: LINKOV.NET Message-ID: <87efl6smxb.fsf@mail.linkov.net> References: <86wq0q602w.fsf@yandex.ru> <877ev36pmr.fsf@mail.linkov.net> <87sha1nbjy.fsf@mail.linkov.net> <23fd061a-9b83-742a-6083-6d2f090b8f22@yandex.ru> <81d36dbe-f563-187a-ec16-df4b051ae204@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1519767494 10683 195.159.176.226 (27 Feb 2018 21:38:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Feb 2018 21:38:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 20489@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 27 22:38:10 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqmwr-0002C6-AM for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Feb 2018 22:38:09 +0100 Original-Received: from localhost ([::1]:40241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqmyt-0001Xv-I4 for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Feb 2018 16:40:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqmyi-0001WT-52 for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 16:40:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqmyh-0004uM-7k for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 16:40:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqmyh-0004uA-3T for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 16:40:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqmyg-0001Gc-Ia for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2018 16:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Feb 2018 21:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20489 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20489-submit@debbugs.gnu.org id=B20489.15197675694814 (code B ref 20489); Tue, 27 Feb 2018 21:40:02 +0000 Original-Received: (at 20489) by debbugs.gnu.org; 27 Feb 2018 21:39:29 +0000 Original-Received: from localhost ([127.0.0.1]:36045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqmy6-0001FX-Lf for submit@debbugs.gnu.org; Tue, 27 Feb 2018 16:39:29 -0500 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:36480 helo=homiemail-a20.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqmy4-0001FP-J6 for 20489@debbugs.gnu.org; Tue, 27 Feb 2018 16:39:24 -0500 Original-Received: from homiemail-a20.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTP id 7F0367EC07B; Tue, 27 Feb 2018 13:39:23 -0800 (PST) Original-Received: from localhost.linkov.net (m91-129-98-215.cust.tele2.ee [91.129.98.215]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTPSA id A6B477EC076; Tue, 27 Feb 2018 13:39:22 -0800 (PST) In-Reply-To: <81d36dbe-f563-187a-ec16-df4b051ae204@yandex.ru> (Dmitry Gutov's message of "Tue, 27 Feb 2018 03:54:55 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:143723 Archived-At: > On that subject: why did we make next-error-last-buffer always buffer-local? next-error-last-buffer is buffer-local to keep the reference to the parent buffer used to navigate to the current buffer, so the next call of next-buffer will use the same parent buffer to continue navigation from it. This works well in most cases except the case of xref buffers. Below is the explanation for code from next-error with added remarks: (defun next-error (&optional arg reset) (let ((buffer (next-error-find-buffer))) (when buffer (with-current-buffer buffer Here the current buffer is *xref* (funcall next-error-function (prefix-numeric-value arg) reset) next-error-function should navigate from *xref* to another buffer and change the current-buffer to the navigated buffer, e.g. ChangeLog.1. This works fine in most cases, for example when next-error-function is compilation-next-error-function, but fails when next-error-function is xref--next-error-function that switches to ChangeLog.1, but doesn't set the value current-buffer to ChangeLog.1. (setq next-error-last-buffer buffer) In normal cases this sets buffer-local next-error-last-buffer in the navigated buffer, e.g. ChangeLog.1 that should be the current buffer. But since xref--next-error-function doesn't set the right current buffer to ChangeLog.1, this sets buffer-local next-error-last-buffer in the wrong buffer, i.e. in *xref*. IOW, the value returned from (current-buffer) is wrong here after xref--next-error-function call. So the question is: in xref--next-error-function can we use code similar to what is used in compilation-next-error-function that works without problems?