unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: emacs-devel <emacs-devel@gnu.org>,
	Stefan Monnier <monnier@IRO.UMontreal.CA>
Subject: Re: Guidelines for the "symbol" syntax class
Date: Mon, 4 Jan 2016 03:14:39 +0200	[thread overview]
Message-ID: <5689C77F.1030408@yandex.ru> (raw)
In-Reply-To: <m2wprq88of.fsf@newartisans.com>

On 01/04/2016 02:55 AM, John Wiegley wrote:

> I suppose my informal guideline is to implement a strategy that works best for
> the mode you want to derive information from, and to not expect syntax classes
> to be a capable enough interface. I'd expect Ruby symbols to include ":",
> personally.

In c++-mode, `std::cout' is two separate symbols, so I'm going to follow 
that model.

> A::B is the qualified name of a symbol

Yes, and methods have qualified names like A::B#foo or A::B.bar, but we 
don't make `#' or `.' symbol constituents.

> -- although "B" is
> technically an unqualified symbol in its own right within that qualified name.

Yup. "B" is the name of a constant set on the module/class A. This is 
relevant because we can reference A::B from code lexically inside A (or 
even inside A::C) by its base name (B). And it's impossible to know 
whether the referenced constant (classes are constants, BTW) is B, A::B 
or A::C::B without runtime information, or parsing the whole project and 
its dependencies.

> Better yet, define a more general API that all modes can use, since many modes
> struggle with these same issues (imenu, thing-at-pt, dabbrev, etc). This
> echoes back to our long IDE thread.

Ouch. We do need to release 25.1 sometime. And I want 
xref-find-references to work okay-ish in ruby-mode by then.

There *are* some variables already in Emacs that I might have to use, 
and maybe I'm missing some of them. E.g. 
dabbrev-abbrev-skip-leading-regexp and find-tag-default-function (should 
xref-collect-references use find-tag-default-function?).

> Perhaps we need layered, semantically-
> defined classes, such that a given text position might occur within many such
> layers (for example, selection might choose B, A::B, or A::B.foo, depending on
> how many times I smash the "select current" key).

easy-kill defines a hierarchy of things (though a simplistic one), which 
works like you describe. How to apply that idea to dabbrev-expand and 
xref-find-references is not immediately obvious to me.



  reply	other threads:[~2016-01-04  1:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-03  5:09 Guidelines for the "symbol" syntax class Dmitry Gutov
2016-01-03 22:56 ` John Wiegley
2016-01-04  0:46   ` Dmitry Gutov
2016-01-04  0:51     ` Stefan Monnier
2016-01-04  0:58       ` Dmitry Gutov
2016-01-04  1:13       ` John Yates
2016-01-04  1:18         ` Dmitry Gutov
     [not found]           ` <CAJnXXog5fO_h5UNnVR67EJtT+u7+G-BVMFV3FnJgK=weGj0m_w@mail.gmail.com>
2016-01-04  2:01             ` Dmitry Gutov
2016-01-04  0:55     ` John Wiegley
2016-01-04  1:14       ` Dmitry Gutov [this message]
2016-01-04  2:56         ` Stefan Monnier
2016-01-04  3:47           ` Dmitry Gutov
     [not found]     ` <CAJnXXogonsWpqadNpX0BijzoiztorYP1d=b31seBfvGVBwwT_Q@mail.gmail.com>
     [not found]       ` <5689CC5C.4000408@yandex.ru>
     [not found]         ` <CAJnXXojy1b6LUdXcC+cDVPYT-OJMXCE8m8yqObE9oUYwU_PGbg@mail.gmail.com>
2016-01-04  2:34           ` Dmitry Gutov

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5689C77F.1030408@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).