From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: xref in a narrowed buffer? Date: Wed, 4 Mar 2020 20:18:42 +0200 Message-ID: References: <2528b0fe-1cb7-578e-f16b-d914d616f645@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="40564"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: emacs-devel@gnu.org To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 04 19:19:27 2020 Return-path: Envelope-to: ged-emacs-devel@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 1j9YcA-000ARr-CR for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Mar 2020 19:19:26 +0100 Original-Received: from localhost ([::1]:38024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9Yc9-0006O1-FS for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Mar 2020 13:19:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55848) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9YbX-0005vW-S3 for emacs-devel@gnu.org; Wed, 04 Mar 2020 13:18:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9YbW-0000uM-Pa for emacs-devel@gnu.org; Wed, 04 Mar 2020 13:18:47 -0500 Original-Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:40176) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j9YbW-0000tl-Ja for emacs-devel@gnu.org; Wed, 04 Mar 2020 13:18:46 -0500 Original-Received: by mail-wm1-x32d.google.com with SMTP id e26so2878953wme.5 for ; Wed, 04 Mar 2020 10:18:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=tqhWPbRzFdl4f6bhp3/KCPIiZm2zIxv566TCFoIk+pY=; b=SpM9ElvQN6SAAhyMwnzbLKt9q5HQpdSq71gFkVriaGsOv/XHSlBIo4fgy8NMQhMxkx SgD8yId6KKMsN2xjCFu8+iVZR7gcBLeqN+MBDKweOUs4z5rERdxj6D8WM5ZqURup0YUj 2A1/nMRN7DgaJ0tOPS3HLS7xb2BJvaZPbmrEzmb5pEu208X9b50x0FEiiQHXueB9JIkH 7faT2nYayLSrgdNlNt1+7kRVe4hw0cRcXU2e96QjTDXTxDpb7wD7kesDgM48P2o+lMo7 9B0+fLQrvJ270h5EZZEj+ShSHz4AkwhE7W4wkCnvVHqAEhLef1F6MDBXrqKJtOGoRoil PsjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tqhWPbRzFdl4f6bhp3/KCPIiZm2zIxv566TCFoIk+pY=; b=YyjXWAcecrAiLOz0A5TPl81RMckh77lJEXWyfeOznO5s0318dFQDbPnrkoGKj2zYv4 Oie3fZbSwSTYTUMtrIj1fcClVbRAu/eNooefJkKNojRQ8E1rBbPu1j92xuePZW7FtcIY EELIb/RmkQ1hzbGlqsMCBwWuXWkDIaCib/dKjKEEvtgtECr0WppqIpGGZ6ZHM8xFaKUO aWP4XfgS4hSVc9TepyRoBbbjZqkaeV8x9hntkRyCF1o80gPKDhd4iQaZRHA6ShYx3X0M Gfpk/hzhVmMhuZfE7BwlhACWqJnvFgjZZtvt1wwoNyXzUMjUZxG1XO3cztIIXNRVMgrd YakA== X-Gm-Message-State: ANhLgQ32jKc8i8Qh/C9e9N5M/bVPaFoxBMOLgCLQKsorNK4YPK+yw7Fh dZ4/dxJAZRU97uRDQiiMb+fhwMQ5 X-Google-Smtp-Source: ADFU+vszctfwOJKdbvJWAV40PF5ilhMGX+z9W3f7wlm7Jyp3ugRS81UfCg6baTrsXr8aAz4pvUz7HQ== X-Received: by 2002:a1c:f615:: with SMTP id w21mr4700702wmc.152.1583345925296; Wed, 04 Mar 2020 10:18:45 -0800 (PST) Original-Received: from [192.168.0.2] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id d7sm5985905wmc.6.2020.03.04.10.18.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2020 10:18:44 -0800 (PST) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245232 Archived-At: On 04.03.2020 18:08, Robert Pluim wrote: >>>>>> On Wed, 4 Mar 2020 17:20:53 +0200, Dmitry Gutov said: > > Dmitry> On 04.03.2020 16:39, Robert Pluim wrote: > >> Should 'xref-goto-ref' widen the buffer before attempting to jump to > >> the definition? Or should 'xref-find-definitions' not show definitions > >> that are outside the narrowed area? > > Dmitry> The latter is pretty hard to do, so the former, I guess. > > After wandering through the maze of twisty cl-defmethods and wondering > why it wasnʼt working, I read the actual message, and realised I was > using the etags backend. This works for me, perhaps add a (when > widen-automatically ..) ? > > diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el > index 897f105019..6995a70b5a 100644 > --- a/lisp/progmodes/etags.el > +++ b/lisp/progmodes/etags.el > @@ -2131,6 +2131,7 @@ xref-location-marker > (let ((buffer (find-file-noselect file))) > (with-current-buffer buffer > (save-excursion > + (widen) > (etags-goto-tag-location tag-info) > (point-marker)))))) This would also need a save-restriction. But according to others, we should signal a meaningful error instead. That might have to be done in another place (also in etags.el), before the "rerun etags" message is shown.