[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xref in a narrowed buffer?

From: Dmitry Gutov
Subject: Re: xref in a narrowed buffer?
Date: Wed, 4 Mar 2020 20:18:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 04.03.2020 18:08, Robert Pluim wrote:
On Wed, 4 Mar 2020 17:20:53 +0200, Dmitry Gutov <address@hidden> 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
+          (widen)
            (etags-goto-tag-location tag-info)

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]