Skip to content

Instantly share code, notes, and snippets.

@knjname
Last active December 12, 2015 09:29
Show Gist options
  • Select an option

  • Save knjname/4751917 to your computer and use it in GitHub Desktop.

Select an option

Save knjname/4751917 to your computer and use it in GitHub Desktop.
(defun error-ignorable-require (md)
(condition-case err
(require md)
(error nil)))
(defmacro when-mode (modename &rest body)
"Evaluate body when `modename' is require-d successfully. `modename' should not be quoted."
(let
((mode `',modename))
`(when
(error-ignorable-require ,mode)
,@body)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment