Refactor Project API to reflect changes upstream
projectile-project-root no longer returns `default-directory` if not in a project (it returns nil). As such, doom-project-* functions (and their uses) have been refactored. + doom-project-p & doom-project-root are aliases for projectile-project-p & projectile-project-root. + doom-project-{p,root,name,expand} now has a DIR argument (for consistency, since projectile-project-name and projectile-project-expand do not). + The nocache parameter is no longer necessary, as projectile's caching behavior is now more sane. + Removed some projectile advice/hacks that are no longer necessary. + Updated unit tests
This commit is contained in:
parent
3961ba1662
commit
53fe7a1f04
22 changed files with 53 additions and 84 deletions
|
@ -104,7 +104,7 @@ preceded by the opening brace or a comma (disregarding whitespace in between)."
|
|||
(executable-find "rc"))
|
||||
(with-temp-buffer
|
||||
(message "Reloaded compile commands for rtags daemon")
|
||||
(rtags-call-rc :silent t "-J" (doom-project-root))))
|
||||
(rtags-call-rc :silent t "-J" (or (doom-project-root) default-directory))))
|
||||
;; then irony
|
||||
(when (and (featurep 'irony) irony-mode)
|
||||
(+cc|irony-init-compile-options)))
|
||||
|
|
|
@ -82,7 +82,7 @@ you're done. This can be called from an external shell script."
|
|||
filename
|
||||
(or (locate-dominating-file (file-truename default-directory)
|
||||
filename)
|
||||
(if (doom-project-p 'nocache) (doom-project-root 'nocache))
|
||||
(doom-project-root)
|
||||
(user-error "Couldn't detect a project")))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
(setq phpactor-working-dir
|
||||
(or phpactor-working-dir
|
||||
(php-project-get-root-dir)
|
||||
(doom-project-root))))
|
||||
(doom-project-root)
|
||||
default-directory)))
|
||||
(advice-add #'phpactor-get-working-dir :before #'+php*project-root)
|
||||
|
||||
(map! :map php-mode-map
|
||||
|
|
|
@ -38,7 +38,7 @@ started it."
|
|||
(puthash proot
|
||||
(+python--extract-version "Pipenv " v)
|
||||
+python-version-cache))
|
||||
(puthash (doom-project-root)
|
||||
(puthash (or (doom-project-root) default-directory)
|
||||
(+python--extract-version "Python " (car (process-lines "python" "--version")))
|
||||
+python-version-cache))
|
||||
(error "Python")))
|
||||
|
@ -53,7 +53,8 @@ started it."
|
|||
(setq +python--version
|
||||
(or (gethash (or (and (fboundp 'pipenv-project-p)
|
||||
(pipenv-project-p))
|
||||
(doom-project-root))
|
||||
(doom-project-root)
|
||||
default-directory)
|
||||
+python-version-cache)
|
||||
(+python-version))))
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ pipenv, unless those tools have modified the PATH that Emacs picked up when you
|
|||
started it."
|
||||
(condition-case _
|
||||
(let ((version-str (car (process-lines "ruby" "--version"))))
|
||||
(puthash (doom-project-root)
|
||||
(puthash (or (doom-project-root) default-directory)
|
||||
(format "Ruby %s" (cadr (split-string version-str " ")))
|
||||
+ruby-version-cache))
|
||||
(error "Ruby")))
|
||||
|
@ -40,7 +40,8 @@ started it."
|
|||
(defun +ruby|update-version (&rest _)
|
||||
"Update `+ruby--version' by consulting `+ruby-version' function."
|
||||
(setq +ruby--version
|
||||
(or (gethash (doom-project-root) +python-version-cache)
|
||||
(or (gethash (or (doom-project-root) default-directory)
|
||||
+python-version-cache)
|
||||
(+ruby-version))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue