Subject: bug#35737: xref--original-command

From: Juri Linkov <[email-masked]>
Date: Mon, 27 May 2019 22:59:37 +0300

>> Thanks, I tried xref revert and it works fine.
>> Also I agree with Eli regarding the command name,
>> documentation and NEWS.
>
> Should be good now.

Thanks.  I wonder why you renamed xref--revert-xref-buffer
to a such strange name xref-refresh-results?  Why not simply
xref-revert-buffer?

>> But I don't want to write a new function.  I just need to check
>> if the xref buffer was created by a particular command.
>
> I think you need to make a choice here.
>
> Do you want to customize your personal Emacs, or do you want to improve the
> default behavior?
>
> If it's the former, I think the advice you posted will work as well as any
> other solution.
>
> I was kind of expecting the latter.

The goal was to improve the default behavior to make customization easier.

>> If despite a chain of indirections, xref still can't distinguish
>> different commands that created the xref buffer, I'd rather close
>> this feature request and use 'advice-add' in customization.
>
> Do we really need to be able to distinguish between xref-find-references
> and project-find-regexp as well?
>
> TBH, xref--original-command is easy to add, but then we'll have an internal
> variable that isn't used anywhere. Somebody will just delete it someday.

The idea was to make xref more customizable differently for different
commands: xref-find-definitions, xref-find-references, project-find-regexp.