Make doom-project-{p,root} functions simpler
+ doom-project-root and doom-project-p no longer takes arguments + Remove doom*project-root advice
This commit is contained in:
parent
77836e08b1
commit
3fcbdae441
4 changed files with 10 additions and 16 deletions
|
@ -53,7 +53,7 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
|
|||
|
||||
If no project is active, return all buffers."
|
||||
(let ((buffers (doom-buffer-list)))
|
||||
(if-let (project-root (doom-project-root t))
|
||||
(if-let (project-root (if (doom-project-p) (doom-project-root)))
|
||||
(cl-loop for buf in buffers
|
||||
if (projectile-project-buffer-p buf project-root)
|
||||
collect buf)
|
||||
|
|
|
@ -63,22 +63,17 @@ state are passed in.")
|
|||
(dolist (fn projectile-project-root-files-functions)
|
||||
(remhash (format "%s-%s" fn default-directory) projectile-project-root-cache)))
|
||||
|
||||
(defun doom-project-p (&optional strict-p)
|
||||
(defun doom-project-p ()
|
||||
"Whether or not this buffer is currently in a project or not."
|
||||
(let ((projectile-require-project-root strict-p))
|
||||
(let ((projectile-require-project-root t))
|
||||
(projectile-project-p)))
|
||||
|
||||
(defun doom-project-root (&optional strict-p)
|
||||
(defun doom-project-root ()
|
||||
"Get the path to the root of your project.
|
||||
If STRICT-P, return nil if no project was found, otherwise return
|
||||
`default-directory'."
|
||||
(let ((projectile-require-project-root strict-p))
|
||||
(ignore-errors (projectile-project-root))))
|
||||
|
||||
(defun doom*project-root (&rest _)
|
||||
"An advice function used to replace project-root-detection functions in other
|
||||
libraries."
|
||||
(doom-project-root))
|
||||
(let (projectile-require-project-root)
|
||||
(projectile-project-root)))
|
||||
|
||||
(defmacro doom-project-has! (files)
|
||||
"Checks if the project has the specified FILES, relative to the project root,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue