From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vitalie Spinu Newsgroups: gmane.emacs.devel Subject: Re: Bad moves with xref-find-definitions Date: Sun, 26 Apr 2015 13:31:36 +0200 Message-ID: <87zj5vm8h3.fsf@gmail.com> References: <87h9s6c27z.fsf@gmail.com> <87zj5wnlyt.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1430047917 17184 80.91.229.3 (26 Apr 2015 11:31:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Apr 2015 11:31:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 26 13:31:56 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YmKmy-0007tF-Gr for ged-emacs-devel@m.gmane.org; Sun, 26 Apr 2015 13:31:56 +0200 Original-Received: from localhost ([::1]:50409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmKmx-0007VF-MS for ged-emacs-devel@m.gmane.org; Sun, 26 Apr 2015 07:31:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmKmk-0007Sn-8Q for emacs-devel@gnu.org; Sun, 26 Apr 2015 07:31:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmKmg-0004jD-80 for emacs-devel@gnu.org; Sun, 26 Apr 2015 07:31:42 -0400 Original-Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:32805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmKmg-0004j2-01 for emacs-devel@gnu.org; Sun, 26 Apr 2015 07:31:38 -0400 Original-Received: by wgin8 with SMTP id n8so90066663wgi.0 for ; Sun, 26 Apr 2015 04:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=sMN/nHnHTTOFEulmjP+dHjb2Tmf7IUGvp8ulDsTwIDY=; b=jGOD5o/V7jYnEKDN8wvlKn+Co672vjHNME1x/uoRVO7ycVC2H382U5epARP5sTjSaz XG3xjqCxhgePDyDSrkOsLgzgYHTrN8GAnRaYHPZwC2Bu5Fffs6LlxmvIxl3XmuKvhfjr c9wnKdSeDvvzVuLyc7qeml3a1FOSKMWyPRupZzR6Ui83kcXwAm1uUSQZi2PVPzMr5vMg vfzwb/E9SoFnh6fjluYlVCqkrWUL0DgroiAbm6DZbOlr0s7UhWt+01/oaC1MorFg4ViX N/eeu+WCjcZMwjdRGl9YdxUXbuZ73I8Q5/IEp4zuD77C3U7T5bvsbM7ZON/OsLV/IZxz CdYA== X-Received: by 10.180.103.231 with SMTP id fz7mr12012363wib.35.1430047897399; Sun, 26 Apr 2015 04:31:37 -0700 (PDT) Original-Received: from localhost (dhcp-077-251-128-242.chello.nl. [77.251.128.242]) by mx.google.com with ESMTPSA id df1sm6990093wib.12.2015.04.26.04.31.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Apr 2015 04:31:36 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat, 25 Apr 2015 23:34:36 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::229 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185905 Archived-At: >>> Stefan Monnier on Sat, 25 Apr 2015 23:34:36 -0400 wrote: >> That's a bit besides the point. I want my interface to behave exactly >> the same independently of the context at point. > You're talking here about the fact that M-. will prompt if there's no > "thing at point"? Yes. > We could make it signal an error, indeed. I would like that. At least it would force people using C-u. Now I always navigate to empty space, even though I ware that it's a completely stupid habit. >> And, most importantly, I don't want to foster bad habits because my >> brain always chooses the easy path - navigate to a symbol instead of >> C-u. > Thing is: the two are different. In some languages, figuring out "the > thing at point" may itself not be obvious and even finding > a human-palatable textual representation of "the thing at point" may > turn out to be extra work. > So M-. really means "pass the current buffer position to the backend and > let it figure out what are the possible corresponding definitions". > Whereas C-u M-. asks the user for a textual representation of some > definition, and then tries to find matching definitions. > Of course, we could make the "empty minibuffer" mean "use the current > buffer position", but it seems cleaner to short-circuit the minibuffer > so we don't have to use a special string for it. Backend has to figure out the "thing" anyways. From there building "textual representation" and passing back to xref is a triviality. Also, you have to provide completions and textual representation of on C-u anyways. What do you currently do if there are multiple matching definitions of the "thing-at-point"? Prompt? >> Having C/C++ api interface to higher order languages is a commonality >> rather than an exception nowadays. > I do not understand what you're trying to say here (more specifically, > I can't see how this relates to the discussion). All I was trying to say is that tags are commonly useful alongside dynamic backends. Blindly replacing tags with an even very good backend is not the right direction IMW. Expecting from end users to solve this problem with add-function :before is unacceptable if there are way to fix it at Emacs level. Different backends can figure different "things-at-point". It would be wise to try back-ends in turn, just like completion-at-point-functions does. As to prompting, if you try to accommodate multiple backends, then merging completion candidates from multiple backends is a simple task when you prompt. If you try instead to "bypass the minibuffer" it's likely to be a much more difficult task. Vitalie