From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christian Barthel Newsgroups: gmane.emacs.help Subject: Re: etags - Word separators with xref-find-definitions Date: Sun, 25 Jul 2021 19:52:58 +0200 Message-ID: <87im0ys2kl.fsf@online.de> References: <874kciydpa.fsf@online.de> <83o8aqwkyh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20898"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) 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 20:31:52 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 1m7iul-0005MD-Jw for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 25 Jul 2021 20:31:51 +0200 Original-Received: from localhost ([::1]:44996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7iuk-0006Zg-Lk for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 25 Jul 2021 14:31:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7iuL-0006ZJ-OA for help-gnu-emacs@gnu.org; Sun, 25 Jul 2021 14:31:25 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.133]:57719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7iuJ-000466-Tu for help-gnu-emacs@gnu.org; Sun, 25 Jul 2021 14:31:25 -0400 Original-Received: from t480a1 ([84.189.158.26]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M7auL-1lzkgO3y5F-0085Bb for ; Sun, 25 Jul 2021 20:31:22 +0200 In-Reply-To: <83o8aqwkyh.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 25 Jul 2021 17:02:14 +0300") X-Archive: expiry=7 X-Provags-ID: V03:K1:o+hUBJUlQfghiIASajrq3BuPzU1WBksajOABYFRlFfPKK/JpuDq LEE9tz+3aOWPBpMcJ49a8AP10tZnqYKPmKyyQFIbcu6D6I264cKBzxFLN4WtzHKzeMcB3TD ++EWDoSQxK7Yo56ddWBWSDgNf4jrSwMssFEbnHkdp4Qc4qReKh3zJF+kIze1gQuXwBKpZSL 2Vr9YkNXqVb+WZlFFM8hA== X-UI-Out-Filterresults: notjunk:1;V03:K0:qxlfLHY6Ogs=:LQLxRVxznXLJfNiTHl3ova cwezud1ELlFw5rnLhcMocCrRCTupyvOOVnl6R+hlF1J3kJCNmGYqbHJQU7S19AlcL8NKvGG6m YETTZnMks6x1wtMNuwOLFAMFPBn6TXaFS1nfmmTQAOXi/tiL/naXJlBR1UNJKr16vaUotfTHo 7fJM/bNQthtRPrpD8riUNRKKO76n+yRQ7QLJG9qohpTUsj17r140QwexGDKzSFKJppmbkyUkL qNyXyeTJppj8LbwCxCwbRUsXVeicG3WFUHPwdZH0SZcTlZ/hJAdrcSDMryfy2noHO80AgpJJt vuTUWcF6T4c5+pE3i6+d5TzsE4mrEBe16vRcxPBRqQQlkjjA7+rbse12DKLIqZlp8NMbZBfI4 2IEH0yX28Jr2Kzi6Mio5HTWAoEj1KPN4wnBxuwGe9Tr8pjjGWqDWE1CwZmd3Bbxb4O16hYvBf 26nvFcUaIkYxOxRoib7ZwOHaooLH0Mw/yp//sxHzVu2FT1z5U3fXGmSiJ3R5n9197LIAuj22L Ve5ta118zE+7lKca714GpoFSehG4uLxJ4MGz8bH078zH8FxuZX8sJjYm2QRrNtuLPtvrWzeD2 VT6gd+n1kWc8r4PwUGZNt0EnIJYrAOdK8Pb5WDhla3jAsYPw4c7j2mMx2cvrmzBSkqS9FML9l wSSb0bHdfX4fm+q90z29lZjpVtVWsrXlxwbV1LxJA1uKIH8wFU/AlNTzVx645U5xuLZZRdWYz VfkB3qTaZ6irlcl/fjODJzq7grsZGqJEvwHSfH09GpneO2ShudiMzchwnybQd1dsyJnAGtQs Received-SPF: pass client-ip=212.227.126.133; envelope-from=bch@online.de; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" X-Gmane-Expiry: 2021-08-01 Xref: news.gmane.io gmane.emacs.help:132103 Archived-At: On Sun, Jul 25 2021, Eli Zaretskii wrote: >> Is it possible to customize the xref function such that it >> recognize =E2=80=98schema.objectname=E2=80=99? 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: --8<---------------cut here---------------start------------->8--- (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) --8<---------------cut here---------------end--------------->8--- This works for my contrived SQL file as expected, but I guess that I need some further improvements when using this on a larger sql code repository . I think that I will execute the put function (setting find-tag-default-function) in the sql-mode-hook or is there a better place to do this? --=20 Christian Barthel