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: emacs-devel <emacs-devel@gnu.org>
Subject: Project support and completions (Was: Re: bug#19466: 25.0.50; xref-find-def doesn't find C functions)
Date: Sat, 24 Jan 2015 20:43:02 +0200	[thread overview]
Message-ID: <54C3E7B6.2020006@yandex.ru> (raw)
In-Reply-To: <83h9vgsehi.fsf@gnu.org>

On 01/24/2015 11:40 AM, Eli Zaretskii wrote:

>> 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.
>
> I'm not sure what completions are alluded to here.  Completions are
> context-dependent, i.e. their DWIM-ish nature should depend on what is
> being completed, and for what purposes.

Code completion, like the first sentence says. Or completions for text, 
if we're talking about that README file.

Since external completion tools are usually already wedded to specific 
notions of projects, let's consider "all words in buffers" (a la 
dabbrev). Arguably, such completion source should use the words from all 
buffers belonging to the same project, as well as some limited 
dictionary that's applicable everywhere.

elisp-completion-at-point only considers the local buffer contents and 
currently loaded symbols (which if fine by me, but that exactly follows 
the pattern).

tags-completion-at-point-function, which is the default, has a different 
problem: it will be used in any buffer, even those not within the 
current tag file(s)'s subtree(s).

> For example, I hope you'd
> agree that it would be bad in general for completion in "C-x C-f" to
> show only files from the current project.

That's neither here no there. `find-file' is a plainly different function.

> By contrast, a specialized
> command that is meant to find files only from the current project
> should probably limit the candidates to the project.

Yes, and that's one feature that would use the current project. When 
used with a completing-read-function that provides some kind of fuzzy 
matching, it can be very handy: type a few letters and have the file you 
were thinking of at your fingertips.

Not so with the default completing-read, though.

> Likewise with symbols -- when the user wants only symbols from the
> current project, or from the programming language of the current
> buffer, that's what Emacs should show.  But there are also situations
> where such limitations produce bad results.

Personally, I consider that handwavy thinking a problem. We can't 
support each and every approach and expect the user not to be 
overwhelmed trying to remember and be able to use all of them.

Even if situations where given limitations are bad can exist, as long as 
they are rare enough, we can sacrifice certain edge cases if what's left 
is a coherent, simple user interface.

An extreme example, I'd say, is Icicles (sorry, Drew). Just looking at 
the documentation makes my head spin. And even if there can be 
situations in my life where I could use each option, I'd rather do the 
work manually rather than look for it, or generally live with an 
interface that does so many things at once.

> The important point is we cannot limit the user to just one possible
> context, even if it is the most frequent one.  Such a feature would be
> too limited.

Ideally, we should provide extensible interfaces. The backend logic that 
xref uses is swappable, and an interested user can write their take on 
the indexing and navigation logic, then share their code, and other 
like-minded users will benefit. Some would be included in Emacs, and 
would be used by enabling a specific minor mode.



  parent reply	other threads:[~2015-01-24 18:43 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
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                                                         ` Dmitry Gutov [this message]
2015-01-24 22:26                                                           ` Project support and completions (Was: Re: bug#19466: 25.0.50; xref-find-def doesn't find C functions) 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=54C3E7B6.2020006@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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.