[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: etags - Word separators with xref-find-definitions
From: |
Leo Butler |
Subject: |
Re: etags - Word separators with xref-find-definitions |
Date: |
Mon, 26 Jul 2021 09:45:18 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Christian Barthel <bch@online.de> writes:
> On Sun, Jul 25 2021, Eli Zaretskii wrote:
>
>>> Is it possible to customize the xref function such that it
>>> recognize ‘schema.objectname’? Are there any variables to
>>> control the behavior of M-. ?
>>
>> You need to customize the etags.el function that is used to guess the
>> symbol at point. The function is this:
>>
>> (defun find-tag--default ()
>> (funcall (or find-tag-default-function
>> (get major-mode 'find-tag-default-function)
>> #'find-tag-default)))
>>
>> So either customizing find-tag-default-function to point to a function
>> of your choice, or making such a function local to the SQL major mode
>> by putting the property on the major-mode's symbol, should do the
>> job. You will probably need to write the function itself, though.
>
> OK, thanks so far. My first draft for this looks something like
> this:
>
> (defun find-sql-identifier ()
> (when (thing-at-point-looking-at
> "\\([.a-zA-Z0-9]*\\)" 50)
> (if (match-beginning 1)
> (buffer-substring (match-beginning 1) (match-end 1))
> "")))
> (put major-mode 'find-tag-default-function 'find-sql-identifier)
Thanks for these pointers, Eli and Christian. I was able to fix a
similar problem I had with `xref-find-definitions' when trying to use it
with latex-mode to look up bibtex citations.
Leo