[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cl-defgeneric vs random funcall in project.el
From: |
Stephen Leake |
Subject: |
Re: cl-defgeneric vs random funcall in project.el |
Date: |
Fri, 31 Jul 2015 09:36:58 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) |
Dmitry Gutov <address@hidden> writes:
> On 07/31/2015 02:33 AM, Stephen Leake wrote:
>
>> If the elisp project backend just used load-path as project-search-path,
>> what desired functionality would you lose?
>
> xref-find-references won't search inside the current project root.
It would help to be more specific. Since we disagree, you can't assume
I'll guess what you have in mind; my first response was "so why would
you want to?". To be truly persuasive, you need to anticipate that
response, and address it before it happens.
A concrete example directory structure:
myproj/
# contains README, some docs
.git/
# contains git repo
build/
contains Makefile, test outputs, intermediate files
lisp/
# contains *.el files
lisp-emacs-24.3/
# contains *.el files only needed with emacs 24.3
test/
# contains test drivers, known good results
The user has set load-path to (".../myproj/lisp" "~/.emacs.d/elpa/..."
".../emacs-25.0/share/..." ...)
One search the user might want to do: find the name of an elisp function
in a test driver script file, to see how it is tested, while
simultaneously finding all places that function is used in the *.el
files, to review the test cases to ensure they are sufficient.
xref-find-references should do that search.
So I agree this is a case for the user adding things to
project-search-path that are not on load-path.
It would be wrong to add the entire directory tree that contains .git;
the user is using emacs 25, so they don't want to see the emacs 24.3
files. Obviously, there is a separate case where they do want to see
those files; that's a different project configuration.
We could provide:
(defun project-create (root)
"Return a project object that has root directory ROOT.
Also enters the project in `project-root-alist'."
...)
`project-root-alist' associates root directories with project objects;
`project-current' walks up the current directory tree until it finds a
matching entry in the alist. If that fails, it tries the other methods
it currenty uses.
(defun project-add-search-path (project path)
"Add PATH (a list of directories) to `project-search-path' for PROJECT.
If the directories are relative, they are first expanded relative to
`default-directory'."
...
)
(defun project-add-search-ignore (project ignores)
"Add IGNORES (a list of shell glob patterns) to `project-ignores'
for PROJECT."
...)
Then, in the same place they add myproj/lisp to load-path, the user
adds:
(defvar my-proj (project-create ".../myproj"))
(project-add-search-path my-proj
'(".../myproj/build" ".../myproj/test"))
# ignore intermediate test files
(project-add-search-ignore my-proj '(".../myproj/build/*.temp"))
xref-find-references then searches all files in all directories on
`project-search-path' and respects `project-ignores'.
--
-- Stephe
- Re: cl-defgeneric vs random funcall in project.el, (continued)
- Re: cl-defgeneric vs random funcall in project.el, Dmitry Gutov, 2015/07/29
- Re: cl-defgeneric vs random funcall in project.el, Stephen Leake, 2015/07/30
- Re: cl-defgeneric vs random funcall in project.el, Dmitry Gutov, 2015/07/30
- Re: cl-defgeneric vs random funcall in project.el, Stephen Leake, 2015/07/30
- Re: cl-defgeneric vs random funcall in project.el, Stephen Leake, 2015/07/30
- Re: cl-defgeneric vs random funcall in project.el, Dmitry Gutov, 2015/07/30
- Re: cl-defgeneric vs random funcall in project.el, Stephen Leake, 2015/07/30
- Re: cl-defgeneric vs random funcall in project.el, Dmitry Gutov, 2015/07/30
- Re: cl-defgeneric vs random funcall in project.el, Stephen Leake, 2015/07/30
- Re: cl-defgeneric vs random funcall in project.el, Dmitry Gutov, 2015/07/30
- Re: cl-defgeneric vs random funcall in project.el,
Stephen Leake <=
- Re: cl-defgeneric vs random funcall in project.el, Dmitry Gutov, 2015/07/31
- Re: cl-defgeneric vs random funcall in project.el, Stefan Monnier, 2015/07/30