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: Tue, 04 Nov 2014 08:52:46 -0600 Message-ID: <85egtjrpa9.fsf@stephe-leake.org> References: <20141102151524.0d9c665c@forcix> <20141102172944.0f7944e3@forcix> <20141103084433.12117c03@forcix> <20141103192853.2702fe7a@forcix> <20141103215526.28edeb27@forcix> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415112821 31941 80.91.229.3 (4 Nov 2014 14:53:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Nov 2014 14:53:41 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 04 15:53:34 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 1XlfUE-0003cC-Iz for ged-emacs-devel@m.gmane.org; Tue, 04 Nov 2014 15:53:34 +0100 Original-Received: from localhost ([::1]:40953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlfUE-0000mX-5X for ged-emacs-devel@m.gmane.org; Tue, 04 Nov 2014 09:53:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlfTd-0000gD-5F for emacs-devel@gnu.org; Tue, 04 Nov 2014 09:53:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlfTX-0008Mk-2s for emacs-devel@gnu.org; Tue, 04 Nov 2014 09:52:57 -0500 Original-Received: from dnvrco-outbound-snat.email.rr.com ([107.14.73.230]:57051 helo=dnvrco-oedge-vip.email.rr.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlfTW-0008MG-Tk for emacs-devel@gnu.org; Tue, 04 Nov 2014 09:52:51 -0500 Original-Received: from [70.94.38.149] ([70.94.38.149:49854] helo=TAKVER) by dnvrco-oedge03 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 61/7E-23829-E38E8545; Tue, 04 Nov 2014 14:52:47 +0000 In-Reply-To: (Stefan Monnier's message of "Mon, 03 Nov 2014 17:38:05 -0500") 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=VHMebyCtUeSnkSwZesYA: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.230 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:176341 Archived-At: Stefan Monnier writes: > > from foo import Foo > > bar = Foo() > > bar.baz_|_ >> The only single string that reliably would allow to find the correct >> definition would be "foo.Foo.baz", but I do not think that anyone >> would consider that to be "the identifier at point" here. > > I would. I would also, but I would not expect a generic Emacs function to return that. It certainly requires a backend function. I'm still not clear what 'identifier-at-point' is good for outside "goto definition", "show uses", and completion. Since the meaning is highly backend specific, I don't see what other parts of Emacs might use it. You say there are other uses - can you list some? In ada-mode, 'ada-identifier-at-point' is used in (ada-mode doesn't provide completion yet): ada-goto-declaration aka find-definition-function ada-show-references aka find-uses-function ada-show-declaration-parents If identifier-at-point is a type, show the definition of the types it inherits from. ada-show-overriding If identifier-at-point is a function, show definitions of functions that override it. ada-show-overridden If identifier-at-point is a function, show definitions of the function that it overrides. The last three are additional candidates for the API. >>> Note that such completion tables are clearly not lists of strings, but >>> they're functions (actually, they're objects represented as functions, >>> for lack of an object system). >> What is the advantage of having the backend define a function that >> returns a completion table as opposed to a function that prompts the >> user for a symbol? The saved code seems minimal, and it means the >> backend can not set the prompt, for example. > > It means the UI can use it for various kinds of completion (e.g. for > completion-at-point-function). +1 ada-mode would provide a tree as well. -- -- Stephe