Fix file-exists-p! with nested forms

Due to the eval not picking up lexical bindings.
This commit is contained in:
Henrik Lissner 2018-08-03 02:46:48 +02:00
parent 639349d0ed
commit 80eb1dc449
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -57,19 +57,18 @@ This is used by `associate!', `file-exists-p!' and `project-file-exists-p!'."
,(if (file-name-absolute-p spec) ,(if (file-name-absolute-p spec)
spec spec
`(expand-file-name ,spec ,directory)))) `(expand-file-name ,spec ,directory))))
((symbolp spec)
`(file-exists-p ,(if (and directory
(or (not (stringp directory))
(file-name-absolute-p directory)))
`(expand-file-name ,spec ,directory)
spec)))
((and (listp spec) ((and (listp spec)
(memq (car spec) '(or and))) (memq (car spec) '(or and)))
`(,(car spec) `(,(car spec)
,@(cl-loop for i in (cdr spec) ,@(cl-loop for i in (cdr spec)
collect (doom--resolve-path-forms i directory)))) collect (doom--resolve-path-forms i directory))))
((listp spec) ((or (symbolp spec)
(doom--resolve-path-forms (eval spec t) directory)) (listp spec))
`(file-exists-p ,(if (and directory
(or (not (stringp directory))
(file-name-absolute-p directory)))
`(expand-file-name ,spec ,directory)
spec)))
(t spec))) (t spec)))
(defun doom--resolve-hook-forms (hooks) (defun doom--resolve-hook-forms (hooks)