Skip to content

Commit fcd8f2b

Browse files
committed
Describe the project type keywords in one place
`projectile-register-project-type' and `projectile--build-project-plist' take the same seventeen keywords, and each carried its own description of what they mean - 61 lines and 49. Predictably the two had drifted: PROJECT-FILE, left unset, falls back to the first marker position and to *all* of that position's alternatives, which the public one says and the private one didn't. The code agrees with the public one, so that is the copy that stays; the private builder now points at it. `projectile-update-project-type' already delegated the same way, so this just brings the third function into line with what the other two were doing between them.
1 parent d6f3919 commit fcd8f2b

1 file changed

Lines changed: 8 additions & 49 deletions

File tree

projectile.el

Lines changed: 8 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6279,55 +6279,14 @@ Returns nil for a predicate marker, which has no file names to give."
62796279

62806280
(cl-defun projectile--build-project-plist
62816281
(marker-files &key project-file compilation-dir configure compile install package test run test-suffix test-prefix src-dir test-dir src-extension test-extension related-files-fn file-kinds tasks)
6282-
"Return a project type plist with the provided arguments.
6283-
6284-
A project type is defined by PROJECT-TYPE, a set of MARKER-FILES,
6285-
and optional keyword arguments.
6286-
6287-
MARKER-FILES is either a list of files or a predicate function. When it
6288-
is a list, ALL of the listed files must be present in the project root for
6289-
the type to match (logical AND) - so a single-file marker like `(\"Foo\")'
6290-
is the common case. A list element may itself be an alternatives clause
6291-
of the form (:any FILE...), which is satisfied when any one of its FILEs
6292-
is present, so `((:any \"build.gradle\" \"build.gradle.kts\"))' matches a
6293-
project with either of them. For anything more involved, don't pass a
6294-
list; use a predicate function instead. The predicate is called with the
6295-
project root as its single argument and should return non-nil when the
6296-
project is of this type.
6297-
6298-
The optional keyword arguments are:
6299-
PROJECT-FILE the main project file in the root project directory. It may be a
6300-
single file or a list of possible files. When omitted it
6301-
defaults to the first marker file. Pass the symbol `none'
6302-
to opt out, so the type is detected but contributes no
6303-
project-root marker (e.g. when its marker also appears
6304-
outside real projects).
6305-
COMPILATION-DIR the directory to run the tests- and compilations in,
6306-
CONFIGURE which specifies a command that configures the project
6307-
`%s' in the command will be substituted with (projectile-project-root)
6308-
before the command is run,
6309-
COMPILE which specifies a command that builds the project,
6310-
INSTALL which specifies a command to install the project.
6311-
PACKAGE which specifies a command to package the project.
6312-
TEST which specifies a command that tests the project,
6313-
RUN which specifies a command that runs the project,
6314-
TEST-SUFFIX which specifies test file suffix, and
6315-
TEST-PREFIX which specifies test file prefix.
6316-
SRC-DIR which specifies the path to the source relative to the project root.
6317-
TEST-DIR which specifies the path to the tests relative to the project root.
6318-
SRC-EXTENSION which specifies the file extension implementation files use,
6319-
when it differs from the one their tests use.
6320-
TEST-EXTENSION which specifies the file extension test files use, when it
6321-
differs from the implementation's (Elixir tests are scripts: `foo.ex\\='
6322-
is tested by `foo_test.exs\\=').
6323-
RELATED-FILES-FN which specifies a custom function to find the related
6324-
files such as test/impl/other files as below:
6325-
CUSTOM-FUNCTION accepts FILE as relative path from the project root and
6326-
returns a plist containing :test, :impl or :other as key and the
6327-
relative path/paths or predicate as value. PREDICATE accepts a
6328-
relative path as the input.
6329-
TASKS an alist of named tasks of the form (TASK-NAME . COMMAND); see
6330-
`projectile-tasks' for the exact shape."
6282+
"Return a project type plist built from MARKER-FILES and the keyword arguments.
6283+
6284+
This is the shape a registered project type takes; the arguments, and what
6285+
each of them means, are documented on `projectile-register-project-type',
6286+
which is the entry point users call and where the description belongs.
6287+
Both take the same keywords, so keeping a second copy here only bought two
6288+
descriptions that could disagree - and by the time this was written, they
6289+
already did."
63316290
;; When PROJECT-FILE isn't given explicitly, derive it from the first
63326291
;; marker file - that's the project's primary manifest in every
63336292
;; file-based registration, so callers needn't repeat it. Function

0 commit comments

Comments
 (0)