From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jorgen Schaefer Newsgroups: gmane.emacs.devel Subject: Re: Generalizing find-definition Date: Thu, 20 Nov 2014 21:21:11 +0100 Message-ID: <20141120212111.2b9632a2@forcix> References: <20141102151524.0d9c665c@forcix> <20141117211039.37f03409@forcix> <85oas2g1rq.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1416514936 3733 80.91.229.3 (20 Nov 2014 20:22:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Nov 2014 20:22:16 +0000 (UTC) Cc: Stephen Leake , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 20 21:22:09 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 1XrYEy-000789-7C for ged-emacs-devel@m.gmane.org; Thu, 20 Nov 2014 21:22:08 +0100 Original-Received: from localhost ([::1]:37223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrYEx-0002b9-Oj for ged-emacs-devel@m.gmane.org; Thu, 20 Nov 2014 15:22:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrYEE-00025x-7A for emacs-devel@gnu.org; Thu, 20 Nov 2014 15:21:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrYE8-0000VS-9Y for emacs-devel@gnu.org; Thu, 20 Nov 2014 15:21:22 -0500 Original-Received: from loki.jorgenschaefer.de ([87.230.15.51]:37799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrYE8-0000V3-2i for emacs-devel@gnu.org; Thu, 20 Nov 2014 15:21:16 -0500 Original-Received: by loki.jorgenschaefer.de (Postfix, from userid 998) id B1F7E200316; Thu, 20 Nov 2014 21:21:13 +0100 (CET) Original-Received: from forcix (port-94058.pppoe.wtnet.de [84.46.79.234]) by loki.jorgenschaefer.de (Postfix) with ESMTPSA id EF7DB2002F4; Thu, 20 Nov 2014 21:21:12 +0100 (CET) In-Reply-To: X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; i586-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 87.230.15.51 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:177890 Archived-At: On Wed, 19 Nov 2014 23:19:28 -0500 Stefan Monnier wrote: > >>> +(defvar find-definition-identifier-function nil > >> I suggest you collapse those two function variables into one: if > >> called with a nil value (or without argument), then just find the > >> definitions of "thing at point" and if called with a string, then > >> find the definitions of that identifier. > > Keeping two variables puts that logic in the front-end, so all the > > backends don't have to implement it, and we can change it for > > everyone consistently. > > I think both in the front-end and in many backends, the two cases will > share a lot of code, so using a single var will simplify code in the > front-end and in many backends as well. As one concrete example, for Elpy, the two will share absolutely no code. But the difference is minuscle: (setq find-definition-function 'elpy-find-definition-by-location) (setq find-definition-identifier-function 'elpy-find-definition-by-identifier) vs. (setq find-definition-function 'elpy-find-definition-by-location-or-identifier) (defun elpy-find-definition-by-location-or-identifier (&optional identifier) (if symbol (elpy-find-definition-by-identifier identifier) (elpy-find-definition-by-location))) So I do not really care either way. Jorgen