Skip to content

Instantly share code, notes, and snippets.

@ajchemist
Created May 24, 2014 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajchemist/988fbda7ecb07a5ccef5 to your computer and use it in GitHub Desktop.
Save ajchemist/988fbda7ecb07a5ccef5 to your computer and use it in GitHub Desktop.
(let* ((config-dir user-emacs-directory)
(config-file (expand-file-name ".config" config-dir)))
(defmacro with-el-config (&rest body)
`(let* ((__parsed-data__ ',(cdr (with-temp-buffer
(insert-file-contents-literally config-file)
(search-forward "load-with-config" nil t)
(end-of-defun)
(preceding-sexp))))
(__load-file-name__ load-file-name)
(__id__ ',(intern (file-relative-name
(file-name-sans-extension __load-file-name__)
config-dir)))
(__data__ (cdr (assoc __id__ __parsed-data__))))
(progn ,@body))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment