From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: cl-defgeneric vs random funcall in project.el Date: Tue, 28 Jul 2015 18:09:51 +0300 Message-ID: <55B79B3F.1060200@yandex.ru> References: <86oaiwa57v.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1438096226 14950 80.91.229.3 (28 Jul 2015 15:10:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Jul 2015 15:10:26 +0000 (UTC) To: Stephen Leake , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 28 17:10:22 2015 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 1ZK6WK-0003uj-8k for ged-emacs-devel@m.gmane.org; Tue, 28 Jul 2015 17:10:20 +0200 Original-Received: from localhost ([::1]:59423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK6WJ-0005P4-LH for ged-emacs-devel@m.gmane.org; Tue, 28 Jul 2015 11:10:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK6Vz-0004rk-7k for emacs-devel@gnu.org; Tue, 28 Jul 2015 11:10:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZK6Vu-0004xS-Ct for emacs-devel@gnu.org; Tue, 28 Jul 2015 11:09:59 -0400 Original-Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:34759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK6Vu-0004x3-6U for emacs-devel@gnu.org; Tue, 28 Jul 2015 11:09:54 -0400 Original-Received: by wibud3 with SMTP id ud3so185153374wib.1 for ; Tue, 28 Jul 2015 08:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=sBSLc8BPmq14S9o67QJm+xtXhr1iM9Cx4wcaUSWb2u4=; b=Z8Rl4b+QS6Crk5Y52NsiyGfEDzfSvpJ9vWnc/fWnenXRajSvhVM/JVnq6nSxbSnTGa hwdqgWpH0ptRGELnny1f3lS/jpBmXUtazkmGqK9JvcMWdKWO7CQBHyCljipLSBf1IkYF 4lZ8Vm5GJ83A8uq/Jmcf7E9a8uva4TW2Ft9X68Bb+R4cD+DQEsqCGgwjFfu+aGsLy+G0 DEub3EroM4fOmBecN+5bj/zVGeQdPaaMliDhzWzdixU78yCxd1jNdulfr60wrwGjB1DC gyGFT8NMCdN8KaIf5DcxVaGW1tjdNi3xoX6Kf9t9/v/QJXGUY22z3bLNjV14UbUOs1kY H8ew== X-Received: by 10.194.21.70 with SMTP id t6mr73981557wje.74.1438096193574; Tue, 28 Jul 2015 08:09:53 -0700 (PDT) Original-Received: from [192.168.0.185] (static-nbl2-118.cytanet.com.cy. [212.31.107.118]) by smtp.googlemail.com with ESMTPSA id pg9sm20102890wjb.40.2015.07.28.08.09.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jul 2015 08:09:52 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0 In-Reply-To: <86oaiwa57v.fsf@stephe-leake.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::235 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:188132 Archived-At: On 07/28/2015 02:31 PM, Stephen Leake wrote: > But the default method uses 'project-search-path-function', which > elisp-mode sets to `elisp-search-function'; elisp.el does not use > cl-defmethod to override project-search-path. It's largely because, currently, project-search-path is supposed to return the source directories inside the project, as well as outside. And if a project implementation has to provide its own implementation, it's much cleaner, I think, if it only has to deal with project-search-path-function, instead of being forced to cl-call-next-method. Further, this part seems like it'd be impossible to implement: "A specialized implementation should use the value `project-search-path-function', or, better yet, call and combine the results from the functions that this value is set to by all major modes used in the project". However, now that we've reached the consensus that project-search-path doesn't need to include the directories inside the current project, an implementation will only need to override it if it actually knows search-path better than the major-mode. > Why do we need both dispatching methods? The alternative (which is more feasible now) is to use the context specializer, like: (cl-defmethod project-search-path (_project &context (major-mode (eql emacs-lisp-mode)))) It's also undocumented yet, and the method dispatch priority between it and method implementation dispatching on the first argument is also unclear now. And it'll need a separate declaration for each deriving mode (such as lisp-interaction-mode). Opinions welcome.