core-lib: use projectile cache in file-exists-p!
If available.
This commit is contained in:
parent
f05aa3a0b1
commit
0f98b5b3c2
1 changed files with 25 additions and 22 deletions
|
@ -38,13 +38,16 @@ Returns (approximately):
|
||||||
(and (if (file-exists-p B) B)
|
(and (if (file-exists-p B) B)
|
||||||
(if (file-exists-p C) C))))
|
(if (file-exists-p C) C))))
|
||||||
|
|
||||||
This is used by `associate!', `file-exists-p!' and `project-file-exists-p!'."
|
This is used by `file-exists-p!' and `project-file-exists-p!'."
|
||||||
(declare (pure t) (side-effect-free t))
|
(declare (pure t) (side-effect-free t))
|
||||||
|
(let ((exists-fn (if (fboundp 'projectile-file-exists-p)
|
||||||
|
#'projectile-file-exists-p
|
||||||
|
#'file-exists-p)))
|
||||||
(cond ((stringp spec)
|
(cond ((stringp spec)
|
||||||
`(let ((--file-- ,(if (file-name-absolute-p spec)
|
`(let ((--file-- ,(if (file-name-absolute-p spec)
|
||||||
spec
|
spec
|
||||||
`(expand-file-name ,spec ,directory))))
|
`(expand-file-name ,spec ,directory))))
|
||||||
(and (file-exists-p --file--)
|
(and (,exists-fn --file--)
|
||||||
--file--)))
|
--file--)))
|
||||||
((and (listp spec)
|
((and (listp spec)
|
||||||
(memq (car spec) '(or and)))
|
(memq (car spec) '(or and)))
|
||||||
|
@ -58,9 +61,9 @@ This is used by `associate!', `file-exists-p!' and `project-file-exists-p!'."
|
||||||
(file-name-absolute-p directory)))
|
(file-name-absolute-p directory)))
|
||||||
`(expand-file-name ,spec ,directory)
|
`(expand-file-name ,spec ,directory)
|
||||||
spec)))
|
spec)))
|
||||||
(and (file-exists-p --file--)
|
(and (,exists-fn --file--)
|
||||||
--file--)))
|
--file--)))
|
||||||
(spec)))
|
(spec))))
|
||||||
|
|
||||||
(defun doom--resolve-hook-forms (hooks)
|
(defun doom--resolve-hook-forms (hooks)
|
||||||
"Converts a list of modes into a list of hook symbols.
|
"Converts a list of modes into a list of hook symbols.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue