From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: Generalizing find-definition Date: Tue, 18 Nov 2014 13:03:09 +0100 Message-ID: References: <20141102151524.0d9c665c@forcix> <20141117211039.37f03409@forcix> <85ppclgcec.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1416312249 12243 80.91.229.3 (18 Nov 2014 12:04:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Nov 2014 12:04:09 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 18 13:04:03 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 1XqhVn-0005aJ-PW for ged-emacs-devel@m.gmane.org; Tue, 18 Nov 2014 13:03:59 +0100 Original-Received: from localhost ([::1]:52708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqhVn-0002VL-9A for ged-emacs-devel@m.gmane.org; Tue, 18 Nov 2014 07:03:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqhVO-0002Eq-Pa for emacs-devel@gnu.org; Tue, 18 Nov 2014 07:03:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqhVH-00031Z-BZ for emacs-devel@gnu.org; Tue, 18 Nov 2014 07:03:34 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:44973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqhVH-00031C-5I for emacs-devel@gnu.org; Tue, 18 Nov 2014 07:03:27 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XqhVB-0005L5-Ju for emacs-devel@gnu.org; Tue, 18 Nov 2014 13:03:21 +0100 Original-Received: from dial-183220.pool.broadband44.net ([212.46.183.220]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Nov 2014 13:03:21 +0100 Original-Received: from eller.helmut by dial-183220.pool.broadband44.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Nov 2014 13:03:21 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 34 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dial-183220.pool.broadband44.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) Cancel-Lock: sha1:xhoqUE9MVhH17+RWvk9E7+uqN90= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:177538 Archived-At: 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)) (symbol-at-point)) (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)) Helmut