unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 44294@debbugs.gnu.org
Cc: dmitry gutov <dgutov@yandex.ru>
Subject: bug#44294: No widen by xref-find-definitions
Date: Wed, 28 Oct 2020 22:01:43 +0200	[thread overview]
Message-ID: <87mu06p1aw.fsf_-_@mail.linkov.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: etags-goto-tag-location-widen.patch --]
[-- Type: text/x-diff, Size: 845 bytes --]

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	other threads:[~2020-10-28 20:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 20:01 Juri Linkov [this message]
2020-10-28 21:37 ` bug#44294: No widen by xref-find-definitions Dmitry Gutov
2020-10-29  8:30   ` Philipp Stephani
2020-10-29  9:11     ` Juri Linkov
2020-10-29  9:09   ` Juri Linkov
2020-10-29 21:20     ` Juri Linkov
2020-10-29 11:31 ` Dmitry Gutov
2020-10-29 21:18   ` Juri Linkov
2020-10-29 21:33     ` Dmitry Gutov
2020-10-30  7:38       ` Juri Linkov
2020-10-30 16:54         ` Dmitry Gutov
2020-10-31 19:41           ` Juri Linkov
2020-10-31 23:14             ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mu06p1aw.fsf_-_@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=44294@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).