From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#44294: No widen by xref-find-definitions Date: Fri, 30 Oct 2020 09:38:24 +0200 Organization: LINKOV.NET Message-ID: <871rhgcgen.fsf@mail.linkov.net> References: <87mu06p1aw.fsf_-_@mail.linkov.net> <5cfcbbf0-beef-3c0a-9641-a010925dbda4@yandex.ru> <87r1pgivdz.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36307"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 44294@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 30 08:40:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kYP17-0009M5-3Q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Oct 2020 08:40:09 +0100 Original-Received: from localhost ([::1]:46296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYP16-0006ap-2h for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Oct 2020 03:40:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYP10-0006aj-H1 for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 03:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kYP10-0007dA-7m for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 03:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kYP10-0007Ce-57 for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 03:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Oct 2020 07:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed patch Original-Received: via spool by 44294-submit@debbugs.gnu.org id=B44294.160404358527661 (code B ref 44294); Fri, 30 Oct 2020 07:40:02 +0000 Original-Received: (at 44294) by debbugs.gnu.org; 30 Oct 2020 07:39:45 +0000 Original-Received: from localhost ([127.0.0.1]:55952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYP0i-0007C5-MJ for submit@debbugs.gnu.org; Fri, 30 Oct 2020 03:39:44 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:33857) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYP0g-0007Bo-DK for 44294@debbugs.gnu.org; Fri, 30 Oct 2020 03:39:43 -0400 X-Originating-IP: 91.129.102.160 Original-Received: from mail.gandi.net (m91-129-102-160.cust.tele2.ee [91.129.102.160]) (Authenticated sender: juri@linkov.net) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id C3A8C20003; Fri, 30 Oct 2020 07:39:34 +0000 (UTC) In-Reply-To: (Dmitry Gutov's message of "Thu, 29 Oct 2020 23:33:44 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:192040 Archived-At: >>> By the way... have you tried to use the same method here as in elisp-mode? >>> Meaning, widen unconditionally inside 'save-restriction'. >>> >>> There should be no reason for backends to do it differently. And this way, >>> you don't have to always search twice for a missing tag when inside >>> a narrowing. >> It should not widen unnecessarily when the found position is within the >> narrowed region. > > Hence the use of save-restriction in elisp-mode which you added. > > etags can use the exact same approach. I see now what you mean. Then maybe better to revert the change in etags-goto-tag-location to restore its original behavior, and fix only its usage by xref, i.e. exactly the same change for xref-location-marker ((l xref-etags-location)) as was made for xref-location-marker ((l xref-elisp-location)): diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 41ed317766..8879726ad5 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2140,8 +2135,10 @@ xref-location-marker (let ((buffer (find-file-noselect file))) (with-current-buffer buffer (save-excursion - (etags-goto-tag-location tag-info) - (point-marker)))))) + (save-restriction + (widen) + (etags-goto-tag-location tag-info) + (point-marker))))))) (cl-defmethod xref-location-line ((l xref-etags-location)) (with-slots (tag-info) l