On Tue, Nov 3, 2015 at 5:18 PM, Dmitry Gutov <
dgutov@yandex.ru> wrote:
> Why don't we canonicalize the file name somehow when an xref instance is created?
I'm OK with that, but then we need to add a comment or something to xref explicitly stating that, when deriving new types from xref-location (or xref-item, if someone adds a file slot to it for whatever reason) all filenames *must* be kept canonicalized.
And then, someone will derive from xref-location and add propertized strings and will want to compare *including* the properties...
No, of course I cannot think of a use case right now, but again, it's infrastructure. It's there to help generalization and reuse.
> It can be solved as above, for example.
Until someone adds tests for etags and wants to compare two xref-etag-location instances (which include a file slot), and then they will have to copy the code from elisp-mode-tests.el.
> It's very nontrivial to write a comparison function that would work beyond the type
> you're currently defining (just one xref subtype). Hence, its applicability will probably
> be rather limited.
Well, you define a generic function that defaults to using `equal', and let subtypes do the refining. `equal' already is quite broad, so I'd bet many subtypes will never require anything more complex than the default xref-compare-locations.
Now that I think of it... How do you sort xref-items and xref-locations?