emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generalizing find-definition


From: Jorgen Schaefer
Subject: Re: Generalizing find-definition
Date: Thu, 20 Nov 2014 21:21:11 +0100

On Wed, 19 Nov 2014 23:19:28 -0500
Stefan Monnier <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]