all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: eller.helmut@gmail.com, 19466@debbugs.gnu.org
Subject: bug#19466: 25.0.50; xref-find-def doesn't find C functions
Date: Fri, 23 Jan 2015 19:34:45 +0200	[thread overview]
Message-ID: <54C28635.8070606@yandex.ru> (raw)
In-Reply-To: <83r3uluawd.fsf@gnu.org>

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

> Most, if not all, projects I work on aren't "projects" in your sense
> of the word, I think -- they lack any "project" files except the
> sources and Makefile's.

A top Makefile is enough for me, conceptually.

> With etags, I switch "projects" by invoking
> visit-tags-table and typing a name of a different TAGS file (I'm then
> given a choice of whether to keep the previous TAGS table or discard
> it, which is important -- see below).

I would consider this you adapting to Emacs's lack of support for 
projects: many people like to have commands that work on the "current 
project" (find-file, replace, etc), and depend on which buffer you're 
currently in. But anyway...

> If xref can reliably deduce that I switched projects and automatically
> update its database, that's fine with me, and would probably
> constitute what you mean by "dependence on the current file or
> project".

There's no single database. If you're using the etags backend, it should 
be just as affected by `M-x visit-tags-table', as `find-tag' is. So that 
should be good enough.

> Take, for example, the use case where I'm testing a program and found
> a bug.  I then need to be able to quickly find and examine the
> definition of symbols that might be involved in the bug, look at their
> code, perhaps make some changes -- this all will be served well by
> using the database (such as TAGS) of that single program.  But suppose
> I now come to the conclusion that the bug is not in the program per
> se, but involves one of the external libraries it uses.  Now I need to
> go through the sources of that library (whose sources, by sheer luck
> or maybe something else, I already have available on my system).  How
> would xref or etags know whether I switched to that library as part of
> my previous work (and therefore still need access to the previous
> project's symbols), or because I'm now working on an entirely
> different project?  What if investigating the bug needs to
> intermittently look at the sources of the program and the library
> (e.g., because the bug happens due to some incompatibility between
> them)?

Honestly, I would probably run two instances of Emacs. But the 
tags-file-name/tags-table-list approach should still work, as long as 
the etags backend is used.

Note that currently the only thing that depends on a specific buffer is 
the backend used. And the only buffers that use the non-default value 
now are in emacs-lisp-mode or its derivatives.

Until that changes, applying either of the code samples I presented 
should give you find-tag-ish behavior everywhere. So I was a bit too 
alarmist about you having to use find-file-hook and different major mode 
hooks.... yet.

> So I think there will always be a need for asking the user about this,
> and in addition there are projects without "project" infrastructure,
> where xref or etags or any similar feature will have to rely on the
> user for telling them which database of symbols to use.

A project infrastructure should take priority over this. For instance, 
how the current Projectile users switch to a file in a "different 
project"? They call `M-x projectile-switch-project', pick one from the 
cached list of projects, and then `M-x projectile-find-file' in the 
resulting buffer. I believe this kind of workflow scales better.

The logic behind determining the current project is entirely 
configurable, so there's no reason why a directory with a Makefile can't 
be considered a project, if the user is so inclined.

> Is xref ready for these use cases?  If so, in what form (simple
> variable customizations, specified commands, Lisp code that the use
> must supply, something else) can the user specify what she wants?

If they really want to, using simple functions and major mode hooks. 
Maybe minor modes. As you've seen, the code to "get back to using etags" 
is trivial.

>> Would it not depend on major mode at all, so it would also be true
>> in help-mode and similar buffers?
>
> Sometimes, I guess.  Like doing that in *scratch* after "emacs -Q", or
> in the *Help* buffer (which sometimes refers to external library
> functions).

Right. You'll only need to worry about help-mode buffers after someone 
writes dedicated xref support for it, and if you want to ignore their 
effors (just like it seems elisp-xref-find is not valuable for you).

> Is it possible to turn on xref-etags-mode (or its equivalents)
> globally?

It's "turned on" by default. All it does is restore the default values 
of two variables, to get back to the default behavior in emacs-lisp-mode 
buffers.

(I don't understand why this is not blindingly obvious from looking at 
those several lines.)

> Are there any disadvantages of that?

The find-func package is generally considered better and easier for 
Emacs Lisp navigation than etags. It's more precise, it distinguishes 
between different kinds of symbols, AND it can easily visit definitions 
from third-party code loaded in user's Emacs.

The one downside (it won't offer non-autoloaded symbols from not loaded 
packages) doesn't seems to be a real problem in practice.

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.





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

Thread overview: 100+ 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 [this message]
2015-01-23 21:03                                                   ` Eli Zaretskii
2015-01-23 22:23                                                     ` Dmitry Gutov
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-24 18:43                                                         ` Project support and completions (Was: Re: bug#19466: 25.0.50; xref-find-def doesn't find C functions) Dmitry Gutov
2015-01-24 22:26                                                           ` Eli Zaretskii
2015-01-24 23:25                                                             ` Dmitry Gutov
2015-01-25  0:21                                                               ` John Yates
2015-01-25 16:09                                                                 ` Eli Zaretskii
2015-01-29 21:19                                                                   ` John Yates
2015-01-30  6:19                                                                     ` Eli Zaretskii
2015-01-30 13:39                                                                       ` John Yates
2015-01-30 15:36                                                                         ` Eli Zaretskii
2015-01-30 18:14                                                                           ` Project support and completions Stefan Monnier
2015-01-30 21:34                                                                             ` Eli Zaretskii
2015-01-31  6:37                                                                               ` Stefan Monnier
2015-01-31  7:38                                                                                 ` Eli Zaretskii
2015-01-31 22:52                                                                                   ` Stefan Monnier
2015-02-01 20:42                                                                             ` Stephen Leake
2015-01-30 16:17                                                                       ` Stefan Monnier
2015-01-30 16:26                                                                         ` Eli Zaretskii
2015-01-30 20:36                                                                         ` Scott Frazer
2015-01-25 16:08                                                               ` Eli Zaretskii
2015-01-25 18:18                                                                 ` Dmitry Gutov
2015-01-25 19:22                                                                   ` Eli Zaretskii
2015-01-25 23:03                                                                     ` Dmitry Gutov
2015-01-26  5:51                                                                       ` Eli Zaretskii
2015-01-25 18:31                                                                 ` Stephen Leake
2015-01-25 15:01                                                             ` Stefan Monnier
2015-01-25 16:01                                                               ` Eli Zaretskii
2015-01-25 18:33                                                                 ` Stefan Monnier
2015-01-25 19:24                                                                   ` Eli Zaretskii
2015-01-25 22:43                                                                     ` Stefan Monnier
2015-01-25 23:05                                                                       ` Dmitry Gutov
2015-01-26  3:46                                                                         ` Stefan Monnier
2015-01-26  4:23                                                                           ` Dmitry Gutov
2015-01-26 15:07                                                                             ` Stefan Monnier
2015-01-26 17:33                                                                               ` Eli Zaretskii
2015-01-26 18:51                                                                                 ` Stephen Leake
2015-01-26  5:44                                                                       ` Eli Zaretskii
2015-01-26 15:11                                                                         ` Stefan Monnier
2015-01-26 17:34                                                                           ` Eli Zaretskii
2015-01-23 21:15                                                   ` bug#19466: 25.0.50; xref-find-def doesn't find C functions 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

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

  git send-email \
    --in-reply-to=54C28635.8070606@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 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.