emacs-devel
[Top][All Lists]
Advanced

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

Re: Per-language project-search-path, was: Re: Unified project interface


From: Stephen Leake
Subject: Re: Per-language project-search-path, was: Re: Unified project interface
Date: Sat, 01 Aug 2015 13:57:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

Dmitry Gutov <address@hidden> writes:

> On 08/01/2015 01:43 PM, Stephen Leake wrote:
>
> If I recall, you've mentioned a concept of project file listing
> different search-paths for different languages. Without
> project-search-path taking the language into account, you'll have to
> append all paths together.

I don't know what you mean by "all paths" here; one project file defines
one source path.

In the case of a multilanguage project, that search path includes files
in all languages.

I often mix languages in one directory anyway; the file extension
indicates the language, so there's no need for it in the directory name.


> And what about jdee? Would you treat lisp/.dir-locals.el as the
> project file for Elisp, and ask the user to select it?

I think you are asking

    "what project would you use while editing elisp files that implement
    jdee"

not

    "what project file does jdee use for Java projects".

Yes, serious users will want to explicitly select the active project.

If I'm debugging jdee, I want the search path to be elisp load-path,
whether I'm in a notes.text file, a jdee .el file, or a test .java file.
So I don't want Emacs to guess what the active project is, nor determine
the search path based on the mode.

When I'm testing jdee's use of the project API, I will explicitly select
a Java project as the active project.

I've just written this:

(cl-defstruct (elisp-project)
  ;; no slots yet
  )

(cl-defmethod project-search-path ((type elisp-project))
  (project--prune-directories load-path))

(cl-defmethod project-root ((type elisp-project))
  ;; no meaningful root
  nil)

;; more overrides to come

(setq project-explicit-prj (make-elisp-project))

See below for project-explicit-prj.

In my mind, there is only one elisp project; all files currently on
load-path.

There will be a similar cl-defstruct for jdee-project.

>> I don't know which would be better as the default; the only general
>> solution is to require a project file.
>
> How does that translate to API requirements?

- Provide a mechanism for the user to explicitly set a project file.

    For example (now in my local project-patches.el):

    (defvar project-explicit-prj nil
      "Project explicitly set by user.")

    (defun project-explicit-prj (dir)
      "Return the project the user has set in `project-explicit-prj'."
      project-explicit-prj)

    (setq project-find-functions 'project-explicit-prj)

    A menu or completion list of previously selected projects would be
    very useful here (I'm working on that).


- Provide a way for functions to require a particular type of project file

    This is mostly there; all functions that only work with projects of
    some type should be cl-defmethods for that type.

--
-- Stephe



reply via email to

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