unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: juri@linkov.net, joaotavora@gmail.com, 44611@debbugs.gnu.org
Subject: bug#44611: Prefix arg for xref-goto-xref
Date: Fri, 25 Dec 2020 16:49:39 +0200	[thread overview]
Message-ID: <189506b0-deeb-5ff3-c129-b083268a3cf3@yandex.ru> (raw)
In-Reply-To: <834kkanh8c.fsf@gnu.org>

On 25.12.2020 15:32, Eli Zaretskii wrote:
>> Cc: juri@linkov.net, joaotavora@gmail.com, 44611@debbugs.gnu.org
>> From: Dmitry Gutov <dgutov@yandex.ru>
>> Date: Fri, 25 Dec 2020 14:14:30 +0200
>>
>>> Then why do we need to have 2 separate modes?
>>
>> Well, Grep (and similar major modes people wrote in third-part packages)
>> do have a certain advantage: its execution is asynchronous, and the user
>> sees the results as soon as they arrive, even during a search over a
>> huge number of files. This can be implemented for xref, with certain
>> changes in the API, and with some use of threads, but that's still a
>> research problem.
> 
> I'm probably missing something: why cannot we display the Grep hits
> received asynchronously in the Xref format?  That would "just" mean
> changes in the filter function, right?

Yes, but that would involve creating a different implementation that 
renders in the same format, which we'll have to then keep in sync with 
the original implementation.

I wouldn't mind, of course. If someone wants to bring Grep closer to 
Xref in presentation, and no code sharing is required, I don't even have 
to participate.

Note that if Grep still doesn't share the underlying data format with 
Xref, xref-query-replace-in-results won't work. The jump-to-location 
commands will also need to have different implementations, so we won't 
be able to properly reuse the major mode either.

> IOW, I'm confused by your
> reference to asynchronous execution, which AFAIU has nothing to do
> with the form in which we present the results, nor with the major mode
> in which we put the buffer where the results are displayed.

The major mode also includes the bindings. Its rendering function also 
assumes synchronous execution currently, and the way it retrieves the 
data pieces to render depends on the data format.

>> I can outline a possible roadmap for improving xref, making its code
>> structure and data more logical (which includes moving some of them
>> out), but I don't think we'll throw out 'M-x grep' away anytime soon.
> 
> We don't need to throw out Grep, not right away anyway.  We just need
> a plan and a roadmap, and a decision that this is the long-term goal.
> And even when we have "M-x grep" showing results in Xref mode, it will
> still need at first be an optional feature, so people who are too used
> to the old presentation could have it.

xref-show-xrefs-function could have a Grep-like option. Although that 
one couldn't be the default, or else we'll force the xref commands to 
use it as well, which would be a step back.

>> Changing the latter to use the xref UI (which will have to be renamed
>> and become a separate package, BTW) is also likely to encounter much
>> bigger resistance than anything we've done in this area before: people
>> don't have the same expectations for new commands as they have for
>> existing ones, so I'm surprised you asked this (given your overall
>> backward compatibility stance, much stronger than mine).
> 
> An optional feature cannot hurt, even if and when it becomes the
> default.  Thus, there's no need for me to object to such long-term
> plans, if they are announced and proceed at a controlled pace
> (including the decision when it becomes the default).

This endeavor might need more of an encouragement than "I don't object".

>>> Do we also want to replace compilation-mode with xref-mode?
>>
>> That wouldn't work.
> 
> I don't understand why.  Can you explain?
> 
> To clarify, all I'm talking about is a possibility to present compiler
> messages in Xref format.  They are similar enough and show the same
> information, so why won't that work?

The format is not exactly the same: compilation log includes both the 
location (file name, line, column), the contents of a line, and the 
error message itself (which could span several lines). That doesn't fit 
the current data model.

I mean, we could extend it, but IME the main complexity is not in how to 
make the buffer look similar enough (the main rendering function, 
xref--insert-xrefs, is just 50 lines long), but how to make the buffer 
work usefully overall. I.e. with compilation you usually want to see 
different kind of errors/warnings/infos denoted prominently, and you 
don't usually (ever?) want to search-replace across the results, like 
you'd want with Grep. OTOH, there was that idea about quick fixes which 
you might add with supporting compilers, and for which there is no 
counterpart in Grep search results.

Finally, a compilation log can often include unstructured information 
like free-form logging, which is very often the case in 
rspec-compilation-mode, which is my main point of interaction with 
compilation-mode. Which would make the data format fall outside Xref's 
data model even more. As such, I'm probably not a good person to take 
point on developing that feature.

>> Do you really want this to happen, though?
> 
> I don't know, I just had this thought and wanted to see what others
> think.  However, if that isn't the plan, then I really don't
> understand the urge to make Xref be like Grep mode.  If they are
> indeed different beasts, why make them similar?

They are already fairly close. But there is some obvious usability 
benefit in having similar key bindings in modes that even serve 
different purposes: users will need to remember fewer bindings, and keep 
fewer differences in mind. Especially when the same key does one thing 
in one mode and something starkly different in another.

The more different the two modes are, the more often we won't be able to 
manage that, of course.

Finally, I don't make any plans like that because currently I can only 
focus on what looked like obvious missing spots in Emacs's built-in 
feature set (xref, project and etags-regen all came from that outlook). 
First I try to make the UI work well, and the unification can come 
later. Someday, someone will come and ask:

   Why do both project and dired call xref to perform their searches and 
render the results? That seems like a different kind of responsibility, 
and should be in a separate feature with well-defined semantics. Maybe 
even two different features.

And then they'll hopefully lend some of their spare time to make that 
happen. To get there, though, the more comfortable we make the Xref UI 
for all current and future users, the better.

>> I never got the impression that you enjoy using xref.
> 
> Aside of the fact that I use it every hour of every day, you mean?

Well, even that is not a given for me (in a recent Reddit comment you 
said that you don't use any of the "alternative" packages created in the 
last 10 years, but I guess the built-in ones are exceptions).

Or you could feel it's more-or-less good enough to replace the find-tag 
UI, or at least not painful enough to demand the new bindings be 
reversed. Or you could think it's better than find-tag, but grep-mode is 
still a better interface for what Grep does.

Also, in my usage, xref-find-definitions almost never pops up the xref 
UI. xref-find-references does, though (though I don't use it often). And 
IIUC you don't really use project-find-regexp.

I'm glad you do like it, though, if I understood you correctly now.





  reply	other threads:[~2020-12-25 14:49 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13  8:18 bug#44611: Prefix arg for xref-goto-xref Juri Linkov
2020-11-13 11:20 ` Dmitry Gutov
2020-11-14 20:36   ` Juri Linkov
2020-11-15  1:05     ` Dmitry Gutov
2020-11-15 19:51       ` Juri Linkov
2020-11-15 22:25         ` Dmitry Gutov
2020-11-15 22:52           ` Drew Adams
2020-11-15 23:11             ` João Távora
2020-12-19 20:38           ` Juri Linkov
2020-12-19 21:41             ` Dmitry Gutov
2020-12-19 22:36               ` João Távora
2020-12-19 23:59                 ` Dmitry Gutov
2020-12-20 20:32                   ` João Távora
2020-12-20 20:45                     ` Dmitry Gutov
2020-12-22  0:52                       ` João Távora
2020-12-20  3:26             ` Eli Zaretskii
2020-12-20  8:39               ` Juri Linkov
2020-12-20 15:43                 ` Eli Zaretskii
2020-12-20 16:10                   ` Dmitry Gutov
2020-12-22  8:58                   ` Juri Linkov
2020-12-22 12:20                     ` Dmitry Gutov
2020-12-22 15:53                     ` Eli Zaretskii
2020-12-22 21:20                       ` Juri Linkov
2020-12-23 15:08                         ` Eli Zaretskii
2020-12-23 16:20                           ` Dmitry Gutov
2020-12-23 16:46                             ` Eli Zaretskii
2020-12-23 18:45                               ` Dmitry Gutov
2020-12-23 19:23                                 ` Eli Zaretskii
2020-12-23 19:56                                   ` Dmitry Gutov
2020-12-23 20:30                                     ` Eli Zaretskii
2020-12-23 21:24                                       ` Dmitry Gutov
2020-12-24 17:44                                         ` Eli Zaretskii
2020-12-24 20:19                                           ` Juri Linkov
2020-12-24 20:44                                             ` Eli Zaretskii
2020-12-25  9:20                                               ` Juri Linkov
2020-12-25 11:44                                                 ` Eli Zaretskii
2020-12-25 15:24                                                   ` Dmitry Gutov
2020-12-27 16:22                                                     ` Juri Linkov
2020-12-27 17:16                                                       ` martin rudalics
2020-12-27 18:53                                                       ` Dmitry Gutov
2020-12-28 17:24                                                         ` Juri Linkov
2021-01-18  1:17                                                           ` Dmitry Gutov
2021-01-19 17:56                                                             ` Juri Linkov
2021-01-19 19:38                                                               ` Dmitry Gutov
2021-02-01 17:16                                                                 ` Juri Linkov
2021-03-16 18:15                                                                   ` Juri Linkov
2021-03-17  8:45                                                                     ` martin rudalics
     [not found]                                                                   ` <87sg4vgef6.fsf@mail.linkov.net>
2021-03-16 23:38                                                                     ` Dmitry Gutov
2021-03-17 17:23                                                                       ` Juri Linkov
2021-03-17 21:48                                                                         ` Dmitry Gutov
2020-12-27 16:20                                                   ` Juri Linkov
2020-12-27 18:21                                                     ` Eli Zaretskii
2020-12-28  0:54                                                       ` Dmitry Gutov
2020-12-28  9:16                                                       ` Juri Linkov
2021-04-22 15:18                                                       ` Dmitry Gutov
     [not found]                                                       ` <1fa6bd28-0524-011e-86c2-60c8faab51f8@yandex.ru>
2021-04-22 17:03                                                         ` Eli Zaretskii
2021-04-22 17:44                                                           ` Dmitry Gutov
2021-04-22 17:47                                                             ` Eli Zaretskii
2021-04-22 17:56                                                               ` Dmitry Gutov
2020-12-25 16:01                                           ` Dmitry Gutov
2021-04-23 10:41                                           ` Dmitry Gutov
2021-04-23 10:53                                             ` Eli Zaretskii
2021-04-24  9:56                                               ` Eli Zaretskii
2021-04-24 10:01                                                 ` Dmitry Gutov
2020-12-23 21:10                               ` Juri Linkov
2020-12-24  3:36                                 ` Eli Zaretskii
2020-12-24 21:38                                   ` Dmitry Gutov
2020-12-25  7:37                                     ` Eli Zaretskii
2020-12-25 12:14                                       ` Dmitry Gutov
2020-12-25 13:32                                         ` Eli Zaretskii
2020-12-25 14:49                                           ` Dmitry Gutov [this message]
2020-12-25 15:42                                             ` Eli Zaretskii
2020-12-28  0:36                                               ` Dmitry Gutov
2020-12-22  9:24                   ` João Távora
2020-12-11  9:30       ` Juri Linkov
2020-12-11 11:19         ` Dmitry Gutov
2020-12-11 12:08         ` Eli Zaretskii
2020-12-12 20:39           ` Juri Linkov
2020-12-13 15:10             ` Eli Zaretskii
2020-12-13 20:20               ` Juri Linkov
2020-12-13 20:50                 ` João Távora
2020-12-14 16:16                 ` Eli Zaretskii
2020-12-14 16:34                   ` 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=189506b0-deeb-5ff3-c129-b083268a3cf3@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=44611@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=juri@linkov.net \
    /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).