From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: Generalizing find-definition Date: Mon, 03 Nov 2014 09:17:27 -0500 Message-ID: <85lhnstll4.fsf@stephe-leake.org> References: <20141102151524.0d9c665c@forcix> <20141102172944.0f7944e3@forcix> <20141103084433.12117c03@forcix> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415024283 30802 80.91.229.3 (3 Nov 2014 14:18:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Nov 2014 14:18:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 03 15:17:56 2014 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 1XlISC-0008NB-Cu for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2014 15:17:56 +0100 Original-Received: from localhost ([::1]:35050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlISB-0002vJ-OK for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2014 09:17:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlIRs-0002sP-LA for emacs-devel@gnu.org; Mon, 03 Nov 2014 09:17:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlIRn-0002e2-0r for emacs-devel@gnu.org; Mon, 03 Nov 2014 09:17:36 -0500 Original-Received: from dnvrco-outbound-snat.email.rr.com ([107.14.73.226]:28857 helo=dnvrco-oedge-vip.email.rr.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlIRm-0002dR-Oy for emacs-devel@gnu.org; Mon, 03 Nov 2014 09:17:30 -0500 Original-Received: from [70.94.38.149] ([70.94.38.149:54671] helo=TAKVER) by dnvrco-oedge03 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 56/28-23829-77E87545; Mon, 03 Nov 2014 14:17:28 +0000 In-Reply-To: <20141103084433.12117c03@forcix> (Jorgen Schaefer's message of "Mon, 3 Nov 2014 08:44:33 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (windows-nt) X-RR-Connecting-IP: 107.14.64.142:25 X-Authority-Analysis: v=2.1 cv=YJMRyH2x c=1 sm=1 tr=0 a=AppmJ/7ZOOFWL/q6u6u93g==:117 a=AppmJ/7ZOOFWL/q6u6u93g==:17 a=ayC55rCoAAAA:8 a=fNEgcOh0sVsA:10 a=9i_RQKNPAAAA:8 a=sHpNcQ4ddv_bRz6gn4cA:9 X-Cloudmark-Score: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 107.14.73.226 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:176274 Archived-At: Jorgen Schaefer writes: > Stefan Monnier wrote: > >> And on the backend side we have: >> - identifier-at-point-function > > Why do we need this? It does not make much sense for this functionality > in languages with combined identifiers. For example, in Python, > "foo.bar()" can be pretty much anything, it depends heavily on the > context. Libraries for introspection expect a position in a file/buffer, > not an identifier, to find the definitions. ada-mode has ada-identifier-at-point; it returns a string suitable for the external cross-reference engine. On the other hand, 'ada-goto-declaration' (which would be used for 'find-definition-function') calls ada-identifier-at-point (and similarly for other cases), so I don't think this needs to be split out as an API function. >> - find-definition-function (with an argument to decide whether we want >> a whole list or just the best/first candidate). > > I am not sure if it is generally easily possible to sort the list of > candidates like that. I guess tags often has the problem of knowing > more than one possible candidate, so it would be preferable for tags to > default to a single destination? I don't ever want the back-end to guess for me without giving me the option to override; if there's a list, I want to see it, either as an icomplete style completion list, or in a buffer. If the backend can put some order on the list (last used is usually good), that is fine. >> Etags.el currently offers some additional functionality: >> - jump to definition of any identifier, with TAB-completion. > > C-u M-. could call a separate function when set, which would be > provided by the mode author to prompt for an identifier (with tab > completion if possible) and goes to the definition of that symbol. It might also be useful to have find-definition-function take an optional 'identifier' argument. Then other code that finds identifiers could use it. -- -- Stephe