Add doom-file-cookie-p to core-lib

This commit is contained in:
Henrik Lissner 2018-05-20 00:07:06 +02:00
parent 85ee9ce459
commit dc4e0f1556
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -48,6 +48,16 @@
"Return EXP wrapped in a list, or as-is if already a list."
(if (listp exp) exp (list exp)))
(defun doom-file-cookie-p (file)
"Returns the value of the ;;;###if predicate form in FILE."
(with-temp-buffer
(insert-file-contents-literally file nil 0 256)
(if (and (re-search-forward "^;;;###if " nil t)
(<= (line-number-at-pos) 3))
(let ((load-file-name file))
(eval (sexp-at-point)))
t)))
(defun doom-keyword-intern (str)
"TODO"
(intern (concat ":" str)))