emacs-devel
[Top][All Lists]
Advanced

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

Re: xref in a narrowed buffer?


From: Robert Pluim
Subject: Re: xref in a narrowed buffer?
Date: Wed, 04 Mar 2020 17:08:42 +0100

>>>>> 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
         (save-excursion
+          (widen)
           (etags-goto-tag-location tag-info)
           (point-marker))))))
 



reply via email to

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