all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: etags - Word separators with xref-find-definitions
Date: Sun, 25 Jul 2021 17:02:14 +0300	[thread overview]
Message-ID: <83o8aqwkyh.fsf@gnu.org> (raw)
In-Reply-To: <874kciydpa.fsf@online.de> (message from Christian Barthel on Sun, 25 Jul 2021 10:56:01 +0200)

> From: Christian Barthel <bch@online.de>
> Date: Sun, 25 Jul 2021 10:56:01 +0200
> 
> I am using a TAGS file with a custom regex for SQL function, view
> and table definitions.  At the moment, I am using this:
> 
> --8<---------------cut here---------------start------------->8---
> etags --language=none \
>    --regex='/[ \t]*create\( or replace\)*[ \t][ \t]*\(function\|view\|table\)[ \t]*\([^ (]*\)/\3/i'
>    *.sql
> --8<---------------cut here---------------end--------------->8---
> 
> The TAGS file contains identifiers like ‘schema.objectname’.
> However, when I am trying to use M-. (xref-find-definitions), it
> either searches for ‘schema’ or ‘objectname’ (depending on the
> location of the point).
> 
> 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.

> (Something similar happens for LaTeX references:  I am using
> \label{chapter:foobar}, but the : is lost and I can’t easily jump
> to the reference)

You could do the same there, just with a slightly different function.



  reply	other threads:[~2021-07-25 14:02 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 [this message]
2021-07-25 17:52   ` Christian Barthel
2021-07-25 19:04     ` Eli Zaretskii
2021-07-26 14:45     ` Leo Butler

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=83o8aqwkyh.fsf@gnu.org \
    --to=eliz@gnu.org \
    --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.