mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
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:
@ -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.")
|
||||
(projectile-reset-cached-project-root)
|
||||
(dolist (fn projectile-project-root-files-functions)
|
||||
(remhash (format "%s-%s" fn default-directory) projectile-project-root-cache)))
|
||||
|
||||
|
||||
(defun doom-project-p ()
|
||||
"Whether or not this buffer is currently in a project or not."
|
||||
"Whether or not this buffer is currently in a project or not."
|
||||
(let ((projectile-require-project-root t))
|
||||
(projectile-project-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."
|
||||
`default-directory'."
|
||||
(let (projectile-require-project-root)
|
||||
(projectile-project-root)))
|
||||
|
||||
(defmacro doom-project-has! (files)
|
||||
|
Reference in New Issue
Block a user