From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Pascal Quesseveur Newsgroups: gmane.emacs.help Subject: Find tags with dot character Date: Mon, 22 Jul 2019 15:51:47 +0200 Organization: Les Enchantements de Miraldra Message-ID: <83k1caxjm4.fsf@gmail.com> Reply-To: pquessev@gmail.com Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="82162"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 22 15:52:06 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hpYjU-000LCh-3f for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Jul 2019 15:52:04 +0200 Original-Received: from localhost ([::1]:33862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hpYjT-0005De-4O for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Jul 2019 09:52:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56984) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hpYjO-0005DY-Nx for help-gnu-emacs@gnu.org; Mon, 22 Jul 2019 09:51:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hpYjN-0007ME-4w for help-gnu-emacs@gnu.org; Mon, 22 Jul 2019 09:51:58 -0400 Original-Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226]:39946 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hpYjM-0007KU-Ue for help-gnu-emacs@gnu.org; Mon, 22 Jul 2019 09:51:57 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hpYjJ-000Kzc-I4 for help-gnu-emacs@gnu.org; Mon, 22 Jul 2019 15:51:53 +0200 X-Injected-Via-Gmane: http://gmane.org/ X-Attribution: PQsr Cancel-Lock: sha1:aLnOAf8Yn02Ys5wSXZbyWT1OUgM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 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.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:121218 Archived-At: Hello, In Delphi methods are defined using notation ClassName.Method. Very often I find it more interesting to look for tags using the name ClassName.Method instead of the name Method. For example on a line var x := MyClass.Create; when the point is inside Create, by default the find-tag function looks for a tag named Create. This tag is found and it corresponds to the declaration of Create method in class MyClass. Instead I would prefer to look for the definition of MyClass.Create. In addition, there are inevitably several classes with the Create method in the project with leads to ambiguities. I can edit the tag name in the minibuffer before validating, but in that case i have to type MyClass.Create in the minibuffer what I find quite painful. So I decided to change the way the dot character is taken into account to build the expression around point. The most obvious thing for me was to change the syntax entry for words. So I defined a function which changes the word syntax entry before calling find-tag-default and then restores the syntax: (defun my-find-tag-default-opascal () (let (tag) (modify-syntax-entry ?. "w") (setq tag (find-tag-default)) (modify-syntax-entry ?. ".") tag)) And in Delphi mode hook, I added: (setq find-tag-default-function 'my-find-tag-default-opascal) This works fine, but I am wondering if i'm not reinventing the wheel because I missed something. -- Pascal Quesseveur pquessev@gmail.com