core-lib: use projectile cache in file-exists-p!

If available.
This commit is contained in:
Henrik Lissner 2019-07-21 14:38:12 +02:00
parent f05aa3a0b1
commit 0f98b5b3c2
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -38,13 +38,16 @@ Returns (approximately):
(and (if (file-exists-p B) B)
(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))
(let ((exists-fn (if (fboundp 'projectile-file-exists-p)
#'projectile-file-exists-p
#'file-exists-p)))
(cond ((stringp spec)
`(let ((--file-- ,(if (file-name-absolute-p spec)
spec
`(expand-file-name ,spec ,directory))))
(and (file-exists-p --file--)
(and (,exists-fn --file--)
--file--)))
((and (listp spec)
(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)))
`(expand-file-name ,spec ,directory)
spec)))
(and (file-exists-p --file--)
(and (,exists-fn --file--)
--file--)))
(spec)))
(spec))))
(defun doom--resolve-hook-forms (hooks)
"Converts a list of modes into a list of hook symbols.