bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#44294: No widen by xref-find-definitions


From: Juri Linkov
Subject: bug#44294: No widen by xref-find-definitions
Date: Wed, 28 Oct 2020 22:01:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

X-Debbugs-CC: Dmitry Gutov <dgutov@yandex.ru>
Tags: patch

>>> diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
>>> @@ -897,8 +897,10 @@ xref-location-marker
>>> -          (goto-char (or (cdr buffer-point) (point-min)))
>>> -          (point-marker))))))
>>> +          (save-restriction
>>> +            (widen)
>>> +            (goto-char (or (cdr buffer-point) (point-min)))
>>> +            (point-marker)))))))
>
> If this works, sure, please install. This piece by itself makes sense.
>
>> Hm...  Does Dmitry have any comments here?  (Added to Cc.)
>
> I'm subscribed to the bug tracker, but I skip over a number of discussions
> automatically (and an extra email in a thread is relatively easy to miss,
> too).
>
> In case I don't respond in similar circumstances in the future, may I ask
> for a personal email? One without 'debbugs.gnu.org' in the From/To/Cc.

Oh, sorry, I noticed this problem is just the tip of the iceberg,
so creating a separate bug report from bug#5042 and bug#9917.

The patch above fixes the problem of using xref-find-definitions
in elisp-mode, but using xref-find-definitions in narrowed
C files still fails with the error "Rerun etags: `%s' not found in %s".

Here is an additional patch that fixes this as well:

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index f6af1f2ea8..1b7f3c72a2 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1406,8 +1406,12 @@ etags-goto-tag-location
              offset (* 3 offset)))     ; expand search window
       (or found
          (re-search-forward pat nil t)
-         (user-error "Rerun etags: `%s' not found in %s"
-                      pat buffer-file-name)))
+         (if (or (= (point-min) 1) (not widen-automatically))
+              (user-error "Rerun etags: `%s' not found in %s"
+                          pat buffer-file-name)
+            ;; Rerun after removing narrowing
+            (widen)
+            (etags-goto-tag-location tag-info))))
     ;; Position point at the right place
     ;; if the search string matched an extra Ctrl-m at the beginning.
     (and (eq selective-display t)

reply via email to

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