| Age | Commit message (Collapse) | Author |
|
This allows for the implementation of IDE-like features where
projectile could context-sensitively change the value of the
command to execute for a given command type.
An example usage of this feature would go as follows:
```elisp
(defun my/compile-command ()
"Returns a String representing the compile command to run for the given context"
(cond
((and (eq major-mode 'java-mode)
(not (string-match-p (regexp-quote "\\.*/test/\\.*") (buffer-file-name (current-buffer)))))
"./gradlew build")
((eq major-mode 'web-mode)
"./gradlew compile-templates")
))
(defun my/test-command ()
"Returns a String representing the test command to run for the given context"
(cond
((eq major-mode 'js-mode) "grunt test") ;; Test the JS of the project
((eq major-mode 'java-mode) "./gradlew test") ;; Test the Java code of the project
((eq major-mode 'my-mode) "special-command.sh") ;; Even Special conditions/test-sets can be covered
))
(projectile-register-project-type 'has-command-at-point '("file.txt")
:compile 'my/compile-command
:test 'my/test-command)
```
In cases where one projectile project covers multiple different build types and commands to run
subdivisions of the testset this is a major improvement.
|
|
to handle files with characters like "+" in them correctly. Such characters should be matched
literally instead of ending up as part of a regexp. This happens for example with Objective-C,
where it's common to have two files of the form Class+Protocol.{m,h}.
|
|
Buffers are created by other packages that appear on projectile's buffer lists, but they always have
some variation that makes impossible including all possible name cases, thus regular expressions
come handy for this sort of cases. This commit allows `*-ignored-*-p` functions to work with regular expressions.
|
|
When enabling projectile-global-mode every time a new file buffer is
opened, a "No projects needed to be removed." message is triggered.
These messages are not helpful to the user, clutter the messages buffer,
may obscure other more informative messages in the mini buffer, and are
rather annoying.
The former behaviour, when used interactively, is still intact.
|
|
|
|
|
|
|
|
|
|
This test was blowing away the actual project file, rather than a test
file. To fix this, move the test to the known-project-test file and
give it test-tmp-file-path.
|
|
Projectile adds projects as directory names, as in "~/project/".
Manually adding a project root that is not a directory name, as
in (projectile-add-known-project "~/project"), works fine, but
Projectile will then add the project root as a directory name, so that
both "~/project" and "~/project/" will be in the list of known
projects.
This change converts "~/project" to "~/project/" before adding it to
the list, thereby avoiding annoying near-duplicates.
|
|
The return value of `projectile-default-configure-command` is checked
for nil, since `format` doesn't accept nil format strings.
|
|
Currently, the source directory and test directory are hardcoded
values ("src/" and "test/", cf. projectile-create-test-file-for)
This commit adds :src-dir and :test-dir as arguments to
projectile-project-type to make it easier to control where the tests
file are created.
|
|
Some build systems (eg. meson, autotools and CMake) support building out
out-of-tree. This is already supported in projectile by setting the
`projectile-project-compilation-dir` variable in .dir-locals.el of the
project you prefer an out-of-tree build fr.
However for some build systems (eg. meson) building in-tree is not a
possibility and having to add a .dir-locals.el file to each meson
project is not ergonomic.
Add support for setting a default compilation dir to a project type.
|
|
|
|
suffixes.
|
|
projectile-enable-caching is important for performance for commands
like projectile-find-file. However, the cache lives indefinitely (even
across Emacs restarts) and can go stale if files are added/removed
outside of Emacs.
Instead, allow the user to specify how long the cache may live by
setting projectile-files-cache-expire, similar to
projectile-file-exists-local-cache-expire.
|
|
Cache the result of (projectile-project-root) as a buffer local variable to
increase performance - this is implemented the same as was done
for (projectile-project-name) in PR 1906.
To ensure project root cache is used when there is no
project (ie. when (projectile-project-root) is nil) - we set the cached value
to the symbol 'none' and then replace this with nil before we return it - since
the cached value is non-nil we don't reevaluate it - but we don't want to
return 'none' as a result - so we instead substitute 'none' for nil before
returning, and also move the `projectile-require-project-root` error check to
the exit of the function to ensure this is still raised in this case.
Finally, this commit also changes the unit tests to handle the cached project
root by resetting before each evaluation - since the unit tests don't actually
change the (buffer-file-name) we need to do this to ensure they still pass.
|
|
|
|
|
|
|
|
|
|
|
|
projectile.el (projectile-find-file-hook-function): New defun. Call
nothing for remote files.
* projectile.el (projectile-mode): Don't set find-file-hook locally.
* test/projectile-test.el (projectile-test-setup-hook-functions-projectile-mode):
(projectile-test-setup-hook-functions-projectile-global-mode): Update tests.
|
|
This reverts commit ee5ce8d0799d6db366025cc664faf683cfdb4cca.
|
|
This change makes it so that a direct `call-process` invocation is used
when it is possible to determine what binary should be used for the
command. This avoids the cost of shell startup time that is incurred
when `shell-command-to-string` is invoked instead.
|
|
|
|
* travis/provision.sh: Don't install Cask.
* test/make-update.el: Use .elpa.
* test/elpa.el: Use .elpa.
* doc/contributing.md: Update test recipe notes.
Re #1046
|
|
* Makefile: Don't depend on cask, which has been broken for months.
Simplify the "all", "update", "compile", "test" and "clean" targets to a
single line each.
* script/emacs.sh: Remove unnecessary script.
* test/elpa.el: New script that initializes the package directory to
.cask/version.
* test/make-update.el: New script that updates dependencies in
.cask/version.
* test/make-compile.el: New script that compiles projectile.el.
|
|
projectile-get-other-file used to consider backup files of files as the
same extension. So if you called it with "test.c" as current-file and
'("test.h" "test.h~") it would return them both, while the user probably
wouldn't want to edit the backup file. This commit makes sure no backup
files are returned.
|
|
Closes #892
|
|
This fixes an awkward bug when the current project is a symlink that
changes. Suppose we have the following filesystem layout:
/tmp/projectile_project -> /tmp/first_project
If we now delete /tmp/first_project and change the symlink:
/tmp/projectile_project -> /tmp/second_project
then `projectile-project-root-cache` will contain a key
`"projectile-root-bottom-up-/tmp/projectile-project"` with value
`"/tmp/first_project"`. This will stop `projectile-find-file` from working
as it can't cd to /tmp/first_project.
Instead, we enforce that the string from `projectile-project-root`
points to a directory that currently exists.
|
|
This test can fail if user-emacs-dir does not exist. So make a
temporary known projects file, as is done in the test of
`projectile-merge-known-projects' in projectile-known-project-test.el.
|
|
|
|
|
|
Other than the project root dir. Fixes #874.
Also make compile-command cache compile-directory specific.
|
|
|
|
This makes overriding the "query the user" part easier.
|
|
|
|
[Fix #657] Remove `file-truename` calls from `projectile-project-root`
|
|
Also make `projectile-locate-dominating-file` return expanded directory.
|
|
|
|
|
|
|
|
|
|
In projects where there are multiple file names with the same
header/source combinations we can still provide more accurate results by
sorting the candidates list to put the other-file under the same
directory name as this file to the top of the list.
|
|
files by extension
Add a new defcustom projectile-globally-ignored-file-suffixes that is
used by projectile-remove-ignored to remove files based off of the file
suffix.
|
|
* Remove test/test-helpers.
* Remove prefix less helper variables and functions.
* Provide two new prefixed macros, which actually solve the task
they are supposed to solve _completely_, instead of stopping
have way through, like the predecessors did.
* Stop using the `f' library.
* Enforce use of spaces for indentation.
* Explicitly require needed libraries.
|
|
Only two functions from `s' were used for which no equivalent function
exists in all supported Emacs versions. So add a backward compatibility
definition of `string-suffix-p' and add `projectile-trim-string' as a
replacement for `s-trim'.
In all other cases *not* using `s' and `f' is actually an improvement,
in my humble opinion. And having to define the two mentioned functions
does therefor not outweigh not having two additional dependencies.
Also see #623.
|
|
Use more explicit filenames, making it possible to guess what is being
tested by just looking at the filenames. Also extend test to assert
that empty lines are ignored.
|
|
|