all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pascal Quesseveur <pquessev@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Find tags with dot character
Date: Mon, 22 Jul 2019 15:51:47 +0200	[thread overview]
Message-ID: <83k1caxjm4.fsf@gmail.com> (raw)

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




             reply	other threads:[~2019-07-22 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 13:51 Pascal Quesseveur [this message]
2019-07-22 15:36 ` Find tags with dot character Stefan Monnier
2019-07-22 17:32   ` Eli Zaretskii
2019-07-23  7:05   ` Pascal Quesseveur

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=83k1caxjm4.fsf@gmail.com \
    --to=pquessev@gmail.com \
    --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.