From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: etags - Word separators with xref-find-definitions Date: Sun, 25 Jul 2021 17:02:14 +0300 Message-ID: <83o8aqwkyh.fsf@gnu.org> References: <874kciydpa.fsf@online.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3547"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 25 16:03:41 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7ejE-0000h3-5V for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 25 Jul 2021 16:03:40 +0200 Original-Received: from localhost ([::1]:37426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7ejD-0003p6-1B for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 25 Jul 2021 10:03:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7ei4-0003lh-TL for help-gnu-emacs@gnu.org; Sun, 25 Jul 2021 10:02:28 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:37770) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7ei4-00020O-Lx for help-gnu-emacs@gnu.org; Sun, 25 Jul 2021 10:02:28 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4403 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7ei1-0006ny-RX for help-gnu-emacs@gnu.org; Sun, 25 Jul 2021 10:02:28 -0400 In-Reply-To: <874kciydpa.fsf@online.de> (message from Christian Barthel on Sun, 25 Jul 2021 10:56:01 +0200) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:132101 Archived-At: > From: Christian Barthel > 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.