all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo Butler <leo.butler@umanitoba.ca>
To: Christian Barthel <bch@online.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: etags - Word separators with xref-find-definitions
Date: Mon, 26 Jul 2021 09:45:18 -0500	[thread overview]
Message-ID: <87bl6pcewx.fsf@t14.reltub.ca> (raw)
In-Reply-To: <87im0ys2kl.fsf@online.de> (Christian Barthel's message of "Sun,  25 Jul 2021 19:52:58 +0200")

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




      parent reply	other threads:[~2021-07-26 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25  8:56 etags - Word separators with xref-find-definitions Christian Barthel
2021-07-25 14:02 ` Eli Zaretskii
2021-07-25 17:52   ` Christian Barthel
2021-07-25 19:04     ` Eli Zaretskii
2021-07-26 14:45     ` Leo Butler [this message]

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=87bl6pcewx.fsf@t14.reltub.ca \
    --to=leo.butler@umanitoba.ca \
    --cc=bch@online.de \
    --cc=help-gnu-emacs@gnu.org \
    /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.