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:46:28 -0500 Message-ID: <85h9ygtk8r.fsf@stephe-leake.org> References: <20141102151524.0d9c665c@forcix> <20141102172944.0f7944e3@forcix> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415026025 28480 80.91.229.3 (3 Nov 2014 14:47:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Nov 2014 14:47:05 +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:46:58 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 1XlIuI-00074M-6q for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2014 15:46:58 +0100 Original-Received: from localhost ([::1]:35281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlIuH-0008Nz-RA for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2014 09:46:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlIty-0008JB-68 for emacs-devel@gnu.org; Mon, 03 Nov 2014 09:46:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlItr-0003xM-57 for emacs-devel@gnu.org; Mon, 03 Nov 2014 09:46:38 -0500 Original-Received: from dnvrco-outbound-snat.email.rr.com ([107.14.73.228]:40124 helo=dnvrco-oedge-vip.email.rr.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlItq-0003x5-TV for emacs-devel@gnu.org; Mon, 03 Nov 2014 09:46:31 -0500 Original-Received: from [70.94.38.149] ([70.94.38.149:54705] helo=TAKVER) by dnvrco-oedge02 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id FC/48-04477-44597545; Mon, 03 Nov 2014 14:46:29 +0000 In-Reply-To: (Stefan Monnier's message of "Sun, 02 Nov 2014 21:22:03 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (windows-nt) X-RR-Connecting-IP: 107.14.64.130:25 X-Authority-Analysis: v=2.1 cv=cs4VkjIi 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=Ojt0dfAr23MUj1tQT7MA: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.228 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:176276 Archived-At: Stefan Monnier writes: >>> M-. RET does "find the callers of a symbol at point", AFAICT. > > Duh, sorry for being dense, of course it doesn't. etags does not offer > the needed info, so the etags.el UI doesn't have such a thing. In emacs -Q, M-. is 'find-tag', which prompts for a tag with the default being the identifer at point, and goes to the first occurrence of that identifier in the tags table. Then tags-loop-continue goes to the next occurrence. The occurrences will include the calling locations; perhaps that is what was meant here. In other situations, "find the callers" would mean go to the start or declaration of the calling functions, not the point of the call. ada-mode provides "show all references", which is the same as "show all calls" for functions. It does not currently have "show all callers". > So on the UI side we mostly have: > - "jump to *the* definition of thing at point". > - "list definitions of thing at point". These two should be combined; only show the list if it has more than one item. The point is that in most cases there is only one, so showing the list is just an annoyance. > - "list uses of thing at point". This should show the list if there is only one; that's not typical, and is important information. > - "return to buffer/position before the last jump". I'm not clear this should be separate from the mark ring (push-mark, pop-mark). > And on the backend side we have: > - identifier-at-point-function This probably does not need to be separate; the other functions will call the equivalent backend function. > - find-definition-function (with an argument to decide whether we want > a whole list or just the best/first candidate). I don't think we need that argument. Instead, it could take an optional argument 'identifier', which would be used instead of indentifier-at-point. > - find-uses-function > Etags.el currently offers some additional functionality: > - jump to definition of any identifier, with TAB-completion. This implies that the backend has to provide the list of identifiers for completion; that's a new backend function 'complete-identifier'. ada-mode doesn't have that now, but it could be useful. It could also get very slow; the list of identifiers can be very large. I guess that's no different from the current tags usage. > - jump to file (among those listed in the TAGS file), tho currently > without TAB-completion. Another backend function; 'complete-file-name'. Or it could be 'project-directories' and 'project-extensions', to be used with ff-get-file. ada-mode uses compilation-search-path for 'project-directories', and ada-body-suffixes, ada-spec-suffixes for 'project-extensions. ada-mode does not currently provide jump to file with prompt, only jump to file derived from identifier at point. Prompt would be useful. > And the second one is also provided by things like projectile (among > many other thingies), tho it seems that none of the bundled Emacs > packages provide a good solution for that common need. I think ff-get-file is good. But maybe others want a more restricted list? -- -- Stephe