emacs-devel
[Top][All Lists]
Advanced

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

Re: cl-defgeneric vs random funcall in project.el


From: Dmitry Gutov
Subject: Re: cl-defgeneric vs random funcall in project.el
Date: Tue, 28 Jul 2015 18:09:51 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0

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.



reply via email to

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