Skip to content

Instantly share code, notes, and snippets.

@outworlder
Created April 9, 2010 14:28
Show Gist options
  • Save outworlder/361215 to your computer and use it in GitHub Desktop.
Save outworlder/361215 to your computer and use it in GitHub Desktop.
(defmacro maybe-require (package &optional body)
"Tries to load the specified package. If it succeeds, then body is executed (if provided)."
(if body
`(lambda ()
(require ,package nil t)
(if (featurep ,package)
,@body))
`(require ,package nil t)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment