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:
Henrik Lissner 2018-09-28 13:54:20 -04:00
parent 3961ba1662
commit 53fe7a1f04
22 changed files with 53 additions and 84 deletions

View file

@ -314,7 +314,7 @@ e.g. ~/w/project/src/lib/file.c
Meant for `+modeline-buffer-path-function'."
(pcase-let
((`(,root-parent ,root ,dir, file)
(shrink-path-file-mixed (doom-project-root)
(shrink-path-file-mixed (or (doom-project-root) default-directory)
(file-name-directory buffer-file-name)
buffer-file-name)))
(list (cons root-parent 'font-lock-comment-face)

View file

@ -8,7 +8,7 @@
(defun +neotree/open ()
"Open the neotree window in the current project."
(interactive)
(let ((project-root (doom-project-root 'nocache)))
(let ((project-root (doom-project-root)))
(require 'neotree)
(if (neo-global--window-exists-p)
(neotree-hide)
@ -19,7 +19,7 @@
"Open the neotree window in the current project, and find the current file."
(interactive)
(let ((path buffer-file-name)
(project-root (doom-project-root 'nocache)))
(project-root (doom-project-root)))
(require 'neotree)
(cond ((and (neo-global--window-exists-p)
(get-buffer-window neo-buffer-name t))

View file

@ -10,8 +10,8 @@
(treemacs-do-remove-project-from-workspace project))
(with-current-buffer origin-buffer
(treemacs-do-add-project-to-workspace
(treemacs--canonical-path (doom-project-root 'nocache))
(doom-project-name 'nocache))
(treemacs--canonical-path (doom-project-root))
(doom-project-name))
(setq treemacs--ready-to-follow t)
(when (or treemacs-follow-after-init treemacs-follow-mode)
(treemacs--follow)))))