Commit 9ed73f6e authored by Sebastian Wiesner's avatar Sebastian Wiesner

[Fix #461] Drop Projectile integration

Gets in the way of ancestor-based config file locating
parent 4ee17a55
......@@ -16,6 +16,7 @@ master (in development)
- Improve GCC syntax checking by expanding templates [GH-459]
- `d-dmd` reports errors with columns now [GH-460]
- Remove Projectile-based config file search [GH-461]
- Bug fixes:
......
......@@ -13,7 +13,6 @@
;; Make optional dependencies available for development
(depends-on "google-this") ; Search for messages
(depends-on "projectile") ; Projectile integration
;; Various modes for use in the unit tests
(depends-on "adoc-mode")
......
......@@ -280,17 +280,13 @@ following algorithm:
1. If the configuration file variable contains a path a directory
separator, expand the path against the buffer's default directory and
use the resulting path as configuration file.
2. If Projectile_ is available and the current buffer is part of a project
project, search the configuration file in the root directory of the project.
3. If the buffer has a file name, search the buffer's directory and any
2. If the buffer has a file name, search the buffer's directory and any
ancestors thereof for the configuration file.
4. Eventually attempt to locate the configuration file in the user's home
3. Eventually attempt to locate the configuration file in the user's home
directory.
If any of these steps succeeds, the subsequent steps are not executed.
.. _Projectile: https://github.com/bbatsov/projectile
.. _error-reporting:
Error reporting
......
......@@ -308,7 +308,6 @@ information about file variables.")
(defcustom flycheck-locate-config-file-functions
'(flycheck-locate-config-file-absolute-path
flycheck-locate-config-file-projectile
flycheck-locate-config-file-ancestor-directories
flycheck-locate-config-file-home)
"Functions to locate syntax checker configuration files.
......@@ -2272,24 +2271,6 @@ _CHECKER is ignored."
(unless (string= (file-name-nondirectory filepath) filepath)
(expand-file-name filepath)))
(defun flycheck-locate-config-file-projectile (filename _checker)
"Locate a configuration FILENAME in a projectile project.
If the Projectile library (see URL
`https://github.com/bbatsov/projectile') is available and the
current buffer is within a Projectile project, search FILENAME in
the root directory of the project. If the file is found, return
its absolute path.
Otherwise return nil.
_CHECKER is ignored."
(when (fboundp 'projectile-project-root)
(-when-let* ((root (ignore-errors (projectile-project-root)))
(filepath (expand-file-name filename root)))
(when (file-exists-p filepath)
filepath))))
(defun flycheck-locate-config-file-ancestor-directories (filename _checker)
"Locate a configuration FILENAME in ancestor directories.
......@@ -2315,7 +2296,6 @@ directory, or nil otherwise."
(mapc (apply-partially #'custom-add-frequent-value
'flycheck-locate-config-file-functions)
'(flycheck-locate-config-file-absolute-path
flycheck-locate-config-file-projectile
flycheck-locate-config-file-ancestor-directories
flycheck-locate-config-file-home))
......
......@@ -48,9 +48,6 @@
(require 'ert) ; Unit test library
(require 'shut-up) ; Silence Emacs and intercept `message'
;; Optional dependencies
(require 'projectile nil 'no-error)
;;; Compatibility
......@@ -489,7 +486,6 @@ check with. ERRORS is the list of expected errors."
:tags '(customization)
(should (equal flycheck-locate-config-file-functions
'(flycheck-locate-config-file-absolute-path
flycheck-locate-config-file-projectile
flycheck-locate-config-file-ancestor-directories
flycheck-locate-config-file-home))))
......@@ -1730,35 +1726,6 @@ Try to reinstall the package defining this syntax checker.\n")))))
'emacs-lisp)
(expand-file-name "../Makefile" flycheck-test-directory)))))
(ert-deftest flycheck-locate-config-file-projectile/existing-file-inside-a-project ()
:tags '(configuration)
(skip-unless (fboundp 'projectile-project-root))
(flycheck-test-with-temp-buffer
(set-visited-file-name (expand-file-name "foo" flycheck-test-directory)
'no-query)
(should (projectile-project-p))
(should (equal
(flycheck-locate-config-file-projectile "Makefile" 'emacs-lisp)
(expand-file-name "../Makefile" flycheck-test-directory)))))
(ert-deftest flycheck-locate-config-file-projectile/not-existing-file-inside-a-project ()
:tags '(configuration)
(skip-unless (fboundp 'projectile-project-root))
(flycheck-test-with-temp-buffer
(set-visited-file-name (expand-file-name "foo" flycheck-test-directory)
'no-query)
(should (projectile-project-p))
(should-not (flycheck-locate-config-file-projectile "Foo" 'emacs-lisp))))
(ert-deftest flycheck-locate-config-file-projectile/outside-a-project ()
:tags '(configuration)
(skip-unless (fboundp 'projectile-project-root))
(flycheck-test-with-temp-buffer
(set-visited-file-name (expand-file-name "foo" temporary-file-directory)
'no-query)
(should-not (projectile-project-p))
(should-not (flycheck-locate-config-file-projectile "Foo" 'emacs-dir))))
(ert-deftest flycheck-locate-config-file-ancestor-directories/not-existing-file ()
:tags '(configuration)
(flycheck-test-with-temp-buffer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment