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: Thu, 04 Dec 2014 02:07:28 -0600 Message-ID: <8561drrg73.fsf@stephe-leake.org> References: <20141102151524.0d9c665c@forcix> <20141117211039.37f03409@forcix> <877fymghgb.fsf@bredband.net> <85ppc0qf9a.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1417680492 6196 80.91.229.3 (4 Dec 2014 08:08:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Dec 2014 08:08:12 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 04 09:08:06 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 1XwRSI-0003yh-BR for ged-emacs-devel@m.gmane.org; Thu, 04 Dec 2014 09:08:06 +0100 Original-Received: from localhost ([::1]:44856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwRSH-0006Xn-QZ for ged-emacs-devel@m.gmane.org; Thu, 04 Dec 2014 03:08:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwRRo-0006JN-Qy for emacs-devel@gnu.org; Thu, 04 Dec 2014 03:07:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwRRj-0005bm-FP for emacs-devel@gnu.org; Thu, 04 Dec 2014 03:07:36 -0500 Original-Received: from dnvrco-outbound-snat.email.rr.com ([107.14.73.227]:12423 helo=dnvrco-oedge-vip.email.rr.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwRRj-0005bd-9K for emacs-devel@gnu.org; Thu, 04 Dec 2014 03:07:31 -0500 Original-Received: from [70.94.38.149] ([70.94.38.149:49666] helo=TAKVER) by dnvrco-oedge01 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 7E/73-08610-14610845; Thu, 04 Dec 2014 08:07:30 +0000 In-Reply-To: <85ppc0qf9a.fsf@stephe-leake.org> (Stephen Leake's message of "Wed, 03 Dec 2014 21:13:05 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (windows-nt) X-RR-Connecting-IP: 107.14.64.118:25 X-Authority-Analysis: v=2.1 cv=F7jZd8RN 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=NEAV23lmAAAA:8 a=H-qCTKae1-XV-fO8lAMA: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.227 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:178805 Archived-At: Stephen Leake writes: > Using the code at: https://github.com/ellerh/xref, I've written an > ada-mode backend (not completion yet). It was quite straight-forward, > and I like the dispatching that eieio provides. > > So I recommend we merge this code into emacs master. > > A couple comments: I used xref--file-location, which is an internal symbol: (defmethod xref-find-definitions ((_ xref-ada-backend) identifier) ... (list (xref-make "" (make-instance 'xref--file-location :file (nth 0 target) :line (nth 1 target) :column (nth 2 target)))) )) There is a non-internal alternative xref-file-location: (defmethod xref-find-definitions ((_ xref-ada-backend) identifier) ... (list (xref-make "" (xref-file-location (nth 0 target) (nth 1 target) (nth 2 target))) )) I find the first more readable; that's part of the point of using the class paradigm. So I suggest promoting the classes in xref.el to a supported part of the API. In addition, that allows the code in '...' to change to also use the xref--file-location class, which would be a Good Thing. -- -- Stephe