all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Find tags with dot character
Date: Mon, 22 Jul 2019 11:36:39 -0400	[thread overview]
Message-ID: <jwv8ssqxf2c.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 83k1caxjm4.fsf@gmail.com

> (defun my-find-tag-default-opascal ()
>   (let (tag)
>     (modify-syntax-entry ?. "w")
>     (setq tag (find-tag-default))
>     (modify-syntax-entry ?. ".")
>     tag))

In case of an error (or a C-g) during the execution of find-tag-default,
this will fail to restore the syntax-table to its original state, so
I recommend:

    (defun my-find-tag-default-opascal ()
      (unwind-protect
          (progn (modify-syntax-entry ?. "w")
                 (find-tag-default))
        (modify-syntax-entry ?. ".")))

> And in Delphi mode hook, I added:
>
> (setq find-tag-default-function 'my-find-tag-default-opascal)

This likely affects the variable globally, so maybe you'd want to use
`setq-local` instead.

> This works fine, but I am wondering if i'm not reinventing the wheel
> because I missed something.

I know the general issue of namespaces is not handled very well by the
etags support.  Your approach above will make thing worse in several
important use cases (e.g. when point is on "<var>.<method>" where we
won't find that tag anywhere (we'd have to lookup something like
"<class>.<method>" instead)), so it's not really something we can use as
is by default, but I think we'd welcome patches which try to improve on
this (e.g. by first trying with the dots and if that fails try again
without them).


        Stefan




  reply	other threads:[~2019-07-22 15:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 13:51 Find tags with dot character Pascal Quesseveur
2019-07-22 15:36 ` Stefan Monnier [this message]
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=jwv8ssqxf2c.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.