Remove witout-project-cache!, rename project-file-exists-p
To doom-project-file-exists-p, which is now a function.
This commit is contained in:
parent
7058facf9d
commit
832b7e9294
2 changed files with 14 additions and 23 deletions
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
(defvar projectile-project-root nil)
|
(defvar projectile-project-root nil)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload (autoload 'projectile-relevant-known-projects "projectile")
|
||||||
(autoload 'projectile-relevant-known-projects "projectile")
|
|
||||||
|
|
||||||
;;;###autodef
|
;;;###autodef
|
||||||
(cl-defun set-project-type! (name &key predicate compile run test configure dir)
|
(cl-defun set-project-type! (name &key predicate compile run test configure dir)
|
||||||
|
@ -24,22 +23,12 @@
|
||||||
;;; Macros
|
;;; Macros
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defmacro without-project-cache! (&rest body)
|
(defun doom-project-file-exists-p (files)
|
||||||
"Run BODY with projectile's project-root cache disabled. This is necessary if
|
|
||||||
you want to interactive with a project other than the one you're in."
|
|
||||||
`(let ((projectile-project-root-cache (make-hash-table :test 'equal))
|
|
||||||
projectile-project-name
|
|
||||||
projectile-project-root
|
|
||||||
projectile-require-project-root)
|
|
||||||
,@body))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defmacro project-file-exists-p! (files)
|
|
||||||
"Checks if the project has the specified FILES.
|
"Checks if the project has the specified FILES.
|
||||||
Paths are relative to the project root, unless they start with ./ or ../ (in
|
Paths are relative to the project root, unless they start with ./ or ../ (in
|
||||||
which case they're relative to `default-directory'). If they start with a slash,
|
which case they're relative to `default-directory'). If they start with a slash,
|
||||||
they are absolute."
|
they are absolute."
|
||||||
`(file-exists-p! ,files (doom-project-root)))
|
(file-exists-p! files (doom-project-root)))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -297,22 +297,24 @@ Otherwise, falls back on `find-file-at-point'."
|
||||||
(find-file-at-point path))
|
(find-file-at-point path))
|
||||||
|
|
||||||
((not (+lookup--jump-to :file path))
|
((not (+lookup--jump-to :file path))
|
||||||
(let ((fullpath (expand-file-name path)))
|
(let ((fullpath (doom-path path)))
|
||||||
(when (and buffer-file-name (file-equal-p fullpath buffer-file-name))
|
(when (and buffer-file-name (file-equal-p fullpath buffer-file-name))
|
||||||
(user-error "Already here"))
|
(user-error "Already here"))
|
||||||
(let* ((insert-default-directory t)
|
(let* ((insert-default-directory t)
|
||||||
(project-root (doom-project-root))
|
(project-root (doom-project-root))
|
||||||
(ffap-file-finder
|
(ffap-file-finder
|
||||||
(cond ((not (file-directory-p fullpath))
|
(cond ((not (doom-glob fullpath))
|
||||||
#'find-file)
|
#'find-file)
|
||||||
((ignore-errors (file-in-directory-p fullpath project-root))
|
((ignore-errors (file-in-directory-p fullpath project-root))
|
||||||
(lambda (dir)
|
(lambda (dir)
|
||||||
(let ((default-directory dir))
|
(let* ((default-directory dir)
|
||||||
(without-project-cache!
|
projectile-project-name
|
||||||
(let ((file (projectile-completing-read "Find file: "
|
projectile-project-root
|
||||||
(projectile-current-project-files)
|
(projectile-project-root-cache (make-hash-table :test 'equal))
|
||||||
:initial-input path)))
|
(file (projectile-completing-read "Find file: "
|
||||||
(find-file (expand-file-name file (doom-project-root)))
|
(projectile-current-project-files)
|
||||||
(run-hooks 'projectile-find-file-hook))))))
|
:initial-input path)))
|
||||||
|
(find-file (expand-file-name file (doom-project-root)))
|
||||||
|
(run-hooks 'projectile-find-file-hook))))
|
||||||
(#'doom-project-browse))))
|
(#'doom-project-browse))))
|
||||||
(find-file-at-point path))))))
|
(find-file-at-point path))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue