From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: xref in a narrowed buffer? Date: Wed, 04 Mar 2020 17:08:42 +0100 Message-ID: References: <2528b0fe-1cb7-578e-f16b-d914d616f645@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="102309"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 04 17:09:16 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 1j9WaB-000QUU-Np for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Mar 2020 17:09:15 +0100 Original-Received: from localhost ([::1]:36262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9WaA-0002Wp-Jx for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Mar 2020 11:09:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54137) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9WZi-00023x-1j for emacs-devel@gnu.org; Wed, 04 Mar 2020 11:08:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9WZh-0006M6-3I for emacs-devel@gnu.org; Wed, 04 Mar 2020 11:08:45 -0500 Original-Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:54922) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j9WZg-0006Ld-Ty for emacs-devel@gnu.org; Wed, 04 Mar 2020 11:08:45 -0500 Original-Received: by mail-wm1-x32a.google.com with SMTP id i9so2728032wml.4 for ; Wed, 04 Mar 2020 08:08:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=aT7Vz0wqo6gT4oPjEzVfBovhkYMyJe6l9qmTCj22txI=; b=kTrHhfkYvOr6Kep6RZJgx2hjLfahvWXMxbiKSEzhi6ewblxHWXghohc/wVw7OhOCQI qYbyjJzaGNn08Pf52Hwzto+MSaJ2nu7i3d4vj87bFznD03zuTlCVw9ahJXFgGiNP6yTr Lbzjkvupv0zWA8IOcb66cZIFnj92bYGKKb8zODJl8Yh2UAN9erKfLIWl0V5TmVuIdGVD yVCQTaWSGNV7Luwx/OWxQTwbkxt6Irxctp9ZKB5IDkt0NIiLX6LH739IelN1nnMvT9JU 2kT72YWvBoHuTSrSlu2NaSajlRR8lLShZ0tmFWaaS9GO30fLjYgFcuqDZGRVKk8/IhnM iA3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=aT7Vz0wqo6gT4oPjEzVfBovhkYMyJe6l9qmTCj22txI=; b=ictBJIQNuisdGrYDjB/AhBWtXILhF/bnoPROLpLxLmozha9CNyYS1o5iUPPUXtrUs2 V5VKH9tC7weR/j74ncVp0bVdFLLRUZhUe1iUBlEvoQ0M+0tQNDG0b1Ibrb7hWfX2jJCZ /vEVBbxV+9m+qm/bO3g5I4ec8lPtMXcXTSqdkWZ7NjuRAbnrBBmw8H3nxS0OYUu8xgrP Ktg2+Feum5nXZGrkyTKBliUHnhi0ASitTE8h/NwRtquGH+sVwSUab0F70RaP96inIxyC PlW7B3qY9lbx7UqMYCBhXhI1FLxKeBwjsPtg7sMgdN9eLq2Sg7hH09mvi3zHWTaV7Srf UnyQ== X-Gm-Message-State: ANhLgQ0yaeJeTasTQ8q+4i8D/T2iMJh5oSDvFspkWr5gCfehWIBzmZOZ MJ9wEuQR1WcHdbCnTGzj1qo2CVXS X-Google-Smtp-Source: ADFU+vvw6nirchePApL21SSnOaUqTuzCA6jjVi37VHn2Ls9wv0rW3Ewc99wdXxQMDsJlxQlpSCScrA== X-Received: by 2002:a05:600c:d8:: with SMTP id u24mr4405623wmm.165.1583338123467; Wed, 04 Mar 2020 08:08:43 -0800 (PST) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id o9sm41640551wrw.20.2020.03.04.08.08.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 08:08:43 -0800 (PST) In-Reply-To: <2528b0fe-1cb7-578e-f16b-d914d616f645@yandex.ru> (Dmitry Gutov's message of "Wed, 4 Mar 2020 17:20:53 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32a 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:245224 Archived-At: >>>>> On Wed, 4 Mar 2020 17:20:53 +0200, Dmitry Gutov sa= id: 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 definitio= ns >> 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=CA=BCt 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)))))) =20