[Top][All Lists]

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

Re: Generalizing find-definition

From: Helmut Eller
Subject: Re: Generalizing find-definition
Date: Tue, 18 Nov 2014 13:03:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

On Tue, Nov 18 2014, Stephen Leake wrote:

>> +(defvar find-definition-function nil
>> +(defvar find-definition-identifier-function nil

Is it possible to use EIEIO instead?  I have a hunch that a "backend"
will need many "methods" in the long run.  My idea is that a mode
creates a subclass of something like a find-definition-backend class and
defines/overrides methods as appropriate for the mode.  The backend
object could then be stored in a buffer local variable.  Using EIEIO
classes and methods would arguably be clearer and more flexible than
defining a bunch of FOO-function variables.

In pseudocode:

;; interface of backend
(defclass find-definition-backend () ())
(defgeneric find-definition-identifier (backend))
(defgeneric find-definitions (backend identifier))

;; implementation of Elisp backend
(defclass elisp-backend (find-definition-backend) ())

(defmethod find-definition-identifier ((backend elisp-backend))

(defmethod find-definitions ((backend elisp-backend) symbol)

;; initialize buffer local backend variable in for elisp-mode:
(set (make-local-variable 'find-definition-backend)
     (make-instance 'elisp-backend))


reply via email to

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