unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 19466@debbugs.gnu.org, eller.helmut@gmail.com
Subject: bug#19466: 25.0.50; xref-find-def doesn't find C functions
Date: Sat, 24 Jan 2015 00:23:24 +0200	[thread overview]
Message-ID: <54C2C9DC.1050908@yandex.ru> (raw)
In-Reply-To: <83twzhryyq.fsf@gnu.org>

On 01/23/2015 11:03 PM, Eli Zaretskii wrote:

> I also like commands that work on the current project, I just don't
> like them to depend too much on the current buffer.

To cut this part of discussion short, yes, the project system can well 
be designed so that the "current project" depends not on the current 
buffer but on the user's choice. So to switch between projects, you 
invoke an explicit command, but don't visit a buffer belonging to the 
other project. And xref can work with such a system (just as it works 
with etags) without significant problems.

> Realistically, we need a command to switch to
> another project, and xref should plug into it, instead of trying to
> second-guess what I want.

Instead of xref plugging into whatever, any project system (which I'm 
assuming is implemented as a minor mode) can plug into xref and set up 
xref-find-function, etc, to use itself.

> It doesn't matter if there's one or many.  The important part is that
> the active one(s) need to be switched when I change to another
> project, and otherwise kept until I say-so.

That depends on the backend's implementation. etags works that way.

>> If you're using the etags backend, it should be just as affected by
>> `M-x visit-tags-table', as `find-tag' is.
>
> I don't understand what that means, sorry.  find-tag cannot work
> without me visiting a TAGS table.

etags-xref-find, likewise, will ask you for the path to the TAGS file, 
if it's not set yet.

> Seriously, though: I very much hope this was a semi-joke, because we
> really don't want asking users to do that.  A single instance of Emacs
> should be able to cope with such a simple task.  FWIW, I regularly
> have about a dozen projects in my Emacs session, and switch between
> them quite a lot.

Semi-joke, yes. That's just what I often do to avoid the clutter of 
buffers opened from different projects. It could work almost as well 
using different frames, but I'd have to find a way to hide the one 
frame's file buffers from the other frames.

You can continue doing what you've always done, no problem.

>> But the tags-file-name/tags-table-list approach should still work,
>> as long as the etags backend is used.
>
> I thought you were asking whether I must stick to etags, and was
> trying to explain which features I need to have, not necessarily in
> etags.  If the only conclusion from this discussion is that I must
> stick to etags or give up on features that it has been offering for
> years, then I'm sorry to say that xref doesn't seem progress to me.

Not at all. When I say "etags backend", I mean "etags backend for xref", 
since the latter is the subject of our discussion.

I think it's high time you've tried the snippets I wrote.

>> Note that currently the only thing that depends on a specific buffer is
>> the backend used.
>
> I fail to understand the rationale behind such a design.  As long as
> we are talking about buffers that hold source code of some programming
> language, why would it be a good idea to switch backends depending on
> the buffer?

You may not like it, but it's the easiest viable approach we can take, 
and a lot of people find it natural. For instance, both original 
proposals for the xref implementation used it.

However, like I mentioned, when a project system is used, we can use its 
backend in all project files, and so the backend would depend on the 
directory you in. But also see my first paragraph in this email.

> projectile-switch-project is conceptually the same as
> visit-tags-table, so I see no difference.

Except it visits the "root file" of the project after switching, and 
immediately "forgets" the previous project. So it's the kind of design 
you don't like.

It's the most popular project solution for Emacs that I know.

> That's not the issue.  The issue is that the logic behind determining
> the current project cannot be reliable enough to decide for the user
> which collection(s) of symbols are of interest to me at any given
> time.  Only the user knows that.  Unlike some other heuristics, where
> it's okay to have an imperfect success rate, in this case it's
> terribly annoying when Emacs refuses to admit that a symbol exists and
> show it to you, when you _know_ for sure it does exist.  This kind of
> annoyance _will_ happen if you rely on automated logic for deciding
> which symbols are or aren't relevant.

While I can understand it, that's just your (i.e. not universal) 
opinion, and I believe it's addressed above. That is, a backend can use 
this approach as well.

> That's not user-level customization.  It's too complex to be that.  We
> need simpler, higher-level customizations.

We don't even know what and how to customize yet. It might be time for 
you to swap the user shoes for the developer shoes.

>>> Is it possible to turn on xref-etags-mode (or its equivalents)
>>> globally?
>>
>> It's "turned on" by default.
>
> Then why did you propose to use hooks?

Because emacs-lisp-mode overrides it, and to reach certain level of 
happiness, you seem to need to revert that override. I believe I've 
explained that in the previous email, no?

>> Compared to etags, it also won't jump to the C functions that are not
>> exposed to Emacs Lisp. The overwhelming majority of our users (myself
>> probably included), won't ever need this.
>
> You can't build useful features on such assumptions.

I can, and I do.

> Btw, this mode of work, in more than one language, is not limited to
> Emacs.  You will see it in Guile, in Python, in Awk, in GDB, and in
> many other places.  It begins to be the rule rather than exception
> these days.  It's not good if Emacs will ask developers to jump
> through hoops to support that.

You seem to be clamoring for project support in Emacs. That's 
commendable, and it's a separate discussion.

Meanwhile, a lot of features currently depend just on the current major 
mode and buffer. There's nothing new about it. The easiest example is 
code completion.

In emacs-lisp-mode, it will parse the current buffer context and offer 
completions from obarray, somewhat filtered. If you have a README in the 
same directory as foo.el (so we might consider them to be in the same 
project), when you open it, you definitely won't get the same 
completions as in emacs-lisp-mode. In fact, if there's no current tags 
file visited, in the default Emacs configuration you won't get any 
completions at all.

Similarly for python-mode (python-shell-completion-at-point only works 
in Python buffers, and only when an inferior shell is running). Likewise 
for Octave, and I just haven't looked at Guile, Awk and GDB support.





  reply	other threads:[~2015-01-23 22:23 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29 19:27 bug#19466: 25.0.50; xref-find-def doesn't find C functions Eli Zaretskii
2014-12-30  4:57 ` Dmitry Gutov
2014-12-30 15:31   ` Eli Zaretskii
2014-12-30 18:05     ` Stefan Monnier
2014-12-30 18:25       ` Dmitry Gutov
2014-12-30 18:34         ` Eli Zaretskii
2014-12-30 18:38           ` Dmitry Gutov
2014-12-30 22:44           ` Stefan Monnier
2015-01-02 17:52             ` Dmitry Gutov
2015-01-04 20:10               ` Stefan Monnier
2015-01-04 20:29                 ` Eli Zaretskii
2015-01-04 23:14                   ` Dmitry Gutov
2015-01-05  3:36                     ` Eli Zaretskii
2015-01-05  6:11                       ` Stefan Monnier
2015-01-16  3:37                       ` Dmitry Gutov
2015-01-16  7:47                         ` martin rudalics
2015-01-16  9:04                           ` Eli Zaretskii
2015-01-16  9:28                             ` martin rudalics
2015-01-19  3:31                           ` Dmitry Gutov
2015-01-19  8:28                             ` martin rudalics
2015-01-19 13:32                               ` Dmitry Gutov
2015-01-20  8:01                                 ` martin rudalics
2015-01-20 12:14                                   ` Dmitry Gutov
2015-01-20 14:51                                     ` martin rudalics
2015-01-21  7:20                                       ` Dmitry Gutov
2015-01-21 10:49                                         ` martin rudalics
2015-01-21 14:24                                           ` Dmitry Gutov
2015-01-21 16:54                                             ` martin rudalics
2015-01-21 18:00                                               ` martin rudalics
2015-01-21 20:02                                                 ` Stefan Monnier
2015-01-22  2:32                                                   ` Dmitry Gutov
2015-01-22 18:22                                                   ` martin rudalics
2015-01-21 19:02                                               ` Dmitry Gutov
2015-01-22  2:26                                               ` Dmitry Gutov
2015-01-22 18:22                                                 ` martin rudalics
2015-01-19 17:41                               ` Eli Zaretskii
2015-01-20  2:54                                 ` Dmitry Gutov
2015-01-20 17:24                                   ` Eli Zaretskii
2015-01-20 20:49                                     ` Dmitry Gutov
2015-01-21 16:25                                       ` Eli Zaretskii
2015-01-22  2:43                                         ` Dmitry Gutov
2015-01-22 18:02                                           ` Eli Zaretskii
2015-01-22 21:02                                             ` Dmitry Gutov
2015-01-23  9:03                                               ` Eli Zaretskii
2015-01-23 17:34                                                 ` Dmitry Gutov
2015-01-23 21:03                                                   ` Eli Zaretskii
2015-01-23 22:23                                                     ` Dmitry Gutov [this message]
2015-01-24  9:40                                                       ` Eli Zaretskii
2015-01-24 16:47                                                         ` Dmitry Gutov
2015-01-31  8:52                                                           ` Eli Zaretskii
2015-02-01  2:24                                                             ` Dmitry Gutov
2015-02-01 16:01                                                               ` Eli Zaretskii
2015-02-01 20:11                                                                 ` Dmitry Gutov
2015-02-01 20:30                                                                   ` Eli Zaretskii
2015-02-01 20:53                                                                     ` Dmitry Gutov
2015-02-02  3:32                                                                       ` Eli Zaretskii
2015-02-23  2:01                                                                         ` Dmitry Gutov
2015-01-23 21:15                                                   ` Stefan Monnier
2015-01-23 21:34                                                     ` Eli Zaretskii
2015-01-16  9:00                         ` Eli Zaretskii
2015-01-04 22:14                 ` Dmitry Gutov
2014-12-30 20:43     ` 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=54C2C9DC.1050908@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=19466@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    /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).