all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Vitalie Spinu <spinuvit@gmail.com>
Cc: Helmut Eller <eller.helmut@gmail.com>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: xref-find-matches and stuff
Date: Thu, 7 May 2015 03:09:37 +0300	[thread overview]
Message-ID: <554AAD41.6060506@yandex.ru> (raw)
In-Reply-To: <87oalxn756.fsf@gmail.com>

On 05/06/2015 04:54 PM, Vitalie Spinu wrote:

> I have the following patterns in mind:

Allow me to offer some sloppy critique.

>    1) etags + mode-specific-backend

Why not use etags, rather than rely on the major mode and it being able 
to only each the buffers currently open in Emacs?

If the problem is that etags is imperfect, let's refine its regexps. If 
its getting out of date is the problem, we could automate something in 
that area too, or switch to something more advanced. E.g. 
https://github.com/leoliu/ggtags boasts automatic updates as the number 
2 in its features list.

>    2) imenu-anywhere + mode-specific-backend

As long as tags are not available, why not simply leave it to the major 
mode? It's sure to be able to provide a more precise data than an 
adapter on top of Imenu.

There's not even a clear standard on the Imenu index structure: e.g. 
flat vs. nested.

>    3) etags + imenu-anywhere + mode-specific-backend

Use tags. :)

I think this list is a reasonable case for a hook of the usual kind 
though: whichever backend returns non-nil to 
`identifier-completion-table', gets used.

> Semantic references could also be used instead of imenu. I personally
> don't use them.

CEDET could be rough around the edges, but it'll beat Imenu and etags. 
Its parsing engine, the symbol database and integration with external 
tools map to all backend features we might have planned.

> That's the problem to be solved. And someone has to solve it anyways.

Like I said, I'd prefer to hold off on dealing with this yet. But don't 
let me stop you.

We could as well introduce merged backends as a core feature later, by 
setting xref-backend to a list, or use a combinator function. Although 
the latter might be tricky with a generics-based backends.

> You might be right. The only complication is that xref-backend is set by
> major mode so I will have to overwrite it by xref-multi everywhere.

That's what minor modes often do.

> I am not sure I understand. The only xref-loc that doesn't have explicit
> :file slot is xref-buffer-location but you can easily extract the file
> or simply use the buffer name for non-visiting files.

I mean that including a file name is not mandated by the xref interface. 
Backends are allowed to provide their own xref-location implementations, 
and some of those might be missing the file slot as well.

> Ok. Let's see how it goes. My gut feeling is that it might get too
> complex and very few backends will actually extend it.

We'll see. And few backends extending it sounds about ideal to me. We 
don't want the user experience to vastly differ between backends either.

> Isn't this class a complication? Cannot you just have optional
> :description slot in root xref-location class? Some backends will be
> able to return directly the :description field.

It might be. But so far, xref-location is effectively just an interface. 
Adding a slot will take us closer to inheritance.

Or a more practical side, maybe xref-description can become a generic 
method. If can certainly be deduced from the contents of 
xref-elisp-location, as well as xref-etags-location and 
xref-buffer-location. xref-file-location would need to store it in a slot.

Or, along the lines of the OO proposal, it could be entirely replaced 
with an xref-buffer-print generic method. You don't ask a location its 
summary, just ask the object to print itself.

That may be suboptimal from the standpoint of an alternative interface, 
though.

> By merging xref--xref and xref-location you will reduce the clutter and
> simply call "xref" what you call "xref-location" right now. You get
> "xref" instead of "xref-location" - "elisp-xref", "etag-xref"
> etc. Cannot get simpler!

That is indeed simpler, but the package is called xref already, maybe we 
should use some suffix in the name of the location base class.

Thanks for the merge suggestion either way.

> Displaying xref--xref instead of the xref-location is rather awkward
> design from the backend developer prospective.  For each of the location
> class you will need to define a pairing `xref--xref` class:

I suppose, if the "render me" method is defined on xref-xref, rather 
than on xref-location. But if not, xref-xref doesn't serve a lot of 
purpose indeed, right now it's simply a two-slot container without any 
associated generic methods.

Keeping it separate would be useful if we find two orthogonal 
hierarchies peeking though the planned functionality, but otherwise, 
merge it is.

> BTW, :description is not very suggestive to me. How about :locstring to
> emphasize that it's a string representation of the location?

Replace one common word with a portmanteau?

It's not really a representation, just something to show in the buffer. 
Call it summary maybe? Both descriptions and summaries are usually strings.



  reply	other threads:[~2015-05-07  0:09 UTC|newest]

Thread overview: 117+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04  2:45 xref-find-matches and stuff Dmitry Gutov
2015-05-04  9:17 ` Helmut Eller
2015-05-04 12:39   ` Dmitry Gutov
2015-05-04 16:17 ` Eli Zaretskii
2015-05-04 16:37   ` Óscar Fuentes
2015-05-04 16:42     ` Eli Zaretskii
2015-05-04 16:49       ` Óscar Fuentes
2015-05-04 19:09         ` Stefan Monnier
2015-05-04 18:24     ` Dmitry Gutov
2015-05-04 20:27   ` Dmitry Gutov
2015-05-05  7:07     ` Helmut Eller
2015-05-05 13:20       ` Dmitry Gutov
2015-05-06 12:23       ` Dmitry Gutov
2015-05-06 17:45         ` Helmut Eller
2015-05-06 18:21           ` Dmitry Gutov
2015-05-06 18:34             ` Helmut Eller
2015-05-06 20:17               ` Dmitry Gutov
2015-05-05 15:40     ` Eli Zaretskii
2015-05-05 16:10       ` Dmitry Gutov
2015-05-05 16:33         ` Eli Zaretskii
2015-05-05 16:37           ` Dmitry Gutov
2015-05-05 16:45             ` Eli Zaretskii
2015-05-05 16:48               ` Dmitry Gutov
2015-05-05 17:20                 ` Eli Zaretskii
2015-05-05 17:29                   ` Dmitry Gutov
2015-05-05 18:33                     ` Eli Zaretskii
2015-05-05 18:38                       ` Dmitry Gutov
2015-05-05 19:11                         ` Eli Zaretskii
2015-05-05 21:44                           ` Dmitry Gutov
2015-05-06  2:40                             ` Eli Zaretskii
2015-05-06 12:36                               ` Dmitry Gutov
2015-05-06 13:04                                 ` Dmitry Gutov
2015-05-06 15:30                                 ` Eli Zaretskii
2015-05-06 22:37                                   ` Dmitry Gutov
2015-05-07  4:06                                     ` Eli Zaretskii
2015-07-20  1:55                                   ` Dmitry Gutov
2015-07-20 16:09                                     ` Eli Zaretskii
2015-07-14  8:30       ` Andreas Politz
2015-07-14 15:52         ` Dmitry Gutov
2015-07-16 18:59           ` Andreas Politz
2015-07-17  1:49             ` Vaidheeswaran C
2015-07-19 18:00             ` Dmitry Gutov
2015-07-20  8:19               ` Andreas Politz
2015-05-05 14:35 ` Vitalie Spinu
2015-05-05 15:23   ` Dmitry Gutov
2015-05-05 17:17     ` Vitalie Spinu
2015-05-06  0:48       ` Dmitry Gutov
2015-05-06 13:54         ` Vitalie Spinu
2015-05-07  0:09           ` Dmitry Gutov [this message]
2015-05-07 12:24             ` Vitalie Spinu
2015-05-08 12:47               ` Dmitry Gutov
2015-05-08 13:02                 ` Francesco Potortì
2015-05-08 17:15                   ` Dmitry Gutov
2015-05-10 12:31                   ` martin rudalics
2015-05-10 14:46                     ` Eli Zaretskii
2015-05-11 10:08                       ` martin rudalics
2015-05-11 15:05                         ` Eli Zaretskii
2015-05-12  9:36                           ` martin rudalics
2015-05-12 16:15                             ` Eli Zaretskii
2015-05-12 16:46                               ` Dmitry Gutov
2015-05-12 17:37                                 ` Eli Zaretskii
2015-05-12 19:57                                   ` Eli Zaretskii
2015-05-12 20:15                                     ` Dmitry Gutov
2015-05-13  2:38                                       ` Eli Zaretskii
2015-05-13 16:23                                         ` Eli Zaretskii
2015-05-14  0:46                                           ` Dmitry Gutov
2015-05-14  2:44                                             ` Eli Zaretskii
2015-05-13  7:33                               ` martin rudalics
2015-05-13 17:28                                 ` Eli Zaretskii
2015-05-14 10:13                                   ` martin rudalics
2015-05-14 15:06                                     ` Eli Zaretskii
2015-05-15 16:44                                       ` martin rudalics
2015-05-15 18:59                                         ` Eli Zaretskii
2015-05-11 15:42                     ` Francesco Potortì
2015-05-08 16:44                 ` Vitalie Spinu
2015-05-08 16:47                   ` Dmitry Gutov
2015-05-08 18:42                     ` Vitalie Spinu
2015-05-08 19:42                       ` Dmitry Gutov
2015-05-08 21:52                         ` Vitalie Spinu
2015-05-09  0:09                           ` Dmitry Gutov
2015-05-09 12:58                             ` Vitalie Spinu
2015-05-11  1:38                               ` Dmitry Gutov
2015-05-09  8:05                           ` Eli Zaretskii
2015-05-09 12:32                             ` Vitalie Spinu
2015-05-09 13:19                               ` Eli Zaretskii
2015-05-09 13:46                                 ` Vitalie Spinu
2015-05-09 14:03                                   ` Eli Zaretskii
2015-05-09 18:23                                     ` Vitalie Spinu
2015-05-09 18:49                                       ` Eli Zaretskii
2015-05-09 21:12                                         ` Vitalie Spinu
2015-05-09  7:07                       ` Eli Zaretskii
2015-05-09  9:06                         ` Helmut Eller
2015-05-09 10:34                           ` Eli Zaretskii
2015-05-09 11:43                             ` Helmut Eller
2015-05-09 12:20                               ` Eli Zaretskii
2015-05-09 12:31                                 ` Dmitry Gutov
2015-05-09 13:09                                   ` Eli Zaretskii
2015-05-09 12:58                                 ` Dmitry Gutov
2015-05-09 13:22                                   ` Eli Zaretskii
2015-05-09 21:56                                     ` Dmitry Gutov
2015-05-10 14:48                                       ` Eli Zaretskii
2015-05-11 15:37                                         ` maintaining etags Francesco Potortì
2015-05-11 16:50                                           ` Eli Zaretskii
2015-05-12 11:17                                             ` Francesco Potortì
2015-05-12 16:21                                               ` Eli Zaretskii
2015-05-12 17:11                                                 ` Eli Zaretskii
2015-05-12 16:37                                         ` xref-find-matches and stuff Eli Zaretskii
2015-05-11  1:01                         ` Stefan Monnier
2015-05-11  1:46                           ` Dmitry Gutov
2015-05-11 13:59                             ` Stefan Monnier
2015-05-11 15:22                               ` Eli Zaretskii
2015-05-11 14:56                             ` Eli Zaretskii
2015-05-11 20:24                               ` Dmitry Gutov
2015-05-12  2:36                                 ` Eli Zaretskii
2015-05-12 11:08                                   ` Dmitry Gutov
2015-05-12 16:19                                     ` Eli Zaretskii
2015-05-11 14:53                           ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=554AAD41.6060506@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=spinuvit@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.